:root {
  --plum: #1E0B2B;
  --plum-deep: #16071F;
  --ivory: #FFF6E8;
  --ivory-dim: rgba(255, 246, 232, 0.76);
  --ivory-faint: rgba(255, 246, 232, 0.08);
  --rani: #E0197D;
  --saffron: #F6A21E;
  --peacock: #10898B;
  --gold: #E9C46A;
  --gold-soft: #F3D48A;
  --line: rgba(233, 196, 106, 0.32);
  --display: 'Rozha One', 'Iowan Old Style', Georgia, serif;
  --body: 'Mukta', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--plum);
  color: var(--ivory);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.no-webgl {
  background:
    radial-gradient(60% 45% at 50% 45%, rgba(246, 162, 30, 0.28), transparent 70%),
    radial-gradient(80% 60% at 20% 90%, rgba(16, 137, 139, 0.35), transparent 70%),
    radial-gradient(70% 60% at 85% 10%, rgba(224, 25, 125, 0.3), transparent 70%),
    var(--plum);
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Greeting */
.greeting {
  position: fixed;
  top: calc(var(--safe-top) + clamp(1.25rem, 4vh, 2.75rem));
  left: 0;
  right: 0;
  padding: 0 1.25rem;
  text-align: center;
  pointer-events: none;
  z-index: 2;
  text-shadow: 0 2px 18px rgba(20, 4, 28, 0.7);
}

.for {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  font-weight: 500;
  font-style: italic;
  color: var(--ivory-dim);
}

.for {
  margin: 0 0 0.1rem;
}

.invited {
  margin: 0 0 0.4rem;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--gold-soft);
}

.names {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.7rem, 10vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: 0.005em;
  background: linear-gradient(180deg, #FFF8EC 25%, var(--gold-soft) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 3px 16px rgba(20, 4, 28, 0.6));
}

.names {
  transform-origin: center;
  transition: transform 1.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

body.finale .names {
  filter: drop-shadow(0 0 22px rgba(20, 4, 28, 0.9)) drop-shadow(0 0 40px rgba(246, 162, 30, 0.25));
}

.lede {
  max-width: 32ch;
  margin: 0.85rem auto 0;
  color: var(--ivory-dim);
  transition: opacity 0.5s ease, max-height 0.5s ease;
  max-height: 6em;
  overflow: hidden;
}

body.walking .lede {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
}

.progress {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.progress li {
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  border: 1px solid var(--gold);
  opacity: 0.55;
  transition: background-color 0.4s, box-shadow 0.4s, opacity 0.4s;
}

.progress li.done {
  background: var(--saffron);
  border-color: var(--saffron);
  opacity: 1;
  box-shadow: 0 0 10px 2px rgba(246, 162, 30, 0.6);
}

.progress {
  transition: opacity 0.8s ease, visibility 0s linear 2s;
}

body.pheras-done .progress {
  opacity: 0;
  visibility: hidden;
  transition-delay: 1.2s, 2s;
}

.diya-line {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gold-soft);
  min-height: 1.4em;
}

/* Sound toggle */
.sound-btn {
  position: fixed;
  top: calc(var(--safe-top) + 0.75rem);
  right: 0.75rem;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.45rem 0.9rem 0.45rem 0.75rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ivory);
  background: rgba(30, 11, 43, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.sound-btn[hidden] {
  display: none;
}

.sound-btn:hover {
  border-color: var(--gold);
}

.sound-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.sound-btn .cross {
  display: none;
}

.sound-btn[data-muted="true"] .waves {
  display: none;
}

.sound-btn[data-muted="true"] .cross {
  display: inline;
}

@media (max-width: 480px) {
  .sound-btn #soundLabel {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .sound-btn {
    padding: 0.45rem 0.7rem;
  }
}

/* Fire target */
.fire-btn {
  position: fixed;
  left: 50%;
  top: 52%;
  width: 170px;
  height: 200px;
  transform: translate(-50%, -60%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  z-index: 2;
}

.fire-btn:focus-visible {
  outline: 2px dashed var(--gold);
  outline-offset: 6px;
}

.fire-btn {
  --cue: clamp(48px, 14vmin, 64px);
}

.fire-btn::before,
.fire-btn::after {
  content: '';
  position: absolute;
  left: calc(50% - var(--cue) / 2);
  top: calc(60% - var(--cue) / 2);
  width: var(--cue);
  height: var(--cue);
  border: 2px solid rgba(255, 246, 232, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 246, 232, 0.35);
  opacity: 0;
  pointer-events: none;
}

body.can-walk .fire-btn::before {
  animation: fire-cue 2s ease-out infinite;
}

body.can-walk .fire-btn::after {
  animation: fire-cue 2s ease-out 1s infinite;
}

@keyframes fire-cue {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }

  25% {
    opacity: 0.85;
  }

  100% {
    transform: scale(1.25);
    opacity: 0;
  }
}

body.no-webgl .fire-btn {
  background: radial-gradient(circle, rgba(255, 196, 107, 0.85), rgba(246, 162, 30, 0.25) 45%, transparent 65%);
}

.hint {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 1rem);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  text-align: center;
  z-index: 2;
  width: max-content;
  max-width: calc(100% - 2rem);
  text-shadow: 0 2px 12px rgba(20, 4, 28, 0.8);
}

.hint p {
  margin: 0;
  color: var(--ivory);
  font-weight: 500;
}

.hint[hidden] {
  display: none;
}

.text-btn {
  font: inherit;
  font-size: 0.95rem;
  color: var(--ivory-dim);
  background: none;
  border: 0;
  padding: 0.6rem 0.8rem;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
  cursor: pointer;
}

.text-btn:hover {
  color: var(--ivory);
}

.text-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Reveal card */
/* Reveal card */
.card {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 1rem);
  transform: translateX(-50%);
  width: min(34rem, calc(100% - 1.5rem));
  max-height: calc(45vh - var(--safe-bottom));
  max-height: calc(45dvh - var(--safe-bottom));
  display: flex;
  flex-direction: column;
  padding: 1.2rem 1.4rem 1.25rem;
  background: rgba(30, 11, 43, 0.8);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  box-shadow: 0 24px 60px rgba(10, 2, 16, 0.55);
  z-index: 3;
}

.card-step,
.card-title,
.card-actions {
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .card {
    padding: 1.05rem 1.15rem 1.1rem;
  }

  .card-title {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
  }

  .card-body {
    font-size: 0.98rem;
  }

  .card-actions {
    margin-top: 0.75rem;
  }
}

.card[hidden] {
  display: none;
}

.card.enter {
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate(-50%, 16px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.card-step {
  margin: 0;
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 500;
}

.card-step[hidden] {
  display: none;
}

.card-title {
  margin: 0.1rem 0 0.45rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.65rem, 5.5vw, 2.15rem);
  line-height: 1.1;
}

.card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--ivory-dim);
}

.card-body p {
  margin: 0 0 0.5rem;
  max-width: 60ch;
}

.card-body a {
  color: var(--gold-soft);
}

.mini-list {
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0;
}

.mini-list li {
  padding: 0.4rem 0;
  border-top: 1px solid var(--ivory-faint);
}

.mini-list li:first-child {
  border-top: 0;
}

.mini-list strong {
  color: var(--ivory);
  font-weight: 600;
  display: block;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.65rem 1.3rem;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.btn.primary {
  background: var(--gold);
  color: var(--plum);
}

.btn.primary:hover {
  background: var(--gold-soft);
}

.btn.ghost {
  background: transparent;
  color: var(--ivory);
  border-color: var(--line);
}

.btn.ghost:hover {
  border-color: var(--gold);
}

.btn:focus-visible {
  outline: 2px solid var(--ivory);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* Details overlay */
.details {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow-y: auto;
  background: rgba(22, 7, 31, 0.93);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: calc(var(--safe-top) + 1rem) 1.25rem calc(var(--safe-bottom) + 3rem);
}

.details[hidden] {
  display: none;
}

.details-inner {
  max-width: 40rem;
  margin: 0 auto;
}

.details .close {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-left: -0.8rem;
  background: rgba(22, 7, 31, 0.92);
  border-radius: 999px;
}

.details header {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

.details header .families {
  color: var(--ivory-dim);
  max-width: 36ch;
  margin: 0 auto 0.5rem;
}

.details header h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  line-height: 1;
  color: var(--gold-soft);
}

.details header .dates {
  margin: 0.6rem 0 0;
  font-weight: 500;
}

.details section {
  padding: 1.75rem 0;
  border-top: 1px solid var(--line);
}

.details h3 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.7rem;
  line-height: 1.15;
}

.details p {
  margin: 0 0 0.6rem;
  color: var(--ivory-dim);
}

.details a:not(.btn) {
  color: var(--gold-soft);
}

.events {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.events li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--ivory-faint);
}

.events li:first-child {
  border-top: 0;
  padding-top: 0;
}

.events .when {
  font-weight: 600;
  color: var(--gold);
  line-height: 1.35;
}

.events .when span {
  display: block;
  font-weight: 400;
  color: var(--ivory-dim);
}

.events h4 {
  margin: 0 0 0.15rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ivory);
}

.events p {
  margin: 0 0 0.2rem;
}

.events .dress {
  color: var(--ivory);
}

/* RSVP form */
form {
  display: grid;
  gap: 1.25rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field>span,
legend {
  font-weight: 600;
  color: var(--ivory);
}

.field small,
legend small {
  font-weight: 400;
  color: var(--ivory-dim);
}

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  font: inherit;
  color: var(--ivory);
  background: var(--ivory-faint);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.7rem 0.85rem;
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 246, 232, 0.45);
}

input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  border-color: var(--gold);
}

textarea {
  resize: vertical;
  min-height: 5.5rem;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

fieldset[hidden] {
  display: none;
}

legend {
  padding: 0;
  margin-bottom: 0.5rem;
}

.choice {
  grid-template-columns: 1fr 1fr;
}

.choice label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  cursor: pointer;
}

.choice label:has(input:checked) {
  border-color: var(--saffron);
  background: rgba(246, 162, 30, 0.12);
}

.choice input {
  accent-color: var(--saffron);
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
}

.help {
  margin: -0.3rem 0 0.2rem;
  font-size: 0.95rem;
}

.count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
}

.count-row small {
  display: block;
  color: var(--ivory-dim);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.stepper button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ivory);
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.stepper button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.stepper input {
  width: 3.2rem;
  text-align: center;
  padding: 0.55rem 0.2rem;
  -moz-appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form-error {
  margin: 0;
  color: #FFB3C9;
  font-weight: 500;
  min-height: 1.5em;
}

.fatal {
  position: fixed;
  inset: auto 1rem calc(var(--safe-bottom) + 1.5rem);
  max-width: 34rem;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(30, 11, 43, 0.9);
  z-index: 4;
}

.fatal code {
  color: var(--gold-soft);
}

@media (max-height: 640px) {
  .names {
    font-size: clamp(2.2rem, 8vw, 3.6rem);
  }

  .lede {
    display: none;
  }

  .progress {
    margin-top: 0.6rem;
  }

  .invited {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card.enter {
    animation: none;
  }

  .lede,
  .progress li {
    transition: none;
  }

  .names {
    transition: none;
  }

  body.can-walk .fire-btn::before {
    animation: none;
    opacity: 0.6;
    transform: none;
  }

  body.can-walk .fire-btn::after {
    animation: none;
  }

  .progress {
    transition: none;
  }
}

/* ---------- Countdown ---------- */
.countdown {
  --cd-gold: #F3D48A;
  --cd-cream: #FFF1D6;
  margin: 0.9rem auto 0;
  text-align: center;
  color: var(--cd-cream);
}

/* hidden until the first tap, then fades in */
.countdown {
  transition: opacity 0.9s ease, transform 0.9s ease, visibility 0s;
}

.countdown.is-waiting {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: none;
}

/* label with gold rules on both sides */
.countdown-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin: 0 0 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cd-gold);
}

.countdown-label::before,
.countdown-label::after {
  content: '';
  width: 2.4rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cd-gold));
}

.countdown-label::after {
  transform: scaleX(-1);
}

.countdown-units {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

/* jharokha tiles: arched top, gold edge, jewel glass */
.countdown .unit {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 3.6rem;
  padding: 0.65rem 0.5rem 0.45rem;
  border-radius: 1.8rem 1.8rem 0.6rem 0.6rem;
  border: 1px solid transparent;
  background:
    linear-gradient(165deg, rgba(78, 16, 52, 0.75), rgba(30, 6, 28, 0.75)) padding-box,
    linear-gradient(160deg, #FFE7A8, #C98A2E 40%, #FFE7A8 65%, #9E6A1E) border-box;
  box-shadow:
    0 8px 20px rgba(20, 0, 15, 0.35),
    inset 0 1px 0 rgba(255, 231, 168, 0.3),
    inset 0 -12px 20px rgba(224, 25, 125, 0.14);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* zari shimmer that sweeps across the tiles, one after another */
.countdown .unit::after {
  content: '';
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 236, 190, 0.38), transparent);
  transform: skewX(-18deg);
  animation: cd-shimmer 7s ease-in-out infinite;
}

.countdown .unit:nth-of-type(2)::after {
  animation-delay: 0.12s;
}

.countdown .unit:nth-of-type(3)::after {
  animation-delay: 0.24s;
}

.countdown .unit:nth-of-type(4)::after {
  animation-delay: 0.36s;
}

/* gold serif numbers */
.countdown .unit b {
  display: block;
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
  background: linear-gradient(180deg, #FFF6DE 10%, #F3D48A 50%, #D9A441 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 6px rgba(246, 162, 30, 0.35));
}

.countdown .unit b.tick {
  animation: cd-tick 0.45s ease-out;
}

.countdown .unit small {
  margin-top: 0.3rem;
  font-size: 0.56rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 241, 214, 0.72);
}

/* small gold diamonds between the tiles */
.countdown .sep {
  width: 5px;
  height: 5px;
  flex: none;
  background: var(--cd-gold);
  transform: rotate(45deg);
  opacity: 0.75;
  box-shadow: 0 0 6px rgba(243, 212, 138, 0.8);
}

/* "Haldi is happening now": a pulsing dot replaces the rules */
.countdown.is-live .countdown-label {
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  color: var(--cd-cream);
}

.countdown.is-live .countdown-label::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FF5FA2;
  animation: cd-live 1.6s ease-out infinite;
}

.countdown.is-live .countdown-label::after {
  display: none;
}

/* per-event pill on the details page */
.event-countdown {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.2rem 0 0.4rem;
  padding: 0.18rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #F3D48A;
  background: rgba(243, 212, 138, 0.1);
  border: 1px solid rgba(243, 212, 138, 0.4);
}

.event-countdown::before {
  content: '';
  width: 5px;
  height: 5px;
  background: currentColor;
  transform: rotate(45deg);
}

.countdown[hidden],
.countdown-units[hidden],
.event-countdown[hidden] {
  display: none;
}

@keyframes cd-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes cd-shimmer {

  0%,
  72% {
    left: -60%;
  }

  100% {
    left: 130%;
  }
}

@keyframes cd-tick {
  0% {
    opacity: 0;
    transform: translateY(-35%);
  }

  60% {
    opacity: 1;
  }

  100% {
    transform: none;
  }
}

@keyframes cd-live {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 95, 162, 0.6);
  }

  100% {
    box-shadow: 0 0 0 10px rgba(255, 95, 162, 0);
  }
}

@media (max-width: 480px) {
  .countdown-units {
    gap: 0.3rem;
  }

  .countdown .unit {
    min-width: 2.9rem;
    padding: 0.55rem 0.35rem 0.4rem;
  }

  .countdown .unit b {
    font-size: 1.35rem;
  }

  .countdown .sep {
    width: 4px;
    height: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {

  .countdown,
  .countdown .unit::after,
  .countdown .unit b.tick,
  .countdown.is-live .countdown-label::before {
    animation: none;
  }
}

/* pin the countdown to the top of the screen */
.countdown {
  position: fixed;
  z-index: 5;
  top: calc(env(safe-area-inset-top, 0px) + 0.75rem);
  left: 0;
  right: 0;
  margin: 0 auto;
  width: fit-content;
  max-width: calc(100vw - 1.5rem);
  pointer-events: none;
  /* never blocks taps on the fire */
}

/* push the greeting down to make room for it */
.greeting {
  margin-top: var(--cd-space, 0px);
}

/* hide it while the details page is open (it keeps its space, so nothing jumps) */
body:has(#details:not([hidden])) .countdown {
  visibility: hidden;
}

/* names: stacked in the mandala on phones */
#names.stacked {
  text-align: center;
  line-height: 1.05;
}

#names.stacked .name,
#names.stacked .amp {
  display: block;
}

#names .amp {
  /* its own solid gold, so it never inherits a transparent gradient-text colour */
  color: #F3D48A;
  -webkit-text-fill-color: #F3D48A;
  background: none;
}

#names.stacked .amp {
  font-size: 0.55em;
  margin: 0.12em 0;
}

body.finale #names:not(.stacked) {
  white-space: nowrap;
}

/* all seven pheras are walked, so the dots can bow out and free that space */
#progress {
  transition: opacity 0.8s ease;
}

body.finale #progress {
  opacity: 0;
}

.details .close {
  position: static;
  background: none;
}

.details header .keepsake-btn {
  margin-top: 1.1rem;
}

.details header .invites {
  margin: 0.5rem 0 0;
  color: var(--ivory-dim);
  font-style: italic;
}

.keepsake-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.75em 1.25em 0.75em 1.05em;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #E07B14, #C2185B);
  box-shadow: 0 6px 18px rgba(194, 24, 91, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.keepsake-btn svg {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

.keepsake-btn small {
  font-size: 0.7em;
  letter-spacing: 0.08em;
  padding: 0.2em 0.55em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.keepsake-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 24px rgba(194, 24, 91, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.keepsake-btn:active {
  transform: translateY(0);
}

.keepsake-btn:focus-visible {
  outline: 2px solid #F3D48A;
  outline-offset: 3px;
}

.keepsake-btn:disabled {
  opacity: 0.8;
  cursor: progress;
}

/* a soft shine sweeps across twice when the page opens, so people notice it */
.keepsake-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: keepsake-shine 1.6s ease 0.6s 2;
  pointer-events: none;
}

@keyframes keepsake-shine {
  to {
    transform: translateX(120%);
  }
}

/* while the PDF is being made, the arrow bobs */
.keepsake-btn.is-busy svg {
  animation: keepsake-bob 0.9s ease-in-out infinite;
}

@keyframes keepsake-bob {
  50% {
    transform: translateY(2px);
  }
}

@media (max-width: 480px) {
  .keepsake-btn {
    flex: 1 1 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {

  .keepsake-btn,
  .keepsake-btn::after,
  .keepsake-btn.is-busy svg {
    animation: none;
    transition: none;
  }
}

.details-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  margin: 0 0 0.5rem;
  padding: max(0.75rem, var(--safe-top)) 0 1rem;
  background: linear-gradient(to bottom, var(--plum-deep) 55%, rgba(22, 7, 31, 0));
  pointer-events: none;
}

/* The button itself: a frosted pill with a chevron */
.details-top .text-btn.close {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.5rem 1.1rem 0.5rem 0.8rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ivory);
  text-decoration: none;
  background: var(--ivory-faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.details-top .text-btn.close svg {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  color: var(--gold);
  transition: transform 0.2s;
}

.details-top .text-btn.close:hover {
  background: rgba(233, 196, 106, 0.16);
  border-color: rgba(233, 196, 106, 0.6);
}

.details-top .text-btn.close:hover svg {
  transform: translateX(-3px);
  /* the chevron nudges back */
}

.details-top .text-btn.close:active {
  transform: scale(0.97);
}

.details-top .text-btn.close:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {

  .details-top .text-btn.close,
  .details-top .text-btn.close svg {
    transition: none;
  }
}