:root {
  color-scheme: light;
  --cream: #faf3e9;
  --cream-2: #f3ead9;
  --paper: #fffaf1;
  --olive: #5b6334;
  --olive-dark: #454b24;
  --ink: #4f5530;
  --sage: #8f9d73;
  --sage-soft: #dfe3cc;
  --sun: #e5bd4c;
  --line: rgba(91, 99, 52, .28);
  --serif: "Cormorant Garamond", "Garamond", "Times New Roman", serif;
  --script: "Pinyon Script", "Brush Script MT", cursive;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  overflow-x: hidden;
  font-variant-numeric: lining-nums;
  /* leggera grana carta */
  background-image: radial-gradient(rgba(91,99,52,.035) 1px, transparent 1px);
  background-size: 4px 4px;
}
img { max-width: 100%; display: block; }
a { color: var(--olive); }
h1, h2, h3 { font-weight: 400; margin: 0; color: var(--olive); }

/* ---------- utilità tipografiche ---------- */
.caps {
  text-transform: uppercase;
  letter-spacing: .28em;
  margin: 0;
  color: var(--olive);
  font-weight: 500;
}
.caps.small { font-size: .82rem; }
.script { font-family: var(--script); color: var(--olive); font-size: 2.6rem; line-height: 1.1; margin: 0; }
.script.big { font-size: clamp(2.8rem, 9vw, 3.8rem); }
.kicker {
  font-family: var(--script); font-size: 1.9rem; color: var(--sage);
  margin: 0 0 .1rem; line-height: 1;
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 7rem 1rem 6rem;
  overflow: hidden;
}
.hero-inner { position: relative; z-index: 2; max-width: 640px; width: 100%; }

.deco { position: absolute; pointer-events: none; user-select: none; z-index: 1; }
.deco-top { top: 0; left: 0; width: clamp(190px, 42vw, 440px); }
.deco-bl  { bottom: 0; left: 0; width: clamp(110px, 22vw, 260px); }
.deco-br  { bottom: 0; right: 0; width: clamp(110px, 22vw, 250px); }

.etna {
  width: min(100%, 560px);
  margin: 0 auto 1.4rem;
  fill: none;
  stroke: var(--olive);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}
.etna path { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 2.6s .2s ease forwards; }
.etna path + path { stroke-width: 1.6; animation-delay: 1.4s; animation-duration: 1.4s; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.intro { font-size: clamp(1.15rem, 4.2vw, 1.45rem); margin: 0 0 1.6rem; line-height: 1.4; }
.names {
  font-family: var(--script);
  font-size: clamp(3.4rem, 15vw, 6.2rem);
  line-height: 1.05;
  margin: 0 0 .4rem;
  color: var(--olive);
}
.names .amp { font-size: .8em; }

.divider { display: flex; align-items: center; gap: .8rem; justify-content: center; margin: 1.6rem auto 1.2rem; max-width: 440px; }
.divider span { flex: 1; height: 1px; background: var(--olive); opacity: .7; }
.divider svg { width: 22px; height: 22px; fill: none; stroke: var(--olive); stroke-width: 1.4; }

.date {
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--olive);
  margin: .15rem 0;
  line-height: 1.1;
  font-weight: 500;
}

.countdown {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem;
  max-width: 400px; margin: 2rem auto 0;
}
.countdown div {
  background: rgba(255, 250, 241, .75);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .6rem .2rem .5rem;
  backdrop-filter: blur(2px);
}
.countdown b { display: block; font-size: 1.7rem; font-weight: 500; color: var(--olive); font-variant-numeric: lining-nums tabular-nums; line-height: 1.1; }
.countdown span { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; }

.cta { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; margin-top: 1.8rem; }

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 500 .95rem/1 var(--serif);
  letter-spacing: .16em; text-transform: uppercase;
  padding: 1rem 1.5rem;
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid var(--olive);
  background: var(--olive);
  color: var(--paper);
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
}
.btn:hover { background: var(--olive-dark); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--olive); }
.btn.ghost:hover { background: var(--sage-soft); }
.btn.wide { width: 100%; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--sun); outline-offset: 3px; }
.btn[disabled] { opacity: .6; cursor: wait; }

.scroll-hint {
  position: absolute; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 2;
  width: 44px; height: 44px; display: grid; place-items: center;
  animation: bob 2.4s ease-in-out infinite;
}
.scroll-hint svg { width: 26px; fill: none; stroke: var(--olive); stroke-width: 1.5; }
@keyframes bob { 50% { transform: translate(-50%, 6px); } }

/* ---------- NAV ---------- */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: center; gap: clamp(.9rem, 4vw, 2.4rem);
  padding: .85rem 1rem calc(.85rem);
  padding-top: max(.85rem, env(safe-area-inset-top));
  background: rgba(250, 243, 233, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  transform: translateY(-110%);
  transition: transform .35s ease;
}
.topnav.show { transform: none; }
.topnav a {
  text-decoration: none; text-transform: uppercase; letter-spacing: .16em;
  font-size: .78rem; font-weight: 600;
}

/* ---------- SEZIONI ---------- */
.section {
  padding: 5.5rem 1rem;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  scroll-margin-top: 3rem;
}
.section.alt {
  max-width: none;
  background: var(--cream-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.section.alt > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.section h2 { font-size: clamp(2.1rem, 7vw, 2.8rem); line-height: 1.15; margin-bottom: .8rem; }
.lead { font-size: 1.15rem; max-width: 34em; margin: 0 auto 2.2rem; }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 0 auto; max-width: 520px; text-align: left; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 76px; top: .6rem; bottom: .6rem; width: 1px; background: var(--line);
}
.timeline li { display: grid; grid-template-columns: 62px 1fr; gap: 2.2rem; padding: .9rem 0; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: 71px; top: 1.45rem; width: 11px; height: 11px; border-radius: 50%;
  background: var(--sun); box-shadow: 0 0 0 4px var(--cream);
}
.timeline time { font-weight: 600; color: var(--olive); font-size: 1.15rem; padding-top: .15rem; font-variant-numeric: lining-nums tabular-nums; }
.timeline h3 { font-size: 1.45rem; line-height: 1.2; }
.timeline p { margin: .2rem 0 0; }

/* mappa */
.map {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 4 / 3; background: var(--sage-soft);
}
.map iframe { width: 100%; height: 100%; border: 0; display: block; filter: sepia(.15) saturate(.85); }

.cards { display: grid; gap: 1rem; margin-top: 2.6rem; text-align: left; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.2rem;
}
.card h3 { font-size: 1.5rem; margin-bottom: .35rem; }
.card p { margin: 0; }
@media (min-width: 760px) { .cards { grid-template-columns: repeat(3, 1fr); } }

/* RSVP */
.rsvp {
  text-align: left; max-width: 520px; margin: 0 auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 20px;
  padding: 1.6rem 1.3rem;
}
.field { display: block; margin: 0 0 1.15rem; border: 0; padding: 0; }
.field > span, .field legend {
  display: block; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 600; color: var(--olive); margin-bottom: .4rem; padding: 0;
}
.field em { text-transform: none; letter-spacing: 0; font-weight: 400; }
input[type=text], input[type=number], textarea {
  width: 100%;
  font: 400 1.1rem/1.4 var(--serif);
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .75rem .9rem;
  min-height: 48px;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: rgba(79, 85, 48, .5); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.choice { display: grid; gap: .5rem; }
.choice label {
  display: flex; align-items: center; gap: .7rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; min-height: 48px;
  background: var(--cream); font-size: 1.1rem;
  transition: background .2s, border-color .2s;
}
.choice input { accent-color: var(--olive); width: 18px; height: 18px; margin: 0; }
.choice label:has(input:checked) { background: var(--sage-soft); border-color: var(--olive); }
.rsvp.no .if-yes { display: none; }

.form-msg { min-height: 1.4em; margin: .8rem 0 0; text-align: center; color: #9a4a2a; }

.thanks { text-align: center; padding: 1rem; }
.thanks .script { font-size: 4rem; }

/* IBAN */
.iban {
  background: var(--paper); border: 1px solid var(--line); border-radius: 20px;
  padding: 1.6rem 1.2rem; max-width: 520px;
}
.iban-name { font-size: 1.3rem; margin: .2rem 0 1rem; }
.iban-code { font-size: 1.15rem; font-variant-numeric: lining-nums tabular-nums; letter-spacing: .05em; word-break: break-word; margin: .2rem 0 1.2rem; color: var(--olive); font-weight: 600; }

/* FOOTER */
.footer {
  position: relative; text-align: center; padding: 5rem 1rem 9rem; overflow: hidden;
}
.footer .script { position: relative; z-index: 2; }
.footer .caps { position: relative; z-index: 2; margin-top: .6rem; }
.deco-foot-l { bottom: 0; left: 0; width: clamp(90px, 18vw, 200px); }
.deco-foot-r { bottom: 0; right: 0; width: clamp(90px, 18vw, 190px); }

/* animazioni di comparsa (solo con JS attivo; l'hero si anima da solo) */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .9s ease, transform .9s ease; }
.js .reveal.in { opacity: 1; transform: none; }
.js .hero .reveal { opacity: 1; transform: none; transition: none; animation: rise 1s .3s ease both; }
.js .hero .names { animation-delay: .6s; }
.js .hero .caps, .js .hero .divider { animation-delay: .9s; }
.js .hero .date, .js .hero .countdown, .js .hero .cta { animation-delay: 1.1s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal, .js .hero .reveal { opacity: 1; transform: none; transition: none; animation: none; }
  .etna path { animation: none; stroke-dashoffset: 0; }
  .scroll-hint { animation: none; }
}

@media (max-width: 420px) {
  body { font-size: 18px; }
  .hero { padding-top: 8.5rem; }
  .countdown b { font-size: 1.45rem; }
  .countdown span { font-size: .62rem; letter-spacing: .08em; }
  .timeline::before { left: 64px; }
  .timeline li { grid-template-columns: 52px 1fr; gap: 1.9rem; }
  .timeline li::before { left: 59px; }
}
