/* ============================================================
   Base styles + default purple palette.
   Theme variables live in themes.css (Task 4). Until that
   exists these :root defaults keep the page styled.
   ============================================================ */

:root {
  --bg: #241436;
  --bg-2: #3a2158;
  --ink: #f6efff;
  --cream: #e6d3ff;
  --gold: #d4af6a;
  --accent: #9b6bde;

  --font-serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-caps: "Cinzel", Georgia, serif;
  --font-script: "Great Vibes", "Cormorant Garamond", cursive;
  --font-sans: "Manrope", system-ui, -apple-system, sans-serif;
  --font-pa: "Mukta Mahee", "Cormorant Garamond", serif;

  --measure: 34rem;
}

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

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

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, h2, h3, p {
  margin: 0;
}

a {
  color: var(--gold);
  text-decoration: none;
}

/* Reveal candidates: motion is applied in Task 7.
   The class alone must NOT hide content. */
.reveal { /* intentionally empty */ }

/* The vignette sprite is a hidden <svg> holding <defs>/<symbol> only. It is
   display:inline by default, so even at width/height 0 it sits in a line box
   and pushed the hero down by ~9px, exposing a strip of page background above
   the artwork. Take it out of flow entirely. */
.vig-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------- Full-page woven texture film ----------
   A barely-there crosshatch weave, tinted with --gold and masked so it
   reads as fabric grain over the whole page (above section colour, below
   the interactive controls). ~4-6% opacity per theme. */
.page-texture {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: var(--texture-opacity, 0.05);
  background-color: var(--gold);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cg stroke='%23fff' stroke-width='0.8' fill='none'%3E%3Cpath d='M0 16 L16 0'/%3E%3Cpath d='M-4 4 L4 -4'/%3E%3Cpath d='M12 20 L20 12'/%3E%3Cpath d='M0 0 L16 16'/%3E%3Cpath d='M-4 12 L4 20'/%3E%3Cpath d='M12 -4 L20 4'/%3E%3C/g%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cg stroke='%23fff' stroke-width='0.8' fill='none'%3E%3Cpath d='M0 16 L16 0'/%3E%3Cpath d='M-4 4 L4 -4'/%3E%3Cpath d='M12 20 L20 12'/%3E%3Cpath d='M0 0 L16 16'/%3E%3Cpath d='M-4 12 L4 20'/%3E%3Cpath d='M12 -4 L20 4'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-size: 16px 16px;
  mask-size: 16px 16px;
}

/* ---------- Layout: sections ---------- */
.section {
  position: relative;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(4rem, 12vh, 8rem) 1.5rem;
}

/* ---------- Section colour rhythm ---------- */
.invite { background: var(--bg-2); }
.rsvp { background: var(--rsvp-bg); color: var(--rsvp-ink); }
.countdown { background: var(--night); }

/* Radial centre glow for the invite moment. */
.invite::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 55% at 50% 46%,
    color-mix(in srgb, var(--gold) 12%, transparent) 0%, transparent 70%);
}

/* ---------- Shape-cut dividers ---------- */
/* `.section >` raises specificity above `.section > *` (the measure cap),
   which is declared later in this file — dividers must stay full-bleed. */
.section > .divider {
  position: absolute;
  left: 0;
  width: 100%;
  max-width: none;
  height: clamp(34px, 5vw, 60px);
  display: block;
  z-index: 1;
  pointer-events: none;
}
/* Sunburst is the signature cut — a touch taller so the interlocking teeth
   read as crafted paper edges rather than a thin border. */
.divider-sunburst { top: -1px; transform: translateY(-99%); height: clamp(46px, 6vw, 74px); }
.divider-spikes { bottom: -1px; transform: translateY(99%); }
.divider-wave { bottom: -1px; transform: translateY(99%); }

.section > * {
  width: 100%;
  max-width: var(--measure);
}

/* ---------- Two-level title lockups ---------- */
.title-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2.25rem;
}

.kicker {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
  padding-left: 0.34em; /* optical: balance the trailing tracking */
}

.section-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  color: var(--cream);
  letter-spacing: 0.01em;
  line-height: 1.1;
}

/* Cormorant italic editorial title (default variant). */
.section-title--italic {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
}

/* Great Vibes script title — larger, gold, relaxed. */
.section-title--script {
  font-family: var(--font-script);
  font-style: normal;
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--gold);
}

/* Ornamental rule: line — diamond — line, reused under titles. */
.title-rule {
  display: block;
  position: relative;
  width: clamp(6rem, 30vw, 9rem);
  height: 10px;
  margin-top: 0.35rem;
}
.title-rule::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, var(--gold) 22%,
    var(--gold) 42%, transparent 46%, transparent 54%, var(--gold) 58%,
    var(--gold) 78%, transparent);
  opacity: 0.65;
}
.title-rule::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 1px solid var(--gold);
  background: color-mix(in srgb, var(--gold) 22%, transparent);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  justify-content: center;
  gap: 0;
  overflow: hidden;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
}

.hero-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  max-width: none; /* override .section > * measure cap — scene is full-bleed */
  pointer-events: none;
}

/* Painted hero: full-bleed <picture>. object-position keeps the couple + domes
   in frame — center-bottom on the portrait mobile crop, right-bottom on the
   wide desktop crop where the couple sits at the right edge. */
.hero-art picture,
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-img {
  object-fit: cover;
  object-position: center bottom;
}
@media (min-aspect-ratio: 1/1) {
  .hero-img { object-position: right bottom; }
}

/* Melt scrim: the painted sky's deep-purple top band already matches the page;
   this gradient dissolves the scene's bottom edge into --bg so the cut into the
   royal-purple world below is invisible — the scene becomes the page. */
.hero-melt-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to bottom,
    transparent 0%,
    transparent 52%,
    color-mix(in srgb, var(--bg) 45%, transparent) 78%,
    color-mix(in srgb, var(--bg) 88%, transparent) 92%,
    var(--bg) 100%);
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: none; /* names run wider than the body measure */
  padding: 0 1.5rem;
}

/* Subtle radial scrim keeps the names legible over busy art. */
.hero-copy::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 130%;
  height: 150%;
  z-index: -1;
  background: radial-gradient(
    ellipse at center,
    color-mix(in srgb, var(--bg) 62%, transparent) 0%,
    color-mix(in srgb, var(--bg) 34%, transparent) 42%,
    transparent 72%
  );
  pointer-events: none;
}

/* ---------- Ambient drifting motif layer (Task 7 animates .motif) ---------- */
#motif-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

#motif-layer .motif {
  position: absolute;
  display: none;
  opacity: 0.42;
  will-change: transform;
}

/* Warm scrim so cream text pops over the painted lavender sky bands. */
.hero-kicker,
.hero-names,
.hero-name,
.hero-weds,
.hero-date {
  text-shadow:
    0 1px 2px color-mix(in srgb, var(--bg) 62%, transparent),
    0 3px 16px color-mix(in srgb, var(--bg) 48%, transparent);
}

.hero-kicker {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.82rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 2rem;
}

.hero-names {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  font-weight: 400;
  margin: 0;
}

.hero-name {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: clamp(2.9rem, 12.5vw, 5.6rem);
  line-height: 1.02;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-transform: uppercase;
  white-space: nowrap;
}

.hero-name .ch {
  display: inline-block;
}

.hero-weds {
  font-family: var(--font-script);
  font-style: normal;
  font-weight: 400;
  font-size: clamp(2.4rem, 8vw, 4rem);
  line-height: 0.9;
  letter-spacing: 0.01em;
  color: var(--gold);
  text-transform: lowercase;
  margin: 0.1rem 0;
}

.hero-date {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  letter-spacing: 0.14em;
  color: var(--cream);
  margin-top: 2.25rem;
}

/* `.section > *` forces width:100% on direct children, which stretched this
   box the full width of the hero; the block-level chevron then sat at the
   box's left edge instead of the centre. Higher specificity than that rule,
   so the box shrink-wraps the chevron and left:50% centres it for real. */
.section > .scroll-hint {
  position: absolute;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  width: auto;
  max-width: none;
  line-height: 0;
  color: var(--gold);
  opacity: 0.72;
}

.scroll-chevron {
  display: block;
  animation: chevron-bob 2.4s ease-in-out infinite;
}

@keyframes chevron-bob {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50% { transform: translateY(6px); opacity: 1; }
}

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

/* ---------- Invocation ---------- */
.invocation {
  background: var(--bg-2);
}

.ik-onkar-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 3vw, 1.75rem);
  margin-bottom: 1.75rem;
}

.ik-flourish {
  flex: 0 0 auto;
  width: clamp(48px, 15vw, 84px);
  height: auto;
  opacity: 0.85;
}

.ik-onkar {
  font-family: var(--font-pa);
  font-size: clamp(3.5rem, 14vw, 6rem);
  line-height: 1;
  color: var(--gold);
  margin: 0;
}

.mool-mantar {
  font-family: var(--font-pa);
  font-size: clamp(1.15rem, 4vw, 1.5rem);
  line-height: 1.9;
  color: var(--cream);
}

/* ---------- Blessings ---------- */
/* Filigree khanda crest above the blessing. Linework crest, not a solid
   glyph — reads as a khanda at a glance and as lace up close. Decorative. */
.khanda-crest {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.15rem, 2vw, 1rem);
  margin-bottom: 1.75rem;
}

.khanda-svg {
  flex: 0 0 auto;
  width: auto;
  height: clamp(90px, 24vw, 110px);
}

.khanda-sprig {
  flex: 0 0 auto;
  width: clamp(38px, 12vw, 60px);
  height: auto;
  opacity: 0.7;
}

#blessings-slots {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

.blessing-slot {
  font-size: 1.2rem;
  color: var(--ink);
  max-width: 34ch;
  margin-inline: auto;
}

/* One person per line, joined by a small centred ampersand. Names never
   wrap mid-way; the two lines just stack. */
.blessing-name {
  display: block;
  white-space: nowrap;
}
.blessing-amp {
  display: block;
  font-family: var(--font-script);
  font-size: 1.25em;
  line-height: 1;
  color: var(--gold);
  margin: 0.1em 0;
}

/* A delicate gold rule separates each family line. */
.blessing-slot:not(.placeholder):not(:first-child)::before {
  content: "";
  display: block;
  width: clamp(1.75rem, 9vw, 2.75rem);
  height: 1px;
  margin: 0 auto 1.15rem;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--gold) 75%, transparent), transparent);
}

.blessing-slot.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-style: italic;
  color: var(--cream);
  opacity: 0.55;
  letter-spacing: 0.03em;
}

.blessing-slot.placeholder::before,
.blessing-slot.placeholder::after {
  content: "";
  display: block;
  width: clamp(1.5rem, 8vw, 3rem);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ---------- Invite ---------- */
.invite { overflow: hidden; }

/* Grammatical-display invite: small caps line → giant word → lede → names. */
.invite-pre {
  position: relative;
  z-index: 1;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
  padding-left: 0.34em;
  margin-bottom: 0.6rem;
}

.invite-giant {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.6rem, 3vw, 1.4rem);
  max-width: none;
  width: 100%;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(4.5rem, 20vw, 7rem);
  line-height: 0.92;
  letter-spacing: 0.02em;
  color: var(--cream);
  text-transform: uppercase;
  margin: 0 0 0.4rem;
}

/* Gold flourish rules flanking the giant word — line + diamond. */
.invite-giant-flourish {
  flex: 1 1 auto;
  max-width: clamp(1.5rem, 10vw, 5rem);
  height: 1px;
  position: relative;
  background: linear-gradient(90deg, transparent, var(--gold) 70%);
  opacity: 0.7;
}
.invite-giant-flourish:last-child {
  background: linear-gradient(90deg, var(--gold) 30%, transparent);
}
.invite-giant-flourish::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -1px;
  width: 6px;
  height: 6px;
  transform: translate(50%, -50%) rotate(45deg);
  background: color-mix(in srgb, var(--gold) 55%, transparent);
  border: 1px solid var(--gold);
}
.invite-giant-flourish:first-child::after { right: auto; left: -1px; transform: translate(-50%, -50%) rotate(45deg); }

.invite-lede {
  position: relative;
  z-index: 1;
  font-style: italic;
  font-size: clamp(1.25rem, 4vw, 1.6rem);
  line-height: 1.7;
  color: var(--cream);
  margin-bottom: 1.5rem;
}

/* Multicolour lockup: names in Cinzel cream, script ampersand in gold. */
.invite-names {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  font-family: var(--font-caps);
  font-weight: 500;
  font-size: clamp(1.7rem, 7vw, 2.8rem);
  letter-spacing: 0.08em;
  line-height: 1.05;
  color: var(--cream);
}

.invite-names .amp {
  font-family: var(--font-script);
  font-style: normal;
  font-weight: 400;
  /* Great Vibes' ampersand is a tall, looping glyph whose ink runs well past
     its line box. A crushed line-height (or negative margin) made it collide
     with the name above and below, so give it a full line box and a little
     air for the flourish that hangs below the baseline. */
  font-size: clamp(2.7rem, 10.5vw, 4.4rem);
  line-height: 1;
  color: var(--gold);
  letter-spacing: 0;
  margin: 0.17em 0 0.01em;
}

/* ---------- Events ---------- */
.events > * {
  max-width: 56rem;
}

#event-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 6vw, 3.5rem);
  width: 100%;
}

/* Borderless module (Laavan pattern): frame + text float on the section
   ground — no card box, no border. The illustrated vignette carries the frame. */
.event-card {
  position: relative;
  background: none;
  border: 0;
  padding: 0.5rem 1rem 2rem;
  text-align: center;
}

/* Mixed-media vignette: painted webp masked to an oval, wrapped by the woven
   gold ring + tucked fronds (SVG overlay). The ring hides the mask's crop seam. */
.event-vignette {
  position: relative;
  width: min(78vw, 20rem);
  aspect-ratio: 300 / 372;
  margin: 0 auto 0.4rem;
  filter: drop-shadow(0 10px 20px color-mix(in srgb, #000 40%, transparent));
}
.vignette-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  /* Frame inner opening is rx99/ry128 in the 300×372 frame; we clip a touch
     wider so the painting fills to just under the gold band, which then covers
     the hard clip edge. Focal content is centred and stays clear of the mask. */
  clip-path: ellipse(38.7% 38.7% at 50% 48.9%);
}
.vignette-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.event-ornament {
  width: 2.5rem;
  height: 1px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.event-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-style: normal;
  font-size: clamp(2rem, 8vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: 0.005em;
  color: var(--cream);
  margin-bottom: 0.5rem;
}

.event-date {
  font-family: var(--font-sans);
  font-size: 1.12rem;
  letter-spacing: 0.05em;
  color: var(--gold);
  margin-bottom: 0.35rem;
}

.event-time {
  font-style: italic;
  font-size: 1.22rem;
  color: var(--cream);
  margin-bottom: 0.35rem;
}

.event-city {
  font-family: var(--font-sans);
  font-size: 0.94rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

/* The venue is the actionable line, so it sits above the city and reads
   louder; the city then becomes quiet context beneath it. */
.event-venue {
  font-style: italic;
  font-size: 1.24rem;
  color: var(--cream);
  max-width: 24ch;
  margin: 0.55rem auto 0;
  text-wrap: balance;
}

.event-venue + .event-city {
  margin-top: 0.3rem;
  opacity: 0.8;
}

.event-maps {
  display: inline-block;
  margin-top: 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 60%, transparent);
  padding-bottom: 2px;
}

@media (min-width: 768px) {
  #event-cards {
    grid-template-columns: 1fr 1fr;
  }
  /* Odd count: last card centers across both columns. */
  .event-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: 27rem;
    width: 100%;
  }
}

/* ---------- RSVP (cream contrast moment) ---------- */
.rsvp { padding-top: clamp(5rem, 13vh, 9rem); padding-bottom: clamp(5rem, 13vh, 9rem); }

.rsvp .kicker { color: color-mix(in srgb, var(--rsvp-ink) 66%, transparent); }
.rsvp .section-title { color: var(--rsvp-ink); }
.rsvp .title-rule::before {
  background: linear-gradient(90deg, transparent, var(--rsvp-ink) 22%,
    var(--rsvp-ink) 42%, transparent 46%, transparent 54%, var(--rsvp-ink) 58%,
    var(--rsvp-ink) 78%, transparent);
  opacity: 0.4;
}
.rsvp .title-rule::after {
  border-color: color-mix(in srgb, var(--rsvp-ink) 60%, transparent);
  background: color-mix(in srgb, var(--rsvp-ink) 14%, transparent);
}

.shagun {
  position: relative;
  z-index: 1;
  margin: 0.5rem 0 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.shagun-envelope {
  width: clamp(150px, 44vw, 200px);
  height: auto;
  filter: drop-shadow(0 12px 22px color-mix(in srgb, var(--rsvp-ink) 22%, transparent));
}

.shagun-caption {
  margin-top: 1.4rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1rem;
  color: color-mix(in srgb, var(--rsvp-ink) 80%, transparent);
}

.btn-rsvp {
  position: relative;
  z-index: 1;
  display: inline-block;
  width: auto;
  max-width: 100%;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: var(--rsvp-bg);
  background: var(--rsvp-ink);
  padding: 1.05rem 3rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--rsvp-ink) 32%, transparent);
}

.btn-rsvp:hover,
.btn-rsvp:focus-visible {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--rsvp-ink) 42%, transparent);
}

.btn-rsvp:active {
  transform: translateY(0) scale(0.99);
}

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

/* ---------- Countdown finale (narrative night scene) ---------- */
/* NB: no `overflow:hidden` here — it would clip the bottom wave divider.
   The starfield is clipped by `.cd-scene` instead. */

/* Full-bleed backdrop — escapes the `.section > *` measure cap via specificity. */
.countdown > .cd-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  max-width: none;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
}

.cd-stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cd-ground-art {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: clamp(120px, 22vh, 200px);
}

/* Fade the scene floor into the closing colour so the countdown → closing
   seam has no color step (covers every theme's ground uniformly). Painted
   above the ground svg (::after is the last child of .cd-scene). */
.cd-scene::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: clamp(70px, 15vh, 140px);
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}

/* only the active theme's ground shows */
.cd-ground { display: none; }

.cd-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--measure);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cd-tableau {
  width: min(84vw, 24rem);
  margin: 0.25rem auto 1.5rem;
}
.cd-tableau img {
  display: block;
  width: 100%;
  height: auto;
  /* Feather the painting's flat indigo ground into the night section */
  -webkit-mask-image: radial-gradient(ellipse 52% 54% at 50% 47%, #000 42%, transparent 84%);
  mask-image: radial-gradient(ellipse 52% 54% at 50% 47%, #000 42%, transparent 84%);
}

#countdown-timer {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: clamp(0.5rem, 2.5vw, 1.4rem);
  flex-wrap: nowrap;
}

.cd-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  flex: 1 1 0;
}

/* thin gold rules between cells */
.cd-rule {
  flex: 0 0 1px;
  align-self: center;
  width: 1px;
  height: clamp(2.2rem, 8vw, 3.2rem);
  background: linear-gradient(var(--gold), transparent 12%, var(--gold) 50%,
    transparent 88%, var(--gold));
  opacity: 0.4;
}

.cd-cell span {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: clamp(2.1rem, 9.5vw, 3.6rem);
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.cd-cell small {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

#countdown-done {
  position: relative;
  z-index: 1;
  font-style: italic;
  font-size: 1.4rem;
  color: var(--gold);
  margin-top: 1.5rem;
}

/* ---------- Closing ---------- */
.closing {
  background: var(--bg);
}

#closing-message {
  font-style: italic;
  font-size: clamp(1.25rem, 4vw, 1.6rem);
  line-height: 1.7;
  color: var(--cream);
  margin-bottom: 2rem;
}

.monogram {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 1.6rem;
  letter-spacing: 0.2em;
  color: var(--gold);
}

/* ---------- Music toggle ---------- */
#music-toggle[hidden] {
  display: none;
}

#music-toggle {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  color: var(--gold);
  background: color-mix(in srgb, var(--bg-2) 90%, var(--night));
  border: 1px solid color-mix(in srgb, var(--gold) 62%, transparent);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px color-mix(in srgb, var(--gold) 16%, transparent);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

#music-toggle:hover {
  border-color: var(--gold);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.36),
    inset 0 0 0 1px color-mix(in srgb, var(--gold) 26%, transparent);
}

#music-toggle .snd-icon { display: block; }

/* Paused: speaker with a small cross. Playing: speaker with sound waves. */
#music-toggle .snd-waves { display: none; }
#music-toggle[aria-pressed="true"] .snd-waves { display: block; }
#music-toggle[aria-pressed="true"] .snd-mute { display: none; }
#music-toggle[aria-pressed="true"] {
  background: color-mix(in srgb, var(--gold) 22%, var(--bg-2));
  border-color: var(--gold);
}

#music-toggle:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Responsive type ---------- */
@media (max-width: 480px) {
  body {
    font-size: 1.08rem;
  }
}
