/*
 * Stile del sito.
 * Impaginazione: un biglietto d'invito che scorre. Apertura con acquerello di viole dipinto su canvas,
 * poi sezioni a colonna stretta cucite da un ramo di viola; il programma è un percorso verticale della giornata.
 * I colori sono tutti qui sotto: chiaro in :root, scuro nel blocco prefers-color-scheme.
 */
:root {
  --paper: #f7f4f8;
  --paper-2: #efe8f3;
  --card: #fffdfe;
  --ink: #2b2131;
  --muted: #6e6377;
  --violet: #6a4790;
  --violet-2: #9b7bbf;
  --violet-soft: #e6dcef;
  --leaf: #5f7d5b;
  --gold: #a88a4e;
  --line: #ddd2e6;
  --danger: #a3343f;
  --todo: #fff0a8;
  --shadow: 0 1px 2px rgba(60, 30, 80, .05), 0 12px 32px -12px rgba(60, 30, 80, .18);
  --f-script: "Pinyon Script", "Snell Roundhand", "Apple Chancery", cursive;
  --f-display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --f-body: "Jost", "Futura", "Avenir Next", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #19131e; --paper-2: #211928; --card: #241c2b; --ink: #f0eaf4; --muted: #b3a8bc;
    --violet: #c9aee8; --violet-2: #9d7cc4; --violet-soft: #3a2c48; --leaf: #9fbd99; --gold: #d2b67a;
    --line: #3b3046; --danger: #f0909a; --todo: #5c4b10;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 34px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
.simboli { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
a { color: var(--violet); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }
p, figure { margin: 0; }

.gutter {
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.col { max-width: 660px; margin: 0 auto; }

/* ---------- Apertura ---------- */
.hero { position: relative; isolation: isolate; overflow: hidden; text-align: center; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.hero-inner { padding-block: 5rem 4.5rem; display: grid; justify-items: center; gap: 1.2rem; }
.seal { width: clamp(118px, 30vw, 148px); aspect-ratio: 1; }
.monogramma { width: 100%; height: 100%; display: block; overflow: visible; }
.monogramma .m-anello { fill: color-mix(in srgb, var(--paper) 75%, transparent); stroke: var(--gold); stroke-width: 1.2; }
.monogramma .m-anello-2 { fill: none; stroke-width: .7; opacity: .7; }
.monogramma .m-gambo { fill: none; stroke: var(--leaf); stroke-width: 1; opacity: .7; stroke-linecap: round; }
.monogramma .m-foglia { fill: var(--leaf); opacity: .62; }
.monogramma .m-petalo { fill: var(--violet); }
.monogramma .m-petalo-chiaro { fill: var(--violet-2); }
.monogramma .m-cuore { fill: #f2d27a; }
.monogramma .m-stella { fill: var(--gold); }
.monogramma .m-lettera { font-family: var(--f-display); font-style: italic; font-size: 62px; font-weight: 400; stroke-width: 1.1px; stroke-linejoin: round; }
/* un filo di contorno dello stesso colore ispessisce i tratti sottili, così si leggono anche da telefono */
.monogramma .m-v { fill: var(--ink); stroke: var(--ink); }
.monogramma .m-f { fill: var(--violet); stroke: var(--violet); }
.monogramma .m-punto { fill: var(--gold); }
.eyebrow { font-size: .76rem; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.names {
  font-family: var(--f-script);
  font-size: clamp(2.3rem, 10.5vw, 6.2rem);
  line-height: 1.1; color: var(--ink); padding-inline: .1em;
  white-space: nowrap;
}
.names .amp {
  font-family: var(--f-display); font-style: italic;
  font-size: .42em; color: var(--violet); margin-inline: .35em .3em;
}
.date-block { display: flex; align-items: center; gap: 1rem; font-family: var(--f-display); margin-top: .4rem; }
.date-block .side {
  font-size: .78rem; letter-spacing: .22em; text-transform: uppercase;
  font-family: var(--f-body); font-weight: 400; color: var(--muted);
  padding-block: .35rem; border-block: 1px solid var(--line); min-width: 6.5rem;
}
.date-block .day { font-size: 3.4rem; line-height: 1; color: var(--violet); font-variant-numeric: lining-nums; }

.countdown { margin-top: 1rem; display: flex; gap: .6rem; font-variant-numeric: tabular-nums; }
.countdown div {
  display: grid; justify-items: center; min-width: 4.6rem;
  padding: .7rem .4rem .55rem;
  background: color-mix(in srgb, var(--card) 80%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px 999px 18px 18px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.countdown b { font-family: var(--f-display); font-weight: 400; font-size: 1.75rem; line-height: 1.1; }
.countdown span { font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.countdown-oggi { font-family: var(--f-script); font-size: 2.2rem; color: var(--violet); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: .9rem; }

/* ---------- Pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  font: inherit; font-weight: 400; font-size: .93rem; letter-spacing: .02em;
  padding: .72rem 1.35rem; border-radius: 999px;
  border: 1px solid var(--violet); background: transparent; color: var(--violet);
  text-decoration: none; cursor: pointer;
  transition: background .2s, color .2s, transform .2s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: var(--violet-soft); color: var(--ink); }
.btn.solid { background: var(--violet); color: var(--paper); }
.btn.solid:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.big { padding: .9rem 1.8rem; font-size: 1rem; }

/* ---------- Menu ---------- */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-block: 1px solid var(--line);
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--paper);
}
.nav ul {
  list-style: none; margin: 0 auto; padding: 0; max-width: 760px;
  display: flex; gap: .2rem; justify-content: center;
  overflow-x: auto; scrollbar-width: none;
}
.nav ul::-webkit-scrollbar { display: none; }
.nav a {
  display: block; white-space: nowrap; padding: .8rem .75rem;
  font-size: .76rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; font-weight: 400;
  border-bottom: 1.5px solid transparent;
}
.nav a:hover, .nav a.attiva { color: var(--violet); }
.nav a.attiva { border-bottom-color: var(--violet); }
@media (max-width: 560px) { .nav ul { justify-content: flex-start; } }

/* ---------- Sezioni ---------- */
main section { padding-block: 4.5rem 1rem; scroll-margin-top: 3.5rem; }
.sec-head { text-align: center; display: grid; gap: .5rem; justify-items: center; margin-bottom: 2.4rem; }
.sec-head h2 { font-family: var(--f-display); font-size: clamp(2rem, 7vw, 2.6rem); line-height: 1.15; }
.sec-head h2 em { font-family: var(--f-script); font-style: normal; color: var(--violet); font-size: 1.25em; }
.lead { color: var(--muted); max-width: 32em; }
.sprig { width: 120px; height: 28px; color: var(--violet-2); }

/* La giornata: due tappe con foto ad arco, alternate a destra e a sinistra */
.col.larga { max-width: 940px; }
.tappe { display: grid; gap: clamp(3.5rem, 9vw, 5.5rem); }
.tappa {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(1.8rem, 5vw, 3.6rem);
  align-items: center;
}
.tappa.inversa { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
.tappa.inversa .tappa-foto { order: 2; }
.tappa-foto {
  position: relative;
  display: grid;
  gap: .5rem;
  justify-items: center;
}
.tappa-foto img, .tappa-foto .disegno {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 6 / 5;
  object-fit: cover;
  /* arco esatto: semicerchio in alto (60% dell'altezza = metà larghezza con proporzione 6:5), angoli morbidi in basso */
  border-radius: 50% 50% 16px 16px / 60% 60% 16px 16px;
  box-shadow: var(--shadow);
  display: block;
}
/* doppio filo dorato attorno all'arco, come il sigillo in apertura */
.tappa-foto::before {
  content: "";
  position: absolute;
  inset: -9px -9px auto -9px;
  aspect-ratio: 6 / 5;
  width: calc(100% + 18px);
  border: 1px solid var(--gold);
  border-radius: 50% 50% 25px 25px / 60% 60% 25px 25px;
  opacity: .65;
  pointer-events: none;
}
.credito { font-size: .72rem; color: var(--muted); letter-spacing: .02em; }
.credito a { color: inherit; text-decoration: none; }
.credito a:hover { text-decoration: underline; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .tappa-foto img { transition: transform .8s cubic-bezier(.2,.7,.2,1); }
  .tappa:hover .tappa-foto img { transform: scale(1.015); }
}

/* disegno della villa */
.disegno { background: linear-gradient(180deg, var(--violet-soft) 0%, var(--paper-2) 62%, var(--paper) 100%); }
.disegno .d-collina { fill: var(--leaf); opacity: .16; }
.disegno .d-collina-2 { opacity: .24; }
.disegno .d-pino ellipse { fill: var(--leaf); opacity: .55; }
.disegno .d-tronco { fill: none; stroke: var(--ink); stroke-width: 2; opacity: .55; stroke-linecap: round; }
.disegno .d-cipresso path { fill: var(--leaf); opacity: .75; }
.disegno .d-villa rect, .disegno .d-villa path { fill: var(--card); stroke: var(--violet); stroke-width: 1.6; stroke-linejoin: round; }
.disegno .d-villa path:nth-of-type(3), .disegno .d-villa path:nth-of-type(4), .disegno .d-villa path:nth-of-type(5) { fill: var(--violet-soft); }
.disegno .d-siepe rect { fill: var(--leaf); opacity: .5; }
.disegno .d-viale { fill: none; stroke: var(--gold); stroke-width: 1.4; opacity: .7; }

.tappa-testo { display: grid; gap: .9rem; min-width: 0; justify-items: start; }
.tappa-quando { display: flex; align-items: baseline; gap: .9rem; flex-wrap: wrap; }
.tappa-ora {
  font-family: var(--f-display);
  font-size: clamp(3rem, 9vw, 4.2rem);
  line-height: 1;
  color: var(--violet);
  font-variant-numeric: lining-nums tabular-nums;
}
.tappa-momento { font-size: .8rem; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.tappa-luogo { font-family: var(--f-display); font-size: clamp(1.6rem, 5vw, 2.1rem); line-height: 1.2; }
.tappa-descr { color: var(--muted); max-width: 30em; }
.momenti { list-style: none; margin: 0; padding: .2rem 0; display: grid; gap: .55rem; }
.momenti li { display: flex; align-items: center; gap: .7rem; }
.momenti svg {
  width: 36px; height: 36px; padding: 8px; flex: none;
  border-radius: 50%; background: var(--violet-soft); color: var(--violet);
}
.tappa-indirizzo { display: flex; gap: .5rem; align-items: flex-start; color: var(--ink); font-size: .95rem; }
.tappa-indirizzo svg { width: 18px; height: 18px; flex: none; color: var(--violet); margin-top: .2em; }
.tappa-azioni { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .2rem; }

@media (max-width: 680px) {
  .tappa, .tappa.inversa { grid-template-columns: 1fr; gap: 1.8rem; }
  .tappa.inversa .tappa-foto { order: 0; }
  .tappa-foto { width: min(78%, 340px); justify-self: center; }
  .tappa-testo { justify-items: center; text-align: center; }
  .tappa-quando { justify-content: center; }
  .momenti li { justify-content: center; }
  .tappa-indirizzo { justify-content: center; }
  .tappa-azioni { justify-content: center; }
}

/* Conferma */
.reply {
  position: relative; background: var(--card); border-radius: 6px;
  padding: 2.8rem clamp(1.2rem, 5vw, 2.6rem) 2.4rem;
  text-align: center; display: grid; gap: 1rem; justify-items: center;
  box-shadow: var(--shadow);
}
.reply::before {
  content: ""; position: absolute; inset: 10px;
  border: 1px solid var(--gold); border-radius: 3px; pointer-events: none; opacity: .7;
}
.reply > * { position: relative; }
.rsvp-mark { font-family: var(--f-display); letter-spacing: .4em; font-size: .85rem; color: var(--gold); padding-left: .4em; }
.reply-title { font-family: var(--f-display); font-size: clamp(1.8rem, 6vw, 2.3rem); }
.deadline { font-family: var(--f-script); font-size: clamp(2rem, 8vw, 2.6rem); color: var(--violet); line-height: 1.2; }

.rsvp-form { width: 100%; max-width: 460px; display: grid; gap: 1.1rem; text-align: left; margin-top: .6rem; }
.field { display: grid; gap: .35rem; border: 0; margin: 0; padding: 0; min-width: 0; }
.field label, .field legend { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 400; padding: 0; }
.field .opt { text-transform: none; letter-spacing: 0; }
.field input[type="text"], .field input[type="number"], .field textarea {
  font: inherit; font-weight: 300; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: .7rem .85rem; width: 100%; resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.field textarea::placeholder { color: var(--muted); opacity: .7; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.choice label { text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--ink); cursor: pointer; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span {
  display: block; text-align: center; padding: .75rem .5rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper);
  transition: border-color .2s, background .2s;
}
.choice input:checked + span { border-color: var(--violet); background: var(--violet-soft); color: var(--ink); font-weight: 400; }
.choice input:focus-visible + span { outline: 2px solid var(--violet); outline-offset: 2px; }
.se-presente { display: grid; gap: 1.1rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-error { color: var(--danger); font-size: .95rem; }
.rsvp-form .btn.big { justify-self: center; }

.thanks { display: grid; gap: .6rem; justify-items: center; padding-block: .5rem; }
.thanks-title { font-family: var(--f-script); font-size: clamp(2.2rem, 8vw, 2.8rem); color: var(--violet); line-height: 1.2; }

.contacts { display: grid; gap: .8rem; justify-items: center; padding-top: 1rem; border-top: 1px solid var(--line); width: 100%; margin-top: .6rem; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.contacts .row { gap: 1rem 1.6rem; }
.phones { font-size: .92rem; color: var(--muted); }
.phones b { font-weight: 400; color: var(--ink); user-select: all; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Informazioni */
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 600px) { .info-grid { grid-template-columns: 1fr; } }
.info { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 1.35rem; display: grid; gap: .5rem; align-content: start; }
.info .k { display: flex; align-items: center; gap: .55rem; font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--leaf); font-weight: 500; }
.info .k svg { width: 18px; height: 18px; }
.info h3 { font-family: var(--f-display); font-size: 1.25rem; justify-self: start; }
.info p { color: var(--muted); }
.info-link { font-size: .9rem; }

/* Regalo */
.gift {
  background: linear-gradient(160deg, var(--violet-soft), var(--paper-2));
  border-radius: 24px; padding: 2rem 1.5rem;
  display: grid; gap: 1rem; justify-items: center; text-align: center;
  border: 1px solid var(--line);
}
.gift .lead { color: var(--ink); }
.who { color: var(--muted); font-size: .95rem; }
.iban {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1rem; letter-spacing: .06em;
  background: var(--card); border: 1px solid var(--line);
  padding: .75rem 1rem; border-radius: 12px;
  overflow-wrap: anywhere; user-select: all; max-width: 100%;
}
.copied { font-size: .85rem; color: var(--leaf); min-height: 1.3em; }

/* Chiusura */
footer {
  margin-top: 4rem; padding-block: 3.5rem; text-align: center;
  background: var(--paper-2); border-top: 1px solid var(--line);
  display: grid; gap: .5rem; justify-items: center;
}
.sig { font-family: var(--f-script); font-size: 2.6rem; color: var(--violet); line-height: 1.2; }
.small { color: var(--muted); font-size: .9rem; }

/* Allergie: il campo più importante del modulo */
.field.importante { background: var(--violet-soft); border-radius: 14px; padding: 1rem 1rem 1.1rem; gap: .5rem; }
.field.importante label { display: flex; align-items: center; gap: .45rem; color: var(--ink); font-weight: 500; }
.field.importante label svg { width: 18px; height: 18px; color: var(--violet); flex: none; }
.field.importante textarea { background: var(--card); }
.aiuto { font-size: .92rem; color: var(--ink); line-height: 1.5; }

/* Bozza: evidenzia i testi che in contenuti.js iniziano con ~ (ancora esempi) */
.bozza .esempio { background: var(--todo); border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.bozza span.esempio, .bozza b.esempio { padding-inline: .15em; }

/* Movimento: il contenuto è già visibile, sale solo un poco */
@media (prefers-reduced-motion: no-preference) {
  .hero-inner > * { animation: sali 1s cubic-bezier(.2,.7,.2,1) both; }
  .hero-inner > *:nth-child(2) { animation-delay: .1s; }
  .hero-inner > *:nth-child(3) { animation-delay: .2s; }
  .hero-inner > *:nth-child(4) { animation-delay: .3s; }
  .hero-inner > *:nth-child(5) { animation-delay: .4s; }
  .hero-inner > *:nth-child(n+6) { animation-delay: .5s; }
  @keyframes sali { from { transform: translateY(10px); } to { transform: none; } }
  .reveal { transition: transform .9s cubic-bezier(.2,.7,.2,1); }
  .reveal.sotto { transform: translateY(18px); }
}
@media (max-width: 420px) {
  body { font-size: 16px; }
  .countdown div { min-width: 4.1rem; }
  .date-block { gap: .7rem; }
  .date-block .side { min-width: 5.4rem; font-size: .7rem; letter-spacing: .16em; }
  .date-block .day { font-size: 2.9rem; }
}
