/* =========================================================
   Eleonora & Francesco · invito
   Palette: crema, verde salvia, arancione/salmone
   ========================================================= */
:root {
  --cream: #FBF6EA;
  --cream-2: #F3EBD8;
  --sage: #8FA67E;
  --sage-deep: #6E8960;
  --sage-dark: #4F6645;
  --salmon: #E8957A;
  --salmon-deep: #D3734F;
  --ink: #3F3A32;
  --ink-soft: #6B6356;
  --line: #D9CDB4;
  --green: #4F6645; /* unico colore per tutte le scritte */

  --script: "Parisienne", cursive;
  --serif: "Cormorant Garamond", Georgia, serif;

  --col: 560px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  color: var(--green);
  background-color: #C9D3B8;
  /* carta leggermente granulosa */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3  0 0 0 0 .28  0 0 0 0 .2  0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body.locked { overflow: hidden; height: 100svh; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

.script { font-family: var(--script); font-weight: 400; }

/* ---------- Colonna carta ---------- */
.paper {
  max-width: var(--col);
  margin: 0 auto;
  background-color: var(--cream);
  /* carta da acquerello ruvida (grana a freddo) */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360'%3E%3Cfilter id='p' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.045' numOctaves='5' seed='3' stitchTiles='stitch' result='n'/%3E%3CfeDiffuseLighting in='n' lighting-color='%23ffffff' surfaceScale='2.6' result='l'%3E%3CfeDistantLight azimuth='225' elevation='62'/%3E%3C/feDiffuseLighting%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='.35' intercept='.65'/%3E%3CfeFuncG type='linear' slope='.35' intercept='.65'/%3E%3CfeFuncB type='linear' slope='.35' intercept='.65'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45  0 0 0 0 .4  0 0 0 0 .3  0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-blend-mode: multiply, normal;
  box-shadow: 0 0 60px rgba(60, 70, 45, .18);
  overflow: hidden;
}

/* =========================================================
   1 · BIGLIETTO
   ========================================================= */
.intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  perspective: 1400px;
  perspective-origin: 50% 50%;
  background: transparent;        /* tra le ante che si aprono si vede già la pagina */
  transition: opacity .7s ease 3.4s, visibility 0s linear 4.1s;
}

/* Le due ante. Ognuna mostra la propria metà della foto del biglietto (img/biglietto.webp):
   l'immagine è dimensionata come "cover" sullo schermo intero e centrata sulla fessura. */
.door {
  --img-w: max(100vw, 56.28vh);              /* 941/1672 = 0.5628 */
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  background: #9fb08e url("../img/biglietto.webp") no-repeat;
  background-size: var(--img-w) auto;
  transform-style: preserve-3d;
  transition:
    transform 4s cubic-bezier(.33, .02, .5, 1),
    box-shadow 4s ease;
  will-change: transform;
}
.door--left  {
  left: 0;
  transform-origin: left center;
  background-position: calc(50vw - var(--img-w) / 2) center;
}
.door--right {
  right: 0;
  transform-origin: right center;
  background-position: calc(var(--img-w) / -2) center;
  z-index: 2;                                 /* sopra la sinistra: il sigillo la copre */
}
/* luce e ombra sulle ante mentre girano */
.door__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 4s cubic-bezier(.4, .05, .3, 1);
}
.door--left .door__shade {   /* l'anta sinistra si allontana dalla luce: si scurisce */
  background: linear-gradient(90deg, rgba(25, 32, 20, .55), rgba(25, 32, 20, .25) 70%, rgba(25, 32, 20, .4));
}
.door--right .door__shade {  /* l'anta destra prende luce, con ombra verso il cardine */
  background: linear-gradient(90deg, rgba(255, 255, 245, .22), rgba(255, 255, 245, .05) 55%, rgba(25, 32, 20, .3));
}
/* spessore del cartoncino sul bordo interno */
.door--left::after, .door--right::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(90deg, rgba(0,0,0,.35), rgba(255,255,255,.15));
}
.door--left::after  { right: 0; }
.door--right::before { left: 0; }

/* sigillo di ceralacca: sta sul bordo sinistro dell'anta destra, a cavallo della fessura */
.seal {
  position: absolute;
  left: 0; top: 50%;
  z-index: 3;
  width: 168px;
  aspect-ratio: 1;
  padding: 0; border: 0; background: none; cursor: pointer;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 5px 8px rgba(30, 40, 25, .4));
  animation: breathe 3s ease-in-out infinite;
}
.seal img { width: 100%; height: 100%; object-fit: contain; }
.seal:focus-visible { outline: 2px dashed var(--cream); outline-offset: 6px; border-radius: 50%; }
.intro__hint {
  position: absolute;
  left: 0; right: 0; bottom: 9%;
  z-index: 3;
  text-align: center;
  font-size: 12px;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: rgba(251, 246, 234, .85);
  animation: pulse 2.4s ease-in-out infinite;
  transition: opacity .3s;
}

.intro.opening .seal { animation: none; }
.intro.opening .intro__hint { opacity: 0; animation: none; }
.intro.opening .door--left  {
  transform: rotateY(-96deg);
  box-shadow: 30px 0 60px rgba(20, 28, 16, .45);
}
.intro.opening .door--right {
  transform: rotateY(96deg);
  box-shadow: -30px 0 60px rgba(20, 28, 16, .45);
}
.intro.opening .door__shade { opacity: 1; }
.intro.opening { opacity: 0; visibility: hidden; }

@keyframes breathe { 50% { transform: translate(-50%, -50%) scale(1.035); } }
@keyframes pulse { 50% { opacity: .45; } }

/* =========================================================
   2 · SIPARIO + BENVENUTI
   ========================================================= */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* parte alta: video della tenda (video/sipario.mp4, ritagliato dall'originale 9:16
   all'area della tenda, 1080x1213). L'abbazia sta fuori, sotto, come immagine fissa:
   gli orli delle tende ci si appoggiano sopra. */
/* niente z-index/mask sul contenitore: isolerebbero il video e il
   "multiply" non vedrebbe più la carta sotto (resterebbe bianco) */
.hero__top {
  position: relative;
  width: 100%;
  aspect-ratio: 1080 / 1213;
}
.curtain-video,
.curtain-still {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  mix-blend-mode: multiply;   /* il bianco del video sparisce sulla carta */
}
.curtain-still { opacity: 0; }
.hero.video-fallback .curtain-still { opacity: 1; }
.hero.video-fallback .curtain-video { opacity: 0; visibility: hidden; }

/* scritte dentro l'apertura del sipario */
.hero__text {
  position: absolute;
  z-index: 1;
  top: 29%; bottom: 13%;
  left: 18%; right: 18%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1.4s ease, transform 1.4s ease;
}
.curtains-open .hero__text { opacity: 1; transform: none; }
.hero__names {
  font-size: clamp(40px, 12.5vw, 66px);
  line-height: 1.05;
  color: var(--green);
}
.hero__names .amp { display: block; font-size: .5em; margin: 2px 0; }
.hero__place {
  margin-top: 12px;
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--green);
}
.hero__date {
  margin-top: 4px;
  font-size: 21px;
  font-style: italic;
  font-weight: 600;
  color: var(--green);
}

/* abbazia sotto, sempre visibile. Non "posizionata": così il video della tenda
   (posizionato) le passa sopra e gli orli con le foglie si appoggiano sulle colline */
.hero__abbey {
  width: 190%;
  max-width: none;
  margin: -5.5% 0 0 -45%;
  mix-blend-mode: multiply;
}
@media (min-width: 520px) { .hero__abbey { width: 130%; margin-left: -15%; } }

.scroll-hint {
  position: absolute;
  left: 50%; bottom: 22px;
  z-index: 5;
  width: 28px; height: 44px;
  margin-left: -14px;
  border: 1.5px solid var(--green);
  border-radius: 16px;
  opacity: 0;
  transition: opacity 1s ease 3s;
}
.scroll-hint span {
  position: absolute; left: 50%; top: 8px;
  width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px;
  background: var(--green);
  animation: wheel 1.8s ease-in-out infinite;
}
.curtains-open .scroll-hint { opacity: .9; }
@keyframes wheel { 60% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }

/* =========================================================
   Sezioni
   ========================================================= */
.section {
  position: relative;
  padding: 88px 28px;
  text-align: center;
}
.section + .section::before { /* separatore in stile schizzo: prato di fiori di campo */
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: min(88%, 480px);
  aspect-ratio: 2044 / 247;
  transform: translate(-50%, -50%);
  background: url("../img/separatore-schizzo.webp") center / contain no-repeat;
}
/* separatore alternato: una sezione cresce da sinistra, la successiva da destra */
.section:nth-of-type(even)::before,
.footer::before { transform: translate(-50%, -50%) scaleX(-1); }
.title {
  font-size: clamp(46px, 12vw, 60px);
  line-height: 1.1;
  color: var(--green);
  margin-bottom: 28px;
}
.lead {
  font-size: 22px;
  font-style: italic;
  color: var(--green);
  margin-bottom: 18px;
}
.caption {
  margin-top: 20px;
  font-size: 15px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green);
}
.illus { width: 78%; max-width: 360px; margin: 0 auto 26px; }
.illus--wide { width: 100%; max-width: 440px; mix-blend-mode: multiply; }
.illus--rsvp { width: 34%; max-width: 150px; margin: -12px auto 18px; }

/* ---------- Storia ---------- */
/* Foto su tela appoggiata al cavalletto ad acquerello. main.js deforma la foto in
   prospettiva sui quattro angoli scritti in data-tela; finché non lo fa resta nascosta. */
.easel {
  position: relative;
  width: 88%;
  max-width: 400px;
  margin: 0 auto 26px;
}
.easel__img { display: block; width: 100%; }
.easel__foto {
  position: absolute;
  top: 0;
  left: 0;
  width: 300px;
  height: 400px;
  object-fit: cover;
  transform-origin: 0 0;
  visibility: hidden;
}
.easel.pronta .easel__foto { visibility: visible; }
.story-text { max-width: 440px; margin: 0 auto; }

/* ---------- Countdown ---------- */
.count {
  position: relative;
  width: min(100%, 560px);
  aspect-ratio: 1220 / 1229;
  margin: 0 auto;
  container-type: inline-size;
}
.count__frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.count__grid { /* spazio bianco interno della cornice */
  position: absolute;
  top: 17%; right: 18%; bottom: 22%; left: 15%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: center;
  gap: 6cqw 2cqw;
}

.count p {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.count span {
  font-size: clamp(34px, 13cqw, 64px);
  line-height: 1;
  font-weight: 500;
  color: var(--green);
  font-variant-numeric: lining-nums tabular-nums;
}
.count small {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--green);
  margin-top: 4px;
}
@container (min-width: 500px) { /* su schermi larghi i quattro numeri in fila */
  .count__grid { grid-template-columns: repeat(4, 1fr); }
  .count span { font-size: 8.5cqw; }
  .count small { font-size: 11px; letter-spacing: .16em; }
}
/* ---------- Location ---------- */
.place-name {
  font-size: 26px;
  font-weight: 500;
  color: var(--green);
  margin-bottom: 8px;
}
address { font-style: normal; margin-bottom: 26px; color: var(--green); }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-block;
  padding: 13px 28px;
  border: 1.5px solid var(--sage-deep);
  border-radius: 999px;
  background: transparent;
  color: var(--green);
  font: 500 15px/1 var(--serif);
  letter-spacing: .2em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background .25s, color .25s;
}
.btn:hover, .btn:focus-visible { background: var(--sage-deep); color: var(--cream); }
.btn--solid { background: var(--green); border-color: var(--green); color: var(--cream); }
.btn--solid:hover, .btn--solid:focus-visible { background: #3E5236; border-color: #3E5236; color: var(--cream); }
.btn--ghost { margin-top: 18px; padding: 10px 22px; font-size: 13px; }

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  margin: 90px 0 100px;      /* spazio per la bottiglia sopra e la coppa sotto */
  padding: 0 0 80px;         /* il getto prosegue sotto l'ultimo momento prima di cadere nella coppa */
  position: relative;
}
/* in cima la bottiglia che versa: il bordo del collo (6px da sinistra, 78px dall'alto
   nell'immagine larga 104px) coincide con l'inizio del getto */
.timeline::before {
  content: "";
  position: absolute;
  top: -78px;
  left: calc(50% - 6px);
  width: 104px;
  aspect-ratio: 658 / 512;
  background: url("../img/timeline-bottiglia.webp") center / contain no-repeat;
}
/* in fondo la coppa: il getto finisce sulla superficie dello spumante
   (48px da sinistra, 43px dall'alto nell'immagine larga 120px) */
.timeline::after {
  content: "";
  position: absolute;
  top: calc(100% - 43px);
  left: calc(50% - 48px);
  width: 120px;
  aspect-ratio: 560 / 611;
  background: url("../img/timeline-coppa.webp") center / contain no-repeat;
}
.timeline__getto { /* getto di spumante disegnato da js/main.js al posto della linea */
  position: absolute;
  top: 0; left: 50%;
  width: 100px;
  margin-left: -50px;
  pointer-events: none;
  z-index: 1;               /* sopra la coppa, così si vede cadere dentro */
}
.tl {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  column-gap: 76px;          /* spazio tra il getto e scritte/immagini */
  padding: 22px 0;
}
.tl__img { width: 100%; max-width: 150px; justify-self: end; }
.tl__body { text-align: left; }
.tl:nth-of-type(even) .tl__img { order: 2; justify-self: start; }
.tl:nth-of-type(even) .tl__body { text-align: right; }
.tl__img--wide { width: 116%; max-width: 210px; } /* cena: immagine panoramica un po' più larga */
/* sul telefono la cena (panoramica 3:1) resta intera, senza tagli, e si allarga
   verso il bordo esterno dello schermo per essere il più grande possibile */
@media (max-width: 520px) {
  .tl__img--wide { width: calc(100% + 26px); max-width: none; margin-left: -26px; }
  .tl:nth-of-type(even) .tl__img--wide { margin-left: 0; margin-right: -26px; } /* se sta a destra si allarga verso destra */
  /* navetta: ancora più grande, quasi fino al bordo e un po' verso il ramo */
  /* stessa distanza dal bordo dello schermo e dal ramo (circa 10px per lato) */
  .tl__img--bus { width: calc(100% + 48px); margin-left: -32px; margin-right: -16px; }
  .tl:nth-of-type(even) .tl__img--bus { margin-left: -16px; margin-right: -32px; }
}
.tl__img--bus { max-width: 250px; }
@media (max-width: 520px) { .tl__img--bus { max-width: none; } }
.tl time {
  display: block;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  color: var(--green);
}
.tl h3 {
  font-family: var(--script);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.1;
  color: var(--green);
  margin-top: 4px;
}
.tl p { font-size: 14px; line-height: 1.35; color: var(--green); margin-top: 4px; }

/* ---------- Regali ---------- */
/* riquadro IBAN dentro la cornice in stile schizzo (img/cornice-iban-schizzo.webp):
   il padding (in frazioni della larghezza) segue lo spazio bianco interno della cornice */
.iban {
  position: relative;
  /* sul telefono la cornice si allarga oltre il margine della sezione per lasciare piu' spazio al testo */
  --w: min(100vw - 12px, 500px);
  width: var(--w);
  left: 50%;
  transform: translateX(-50%);
  margin: 26px 0 0;
  aspect-ratio: 1515 / 985;
  padding: calc(var(--w) * .09) calc(var(--w) * .19) calc(var(--w) * .105) calc(var(--w) * .15);
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.iban__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: fill;
  pointer-events: none;
}
.iban > p, .iban > button { position: relative; }
.iban__label {
  font-size: clamp(9px, 2.8cqw, 12px);
  font-weight: 600;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--green);
}
.iban__value { font-size: clamp(15px, 4.9cqw, 21px); line-height: 1.25; margin-bottom: 2.4cqw; }
.iban .btn--ghost { margin-top: 1.5cqw; padding: 2cqw 4.5cqw; font-size: clamp(10px, 2.7cqw, 13px); }
.iban__code { font-size: clamp(14px, 4.5cqw, 20px); font-variant-numeric: tabular-nums; letter-spacing: .02em; overflow-wrap: anywhere; } /* se va a capo, lo fa tra i gruppi di cifre */

/* ---------- RSVP ---------- */
.deadline { margin-bottom: 30px; color: var(--green); }
.form {
  text-align: left;
  max-width: 440px;
  margin: 0 auto;
}
.field {
  display: block;
  margin: 0 0 24px;
  padding: 0;
  border: 0;
}
.field > span, .field legend, .if-bus > span {
  display: block;
  margin-bottom: 8px;
  padding: 0;
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--green);
}
input[type="text"], select, textarea {
  width: 100%;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1.5px solid var(--line);
  border-radius: 0;
  background: transparent;
  font: 19px/1.4 var(--serif);
  color: var(--green);
  -webkit-appearance: none;
  appearance: none;
}
select {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236E8960' stroke-width='1.5'/%3E%3C/svg%3E") right 4px center no-repeat;
}
textarea { resize: vertical; }
::placeholder { color: var(--green); opacity: .5; }
input:focus, select:focus, textarea:focus { outline: none; border-bottom-color: var(--sage-deep); }
#guests input + input, .if-kids { margin-top: 10px; }

.choices { display: flex; flex-wrap: wrap; gap: 10px; }
.choices--stack { flex-direction: column; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block;
  padding: 10px 18px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: 18px;
  transition: all .2s;
}
.choices--stack .choice span { border-radius: 12px; }
.choice input:checked + span {
  border-color: var(--sage-deep);
  background: var(--sage-deep);
  color: var(--cream);
}
.choice input:focus-visible + span { outline: 2px dashed var(--salmon); outline-offset: 2px; }

.bus__info {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--salmon);
  background: rgba(232, 149, 122, .08);
  font-size: 17px;
  line-height: 1.45;
}
.if-bus { display: block; margin-top: 14px; }

.form__error { color: var(--green); font-weight: 600; margin-bottom: 14px; font-size: 17px; }
.form .btn--solid { display: block; width: 100%; margin-top: 8px; }
.form .btn--solid[disabled] { opacity: .6; cursor: wait; }

.thanks { padding: 20px 0; }
.thanks__title { font-size: 56px; color: var(--green); }

/* ---------- Footer ---------- */
.footer {
  position: relative;
  padding: 72px 20px 24px;
  text-align: center;
  color: var(--green);
}
.footer::before { /* stesso rametto separatore delle sezioni */
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: min(88%, 480px);
  aspect-ratio: 2044 / 247;
  transform: translate(-50%, -50%) scaleX(-1); /* rsvp è da sinistra, quindi qui da destra */
  background: url("../img/separatore-schizzo.webp") center / contain no-repeat;
}
.footer__names { font-size: clamp(42px, 12vw, 54px); line-height: 1.1; }
.footer__date { margin-top: 6px; letter-spacing: .3em; font-size: 15px; color: var(--green); }
.footer__img { width: 78%; max-width: 380px; margin: 24px auto 0; }

/* ---------- Comparsa allo scroll ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 1s ease, transform 1s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01s !important; transition-delay: 0s !important; }
  html { scroll-behavior: auto; }
}

@media (min-width: 600px) {
  .paper { margin-top: 0; }
}

@media (min-width: 520px) {
  .tl { column-gap: 110px; }
  .tl time { font-size: 26px; }
  .tl h3 { font-size: 28px; }
  .tl p { font-size: 15px; }
}
