:root {
  --carta: #f7efe6;
  --carta-2: #fbf6f0;
  --inchiostro: #2b211c;
  --seppia: #5a3a2a;
  --tenue: #7d6a5e;
  --linea: #cdbcad;
  --accento: #8a5a44;
  --errore: #a33a2a;
  --campo: #fffaf5;
  --script: "Pinyon Script", "Brush Script MT", cursive;
  --serif: "Cormorant Garamond", Garamond, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--carta);
  background-image:
    radial-gradient(ellipse at 50% 0%, var(--carta-2) 0%, transparent 70%),
    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 .35 0 0 0 0 .27 0 0 0 0 .2 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--inchiostro);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ---------- acquerelli ---------- */
.acquerelli { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.wc { position: absolute; width: min(70vw, 520px); height: auto; opacity: .9; }
.wc-azzurro { top: 14vh; right: max(-22vw, -170px); transform: rotate(-12deg); }
.wc-verde   { top: 46vh; right: max(-24vw, -190px); transform: rotate(18deg); }
.wc-rosa    { top: 54vh; left:  max(-26vw, -200px); transform: rotate(-4deg); }

main, footer { position: relative; z-index: 1; }

/* ---------- invito ---------- */
.invito {
  min-height: 100vh;
  min-height: 100svh;
  max-width: 640px;
  margin: 0 auto;
  padding: 56px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.occhiello {
  display: flex; align-items: center; gap: 18px;
  width: 100%; max-width: 440px;
  margin: 0 0 6px;
  font-size: 17px; font-weight: 500;
  letter-spacing: .32em; text-transform: uppercase;
  color: var(--inchiostro);
}
.occhiello::before, .occhiello::after { content: ""; flex: 1; height: 1px; background: var(--inchiostro); opacity: .55; }
.occhiello span { padding-left: .32em; }

.nomi {
  margin: 4px 0 0;
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(40px, 12vw, 96px);
  line-height: 1.15;
  color: var(--seppia);
  white-space: nowrap;
}
.nomi .e { font-family: var(--serif); font-style: italic; font-size: .62em; margin: 0 .12em; }

.svolazzo { width: min(62%, 300px); height: auto; margin: -4px 0 26px; }
.svolazzo path { fill: none; stroke: var(--seppia); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 340; stroke-dashoffset: 340; }
.visibile .svolazzo path, .svolazzo.visibile path { animation: traccia 1.8s .3s ease forwards; }
@keyframes traccia { to { stroke-dashoffset: 0; } }

.ci-sposiamo { margin: 0; font-style: italic; font-size: clamp(28px, 7vw, 38px); letter-spacing: .03em; }
.data { margin: 0; font-size: clamp(46px, 12.5vw, 74px); line-height: 1.1; font-weight: 500; }
.citta { margin: 6px 0 0; font-size: 19px; font-weight: 600; letter-spacing: .42em; padding-left: .42em; text-transform: uppercase; }

.messaggio {
  margin-top: 30px; padding-top: 26px;
  border-top: 1px solid var(--linea);
  max-width: 470px;
  font-size: 20px;
}
.messaggio p { margin: 0 0 12px; text-wrap: balance; }
.messaggio strong { font-weight: 600; }

.dettagli {
  margin: 14px 0 0;
  font-size: 14px; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--tenue);
}

.freccia {
  margin-top: 30px;
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--seppia); text-decoration: none;
  font-size: 15px; font-weight: 600; letter-spacing: .25em; text-transform: uppercase;
  padding-left: .25em;
}
.freccia svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.5; animation: oscilla 2.2s ease-in-out infinite; }
@keyframes oscilla { 50% { transform: translateY(5px); } }

/* ---------- rsvp ---------- */
.rsvp {
  max-width: 560px;
  margin: 0 auto 40px;
  padding: 40px 22px 34px;
  background: rgba(255, 250, 245, .78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(138, 90, 68, .18);
  border-radius: 6px;
  box-shadow: 0 18px 50px -30px rgba(70, 40, 20, .35);
}
@media (min-width: 600px) { .rsvp { padding: 48px 48px 40px; } }

.rsvp h2 {
  margin: 0; text-align: center;
  font-family: var(--script); font-weight: 400;
  font-size: 58px; line-height: 1.1; color: var(--seppia);
}
.sottotitolo { margin: 0 0 26px; text-align: center; font-style: italic; color: var(--tenue); }

.avviso {
  margin-bottom: 22px; padding: 12px 16px;
  font-size: 17px; line-height: 1.4;
  background: #f3e6d9; border-left: 3px solid var(--accento);
}

form { margin: 0; }
fieldset { border: 0; padding: 0; min-width: 0; }
.campo { margin: 0 0 24px; }

label, legend {
  display: block;
  margin-bottom: 8px;
  font-size: 15px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--seppia);
}
.facoltativo { text-transform: none; letter-spacing: 0; font-weight: 400; font-style: italic; color: var(--tenue); }

input[type="text"], textarea {
  width: 100%;
  font: inherit; font-size: 20px; color: var(--inchiostro);
  background: var(--campo);
  border: 1px solid var(--linea); border-radius: 4px;
  padding: 10px 12px;
  transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 84px; }
input[type="text"]:focus, textarea:focus { outline: none; border-color: var(--accento); box-shadow: 0 0 0 3px rgba(138, 90, 68, .15); }
[aria-invalid="true"] { border-color: var(--errore) !important; }

.scelte { display: flex; flex-wrap: wrap; gap: 10px; }
.scelta { position: relative; margin: 0; flex: 1 1 140px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.scelta input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.scelta span {
  display: flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 8px 14px;
  font-size: 19px; color: var(--inchiostro); text-align: center;
  background: var(--campo);
  border: 1px solid var(--linea); border-radius: 4px;
  transition: background .2s, border-color .2s, color .2s;
  cursor: pointer;
}
.scelta input:checked + span { background: var(--seppia); border-color: var(--seppia); color: #fff8f1; }
.scelta input:focus-visible + span { outline: 2px solid var(--accento); outline-offset: 2px; }

.ospiti { list-style: none; margin: 14px 0 0; padding: 0; counter-reset: ospite; }
.ospite {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px dashed var(--linea);
  animation: entra .35s ease;
}
@keyframes entra { from { opacity: 0; transform: translateY(-6px); } }
.ospite label.tit { grid-column: 1 / -1; margin: 0; }
.ospite input[type="text"] { grid-column: 1; }
.ospite .togli {
  grid-column: 2;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: none; border: 1px solid var(--linea); border-radius: 4px;
  color: var(--tenue); cursor: pointer;
}
.ospite .togli:hover { color: var(--errore); border-color: var(--errore); }
.ospite .togli svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.ospite .bimbo {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  margin: 0; font-size: 18px; font-weight: 400;
  text-transform: none; letter-spacing: 0; color: var(--inchiostro);
  cursor: pointer;
}
.ospite .bimbo input { width: 20px; height: 20px; accent-color: var(--seppia); margin: 0; }
.ospite .errore { grid-column: 1 / -1; }

.link-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 6px; padding: 10px 2px;
  font: inherit; font-size: 18px; font-style: italic; color: var(--accento);
  background: none; border: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.link-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; }

.sotto { margin-top: 14px; }

.errore { margin: 6px 0 0; min-height: 0; font-size: 16px; color: var(--errore); font-style: italic; }
.errore:empty { display: none; }

.trappola { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.privacy { margin: 4px 0 18px; font-size: 15px; line-height: 1.4; color: var(--tenue); font-style: italic; }

.invia {
  width: 100%;
  min-height: 56px;
  font: inherit; font-size: 17px; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase;
  color: #fff8f1; background: var(--seppia);
  border: 0; border-radius: 4px;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.invia:hover { background: #4a2f22; }
.invia:active { transform: translateY(1px); }
.invia[disabled] { opacity: .65; cursor: progress; }
.errore-invio { text-align: center; }

.grazie { text-align: center; padding: 10px 0 6px; outline: none; }
.grazie-titolo { margin: 0; font-family: var(--script); font-size: 56px; line-height: 1.2; color: var(--seppia); }
.grazie p { margin: 0 0 10px; }

.tempo {
  margin-top: 30px; padding-top: 22px;
  border-top: 1px solid var(--linea);
  text-align: center;
}
.tempo p { margin: 0 0 12px; font-style: italic; }
.whatsapp {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 20px;
  font-size: 18px; font-weight: 600; color: var(--seppia); text-decoration: none;
  border: 1px solid var(--seppia); border-radius: 40px;
  transition: background .2s, color .2s;
}
.whatsapp:hover { background: var(--seppia); color: #fff8f1; }
.whatsapp svg { width: 22px; height: 22px; fill: currentColor; }
.piccolo { font-size: 17px; }

footer {
  padding: 10px 16px 34px;
  text-align: center;
  font-size: 13px; letter-spacing: .3em; text-transform: uppercase; color: var(--tenue);
}

/* ---------- comparsa ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 1s ease, transform 1s ease; }
.reveal.visibile { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .svolazzo path { stroke-dashoffset: 0; animation: none !important; }
  .freccia svg, .ospite { animation: none; }
}

@media (max-width: 380px) {
  body { font-size: 18px; }
  .messaggio { font-size: 18px; }
  .occhiello { font-size: 15px; gap: 12px; }
}
