/* ============================================
   PANIFICIO AVATO — Stile Principale
   Sito vetrina | Dal 1991 | San Demetrio Corone
   ============================================ */

/* --- Variabili CSS --- */
:root {
  --color-primary: #8B4513;
  --color-secondary: #F5E6CC;
  --color-accent: #B22222;
  --color-dark: #3E2723;
  --color-bg: #FFF8F0;
  --color-white: #FFFFFF;
  --color-text: #4A3728;
  --color-text-light: #7A6A5E;
  --color-border: #E8D5C0;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(62, 39, 35, 0.08);
  --shadow-lg: 0 8px 30px rgba(62, 39, 35, 0.12);
  --transition: 0.3s ease;
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Lato', -apple-system, sans-serif;
  --max-width: 1200px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-accent);
}

/* --- Tipografia --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-dark);
  line-height: 1.3;
  font-weight: 700;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.3rem; }

p {
  margin-bottom: 1rem;
  color: var(--color-text);
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* --- Sezione generica --- */
.section {
  padding: 4rem 0;
}

.section-title {
  text-align: center;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  text-align: center;
  color: var(--color-text-light);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 2.5rem;
}

/* Decoratore sotto titolo sezione */
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--color-accent);
  margin: 0.75rem auto 0;
  border-radius: 2px;
}

/* --- NAVBAR --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 248, 240, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--transition);
}

.navbar.scrolled {
  box-shadow: var(--shadow);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-dark);
}

.navbar-brand img {
  height: 60px;
  width: auto;
}

.navbar-brand span {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.navbar-brand .brand-sub {
  font-size: 0.65rem;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--color-text-light);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  position: relative;
  padding: 0.25rem 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width var(--transition);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a.active {
  color: var(--color-primary);
}

/* CTA nella navbar */
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-accent);
  color: var(--color-white) !important;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--transition), transform var(--transition);
}

.nav-cta::after {
  display: none !important;
}

.nav-cta:hover {
  background: #8B1A1A;
  color: var(--color-white);
  transform: translateY(-1px);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.hamburger span {
  display: block;
  width: 26px;
  height: 2.5px;
  background: var(--color-dark);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* --- HERO --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  margin-top: 0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(62, 39, 35, 0.55) 0%,
    rgba(62, 39, 35, 0.7) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 2;
  color: var(--color-white);
  padding: 2rem 1.25rem;
  max-width: 700px;
}

.hero-logo {
  width: 500px;
  height: auto;
  margin: 0 auto 2rem;
  filter: brightness(0) invert(1) drop-shadow(0 4px 20px rgba(0,0,0,0.4));
  animation: heroFadeIn 1.2s ease-out 0.2s both;
}

.hero h1 {
  color: var(--color-white);
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.hero .hero-dal {
  font-family: var(--font-body);
  font-size: 1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 1rem;
}

.hero p {
  color: rgba(255,255,255,0.9);
  font-size: 1.15rem;
  margin-bottom: 2rem;
  line-height: 1.8;
}

/* --- Bottoni --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-align: center;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-white);
}

.btn-primary:hover {
  background: #8B1A1A;
  color: var(--color-white);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(178, 34, 34, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--color-white);
  border: 2px solid var(--color-white);
}

.btn-outline:hover {
  background: var(--color-white);
  color: var(--color-dark);
}

.btn-outline-dark {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-outline-dark:hover {
  background: var(--color-primary);
  color: var(--color-white);
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Card Prodotto --- */
.products-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.product-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.product-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.product-card-body {
  padding: 1.5rem;
}

.product-card h3 {
  margin-bottom: 0.5rem;
}

.product-card p {
  font-size: 0.95rem;
  color: var(--color-text-light);
  margin-bottom: 1rem;
}

.product-card .btn {
  font-size: 0.9rem;
  padding: 0.6rem 1.25rem;
}

/* --- Sezione Storia (homepage) --- */
.story-section {
  background: var(--color-secondary);
}

.story-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: center;
}

.story-img {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.story-img img {
  width: 100%;
  height: 350px;
  object-fit: cover;
}

.story-text h2 {
  margin-bottom: 1rem;
}

.story-text p {
  margin-bottom: 1.5rem;
}

/* --- Sezione Dove Siamo (homepage) --- */
.location-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.location-info {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.info-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--color-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--color-primary);
}

.info-item h3 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.info-item p {
  font-size: 0.95rem;
  color: var(--color-text-light);
  margin-bottom: 0;
}

.map-container {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  height: 300px;
}

.map-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- CTA Banner --- */
.cta-banner {
  background: var(--color-primary);
  text-align: center;
  padding: 3.5rem 1.25rem;
}

.cta-banner h2 {
  color: var(--color-white);
  margin-bottom: 0.75rem;
}

.cta-banner p {
  color: rgba(255,255,255,0.85);
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
}

.cta-banner .btn {
  background: var(--color-white);
  color: var(--color-primary);
}

.cta-banner .btn:hover {
  background: var(--color-secondary);
  transform: translateY(-2px);
}

/* --- FOOTER --- */
.footer {
  background: var(--color-dark);
  color: rgba(255,255,255,0.8);
  padding: 3rem 0 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.footer-brand img {
  height: 50px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.footer-brand h4 {
  color: var(--color-white);
  font-size: 1.1rem;
  margin: 0;
}

.footer h4 {
  color: var(--color-white);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.footer p,
.footer a {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.8;
}

.footer a:hover {
  color: var(--color-white);
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

/* --- PAGE HERO (pagine interne) --- */
.page-hero {
  padding: 8rem 0 3rem;
  text-align: center;
  background: var(--color-secondary);
  border-bottom: 1px solid var(--color-border);
}

.page-hero h1 {
  margin-bottom: 0.5rem;
}

.page-hero p {
  color: var(--color-text-light);
  font-size: 1.05rem;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  color: var(--color-text-light);
}

.breadcrumb a {
  color: var(--color-primary);
}

.breadcrumb span {
  color: var(--color-text-light);
}

/* --- PRODOTTI (pagina dedicata) --- */
.product-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.product-detail:last-child {
  border-bottom: none;
}

.product-detail-img {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.product-detail-img img {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.product-detail-text h2 {
  margin-bottom: 0.75rem;
}

.product-detail-text .product-tag {
  display: inline-block;
  background: var(--color-secondary);
  color: var(--color-primary);
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.product-detail-text p {
  margin-bottom: 0.75rem;
}

.product-detail-text .ingredients {
  font-style: italic;
  color: var(--color-text-light);
  font-size: 0.9rem;
}

/* Alternate layout (immagine a destra) */
.product-detail.reverse {
  direction: ltr;
}

/* --- CHI SIAMO --- */
.timeline {
  position: relative;
  padding-left: 2rem;
  border-left: 3px solid var(--color-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
  padding-left: 1.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.65rem;
  top: 0.4rem;
  width: 14px;
  height: 14px;
  background: var(--color-accent);
  border-radius: 50%;
  border: 3px solid var(--color-bg);
}

.timeline-item .year {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-primary);
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
}

.values-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.value-card {
  background: var(--color-white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: center;
}

.value-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.value-card h3 {
  margin-bottom: 0.5rem;
}

.value-card p {
  font-size: 0.95rem;
  color: var(--color-text-light);
  margin-bottom: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.gallery-grid img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}

.gallery-grid img:hover {
  transform: scale(1.02);
}

/* --- CONTATTI --- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

.contact-form {
  background: var(--color-white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: var(--color-dark);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 130px;
}

.contact-info-card {
  background: var(--color-white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hours-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.hours-table td {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
}

.hours-table td:last-child {
  text-align: right;
  font-weight: 600;
  color: var(--color-dark);
}

.hours-table tr:last-child td {
  border-bottom: none;
}

/* --- RESPONSIVE --- */

/* Tablet (768px+) */
@media (min-width: 768px) {
  h1 { font-size: 2.8rem; }
  h2 { font-size: 2.2rem; }

  .hero h1 { font-size: 3.5rem; }
  .hero .hero-dal { font-size: 1.1rem; }
  .hero-logo { width: 480px; }

  .hamburger { display: none; }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .story-grid,
  .product-detail {
    grid-template-columns: 1fr 1fr;
  }

  .product-detail.reverse {
    direction: rtl;
  }

  .product-detail.reverse > * {
    direction: ltr;
  }

  .location-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .values-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }

  .gallery-grid img {
    height: 250px;
  }

  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }

  .map-container {
    height: 100%;
    min-height: 350px;
  }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  h1 { font-size: 3.2rem; }

  .hero h1 { font-size: 4rem; }
  .hero-logo { width: 560px; }

  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }

  .values-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .product-detail-img img {
    height: 400px;
  }
}

/* Mobile menu */
@media (max-width: 767px) {
  .hamburger {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--color-bg);
    flex-direction: column;
    padding: 5rem 2rem 2rem;
    gap: 1.5rem;
    box-shadow: -5px 0 20px rgba(0,0,0,0.1);
    transition: right var(--transition);
  }

  .nav-links.open {
    right: 0;
  }

  .nav-links a {
    font-size: 1.1rem;
  }

  .nav-cta {
    width: 100%;
    justify-content: center;
  }

  /* Overlay scuro quando menu aperto */
  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
  }

  .nav-overlay.active {
    display: block;
  }
}

/* --- ANIMAZIONI SCROLL --- */

/* Stato iniziale: elemento nascosto */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

/* Stato animato: elemento visibile */
.animate-on-scroll.animated {
  opacity: 1;
  transform: translateY(0);
}

/* Variante: slide da sinistra */
.animate-slide-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.animate-slide-left.animated {
  opacity: 1;
  transform: translateX(0);
}

/* Variante: slide da destra */
.animate-slide-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.animate-slide-right.animated {
  opacity: 1;
  transform: translateX(0);
}

/* Variante: zoom in */
.animate-zoom {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-zoom.animated {
  opacity: 1;
  transform: scale(1);
}

/* Variante: fade semplice */
.animate-fade {
  opacity: 0;
  transition: opacity 0.8s ease-out;
}

.animate-fade.animated {
  opacity: 1;
}

/* Stagger delay per card in griglia */
.stagger-1 { transition-delay: 0s; }
.stagger-2 { transition-delay: 0.15s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.45s; }

/* Hero entrance animation */
.hero-content {
  animation: heroFadeIn 1.2s ease-out forwards;
}

@keyframes heroFadeIn {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero p {
  animation: heroFadeIn 1s ease-out 0.5s both;
}

.hero-buttons {
  animation: heroFadeIn 1s ease-out 0.7s both;
}

/* Section title animation */
.section-title.animate-on-scroll,
.section-subtitle.animate-on-scroll {
  transform: translateY(25px);
}

/* Timeline items stagger */
.timeline-item.animate-on-scroll:nth-child(1) { transition-delay: 0s; }
.timeline-item.animate-on-scroll:nth-child(2) { transition-delay: 0.2s; }
.timeline-item.animate-on-scroll:nth-child(3) { transition-delay: 0.4s; }
.timeline-item.animate-on-scroll:nth-child(4) { transition-delay: 0.6s; }

/* Gallery images stagger */
.gallery-grid img.animate-on-scroll:nth-child(1) { transition-delay: 0s; }
.gallery-grid img.animate-on-scroll:nth-child(2) { transition-delay: 0.1s; }
.gallery-grid img.animate-on-scroll:nth-child(3) { transition-delay: 0.2s; }
.gallery-grid img.animate-on-scroll:nth-child(4) { transition-delay: 0.3s; }
.gallery-grid img.animate-on-scroll:nth-child(5) { transition-delay: 0.4s; }
.gallery-grid img.animate-on-scroll:nth-child(6) { transition-delay: 0.5s; }

/* Riduce animazioni per chi preferisce meno movimento */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll,
  .animate-slide-left,
  .animate-slide-right,
  .animate-zoom,
  .animate-fade {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero-content,
  .hero .hero-dal,
  .hero h1,
  .hero p,
  .hero-buttons {
    animation: none;
  }
}

/* Utility */
.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
