:root {
  --night: #140c1b;
  --night-2: #211530;
  --plum: #3a2548;
  --pumpkin: #e8741c;
  --ink: #25140a;
  --bone: #f1e2c0;
  --bone-dim: #cdbb97;
  --candle: #f4c05a;
  --ember: #de5a22;
  --display: 'Grenze Gotisch', Georgia, serif;
  --body: 'IM Fell English', Georgia, 'Times New Roman', serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse 80% 45% at 50% 0%, rgba(244, 192, 90, .16), transparent 70%),
    var(--night);
  color: var(--bone);
  font-family: var(--body);
  font-size: 1.2rem;
  line-height: 1.65;
  overflow-x: hidden;
}

a { color: var(--candle); text-underline-offset: .18em; }
a:hover { color: #ffd98a; }

:focus-visible { outline: 3px solid var(--candle); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- hero: the porch ---------- */
.hero { padding: clamp(1rem, 4vw, 2.5rem) 16px 0; }

.scene-wrap {
  max-width: 1100px;
  margin: 0 auto;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .55), 0 0 80px rgba(255, 179, 71, .08);
}
.scene { display: block; width: 100%; height: auto; }

#door {
  transform-box: fill-box;
  transform-origin: left center;
  transition: transform 2.2s cubic-bezier(.5, 0, .2, 1);
}
#spill { opacity: 0; transition: opacity 1.8s ease .5s; }
.scene.open #door { transform: scaleX(.12) skewY(-6deg); }
.scene.open #spill { opacity: 1; }

.pumpkins .face, .lamp-glow { animation: flicker 4s infinite; }
.pumpkins use:nth-child(2) .face { animation-delay: -1.1s; }
.lamp-glow { animation-duration: 6s; animation-delay: -2s; }

.masthead { text-align: center; padding: clamp(1.75rem, 5vw, 2.75rem) 0 0; }
.masthead h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 9vw, 5.5rem);
  line-height: 1;
  margin: 0;
  color: var(--bone);
  text-shadow: 0 0 30px rgba(232, 116, 28, .35);
}
.masthead .when { margin: .6rem 0 0; font-style: italic; font-size: 1.3rem; color: var(--bone-dim); }

/* ---------- countdown ---------- */
.countdown { text-align: center; padding: clamp(1.5rem, 5vw, 2.5rem) 0 1rem; }
.countdown-lead {
  margin: 0 0 .75rem;
  font-style: italic;
  font-size: 1.35rem;
  color: var(--bone-dim);
}
.clock {
  display: flex;
  justify-content: center;
  gap: clamp(.9rem, 4vw, 3rem);
}
.clock div { display: flex; flex-direction: column; align-items: center; min-width: 3.2ch; }
.clock span {
  font-family: var(--display);
  font-size: clamp(2.6rem, 11vw, 6rem);
  line-height: 1;
  color: var(--candle);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(244, 192, 90, .45), 0 0 2px rgba(244, 192, 90, .9);
  animation: flicker 5s infinite;
}
.clock small { font-size: 1rem; color: var(--bone-dim); margin-top: .35rem; }
.clock div:nth-child(2) span { animation-delay: -1.3s; }
.clock div:nth-child(3) span { animation-delay: -2.9s; }
.clock div:nth-child(4) span { animation-delay: -4.1s; }

@keyframes flicker {
  0%, 100% { opacity: 1; }
  41% { opacity: 1; }
  42% { opacity: .78; }
  43% { opacity: .96; }
  71% { opacity: .9; }
  72% { opacity: 1; }
}

.countdown.arrived .clock { display: none; }
.countdown.arrived .countdown-lead {
  font-family: var(--display);
  font-style: normal;
  font-size: clamp(1.8rem, 7vw, 3rem);
  color: var(--candle);
  line-height: 1.2;
}

/* ---------- content ---------- */
main { max-width: 44rem; margin: 0 auto; padding: 1rem 16px 2rem; }

h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.7rem, 5.5vw, 2.3rem);
  line-height: 1.15;
  color: var(--bone);
  margin: 0 0 .75rem;
}
h3 { font-family: var(--display); font-weight: 400; font-size: 1.2rem; margin: 0 0 .5rem; color: var(--candle); }
p { margin: 0 0 1rem; }

.details { margin: 1.5rem 0 3.5rem; }
.details dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--plum);
  border-bottom: 1px solid var(--plum);
}
.details dt { font-family: var(--display); color: var(--candle); font-size: 1.1rem; }
.details dd { margin: .2rem 0 0; font-size: 1.1rem; line-height: 1.45; }

.notice { margin: 0 0 3.5rem; }
.notice p { max-width: 38rem; }

.ledger {
  margin-top: 1.25rem;
  padding: 1.1rem 1.25rem;
  background: var(--night-2);
  border-left: 3px solid var(--pumpkin);
}
.ledger-list { margin: 0; padding: 0; list-style: none; }
.ledger-list li { padding: .3rem 0; border-bottom: 1px dotted var(--plum); }
.ledger-list li:last-child { border-bottom: 0; }
.ledger-list .who { color: var(--bone-dim); font-style: italic; }
.ledger-list .empty { color: var(--bone-dim); font-style: italic; }

.playlist { counter-reset: track; margin-top: 1rem; }
.playlist li:not(.empty) { counter-increment: track; display: flex; gap: .75rem; }
.playlist li:not(.empty)::before {
  content: counter(track);
  font-family: var(--display);
  color: var(--candle);
  min-width: 1.6rem;
}

/* ---------- RSVP ---------- */
.rsvp {
  background: var(--bone);
  color: var(--ink);
  border-radius: 28px;
  padding: clamp(1.5rem, 5vw, 2.75rem);
  box-shadow: 0 0 0 6px var(--night), 0 0 0 8px var(--pumpkin), 0 30px 60px rgba(0, 0, 0, .5);
}
.rsvp h2 { color: var(--ink); text-align: center; }
.rsvp a { color: #8a2a06; }
.headcount { text-align: center; font-style: italic; margin-top: -.25rem; }

.yesno {
  display: flex;
  justify-content: center;
  gap: 1rem;
  border: 0;
  padding: 0;
  margin: 1rem 0 1.75rem;
}
.answer { cursor: pointer; }
.answer input { position: absolute; opacity: 0; pointer-events: none; }
.answer span {
  display: inline-block;
  font-family: var(--display);
  font-size: 1.9rem;
  padding: .35rem 1.6rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  transition: background .2s, color .2s;
}
.answer input:checked + span { background: var(--ink); color: var(--candle); }
.answer input:focus-visible + span { outline: 3px solid var(--ember); outline-offset: 3px; }

.field { margin: 0 0 1.1rem; }
.field label { display: block; font-size: 1.1rem; margin-bottom: .25rem; }
.opt { color: #6b5540; font-style: italic; font-size: .95rem; }
.field input, .field textarea {
  width: 100%;
  font: inherit;
  font-size: 1.1rem;
  color: var(--ink);
  background: #fbf3de;
  border: 2px solid #8a6a45;
  border-radius: 8px;
  padding: .6rem .75rem;
}
.field input::placeholder { color: #9c8468; font-style: italic; }
.field input:focus, .field textarea:focus { border-color: var(--ink); outline: 3px solid var(--candle); outline-offset: 0; }
.field.small input { max-width: 7rem; }

.rsvp.declining .going { display: none; }

.form-error { color: #9b1c0a; font-weight: bold; }

button[type="submit"] {
  display: block;
  width: 100%;
  font-family: var(--display);
  font-size: 1.5rem;
  padding: .75rem 1rem;
  margin-top: .5rem;
  color: var(--bone);
  background: var(--ink);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s;
}
button[type="submit"]:hover { background: #4a2912; }
button[type="submit"]:disabled { opacity: .6; cursor: wait; }

.thanks { text-align: center; padding: 1rem 0; }
.thanks h3 { color: var(--ink); font-size: 1.6rem; line-height: 1.25; }
.linkish {
  font: inherit; background: none; border: 0; padding: 0;
  color: #8a2a06; text-decoration: underline; cursor: pointer;
}

/* ---------- footer ---------- */
footer { text-align: center; padding: 2rem 16px 4rem; color: var(--bone-dim); }
.goodbye {
  font-family: var(--display);
  font-size: clamp(1.9rem, 7vw, 3.2rem);
  color: var(--pumpkin);
  margin: 0;
  line-height: 1.1;
}

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  body { font-size: 1.1rem; }
  .details dl { grid-template-columns: 1fr; gap: 1rem; }
  .answer span { font-size: 1.6rem; padding: .3rem 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .clock span { animation: none; }
  .pumpkins .face, .lamp-glow { animation: none; }
  #door, #spill { transition: none; }
}
