/* =============================================================================
   Srishti & Lakshraj — engagement invitation
   Dark burgundy, gold and ivory. Mobile first; on desktop the film is a
   centred portrait column. Details read like printed stationery: script
   headings, gold ornaments, hairline dividers — no template boxes.
   ============================================================================= */

:root {
  --bg: #1a060d;
  --bg-soft: #25101a;
  --panel: rgba(201, 163, 91, 0.05);
  --line: rgba(201, 163, 91, 0.26);
  --line-faint: rgba(201, 163, 91, 0.14);
  --gold: #c9a35b;
  --gold-soft: #e3c583;
  --ivory: #f4ead9;
  --muted: rgba(244, 234, 217, 0.72);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --script: "Great Vibes", "Brush Script MT", cursive;
  --film-aspect: 0.5625; /* set from the real frame size by app.js */
}

* { box-sizing: border-box; }
html { scrollbar-color: #4a2a1a var(--bg); }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(201, 163, 91, 0.35); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: #4a2a1a; border-radius: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }

/* ---------------------------------------------------------------- loader */
#loader {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  background: radial-gradient(120% 90% at 50% 0%, #2c0f1c 0%, var(--bg) 60%);
}
.loader-monogram {
  margin: 0;
  font-family: var(--script);
  font-size: clamp(2.4rem, 9vw, 4rem);
  color: var(--gold-soft);
}
/* the pasted loading picture, background-removed (from content.js) */
.loader-art {
  display: block;
  height: clamp(9rem, 26vh, 15rem);
  width: auto;
  margin: 0 auto 1.1rem;
  filter: drop-shadow(0 8px 32px rgba(0, 0, 0, 0.5));
  animation: loader-float 3.2s ease-in-out infinite;
}
@keyframes loader-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-10px) scale(1.012); }
}
.loader-art[hidden] { display: none; }
.loader-pct {
  margin: 0;
  font-size: clamp(1.4rem, 5vw, 2rem);
  letter-spacing: 0.08em;
  color: var(--ivory);
  font-variant-numeric: tabular-nums;
}
#loader.is-indeterminate .loader-pct { visibility: hidden; }
.loader-bar {
  width: min(240px, 60vw);
  height: 2px;
  background: rgba(201, 163, 91, 0.25);
  overflow: hidden;
}
.loader-bar-fill {
  height: 100%; width: 0%;
  background: var(--gold);
  transition: width 0.2s ease-out;
}
#loader.is-indeterminate .loader-bar-fill {
  width: 36%;
  animation: loader-slide 1.1s ease-in-out infinite;
}
@keyframes loader-slide {
  from { transform: translateX(-110%); }
  to   { transform: translateX(340%); }
}
.loader-label {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------------------------------------------------------- hint */
#scroll-hint {
  position: fixed; left: 50%;
  bottom: max(1.2rem, calc(env(safe-area-inset-bottom, 0px) + 1.2rem));
  transform: translateX(-50%);
  z-index: 55;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  font-size: 0.55rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(244, 234, 217, 0.78);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.85), 0 0 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
/* no visible box: just a soft pool of shade so the type reads on any frame */
#scroll-hint::before {
  content: "";
  position: absolute;
  inset: -1.6rem -2.6rem;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(50% 62% at 50% 58%, rgba(10, 2, 6, 0.48), transparent 72%);
}
#scroll-hint.is-visible { opacity: 1; }
/* very narrow phones: keep it on one compact line */
@media (max-width: 380px) {
  #scroll-hint {
    font-size: 0.5rem;
    letter-spacing: 0.3em;
  }
}
.hint-arrow { display: block; line-height: 0; color: var(--gold-soft); }
/* the hairline draws itself downward, then the chevron fades in, and
   the whole stroke dissolves before the loop repeats */
.hint-line {
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  animation: hint-draw 2.6s ease-in-out infinite;
}
.hint-chevron {
  opacity: 0;
  animation: hint-chevron 2.6s ease-in-out infinite;
}
@keyframes hint-draw {
  0%   { stroke-dashoffset: 20; opacity: 0; }
  22%  { opacity: 1; }
  45%  { stroke-dashoffset: 0; opacity: 1; }
  78%  { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes hint-chevron {
  0%, 32% { opacity: 0; }
  52%, 78% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------------------------------------------------------------- music */
#sound-toggle {
  position: fixed;
  right: max(1rem, calc(env(safe-area-inset-right, 0px) + 1rem));
  bottom: max(1rem, calc(env(safe-area-inset-bottom, 0px) + 1rem));
  z-index: 56;
  width: 2.2rem; height: 2.2rem;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  background: rgba(26, 6, 13, 0.45);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold-soft);
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0.7;
  transition: opacity 0.3s ease, border-color 0.3s ease;
}
#sound-toggle:hover { opacity: 1; border-color: var(--gold); }
#sound-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
#sound-toggle .snd-x { display: none; }
#sound-toggle.is-muted .snd-x { display: block; }
#sound-toggle.is-muted .snd-waves { display: none; }

/* ---------------------------------------------------------------- film */
#film {
  position: relative;
  height: 500vh;
}
html.reduced-motion #film,
html.no-frames #film,
html.no-libraries #film {
  height: 100vh;
  height: 100dvh;
}
#stage {
  position: sticky; top: 0;
  /* exactly the visible viewport on every phone: no hidden band below the
     URL bar, so nothing can "stretch" when the bar collapses — the film
     always fills precisely what is on screen */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(90% 70% at 50% 30%, #2b0e1b 0%, var(--bg) 70%);
}
/* full-size film: the whole frame is shown, nothing shrunk */
#stage-frame {
  position: absolute; top: 0; bottom: 0; left: 0; right: 0;
  margin: auto;
  width: 100%; height: 100%;
  background: var(--bg-soft);
  container-type: inline-size;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.55);
}
/* desktop: centre the film as a portrait column matched to the visible height */
@media (orientation: landscape) and (min-width: 700px) {
  #stage-frame {
    width: min(100vw, calc(100dvh * var(--film-aspect)));
  }
}
#film-canvas {
  display: block;
  width: 100%; height: 100%;
}

/* titles — inside the curtain frame of the film:
   the frame has curtain columns left and right, an empty inner area
   above and the couple below, so the text is inset to the inner area
   and sits low, close above the couple */
.titles {
  position: absolute; z-index: 2;
  top: 17%;
  left: 17.5%;
  right: 17.5%;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(0.45rem, 1.7lvh, 1.1rem);
  text-align: center;
  pointer-events: none;
}
.t {
  margin: 0;
  opacity: 0; /* render(p) drives opacity + the reveal effects */
  will-change: opacity, transform, filter;
}
/* gold-light fill for the names: the gradient is set per-frame by render(p) */
.t-shimmer {
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  background-repeat: no-repeat;
}
.t-families {
  font-size: clamp(0.58rem, 3.1vw, 0.95rem);
  font-size: clamp(0.58rem, 3.1cqw, 0.95rem);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gold-soft);
  line-height: 1.6;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.65);
}
/* the couple's names share one baseline row: no stacked overlap */
.t-names {
  display: flex; align-items: baseline; justify-content: center;
  gap: clamp(0.4rem, 1.7vw, 1.05rem);
  gap: clamp(0.4rem, 2.1cqw, 1.05rem);
  flex-wrap: nowrap;
  max-width: 100%;
}
.t-groom, .t-bride {
  font-family: var(--script);
  font-weight: 400;
  color: var(--ivory);
  line-height: 1.3;
  white-space: nowrap;
  text-shadow: 0 2px 26px rgba(0, 0, 0, 0.7);
}
.t-groom { font-size: clamp(1.9rem, 8.9vw, 3.9rem); font-size: clamp(1.9rem, 9.5cqw, 4.5rem); }
.t-bride { font-size: clamp(1.9rem, 8.9vw, 3.9rem); font-size: clamp(1.9rem, 9.5cqw, 4.5rem); }
.t-amp {
  font-family: var(--script);
  color: var(--gold);
  line-height: 1.3;
  font-size: clamp(1.3rem, 5vw, 2.3rem);
  font-size: clamp(1.3rem, 5.4cqw, 2.5rem);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
}
.t-invite {
  font-style: italic;
  color: var(--ivory);
  max-width: 24ch;
  line-height: 1.5;
  font-size: clamp(0.9rem, 4vw, 1.2rem);
  font-size: clamp(0.9rem, 4.2cqw, 1.25rem);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.65);
}
.t-date {
  font-size: clamp(0.95rem, 4.4vw, 1.35rem);
  font-size: clamp(0.95rem, 4.6cqw, 1.4rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-soft);
  line-height: 1.5;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.65);
}
.t-venue {
  font-style: italic;
  color: var(--ivory);
  line-height: 1.5;
  font-size: clamp(0.9rem, 4.1vw, 1.15rem);
  font-size: clamp(0.9rem, 4.3cqw, 1.2rem);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.65);
}

#film-message {
  position: absolute; z-index: 3;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: min(85%, 46ch);
  text-align: center;
  font-size: 1.05rem;
  color: var(--ivory);
  opacity: 0;
  transition: opacity 0.6s ease;
}
#film-message.is-visible { opacity: 1; }

/* ---------------------------------------------------------------- details */
#details {
  position: relative;
  z-index: 2;
  background:
    radial-gradient(70% 26% at 50% 0%, rgba(43, 14, 27, 0.5), transparent 75%),
    var(--bg);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* faux-3D ornament band: interlocked gold rings between film and details */
.deco-band {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(3rem, 9vw, 4.5rem) 0 0;
}
.ring-pair { position: relative; width: 132px; height: 74px; }
.ring {
  position: absolute; top: 0;
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 6px solid transparent;
  background:
    linear-gradient(#1a060d, #1a060d) padding-box,
    linear-gradient(160deg, #f3dfae 0%, #8a5f26 38%, #e3c583 62%, #6d4a1c 100%) border-box;
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.55),
    inset 0 3px 6px rgba(255, 236, 190, 0.28),
    inset 0 -4px 9px rgba(0, 0, 0, 0.6);
}
.r1 { left: 0; transform: rotate(-10deg); z-index: 2; }
.r2 { left: 56px; top: 8px; transform: rotate(10deg); z-index: 1; }
/* a small gem set on the second ring */
.ring-gem {
  position: absolute; top: -9px; left: 79px;
  width: 15px; height: 15px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #fff6e2 0%, #e3c583 38%, #a8823f 62%, #7a541f 100%);
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.55), inset 0 0 7px rgba(255, 255, 255, 0.55);
}
/* floating sparkles around the rings */
.sparkle {
  position: absolute;
  font-size: 1rem;
  color: var(--gold-soft);
  text-shadow: 0 0 14px rgba(227, 197, 131, 0.85);
  animation: sparkle-drift 4.2s ease-in-out infinite;
}
.s1 { left: 22%; top: 30%; }
.s2 { right: 20%; top: 55%; animation-delay: 1.3s; font-size: 0.8rem; }
.s3 { left: 62%; top: 12%; animation-delay: 2.4s; font-size: 0.7rem; }
@keyframes sparkle-drift {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.45; }
  50%      { transform: translateY(-9px) scale(1.25); opacity: 1; }
}
.sec {
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(3.2rem, 11vw, 6rem) 1.6rem;
  text-align: center;
}
.sec-welcome { padding-top: clamp(4.5rem, 14vw, 8rem); }

/* eyebrow: small caps flanked by hairlines */
.eyebrow {
  margin: 0 0 1.4rem;
  display: flex; align-items: center; justify-content: center;
  gap: 0.9rem;
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--gold);
}
.eyebrow::before, .eyebrow::after {
  content: "";
  display: block;
  height: 1px; width: clamp(1.6rem, 8vw, 3rem);
  background: var(--gold);
  opacity: 0.5;
}

/* script headings */
.sec-heading {
  margin: 0;
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(2rem, 8.5vw, 2.9rem);
  color: var(--gold-soft);
  line-height: 1.3;
}
/* ornament: hairline — diamond — hairline */
.orn {
  display: flex; align-items: center; justify-content: center;
  gap: 0.85rem;
  margin: 1.5rem auto 1.9rem;
  color: var(--gold);
}
.orn::before, .orn::after {
  content: "";
  display: block;
  height: 1px; flex: 0 1 clamp(2.4rem, 13vw, 4.2rem);
  background: currentColor;
  opacity: 0.45;
}
.orn i {
  display: block;
  width: 7px; height: 7px;
  background: var(--gold);
  transform: rotate(45deg);
  opacity: 0.85;
}
.sec-script {
  margin: 0;
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(2.6rem, 11vw, 4rem);
  color: var(--ivory);
  line-height: 1.3;
}
.sec-text {
  margin: 0.5rem auto;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.08rem;
}
.sec-welcome .sec-text { font-style: italic; }
.sec-note {
  margin: 1.6rem auto 0;
  color: var(--gold-soft);
  font-style: italic;
  font-size: 1rem;
}

/* countdown: the date large, the counter small and quiet */
.countdown-date {
  margin: 0 0 1.1rem;
  font-size: clamp(1.45rem, 6vw, 2.2rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ivory);
}
.countdown {
  display: flex; justify-content: center; align-items: baseline;
  margin-bottom: 1.5rem;
}
.countdown-cell {
  display: flex; align-items: baseline; gap: 0.32rem;
  padding: 0 clamp(0.7rem, 3.5vw, 1.5rem);
}
.countdown-cell + .countdown-cell { border-left: 1px solid var(--line-faint); }
.countdown-num {
  font-size: clamp(1.05rem, 4.2vw, 1.45rem);
  font-weight: 500;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.countdown-label {
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* families: quiet columns, no boxes */
.families {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}
.family-heading {
  margin: 0 0 0.3rem;
  font-family: var(--script);
  font-weight: 400;
  font-size: 1.7rem;
  color: var(--gold-soft);
}
.family-text { margin: 0; color: var(--ivory); font-size: 1.05rem; }

/* celebrations: a hairline-separated programme */
.events {
  max-width: 30rem;
  margin: 0 auto;
}
.event { padding: 1.4rem 0; }
.event + .event { border-top: 1px solid var(--line-faint); }
.event-name {
  margin: 0 0 0.35rem;
  font-family: var(--script);
  font-weight: 400;
  font-size: 1.8rem;
  color: var(--ivory);
}
.event-meta {
  margin: 0;
  color: var(--gold-soft);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.event-note { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.98rem; font-style: italic; }

/* photos: thin gold mats */
.photos {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
.photo {
  margin: 0;
  border: 1px solid var(--line);
  padding: 0.45rem;
  background: rgba(0, 0, 0, 0.22);
}
.photo img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.photo-caption { padding-top: 0.55rem; font-size: 0.85rem; color: var(--muted); font-style: italic; }

/* venue */
.venue-name {
  margin: 0 0 0.5rem;
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(1.9rem, 7vw, 2.4rem);
  color: var(--ivory);
}
.venue-address {
  margin: 0 0 1.8rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.venue-map-wrap {
  max-width: 40rem;
  margin: 0 auto;
  border: 1px solid var(--line);
  padding: 0.5rem;
  background: var(--panel);
}
.venue-map {
  display: block;
  width: 100%;
  height: min(56vw, 320px);
  border: 0;
  filter: grayscale(0.2) sepia(0.18) saturate(0.9);
}

/* rsvp */
.btn {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 1rem 2.6rem;
  border: 1px solid var(--gold);
  border-radius: 2px;
  color: var(--gold-soft);
  text-decoration: none;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 0.72rem;
  transition: background 0.3s ease, color 0.3s ease;
}
.btn:hover { background: var(--gold); color: var(--bg); }
.btn--sm {
  margin-top: 0;
  padding: 0.62rem 1.4rem;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
}

/* closing */
.closing-names {
  margin: 0.3rem 0 0;
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(2.5rem, 10vw, 3.8rem);
  color: var(--gold-soft);
  line-height: 1.3;
}
.closing-families {
  margin: 0.45rem 0 0;
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ---------------------------------------------------------------- degrade */
html.no-libraries .t { opacity: 1 !important; clip-path: none !important; }
html.no-libraries .t-shimmer {
  -webkit-text-fill-color: var(--ivory);
  color: var(--ivory);
  background-image: none !important;
}
html.no-libraries #scroll-hint { display: none; }

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  .loader-art { animation: none; }
  .sparkle { animation: none; }
  .hint-line { animation: none; stroke-dashoffset: 0; opacity: 1; }
  .hint-chevron { animation: none; opacity: 1; }
  #loader.is-indeterminate .loader-bar-fill { animation: none; }
  .loader-bar-fill { transition: none; }
}
