/* ============================================================
   Sito matrimonio — foglio di stile
   Palette: avorio caldo + quasi-nero caldo + verde salvia
   Tipografia: Cormorant Garamond (display) + Inter (body)
   ============================================================ */

/* ---------- Custom properties ---------- */
:root {
  /* Colori */
  --c-bg: #FAF7F2;          /* avorio */
  --c-bg-alt: #F3EEE6;      /* avorio più profondo per sezioni alternate */
  --c-surface: #FFFDFA;     /* superficie card */
  --c-ink: #1A1815;         /* quasi-nero caldo */
  --c-ink-soft: #57524A;    /* testo secondario */
  --c-ink-mute: #8A847A;    /* testo attenuato */
  --c-accent: #8A9B6E;      /* verde salvia */
  --c-accent-dark: #6E7E55; /* salvia scuro (testo su chiaro, AA) */
  --c-accent-soft: #E7EADF; /* salvia molto chiaro (sfondi) */
  --c-line: #E4DDD1;        /* linee sottili */
  --c-error: #B0503C;       /* terracotta scuro per errori */

  /* Tipografia */
  --f-display: 'Cormorant Garamond', Georgia, serif;
  --f-body: 'Inter', -apple-system, sans-serif;

  /* Scala fluida */
  --fs-hero: clamp(3rem, 11vw, 7.5rem);
  --fs-h2: clamp(2.2rem, 5.5vw, 4rem);
  --fs-h3: clamp(1.4rem, 2.6vw, 1.9rem);
  --fs-body: clamp(1rem, 1.1vw, 1.0625rem);
  --fs-small: 0.875rem;
  --fs-eyebrow: 0.75rem;

  /* Layout */
  --w-content: 1100px;
  --pad-section: clamp(5rem, 12vw, 9.5rem);
  --pad-inline: clamp(1.25rem, 5vw, 3rem);

  /* Finiture */
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-soft: 0 20px 50px -24px rgba(26, 24, 21, 0.18);
  --shadow-lift: 0 30px 60px -28px rgba(26, 24, 21, 0.26);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --t-fast: 220ms;
  --t-med: 320ms;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  font-family: var(--f-body);
  font-size: var(--fs-body);
  line-height: 1.7;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* Grain overlay: texture leggerissima su tutta la pagina */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

/* l'attributo hidden vince sempre, anche su elementi con display via classe */
[hidden] { display: none !important; }

/* testo solo per screen reader */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Gate con parola d'ordine ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad-inline);
  background:
    radial-gradient(50% 42% at 50% 28%, rgba(138, 155, 110, 0.14), transparent 70%),
    radial-gradient(42% 36% at 80% 78%, rgba(198, 123, 92, 0.08), transparent 70%),
    var(--c-bg);
  transition: opacity 0.6s var(--ease-out);
}

.gate.is-unlocking { opacity: 0; pointer-events: none; }

.gate__card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.gate__names {
  font-family: var(--f-display);
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  font-weight: 500;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.gate__names em {
  font-style: italic;
  color: var(--c-accent-dark);
}

.gate__hint {
  font-size: var(--fs-small);
  color: var(--c-ink-soft);
  margin-bottom: 2rem;
}

.gate__form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.gate__form .field__input { text-align: center; }

.gate__card.is-shaking { animation: shake 0.4s var(--ease-out); }

.gate .field__error { margin-top: 0.8rem; }

a { color: inherit; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

::selection { background: var(--c-accent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--c-accent-dark);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Utility tipografiche ---------- */
.eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-accent-dark);
  margin-bottom: 1.1rem;
}

.section__title {
  font-family: var(--f-display);
  font-size: var(--fs-h2);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin-bottom: 1.6rem;
}

.section__title em {
  font-style: italic;
  color: var(--c-accent-dark);
}

/* ---------- Layout di sezione ---------- */
.section {
  padding: var(--pad-section) var(--pad-inline);
  position: relative;
  overflow: hidden; /* le decorazioni (parole fantasma, blob) non creano scroll */
}

.section__inner {
  max-width: var(--w-content);
  margin-inline: auto;
  position: relative;
}

.section__inner--wide { max-width: calc(var(--w-content) + 100px); }

.section__inner--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Parola "fantasma" gigante di sezione (mossa in parallax dal JS) */
.section__ghost {
  position: absolute;
  top: clamp(1rem, 6vw, 4rem);
  z-index: 0;
  font-family: var(--f-display);
  font-style: italic;
  font-size: clamp(5rem, 15vw, 13rem);
  line-height: 1;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px rgba(26, 24, 21, 0.08);
  user-select: none;
  pointer-events: none;
  will-change: transform;
}

.section__ghost--right { right: clamp(-2rem, -1vw, 0rem); }
.section__ghost--left { left: clamp(-2rem, -1vw, 0rem); }

.section > .section__inner { position: relative; z-index: 1; }

/* Aloni di colore che respirano di continuo (l'esterno è mosso in parallax) */
.blob {
  position: absolute;
  z-index: 0;
  width: clamp(280px, 40vw, 560px);
  aspect-ratio: 1;
  pointer-events: none;
  will-change: transform;
}

.blob::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(138, 155, 110, 0.16), transparent 72%);
  animation: blob-breathe 9s ease-in-out infinite alternate;
}

.blob--left { left: -12%; top: 20%; }
.blob--right { right: -12%; top: 30%; }
.blob--low::after { animation-delay: -4s; }

@keyframes blob-breathe {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(4%, -7%) scale(1.18); }
}

/* Numero di sezione decorativo */
.section__number {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--c-ink-mute);
  margin-bottom: 2.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section__number::after {
  content: '';
  height: 1px;
  width: 56px;
  background: var(--c-line);
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  transform: translateY(-100%);
  transition: transform 420ms var(--ease-out), background-color var(--t-med);
  background: rgba(250, 247, 242, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--c-line);
}

.site-header.is-visible { transform: translateY(0); }

.nav {
  max-width: calc(var(--w-content) + 100px);
  margin-inline: auto;
  padding: 0.9rem var(--pad-inline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav__brand {
  font-family: var(--f-display);
  font-size: 1.35rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.04em;
}

.nav__brand em {
  font-style: italic;
  color: var(--c-accent-dark);
}

.nav__menu {
  display: flex;
  align-items: center;
  gap: 2.2rem;
  list-style: none;
}

.nav__menu a {
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--c-ink-soft);
  position: relative;
  padding-block: 0.3rem;
  transition: color var(--t-fast);
}

/* underline animato */
.nav__menu a:not(.nav__cta)::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--c-accent-dark);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--t-med) var(--ease-out);
}

.nav__menu a:hover { color: var(--c-ink); }
.nav__menu a:not(.nav__cta):hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav__cta {
  color: #fff !important;
  background: var(--c-accent-dark);
  padding: 0.55rem 1.3rem !important;
  border-radius: 999px;
  transition: background-color var(--t-fast), transform var(--t-fast) var(--ease-spring);
}

.nav__cta:hover { background: var(--c-ink) !important; transform: translateY(-1px); }

/* Hamburger */
.nav__toggle {
  display: none;
  width: 44px;
  height: 44px;
  position: relative;
  z-index: 110;
}

.nav__toggle-line {
  position: absolute;
  left: 10px;
  width: 24px;
  height: 1.5px;
  background: var(--c-ink);
  transition: transform var(--t-med) var(--ease-out), top var(--t-med) var(--ease-out);
}

.nav__toggle-line:nth-child(1) { top: 18px; }
.nav__toggle-line:nth-child(2) { top: 25px; }

.nav__toggle[aria-expanded="true"] .nav__toggle-line:nth-child(1) { top: 21.5px; transform: rotate(45deg); }
.nav__toggle[aria-expanded="true"] .nav__toggle-line:nth-child(2) { top: 21.5px; transform: rotate(-45deg); }

@media (max-width: 760px) {
  .nav__toggle { display: block; }

  /* Nota: l'header ha transform e backdrop-filter, quindi diventa il
     containing block dei figli "fixed". Il menu è quindi un pannello
     absolute agganciato sotto l'header, alto quanto il resto dello schermo. */
  .nav__menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: calc(100svh - 74px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2.2rem;
    background: var(--c-bg);
    border-top: 1px solid var(--c-line);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--t-med) var(--ease-out),
                transform var(--t-med) var(--ease-out),
                visibility 0s var(--t-med);
  }

  .nav__menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity var(--t-med) var(--ease-out),
                transform var(--t-med) var(--ease-out);
  }

  .nav__menu a { font-size: 1.05rem; }
  .nav__cta { padding: 0.7rem 1.8rem !important; }
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  padding: var(--pad-inline);
}

/* slideshow di foto sullo sfondo (mosso in parallax dal JS) */
.hero__media {
  position: absolute;
  inset: -14% 0 0 0;
  will-change: transform;
}

.hero__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  animation: slide-cycle 21s ease-in-out infinite;
}

.hero__slide:nth-child(1) { animation-delay: 0s; }
.hero__slide:nth-child(2) { animation-delay: 7s; }
.hero__slide:nth-child(3) { animation-delay: 14s; }

/* fallback senza animazioni (reduced motion): resta la prima foto */
.hero__slide:first-child { opacity: 1; }

/* crossfade + lento zoom Ken Burns: ogni foto vive ~1/3 del ciclo */
@keyframes slide-cycle {
  0% { opacity: 0; transform: scale(1); }
  5%, 33% { opacity: 1; }
  43%, 100% { opacity: 0; }
  100% { transform: scale(1.12); }
}

/* velo avorio sopra le foto: tiene leggibile il testo e fonde col resto */
.hero__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(52% 44% at 50% 30%, rgba(138, 155, 110, 0.12), transparent 70%),
    radial-gradient(40% 36% at 18% 78%, rgba(198, 123, 92, 0.06), transparent 70%),
    linear-gradient(
      180deg,
      rgba(250, 247, 242, 0.86) 0%,
      rgba(250, 247, 242, 0.62) 45%,
      rgba(250, 247, 242, 0.8) 78%,
      var(--c-bg) 100%
    );
}

.hero__inner { position: relative; isolation: isolate; }

/* data "fantasma" gigante sullo sfondo, solo contorno */
.hero__ghost {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--f-display);
  font-style: italic;
  font-size: clamp(8rem, 26vw, 22rem);
  line-height: 1;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px rgba(26, 24, 21, 0.07);
  user-select: none;
  pointer-events: none;
  opacity: 0;
  animation:
    fade-in 2s ease 1.8s forwards,
    ghost-drift 16s ease-in-out 2s infinite alternate;
}

@keyframes ghost-drift {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(calc(-50% + 1.6vw), calc(-50% - 1.4vh)) rotate(-1.2deg); }
}

/* aloni della hero */
.hero__blob-a { top: 10%; left: 6%; }
.hero__blob-b { bottom: 6%; right: 4%; }

.hero__blob-b::after {
  background: radial-gradient(closest-side, rgba(198, 123, 92, 0.1), transparent 72%);
  animation-delay: -5s;
}

/* rami di salvia laterali, disegnati con lo stroke */
.hero__branch {
  position: absolute;
  bottom: 6%;
  width: clamp(70px, 9vw, 130px);
  height: auto;
  color: var(--c-accent);
  opacity: 0;
  transform-origin: bottom center;
}

.hero__branch--left {
  left: clamp(0.5rem, 5vw, 6rem);
  animation:
    branch-in 1.4s var(--ease-out) 1.2s forwards,
    sway-l 6.5s ease-in-out 4s infinite alternate;
}

.hero__branch--right {
  right: clamp(0.5rem, 5vw, 6rem);
  transform: scaleX(-1);
  animation:
    branch-in 1.4s var(--ease-out) 1.2s forwards,
    sway-r 6.5s ease-in-out 4.6s infinite alternate;
}

@keyframes branch-in { to { opacity: 0.75; } }

/* ondeggiamento continuo dei rami */
@keyframes sway-l {
  from { transform: rotate(0deg); }
  to { transform: rotate(3deg); }
}

@keyframes sway-r {
  from { transform: scaleX(-1) rotate(0deg); }
  to { transform: scaleX(-1) rotate(3deg); }
}

.hero__branch .branch-stem,
.hero__branch .branch-leaf {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: draw-branch 2.6s var(--ease-out) forwards;
}

.hero__branch .branch-stem { animation-delay: 1.2s; }
.hero__branch .branch-leaf:nth-of-type(2) { animation-delay: 1.5s; }
.hero__branch .branch-leaf:nth-of-type(3) { animation-delay: 1.7s; }
.hero__branch .branch-leaf:nth-of-type(4) { animation-delay: 1.9s; }
.hero__branch .branch-leaf:nth-of-type(5) { animation-delay: 2.1s; }
.hero__branch .branch-leaf:nth-of-type(6) { animation-delay: 2.3s; }
.hero__branch .branch-leaf:nth-of-type(7) { animation-delay: 2.5s; }
.hero__branch .branch-leaf:nth-of-type(8) { animation-delay: 2.7s; }

@keyframes draw-branch { to { stroke-dashoffset: 0; } }

@media (max-width: 700px) {
  .hero__branch { width: 56px; bottom: 12%; }
  .hero__branch--left { left: -0.6rem; }
  .hero__branch--right { right: -0.6rem; }
}

.hero__eyebrow {
  margin-bottom: 2.4rem;
  opacity: 0;
  animation: fade-up 0.9s var(--ease-out) 0.25s forwards;
}

.hero__title {
  font-family: var(--f-display);
  font-size: var(--fs-hero);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.015em;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* "&" gigante in corsivo, sovrapposto ai nomi */
.hero__amp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -54%);
  font-style: italic;
  font-weight: 400;
  font-size: 2.1em;
  color: var(--c-accent);
  opacity: 0;
  z-index: -1;
  animation: amp-in 1.6s var(--ease-out) 1.15s forwards;
}

@keyframes amp-in {
  from { opacity: 0; transform: translate(-50%, -44%) scale(0.94); }
  to { opacity: 0.5; transform: translate(-50%, -54%) scale(1); }
}

/* leggero sfalsamento editoriale dei due nomi */
.hero__name { transform: translateX(-0.4em); }
.hero__name--second { transform: translateX(0.4em); }

/* entrata lettera per lettera: gli span .char li crea il JS */
.hero__name .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.55em) rotate(2deg);
  animation: hero-char 0.9s var(--ease-out) forwards;
  animation-delay: calc(0.45s + var(--i) * 55ms);
}

.hero__name--second .char {
  animation-delay: calc(0.85s + var(--i) * 55ms);
}

@keyframes hero-char {
  to { opacity: 1; transform: translateY(0) rotate(0deg); }
}

/* fallback senza JS: i nomi restano visibili */
.no-js .hero__name .char { opacity: 1; transform: none; animation: none; }

.hero__rule {
  width: 56px;
  height: 1px;
  background: var(--c-ink);
  opacity: 0.35;
  margin: 2.2rem auto 2rem;
  transform: scaleX(0);
  animation: rule-in 0.9s var(--ease-out) 1.5s forwards;
}

@keyframes rule-in { to { transform: scaleX(1); } }

.hero__date {
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0;
  animation: fade-up 0.9s var(--ease-out) 1.65s forwards;
}

.hero__place {
  margin-top: 0.6rem;
  font-size: var(--fs-small);
  color: var(--c-ink-soft);
  letter-spacing: 0.08em;
  opacity: 0;
  animation: fade-up 0.9s var(--ease-out) 1.85s forwards;
}

/* indicatore di scroll */
.hero__scroll {
  position: absolute;
  bottom: 2.4rem;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 64px;
  display: flex;
  justify-content: center;
  opacity: 0;
  animation: fade-in 1s ease 2.4s forwards;
}

.hero__scroll-line {
  width: 1px;
  height: 100%;
  background: linear-gradient(to bottom, transparent, var(--c-ink-soft));
  position: relative;
  overflow: hidden;
}

.hero__scroll-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--c-bg-alt);
  animation: scroll-hint 2.2s var(--ease-out) infinite;
}

@keyframes scroll-hint {
  0% { transform: translateY(0); }
  60%, 100% { transform: translateY(105%); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in { to { opacity: 1; } }

/* ---------- Scroll reveal (via IntersectionObserver) ---------- */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  filter: blur(7px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out),
              filter 0.9s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.reveal.is-revealed {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* ---------- Foglie fluttuanti (canvas a schermo intero) ---------- */
.petals {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 90;
  pointer-events: none;
}

/* ---------- Marquee editoriale ---------- */
.marquee {
  overflow: hidden;
  padding-block: clamp(1.2rem, 3vw, 2rem);
  border-block: 1px solid var(--c-line);
  background: var(--c-bg);
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee 36s linear infinite;
}

.marquee__group {
  display: flex;
  align-items: center;
  gap: clamp(1.6rem, 4vw, 3rem);
  padding-right: clamp(1.6rem, 4vw, 3rem);
}

.marquee span {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.7rem, 4.5vw, 3.2rem);
  line-height: 1.2;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px rgba(26, 24, 21, 0.4);
}

.marquee span em { -webkit-text-stroke-color: var(--c-accent-dark); }

.marquee i {
  font-style: normal;
  font-size: 0.9rem;
  color: var(--c-accent);
  animation: spin-slow 10s linear infinite;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

/* variante su banda salvia, leggermente inclinata */
.marquee--accent {
  background: var(--c-accent-dark);
  border: none;
  transform: rotate(-1.4deg) scale(1.02);
  margin-block: clamp(-1rem, -1vw, -0.5rem);
  position: relative;
  z-index: 2;
  box-shadow: 0 24px 50px -30px rgba(110, 126, 85, 0.55);
}

.marquee--accent span {
  color: var(--c-bg);
  -webkit-text-stroke: 0;
}

.marquee--accent span em { color: #DCE3CF; }
.marquee--accent i { color: rgba(250, 247, 242, 0.7); }
.marquee--accent .marquee__track { animation-duration: 26s; animation-direction: reverse; }

/* ---------- Countdown ---------- */
.countdown { background: var(--c-bg); text-align: center; }

.countdown .section__number { justify-content: center; }
.countdown .section__number::after { display: none; }

.countdown__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 150px));
  justify-content: center;
  gap: clamp(0.8rem, 3vw, 2.5rem);
  margin-top: 3rem;
}

.countdown__unit {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: clamp(1rem, 2.5vw, 1.8rem) 0.5rem;
  border-top: 1px solid var(--c-line);
}

.countdown__value {
  font-family: var(--f-display);
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

/* animazione al cambio cifra (classe aggiunta da JS) */
.countdown__value.is-ticking {
  animation: tick 0.5s var(--ease-out);
}

@keyframes tick {
  0% { opacity: 0; transform: translateY(-0.28em); }
  100% { opacity: 1; transform: translateY(0); }
}

.countdown__label {
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-ink-mute);
}

@media (max-width: 560px) {
  .countdown__grid { grid-template-columns: repeat(2, 1fr); }
}

/* ornamento decorativo (linee + fogliolina) */
.ornament {
  display: block;
  width: 160px;
  margin: 3.5rem auto 0;
  color: var(--c-accent);
  opacity: 0.9;
}

/* ---------- Storia / timeline ---------- */
.story { background: var(--c-bg-alt); }

.story__intro {
  max-width: 65ch;
  color: var(--c-ink-soft);
  margin-bottom: 4rem;
}

.timeline {
  list-style: none;
  position: relative;
  padding-left: 2.2rem;
  max-width: 640px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--c-line);
}

/* linea che si "disegna" man mano che si scorre (progress dal JS) */
.timeline::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--c-accent);
  transform: scaleY(var(--tl-progress, 0));
  transform-origin: top;
}

.timeline__item {
  position: relative;
  padding-bottom: 3rem;
}

.timeline__item:last-child { padding-bottom: 0; }

.timeline__item::before {
  content: '';
  position: absolute;
  left: calc(-2.2rem + 1px);
  top: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 0 5px var(--c-bg-alt);
}

.timeline__year {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--c-accent-dark);
  margin-bottom: 0.2rem;
}

.timeline__heading {
  font-family: var(--f-display);
  font-size: var(--fs-h3);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.timeline__text {
  color: var(--c-ink-soft);
  max-width: 55ch;
}

.story__quote {
  margin-top: 4.5rem;
  padding-left: 1.6rem;
  border-left: 2px solid var(--c-accent);
  max-width: 34ch;
}

.story__quote p {
  font-family: var(--f-display);
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  font-weight: 500;
  line-height: 1.3;
}

.story__quote em {
  font-style: italic;
  color: var(--c-accent-dark);
}

/* ---------- Polaroid (foto ad album, mosse dallo scroll) ---------- */
.polaroid {
  width: min(250px, 64vw);
  background: #fff;
  padding: 10px 10px 14px;
  border-radius: 4px;
  box-shadow:
    0 18px 40px -18px rgba(26, 24, 21, 0.35),
    0 4px 10px -4px rgba(26, 24, 21, 0.15);
  transform: rotate(var(--tilt, 0deg));
  will-change: transform;
  z-index: 2;
}

.polaroid img {
  width: 100%;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  border-radius: 2px;
}

.polaroid figcaption {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.05rem;
  text-align: center;
  color: var(--c-ink-soft);
  padding-top: 0.6rem;
}

/* pezzetto di scotch in alto */
.polaroid::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  width: 92px;
  height: 26px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(231, 234, 223, 0.8);
  border-left: 1px dashed rgba(26, 24, 21, 0.12);
  border-right: 1px dashed rgba(26, 24, 21, 0.12);
  box-shadow: 0 2px 5px rgba(26, 24, 21, 0.08);
}

/* desktop: appoggiate ai lati delle sezioni */
@media (min-width: 1000px) {
  .polaroid { position: absolute; }
  .polaroid--story-a { right: 3%; top: 24%; }
  .polaroid--story-b { right: 14%; top: 52%; }
  .polaroid--details { right: 0; top: -2rem; width: 220px; }
  .polaroid--info { right: 1%; top: -3rem; width: 210px; }
}

/* mobile/tablet: entrano nel flusso come un piccolo album */
@media (max-width: 999px) {
  .polaroid {
    position: relative;
    margin: 3rem auto 0;
  }
  .polaroid--story-b { margin-top: 1.6rem; }
}

/* ---------- Card generiche ---------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* ---------- Dettagli evento ---------- */
.details__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: clamp(1.2rem, 3vw, 2rem);
  margin-top: 3rem;
}

.details__card {
  padding: clamp(1.8rem, 4vw, 2.8rem);
  transition: transform var(--t-med) var(--ease-spring), box-shadow var(--t-med);
}

.details__card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lift);
}

.details__time {
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-accent-dark);
  margin-bottom: 0.8rem;
}

.details__heading {
  font-family: var(--f-display);
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  font-weight: 500;
  margin-bottom: 1.2rem;
}

.details__location { font-weight: 600; }

.details__address {
  color: var(--c-ink-soft);
  font-size: var(--fs-small);
  margin-bottom: 1.8rem;
}

.details__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--c-line);
}

/* link con underline animato */
.link-underline {
  font-size: var(--fs-small);
  font-weight: 500;
  text-decoration: none;
  color: var(--c-accent-dark);
  position: relative;
  padding-bottom: 2px;
}

.link-underline::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--t-med) var(--ease-out);
}

.link-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: var(--fs-small);
  font-weight: 500;
  border-radius: 999px;
  padding: 0.7rem 1.5rem;
  transition: background-color var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), transform var(--t-fast) var(--ease-spring),
              box-shadow var(--t-fast);
}

.btn--ghost {
  border: 1px solid var(--c-ink-mute);
  color: var(--c-ink);
}

.btn--ghost:hover {
  border-color: var(--c-ink);
  background: var(--c-ink);
  color: var(--c-bg);
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--c-accent-dark);
  color: #fff;
  padding: 0.95rem 2.4rem;
  font-size: 0.95rem;
  box-shadow: 0 14px 30px -14px rgba(110, 126, 85, 0.7);
}

.btn--primary:hover {
  background: var(--c-ink);
  transform: translateY(-2px);
  box-shadow: 0 18px 34px -14px rgba(26, 24, 21, 0.5);
}

.btn--primary:active { transform: translateY(0); }

/* ---------- Info utili ---------- */
.info { background: var(--c-bg-alt); }

.info__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(1rem, 2.5vw, 1.6rem);
  margin-top: 3rem;
}

.info__card {
  padding: 1.8rem 1.6rem;
  transition: transform var(--t-med) var(--ease-spring), box-shadow var(--t-med);
}

.info__card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.info__icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--c-accent-soft);
  color: var(--c-accent-dark);
  margin-bottom: 1.1rem;
  animation: float-icon 5.5s ease-in-out infinite;
}

.info__card:nth-child(even) .info__icon { animation-delay: -2.7s; }
.info__card:nth-child(3n) .info__icon { animation-delay: -1.4s; }

@keyframes float-icon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.info__icon svg { width: 22px; height: 22px; }

.info__heading {
  font-family: var(--f-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.info__text {
  font-size: var(--fs-small);
  color: var(--c-ink-soft);
}

/* ---------- RSVP (sezione centrata) ---------- */
.rsvp .section__number { justify-content: center; }
.rsvp .section__number::after { display: none; }

.rsvp__intro {
  max-width: 60ch;
  color: var(--c-ink-soft);
  margin-bottom: 3rem;
}

.rsvp__form {
  padding: clamp(1.6rem, 5vw, 3rem);
  width: 100%;
  max-width: 660px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 1.7rem;
  text-align: left;
}

.field { display: flex; flex-direction: column; }

fieldset.field { border: none; }

.field__label {
  font-size: var(--fs-small);
  font-weight: 500;
  margin-bottom: 0.55rem;
}

.field__label span[aria-hidden] { color: var(--c-accent-dark); }

.field__optional {
  font-weight: 400;
  color: var(--c-ink-mute);
}

.field__input {
  font: inherit;
  color: var(--c-ink);
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
  width: 100%;
}

.field__input:hover { border-color: var(--c-ink-mute); }

.field__input:focus {
  outline: none;
  border-color: var(--c-accent-dark);
  background: var(--c-surface);
  box-shadow: 0 0 0 3px rgba(138, 155, 110, 0.22);
}

textarea.field__input { resize: vertical; min-height: 64px; }

/* select con freccia custom */
.field__select-wrap { position: relative; }

.field__select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.6rem;
  cursor: pointer;
}

.field__select-wrap::after {
  content: '';
  position: absolute;
  right: 1.05rem;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--c-ink-soft);
  border-bottom: 1.5px solid var(--c-ink-soft);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* errori inline */
.field__error {
  font-size: 0.8rem;
  color: var(--c-error);
  margin-top: 0.45rem;
  min-height: 0;
  display: none;
}

.field__error.is-visible { display: block; }

.field.has-error .field__input,
.field.has-error .segmented { border-color: var(--c-error); }

.field.has-error .field__input:focus {
  box-shadow: 0 0 0 3px rgba(176, 80, 60, 0.18);
}

/* shake sugli errori */
.field.is-shaking { animation: shake 0.4s var(--ease-out); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  55% { transform: translateX(5px); }
  80% { transform: translateX(-3px); }
}

/* toggle Sì / No */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-radius: 999px;
  padding: 4px;
  transition: border-color var(--t-fast);
}

.segmented__option { position: relative; }

.segmented__option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.segmented__option span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--c-ink-soft);
  border-radius: 999px;
  transition: background-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}

.segmented__option input:checked + span {
  background: var(--c-accent-dark);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(110, 126, 85, 0.8);
}

.segmented__option input:focus-visible + span {
  outline: 2px solid var(--c-accent-dark);
  outline-offset: 2px;
}

/* checkbox intolleranze come "pill" */
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.check { position: relative; }

.check input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.check span {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.05rem;
  font-size: var(--fs-small);
  border: 1px solid var(--c-line);
  border-radius: 999px;
  background: var(--c-bg);
  color: var(--c-ink-soft);
  transition: background-color var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), transform var(--t-fast) var(--ease-spring);
}

.check:hover span { border-color: var(--c-ink-mute); }

.check input:checked + span {
  background: var(--c-accent-soft);
  border-color: var(--c-accent-dark);
  color: var(--c-accent-dark);
  font-weight: 500;
}

.check input:focus-visible + span {
  outline: 2px solid var(--c-accent-dark);
  outline-offset: 2px;
}

/* blocchi condizionali del form */
.rsvp__conditional {
  display: flex;
  flex-direction: column;
  gap: 1.7rem;
}

.rsvp__companions:not(:empty) {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.2rem;
  background: var(--c-bg);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--c-line);
}

.rsvp__companions .field { animation: fade-up 0.45s var(--ease-out) both; }

/* --- sezione dedicata intolleranze, per ospite --- */
.diet {
  background: linear-gradient(180deg, var(--c-accent-soft), rgba(231, 234, 223, 0.35));
  border: 1px solid rgba(138, 155, 110, 0.35);
  border-radius: var(--radius);
  padding: clamp(1.3rem, 3.5vw, 2rem);
}

.diet__head {
  text-align: center;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid rgba(138, 155, 110, 0.3);
  margin-bottom: 1.4rem;
}

.diet__icon {
  width: 26px;
  height: 26px;
  color: var(--c-accent-dark);
  margin-bottom: 0.5rem;
}

.diet__title {
  font-family: var(--f-display);
  font-size: clamp(1.3rem, 3vw, 1.65rem);
  font-weight: 600;
}

.diet__hint {
  font-size: var(--fs-small);
  color: var(--c-ink-soft);
  max-width: 40ch;
  margin: 0.35rem auto 0;
}

.diet__people {
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
}

.diet__person {
  border: none;
  padding: 0;
  animation: fade-up 0.45s var(--ease-out) both;
}

.diet__person + .diet__person {
  padding-top: 1.3rem;
  border-top: 1px dashed rgba(138, 155, 110, 0.4);
}

.diet__person-name {
  /* float+width: fa fluire il contenuto del fieldset sotto la legend */
  float: left;
  width: 100%;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--c-accent-dark);
  margin-bottom: 0.7rem;
}

.diet__person .checks,
.diet__person .diet__other { clear: both; }

/* le pill dentro il pannello salvia poggiano su superficie chiara */
.diet .check span { background: var(--c-surface); }

.diet .check input:checked + span {
  background: var(--c-accent-dark);
  border-color: var(--c-accent-dark);
  color: #fff;
}

.diet__other { margin-top: 0.9rem; }

.rsvp__submit { align-self: center; min-width: 260px; margin-top: 0.4rem; }

.rsvp__form-error { margin-top: -0.8rem; }

/* schermata di conferma */
.rsvp__success {
  width: 100%;
  max-width: 660px;
  margin-inline: auto;
  padding: clamp(2.5rem, 6vw, 4rem);
  text-align: center;
  animation: scale-in 0.6s var(--ease-out);
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.rsvp__check {
  width: 84px;
  height: 84px;
  margin-inline: auto;
  color: var(--c-accent-dark);
}

.rsvp__check-circle {
  stroke: currentColor;
  stroke-dasharray: 208;
  stroke-dashoffset: 208;
  animation: draw 1s var(--ease-out) 0.15s forwards;
}

.rsvp__check-mark {
  stroke: currentColor;
  stroke-dasharray: 42;
  stroke-dashoffset: 42;
  animation: draw 0.5s var(--ease-out) 0.9s forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }

.rsvp__success-title {
  font-family: var(--f-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 500;
  margin-top: 1.4rem;
  margin-bottom: 0.6rem;
}

.rsvp__success-text { color: var(--c-ink-soft); max-width: 42ch; margin-inline: auto; }

/* ---------- Footer ---------- */
.footer {
  background: var(--c-ink);
  color: var(--c-bg);
  text-align: center;
  padding: clamp(3.5rem, 8vw, 5.5rem) var(--pad-inline);
}

.footer__names {
  font-family: var(--f-display);
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  font-weight: 500;
}

.footer__date {
  margin-top: 0.8rem;
  font-size: var(--fs-small);
  letter-spacing: 0.3em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  color: rgba(250, 247, 242, 0.75);
}

.footer__heart {
  width: 14px;
  height: 14px;
  fill: var(--c-accent);
  animation: heartbeat 2.2s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 30%, 100% { transform: scale(1); }
  10% { transform: scale(1.25); }
  20% { transform: scale(1.08); }
}

.footer__hashtag {
  margin-top: 1.6rem;
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-accent);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal { opacity: 1; transform: none; filter: none; }
  .hero__bg { transform: none !important; }
  .petals { display: none; }
  .timeline::after { transform: scaleY(1); }
}
