/* ==========================================================================
   base.css — stili condivisi da tutte le pagine (home, vini, visita, contatti)
   Include: variabili, reset di base, header/navigazione, tipografia comune.
   ========================================================================== */

/* Palette dal PDF: #ffffff, #ffe233, #1a4c23, #ddcd8c, #000000 */
:root {
  --white: #ffffff;
  --yellow: rgba(255, 226, 51, 0.75);
  --green: #1a4c23;
  --sand: #ddcd8c;
  --black: #000000;
  --font-body: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-display: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  /* Margine orizzontale unico di tutte le pagine: stesso spazio (60px su
     desktop) tra il bordo dello schermo e testi, immagini e pannelli. */
  --page-gutter: clamp(1.25rem, 5vw, 3.75rem);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* Sfondo bianco anche nell'area di rimbalzo (overscroll) di Safari iOS */
  background: var(--white);
}

body {
  margin: 0;
  color: var(--black);
  background: var(--white);
  font-family: var(--font-body);
  line-height: 1.6;
}

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

a { color: inherit; text-decoration: none; }

button { font: inherit; }

/* Header: trasparente sopra la hero, bianco (testo verde) e fisso dopo lo scroll */
.site-header {
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: .7rem var(--page-gutter);
  color: var(--white);
  background: transparent;
  transition: background-color .35s ease, color .35s ease;
}

.site-header.is-scrolled {
  background: var(--white);
  color: var(--green);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-self: start;
}

.header-right {
  justify-self: end;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  color: inherit;
  font-family: var(--font-body);
  font-size: .9rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  padding: .25rem 0;
}

.lang-option {
  color: inherit;
  background: transparent;
  border: none;
  padding: .15rem .1rem;
  cursor: pointer;
  opacity: .45;
  transition: opacity .2s ease;
}

.lang-option:hover {
  opacity: .75;
}

.lang-option.is-active {
  opacity: 1;
}

.lang-option:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: .15rem;
  opacity: 1;
}

.lang-sep {
  opacity: .35;
}

.menu-dropdown {
  position: relative;
  padding-bottom: .4rem;
}

.menu-toggle {
  color: inherit;
  border: none;
  background: transparent;
  padding: .25rem .5rem;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
}

.menu-dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0;
  /* Leggermente trasparente per lasciar intravedere il contenuto sottostante */
  background: rgba(255, 255, 255, 0.68);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--green);
  display: none;
  flex-direction: column;
  min-width: 200px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.menu-dropdown-list a {
  padding: .5rem .75rem;
  font-size: .85rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}

.menu-dropdown-list a:hover {
  border-color: currentColor;
}

.menu-dropdown.is-open .menu-dropdown-list {
  display: flex;
}

/* Hover solo sui dispositivi con puntatore: evita che il menu resti
   aperto dopo un tap sul touchscreen */
@media (hover: hover) {
  .menu-dropdown:hover .menu-dropdown-list {
    display: flex;
  }
}

.logo {
  display: block;
  width: 110px;
  text-align: center;
  line-height: 1;
  justify-self: center;
}
.logo img { width: 100%; height: auto; max-height: 52px; object-fit: contain; }

/* Home: niente logo nel banner sulla landing (c'è quello grande nella hero).
   Resta nel layout, invisibile, per non spostare il cambio lingua; compare
   dopo aver superato la hero, come prima. */
.home-intro .site-header .logo {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .35s ease, visibility .35s ease;
}

.home-intro .site-header.is-scrolled .logo {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Il file logo.svg è giallo: il filtro lo rende sempre bianco sull'header */
.site-header .logo img { filter: brightness(0) invert(1); }

/* Sfondo bianco (header appena scrollato): lo logo diventa verde */
.site-header.is-scrolled .logo img {
  filter: brightness(0) invert(.234) sepia(1.09) saturate(1.12) hue-rotate(68deg) brightness(1.09) contrast(1.44);
}

/* Tipografia comune */
.eyebrow {
  margin: 0 0 1rem;
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}

h1, h2, h3 {
  font-family: var(--font-display);
  /* Tutto in IBM Plex Mono: i titoli si distinguono per peso (semibold),
     dimensione e maiuscolo */
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.4rem, 5.6vw, 5.2rem);
  max-width: 1000px;
  margin: 0 0 1.5rem;
}

.intro-copy {
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  max-width: 680px;
  margin: 0;
}

/* Contenitore usato dalle pagine interne (vini, visita) */
.content-wrap {
  width: 100%;
  padding: clamp(3rem, 7vw, 7rem) var(--page-gutter);
}

/* Footer di sito: identico su tutte le pagine (home, vini, visita, contatti).
   Sfondo bianco con contenuti verdi, separato dal resto della pagina
   da una sola riga verde in alto. */
.site-footer {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  padding: clamp(1.1rem, 2.2vw, 1.6rem) var(--page-gutter);
  background: var(--white);
  color: var(--green);
  border-top: 3px solid var(--green);
  font-size: .9rem;
  line-height: 1.5;
}
.site-footer p { margin: 0; }

/* Riga principale: logo, nome e recapiti sulla stessa linea, con lo stesso
   font e la stessa dimensione per tutti i testi. */
.footer-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.75rem;
}

/* Logo del footer, verde come i testi (stesso filtro dell'header scrollato) */
.footer-logo { display: block; width: clamp(70px, 8vw, 100px); flex: none; }
.footer-logo img {
  width: 100%;
  height: auto;
  max-height: 60px;
  object-fit: contain;
  filter: brightness(0) invert(.234) sepia(1.09) saturate(1.12) hue-rotate(68deg) brightness(1.09) contrast(1.44);
}

.footer-name,
.footer-main a {
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.footer-main a {
  padding-bottom: .1rem;
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.footer-main a:hover { border-color: currentColor; }
.footer-map-link::after { content: " ↗"; }

/* Sede legale, partita IVA e copyright: nota burocratica piccola, in fondo,
   su un'unica riga centrata */
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: .2rem .6rem;
  text-align: center;
}
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 .6rem;
}
.footer-legal-vat::before { content: "·"; margin-right: .6rem; }
.footer-copy::before { content: "·"; margin-right: .6rem; }
.footer-legal,
.footer-copy,
.footer-privacy-link {
  font-size: .65rem;
  line-height: 1.5;
  letter-spacing: .03em;
  opacity: .55;
}
.footer-privacy-link {
  padding-bottom: .1rem;
  border-bottom: 1px solid transparent;
  transition: opacity .2s ease, border-color .2s ease;
}
.footer-privacy-link::before { content: "·"; margin-right: .6rem; }
.footer-privacy-link:hover {
  opacity: 1;
  border-color: currentColor;
}

/* Accessibilità: riduce le animazioni se richiesto dal dispositivo */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    transition-duration: .01ms !important;
  }
}

/* Header su mobile */
@media (max-width: 760px) {
  .site-header {
    /* Colonne laterali simmetriche: menu e lingue restano ai bordi
       opposti e il logo, che occupa tutte le colonne, risulta centrato
       rispetto allo schermo. */
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: .5rem 4vw;
    gap: .5rem;
  }

  .header-left {
    gap: .5rem;
  }

  .header-right {
    justify-self: end;
  }

  .lang-toggle {
    font-size: .95rem;
    letter-spacing: .08em;
    padding: .4rem 0;
  }

  .lang-option {
    padding: .3rem .25rem;
  }

  .menu-toggle {
    font-size: 1.8rem;
    padding: .35rem .5rem;
  }

  .menu-dropdown-list {
    min-width: 220px;
  }

  .menu-dropdown-list a {
    font-size: .95rem;
    letter-spacing: .08em;
    padding: .75rem 1rem;
    white-space: nowrap;
  }

  /* Logo al centro */
  .logo {
    /* Occupa tutte le colonne e si centra sull'intera larghezza
       dell'header: così resta al centro dello schermo anche se il menu
       (a sinistra) e le lingue (a destra) hanno larghezze diverse. */
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
    width: 84px;
  }
  .header-left {
    grid-column: 1;
    grid-row: 1;
  }
  .header-right {
    grid-column: 3;
    grid-row: 1;
  }
  .logo img { max-height: 44px; }

  /* Footer mobile: logo in alto, recapiti in colonna, info legali in fondo */
  .site-footer { gap: 1rem; }
  .footer-main {
    flex-direction: column;
    align-items: flex-start;
    gap: .55rem;
  }
  .footer-logo {
    align-self: center;
    width: 110px;
    margin-bottom: .35rem;
  }
  .footer-name { display: none; }
  .footer-main a {
    font-size: .95rem;
    white-space: normal;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    text-align: center;
  }
  .footer-legal {
    flex-direction: column;
    align-items: center;
    gap: .15rem;
  }
  .footer-legal-vat::before,
  .footer-copy::before,
  .footer-privacy-link::before { content: none; }

  .content-wrap { padding: 3rem 7vw; }
}

@media (max-width: 420px) {
  .lang-toggle {
    font-size: .9rem;
    letter-spacing: .05em;
  }
  .menu-toggle {
    font-size: 1.65rem;
  }
  .menu-dropdown-list a {
    font-size: .9rem;
    padding: .7rem .9rem;
  }

  .logo { width: 76px; }
}
