:root {
  --cream: #FBF6EF;
  --cream-deep: #F3E4C8;
  --pink: #E3A6AE;
  --pink-deep: #C98F97;
  --pink-tint: #F7E7E9;
  --blue: #9FC1DD;
  --blue-deep: #83A7C4;
  --blue-tint: #E7F0F7;
  --ink: #3A342E;
  --ink-soft: #756C61;
  --white: #FFFFFF;
  --shadow: 0 20px 40px -20px rgba(58, 52, 46, 0.25);
  font-size: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

h1 { font-size: clamp(1.8rem, 7vw, 2.6rem); line-height: 1.1; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.3rem, 4.5vw, 1.6rem); line-height: 1.2; margin-bottom: 0.35rem; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  margin: 0 0 0.75rem;
}
.eyebrow.pink { color: var(--pink-deep); }
.eyebrow.blue { color: var(--blue-deep); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 52vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--cream);
  padding: 3.2rem 1.25rem 2.2rem;
}

.hero-photo {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  display: block;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    180deg,
    rgba(30, 32, 40, 0.28) 0%,
    rgba(30, 32, 40, 0.05) 32%,
    rgba(30, 32, 40, 0.05) 68%,
    var(--cream) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.hero h1 {
  color: #fff;
  text-shadow: 0 2px 14px rgba(20, 20, 30, 0.35), 0 1px 3px rgba(20, 20, 30, 0.3);
}

.hero .eyebrow {
  text-shadow: 0 1px 4px rgba(20, 20, 30, 0.35);
}

.hero-sub {
  margin: 0.6rem auto 0;
  max-width: 32ch;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 6px rgba(20, 20, 30, 0.3);
  font-size: 0.95rem;
}

.date-pill {
  display: inline-block;
  margin-top: 0.9rem;
  padding: 0.45rem 1.2rem;
  background: var(--white);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.countdown {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(6px);
  border-radius: 14px;
  padding: 0.45rem 0.6rem;
  min-width: 50px;
}

.countdown-unit .num {
  font-family: 'Fraunces', serif;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1;
}

.countdown-unit .lbl {
  margin-top: 0.15rem;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

/* ---------- Cards ---------- */

main {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 1.1rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: -1.8rem;
  position: relative;
  z-index: 2;
}

.card {
  background: var(--white);
  border-radius: 26px;
  padding: 1.5rem 1.3rem;
  box-shadow: var(--shadow);
}

.card-sub {
  color: var(--ink-soft);
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

/* Di default le card sono visibili: l'animazione è un progressive enhancement
   attivato via JS solo se IntersectionObserver è disponibile (vedi app.js),
   così un guasto/blocco dello script non lascia mai la pagina con sezioni invisibili. */
.reveal.pre-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.pre-reveal.in-view {
  opacity: 1;
  transform: none;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.7rem;
  border-radius: 16px;
  margin-bottom: 0.5rem;
}
.info-row:last-child { margin-bottom: 0; }
.info-row:nth-of-type(1) { background: var(--pink-tint); }
.info-row:nth-of-type(2) { background: var(--blue-tint); }
.info-row:nth-of-type(3) { background: var(--cream-deep); }

.info-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.info-icon svg { width: 19px; height: 19px; }
.info-icon.pink { background: var(--pink); color: var(--white); }
.info-icon.blue { background: var(--blue); color: var(--white); }
.info-icon.gold { background: #DDBE7E; color: var(--white); }

.info-text { display: flex; flex-direction: column; }
.info-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
}
.info-value { font-size: 1.02rem; font-weight: 600; }

/* ---------- Forms ---------- */

form { display: flex; flex-direction: column; gap: 0.75rem; }

.field-row { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.field-row .field { flex: 1 1 140px; }

.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }

input[type="text"], input[type="number"], textarea {
  font-family: inherit;
  font-size: 0.96rem;
  color: var(--ink);
  border: 1.5px solid #E6DFD3;
  border-radius: 13px;
  padding: 0.6rem 0.8rem;
  background: var(--cream);
  font-weight: 400;
  width: 100%;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--pink);
}

textarea { resize: vertical; min-height: 56px; }

fieldset.choice-group {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
fieldset.choice-group legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0;
  margin-bottom: 0.2rem;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.9rem;
  border: 1.5px solid #E6DFD3;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 500;
  color: var(--ink);
}
.choice input { accent-color: var(--pink); width: 18px; height: 18px; }
.choice:has(input:checked) { border-color: var(--pink); background: var(--pink-tint); }

#numero-field { transition: opacity 0.2s ease; }
#numero-field.hidden { display: none; }

.vote-options { display: flex; gap: 0.7rem; }
.vote-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem;
  border-radius: 15px;
  border: 1.5px solid #E6DFD3;
  cursor: pointer;
  font-weight: 600;
}
.vote-option input { accent-color: var(--ink); }
.vote-blue:has(input:checked) { border-color: var(--blue-deep); background: var(--blue-tint); }
.vote-pink:has(input:checked) { border-color: var(--pink-deep); background: var(--pink-tint); }

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.4rem;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--white);
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-pink { background: linear-gradient(135deg, var(--pink), var(--pink-deep)); }
.btn-blue { background: linear-gradient(135deg, var(--blue), var(--blue-deep)); }

.form-msg {
  margin: 0;
  font-size: 0.9rem;
  min-height: 1.2em;
}
.form-msg.success { color: #4C7A5E; font-weight: 600; }
.form-msg.error { color: #B54848; font-weight: 600; }

.btn-stats {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.4rem;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(90deg, var(--blue-deep) 50%, var(--pink-deep) 50%);
  box-shadow: 0 8px 18px -8px rgba(58, 52, 46, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-stats::after {
  content: '';
  position: absolute;
  top: 8%;
  bottom: 8%;
  left: 50%;
  width: 2px;
  background: rgba(255, 255, 255, 0.55);
  transform: translateX(-1px);
}
.btn-stats svg { width: 18px; height: 18px; color: #fff; flex-shrink: 0; position: relative; z-index: 1; }
.btn-stats span { position: relative; z-index: 1; text-shadow: 0 1px 2px rgba(0,0,0,0.15); }
.btn-stats:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -8px rgba(58, 52, 46, 0.45); }
.btn-stats.active { box-shadow: inset 0 1px 4px rgba(0,0,0,0.2); }

.stats-box {
  margin-top: 0.3rem;
  padding-top: 0.8rem;
  border-top: 1px solid #EFE7D9;
}

.stats-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--pink-tint);
}
.stats-bar-fill {
  background: linear-gradient(90deg, var(--blue), var(--blue-deep));
  height: 100%;
  transition: width 0.5s ease;
}

.stats-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 0.7rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.stats-legend b { color: var(--ink); font-weight: 700; }

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 0.4rem;
}
.dot-blue { background: var(--blue-deep); }
.dot-pink { background: var(--pink-deep); }

.stats-total {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
}

.outro {
  text-align: center;
  padding: 0.8rem 0 1.6rem;
  color: var(--ink-soft);
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 1rem;
}

@media (max-width: 420px) {
  .countdown-unit { min-width: 46px; padding: 0.4rem 0.5rem; }
  .card { padding: 1.3rem 1.1rem; }
}
