/* Nina's birthday invitation: every style for index.html.
   Mobile-first; at 769px and up the whole page is replaced by #desktop-notice.
   Palette comes from the client's envelope (burgundy, antique gold) and the
   painted theater; the page is one night-dark theme from top to bottom.
   Shape rule: floating switches over media are pills, everything else is 2px. */

/* ===== Fonts =====
   DM Constitution (typeface.ge) is Georgian-only with its own digits, so English
   display text falls to Federo, whose art-deco strokes match it. Body text is
   LGV Big Noodle (typeface.ge), a condensed capital face with full Georgian
   and Latin; Noto Sans Georgian is only a fallback for missing glyphs (the
   footer heart). font-display: block is safe only because the loading screen
   covers the block period. */
@font-face {
  font-family: 'LGV Big Noodle';
  src: url('fonts/lgv-big-noodle.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: 'DM Constitution';
  src: url('fonts/dm-constitution.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

/* ===== Tokens ===== */
:root {
  --vh: 1vh;                       /* JS off = plain 1vh; the inline head script pins it */

  --night: #0d0507;                /* the page: a theater with the house lights down */
  --night-2: #160809;
  --velvet: #2a0a10;               /* ticket card, envelope burgundy sunk into shadow */
  --wine: #531316;                 /* client palette maroon */
  --gold: #d8b46a;
  --gold-deep: #a8823f;
  --gold-pale: #f1dcaa;
  --ivory: #f3e6cc;
  --ivory-soft: rgba(243, 230, 204, 0.72);
  --ivory-faint: rgba(243, 230, 204, 0.6);
  --hair: rgba(216, 180, 106, 0.42);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-slow: cubic-bezier(0.45, 0.05, 0.3, 1);

  --font-display: 'DM Constitution', 'Federo', serif;
  --font-body: 'LGV Big Noodle', 'Noto Sans Georgian', sans-serif;
}

/* English reorders the stacks so Latin glyphs never come from the Georgian
   face (DM Constitution carries a handful of stray Latin letters). */
body.lang-en {
  --font-display: 'Federo', 'DM Constitution', serif;
  --font-body: 'LGV Big Noodle', 'Noto Sans Georgian', sans-serif;
}

/* ===== Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--night);
  -webkit-text-size-adjust: 100%;
  /* Thumb starts invisible behind the envelope and fades in on open. */
  scrollbar-width: thin;
  scrollbar-color: transparent var(--night);
  transition: scrollbar-color 1.2s ease;
}

html.scrollbar-ready {
  scrollbar-color: rgba(216, 180, 106, 0.5) var(--night);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background-color: var(--night); }
::-webkit-scrollbar-thumb { background-color: transparent; border-radius: 3px; }
.scrollbar-ready::-webkit-scrollbar-thumb,
.scrollbar-ready ::-webkit-scrollbar-thumb { background-color: rgba(216, 180, 106, 0.5); }

html,
body {
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  background-color: var(--night);
  color: var(--ivory);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.5;
  letter-spacing: 0.03em;
  /* clip, not hidden: overflow-x hidden would turn body into a scroll
     container and break the sticky menorah. */
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

/* Paper and film grain over everything: one fixed, inert layer, never on a
   scrolling element, so it costs one composite and no repaints. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 0.9  0 0 0 0 0.75  0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img,
video {
  display: block;
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ===== Scroll lock =====
   Never position:fixed / overflow:hidden on the document: Chrome iOS from a
   chat app would freeze its viewport short. script.js traps the gesture. */
html.is-locked,
html.is-locked body {
  overscroll-behavior: none;
  touch-action: none;
}

/* ===== Loading screen ===== */
.loader {
  position: fixed;
  inset: 0;
  z-index: 10001;               /* above the intro tap layers */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background-color: var(--night);
  transition: opacity 0.7s ease;
}

.loader.fade-out { opacity: 0; pointer-events: none; }
.loader.gone { display: none; }

.loader__ring {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(216, 180, 106, 0.18);
  border-top-color: var(--gold);
  animation: spin 1.1s linear infinite;
}

.loader__track {
  width: 120px;
  height: 1px;
  background-color: rgba(216, 180, 106, 0.18);
  overflow: hidden;
}

.loader__bar {
  height: 100%;
  background-color: var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s ease;
}

.loader__pct {
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0.2em;
  color: rgba(216, 180, 106, 0.7);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Fixed toggles ===== */
.toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.8s ease, transform 0.8s var(--ease-out);
}

.toggle--music { left: 14px; }
.toggle--lang { right: 14px; }

.toggle.visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 54px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(216, 180, 106, 0.5);
  background-color: rgba(13, 5, 7, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.switch--lang { width: 62px; }

.switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--gold);
  color: var(--velvet);
  font-size: 11px;
  line-height: 20px;
  text-align: center;
  transition: transform 0.35s var(--ease-out), background-color 0.35s ease, color 0.35s ease;
}

/* Music: thumb parked left and dim when paused, lit and right when playing. */
.switch__thumb--note {
  background-color: rgba(216, 180, 106, 0.28);
  color: var(--gold-pale);
}

.switch.playing .switch__thumb--note {
  transform: translateX(26px);
  background-color: var(--gold);
  color: var(--velvet);
}

.switch__label {
  position: relative;
  z-index: 1;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--gold-pale);
  transition: opacity 0.3s ease;
}

/* Both labels always show. The selected one sits on the gold thumb, so it
   turns dark burgundy to read against it; the other stays a dim gold on the
   track. Labels are stacked above the thumb (z-index on .switch__label). */
.switch__label {
  width: 16px;
  text-align: center;
  transition: color 0.35s ease, opacity 0.35s ease;
}

.switch__label--ka { margin-left: -3px; color: var(--velvet); }
.switch__label--en { margin-right: -3px; opacity: 0.6; }
.switch--lang .switch__thumb { left: 3px; }
.switch--lang.lang-en .switch__thumb { transform: translateX(34px); }
.switch--lang.lang-en .switch__label--ka { color: var(--gold-pale); opacity: 0.6; }
.switch--lang.lang-en .switch__label--en { color: var(--velvet); opacity: 1; }

/* ===== Theater ===== */
.theater {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background-color: var(--night);
}

.vh-lock .theater { height: calc(var(--vh) * 100); }

/* Fades the whole scene to black as it scrolls away (--vis set by script.js
   from an IntersectionObserver ratio, no scroll handler). */
.theater__dim {
  position: absolute;
  inset: 0;
  opacity: var(--vis, 1);
  transition: opacity 0.25s linear;
}

/* A 9:16 box that covers the section like object-fit: cover, so everything
   inside can be placed in the artwork's own coordinates. */
.frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, calc(100vh * 9 / 16));
  aspect-ratio: 9 / 16;
  transform: translate(-50%, -50%);
}

.vh-lock .frame { width: max(100%, calc(var(--vh) * 100 * 9 / 16)); }

.frame__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame__media--hold { z-index: 1; }
.frame__media--clip { z-index: 3; opacity: 0; transition: opacity 0.45s ease; }
#clip-1 { z-index: 4; opacity: 1; }
.frame__media--clip.is-on { opacity: 1; }
.frame__media--clip.is-off,
#clip-1.is-off { opacity: 0; }
.frame__media--poster { z-index: 5; transition: opacity 0.3s ease; }
.frame__media--poster.hidden { opacity: 0; pointer-events: none; }

/* Spotlight life: only once the final frame is up. */
.spot {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.4s ease;
}

.theater.is-live .spot { opacity: 1; }

.spot__glow {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 0;
  height: 46%;
  background-image: radial-gradient(ellipse 52% 58% at 50% 56%, rgba(255, 186, 120, 0.2), rgba(255, 186, 120, 0) 72%);
  mix-blend-mode: screen;
  animation: breathe 6.5s ease-in-out infinite alternate;
}

@keyframes breathe {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

.spot__dust {
  position: absolute;
  left: 22%;
  right: 22%;
  top: 2%;
  height: 42%;
}

.mote {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background-color: rgba(255, 230, 180, 0.9);
  box-shadow: 0 0 5px rgba(255, 200, 130, 0.85);
  opacity: 0;
  animation: drift var(--d, 14s) linear var(--delay, 0s) infinite;
}

@keyframes drift {
  0% { opacity: 0; transform: translate(0, 0); }
  18% { opacity: var(--o, 0.7); }
  82% { opacity: var(--o, 0.7); }
  100% { opacity: 0; transform: translate(var(--dx, 10px), -90px); }
}

/* Curtain text: set inside the lit pool of the curtain (artwork coordinates). */
.curtain-text {
  position: absolute;
  z-index: 6;
  left: 17%;
  right: 17%;
  top: 19.5%;
  height: 19%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  /* Sits above the clips in the stack, so it stays hidden until the final
     still is up; the pen wipe then writes it on. */
  visibility: hidden;
}

.theater.is-live .curtain-text { visibility: visible; }

.curtain-text__line {
  font-size: 16px;
  line-height: 1.62;
  color: #fcebc9;
  text-shadow: 0 1px 14px rgba(70, 4, 8, 0.75), 0 0 2px rgba(70, 4, 8, 0.4);
}

body.lang-en .curtain-text__line {
  font-size: 20px;
  line-height: 1.38;
  letter-spacing: 0.02em;
}

/* Each wrapped line is written on by a pen wipe: a soft-edged mask slides
   from left to right, one line after another. Never typed letter by letter. */
.curtain-text .ln {
  display: block;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 42%, transparent 58%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0%, #000 42%, transparent 58%, transparent 100%);
  -webkit-mask-size: 250% 100%;
  mask-size: 250% 100%;
  -webkit-mask-position: 100% 0;
  mask-position: 100% 0;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.theater.is-live .curtain-text .ln {
  animation: pen-wipe 1.7s var(--ease-slow) forwards;
  animation-delay: calc(var(--i, 0) * 0.62s + 0.5s);
}

@keyframes pen-wipe {
  to {
    -webkit-mask-position: 0 0;
    mask-position: 0 0;
  }
}

/* Blends the bottom of the theater into the night of the next section. */
.theater__fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18%;
  z-index: 2;
  pointer-events: none;
  background-image: linear-gradient(to bottom, rgba(13, 5, 7, 0), var(--night));
}

/* ===== Scroll hints =====
   "Scroll down" with a thin gold line a point of light keeps running down.
   One on the theater (after the curtain line is written) and one on the
   story stage (while a panel is up, since the story only moves on scroll). */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 1s ease, transform 1s var(--ease-out);
  pointer-events: none;
}

.scroll-hint__text {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0.18em;
  color: var(--gold-pale);
  text-shadow: 0 1px 10px rgba(13, 5, 7, 0.9);
}

.scroll-hint__line {
  position: relative;
  width: 1px;
  height: 30px;
  overflow: hidden;
  background-color: rgba(216, 180, 106, 0.28);
}

.scroll-hint__line::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 12px;
  background-image: linear-gradient(to bottom, rgba(241, 220, 170, 0), var(--gold-pale));
  transform: translateY(-12px);
  animation: hint-run 2.2s var(--ease-slow) infinite;
}

@keyframes hint-run {
  0% { transform: translateY(-12px); }
  70%, 100% { transform: translateY(30px); }
}

.theater.is-live .scroll-hint--hero {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 4.6s;
}

/* Over the menorah's floor: a little smaller and lower. */
.scroll-hint--story { bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); }
.scroll-hint--story .scroll-hint__line { height: 22px; }

.menorah-stage.has-step .scroll-hint--story {
  opacity: 0.9;
  transform: translate(-50%, 0);
  transition-delay: 0.6s;
}

/* ===== Envelope tap ===== */
.intro-ui {
  position: absolute;
  inset: 0;
  z-index: 10;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.intro-ui.gone { display: none; }

.intro-ui__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 9%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  color: var(--gold-pale);
  text-shadow: 0 1px 10px rgba(30, 0, 4, 0.8);
  animation: hint-pulse 2.8s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

/* Held still behind the loader so it never plays out unseen. */
html.is-loading .intro-ui__hint { animation: none; opacity: 0; }
.intro-ui.is-tapped .intro-ui__hint { animation: none; opacity: 0; }

.intro-ui__ka {
  font-family: var(--font-body);
  font-size: 17px;
  letter-spacing: 0.08em;
}

.intro-ui__en {
  font-family: 'Federo', serif;
  font-size: 14px;
  letter-spacing: 0.22em;
}

.intro-ui__rule {
  width: 34px;
  height: 1px;
  background-color: rgba(241, 220, 170, 0.6);
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* Shown only when iOS refuses autoplay; the tap here restarts the clip. */
.intro-tap {
  position: absolute;
  inset: 0;
  z-index: 11;
  background: url('poster.jpg') center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  cursor: pointer;
}

.intro-tap.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ===== Story over the menorah ===== */
.story {
  position: relative;
  background-color: var(--night);
}

.menorah-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.vh-lock .menorah-stage { height: calc(var(--vh) * 100); }

/* Soft floor: when the section ends and the stage scrolls away, the painting
   sinks into the night instead of ending on a hard edge. */
.menorah-stage::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 9%;
  background-image: linear-gradient(to bottom, rgba(13, 5, 7, 0), var(--night));
}

/* Bottom-anchored 9:16 box, so the menorah always stands on the floor of the
   screen and the dark sky above it holds the text. */
.menorah {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: max(100%, calc(100vh * 9 / 16));
  aspect-ratio: 9 / 16;
  transform: translateX(-50%);
}

.vh-lock .menorah { width: max(100%, calc(var(--vh) * 100 * 9 / 16)); }

.menorah__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Lit pixels come back through masks: each flame layer is the lit painting
   seen through a soft ellipse at its own candle, so a candle lights with its
   real painted flame and glow, not a CSS imitation. */
.flame,
.menorah__body {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.6s ease;
  pointer-events: none;
}

.flame__px,
.menorah__body {
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.flame__px {
  position: absolute;
  inset: 0;
  background-size: 100% 100%;
  -webkit-mask-image: radial-gradient(ellipse 12% 7% at var(--x) var(--y), #000 0%, rgba(0, 0, 0, 0.9) 28%, rgba(0, 0, 0, 0.4) 62%, transparent 100%);
  mask-image: radial-gradient(ellipse 12% 7% at var(--x) var(--y), #000 0%, rgba(0, 0, 0, 0.9) 28%, rgba(0, 0, 0, 0.4) 62%, transparent 100%);
  animation: flicker var(--fd, 3s) ease-in-out var(--fdel, 0s) infinite alternate;
}

/* Deferred: the lit painting downloads only after the loader clears. */
html.assets-ready .flame__px,
html.assets-ready .menorah__body {
  background-image: url('menorah.jpg');
}

.menorah__body {
  background-size: 100% 100%;
  -webkit-mask-image: radial-gradient(ellipse 40% 22% at 50% 78%, #000 0%, rgba(0, 0, 0, 0.7) 45%, transparent 100%);
  mask-image: radial-gradient(ellipse 40% 22% at 50% 78%, #000 0%, rgba(0, 0, 0, 0.7) 45%, transparent 100%);
  opacity: var(--lit, 0);
}

.flame.is-lit { opacity: 1; }
.flame:not(.is-lit) { transition-duration: 0.9s; }

@keyframes flicker {
  0% { opacity: 1; }
  40% { opacity: 0.86; }
  70% { opacity: 0.97; }
  100% { opacity: 0.9; }
}

@keyframes touch {
  0% { opacity: 0.9; transform: scale(0.3); }
  100% { opacity: 0; transform: scale(8); }
}

/* Keeps text readable over the top of the painting. */
.menorah-stage__veil {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to bottom, rgba(13, 5, 7, 0.75) 0%, rgba(13, 5, 7, 0.25) 42%, rgba(13, 5, 7, 0) 58%);
}

/* All panels share one place above the menorah; only the active one shows.
   Panels already read drift up and away, panels still to come wait just
   below, so scrolling either way moves the text in the direction of travel. */
.panels {
  position: absolute;
  left: 30px;
  right: 30px;
  top: 0;
  bottom: 0;
}

.panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--vh) * 8);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s ease, transform 1.1s var(--ease-out);
  pointer-events: none;
}

.panel.is-past { transform: translateY(-18px); }

.panel.is-active {
  opacity: 1;
  transform: none;
  transition-delay: 0.18s;     /* the outgoing panel clears first */
  pointer-events: auto;
}

.story__p {
  max-width: 26ch;
  font-size: 21px;
  line-height: 1.42;
  letter-spacing: 0.04em;
  color: var(--ivory);
  text-shadow: 0 1px 16px rgba(13, 5, 7, 0.9);
}

body.lang-en .story__p {
  font-size: 23px;
  line-height: 1.38;
}

.panel--trio { gap: calc(var(--vh) * 4); }

.trio__row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s ease, transform 1s var(--ease-out);
}

.trio__row.is-shown {
  opacity: 1;
  transform: none;
}

.trio__word {
  font-size: 38px;
  line-height: 1.2;
  color: var(--gold);
  text-shadow: 0 0 22px rgba(216, 160, 80, 0.25);
}

.trio__note {
  font-size: 16px;
  letter-spacing: 0.12em;
  color: var(--ivory-soft);
}

.panel--celebrate { top: calc(var(--vh) * 9); }

.celebrate__title {
  max-width: 13em;
  font-size: 30px;
  line-height: 1.32;
  padding-bottom: 4px;
}

body.lang-en .celebrate__title {
  font-size: 44px;
  line-height: 1.12;
}

.celebrate__date {
  font-size: 30px;
  line-height: 1.2;
  padding-bottom: 4px;
}

/* Scroll distance only: each step is how far the guest scrolls per panel. */
.story__steps {
  position: relative;
  margin-top: -100vh;
  margin-top: -100svh;
}

.vh-lock .story__steps { margin-top: calc(var(--vh) * -100); }

.step { height: calc(var(--vh) * 70); }
.step--lead { height: calc(var(--vh) * 40); }
.step--short { height: calc(var(--vh) * 45); }
.step--last { height: calc(var(--vh) * 120); }

/* Gold leaf: lies dark until its moment, then one band of light crosses it
   and leaves it lit. The lit tone is capped warm, never white. */
.gilt {
  color: var(--gold);
  background-image: linear-gradient(100deg, #e0bd76 0%, #e8c885 34%, #fbe8bb 45%, #b48c47 55%, #6b4f26 70%, #6b4f26 100%);
  background-size: 320% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.panel.is-gilded .gilt {
  animation: gild 2.8s var(--ease-slow) 0.5s forwards;
}

@keyframes gild { to { background-position: 0 0; } }

/* White-lead pearls: a row of small gold dots, the illuminator's divider. */
.pearls {
  width: 132px;
  height: 7px;
  margin: 20px auto;
  opacity: 0.8;
  background-image: radial-gradient(circle, var(--gold) 0, var(--gold) 1.2px, transparent 1.7px);
  background-size: 11px 7px;
  background-repeat: repeat-x;
  background-position: center;
}

/* ===== Sections ===== */
.section {
  position: relative;
  padding: 104px 22px;
  background-color: var(--night);
}

.section__title {
  font-size: 30px;
  line-height: 1.25;
  color: var(--gold);
  text-align: center;
}

body.lang-en .section__title { font-size: 34px; }

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1.1s ease, transform 1.1s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ===== Registration ticket ===== */
.rsvp {
  padding-top: 72px;
  background-image: radial-gradient(ellipse 80% 40% at 50% 0%, rgba(83, 19, 22, 0.35), rgba(83, 19, 22, 0) 70%);
}

.ticket {
  position: relative;
  max-width: 420px;
  margin: 0 auto;
  border-radius: 2px;
  border: 1px solid rgba(216, 180, 106, 0.55);
  background-color: var(--velvet);
  box-shadow:
    inset 0 0 0 5px var(--velvet),
    inset 0 0 0 6px rgba(216, 180, 106, 0.28),
    0 30px 70px rgba(0, 0, 0, 0.5);
}

.ticket__stub {
  position: relative;
  padding: 24px 24px 20px;
  text-align: center;
  border-bottom: 1px dashed rgba(216, 180, 106, 0.45);
}

/* The perforation notches. */
.ticket__stub::before,
.ticket__stub::after {
  content: '';
  position: absolute;
  bottom: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--night);
  border: 1px solid rgba(216, 180, 106, 0.55);
}

.ticket__stub::before { left: -11px; clip-path: inset(0 0 0 50%); }
.ticket__stub::after { right: -11px; clip-path: inset(0 50% 0 0); }

.ticket__admit {
  font-size: 14px;
  letter-spacing: 0.24em;
  color: rgba(216, 180, 106, 0.85);
}

.ticket__deadline {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--ivory);
}

.ticket__body { padding: 34px 26px 36px; }

.form { margin-top: 26px; }

.field { margin-bottom: 22px; }

.field__label {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--ivory-soft);
}

.field__input {
  display: block;
  width: 100%;
  padding: 9px 2px 10px;
  border: 0;
  border-bottom: 1px solid var(--hair);
  border-radius: 0;
  background-color: transparent;
  font-size: 20px;           /* 16px or more: iOS never zooms the page on focus */
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--ivory);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.field__input:focus {
  border-bottom-color: var(--gold);
  box-shadow: 0 1px 0 var(--gold);
}

.field__input--area {
  resize: none;
  line-height: 1.5;
}

.field__help {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ivory-faint);
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 210px;
  margin: 30px auto 0;
  padding: 15px 30px;
  border: 0;
  border-radius: 2px;
  background-color: var(--gold);
  color: var(--velvet);
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, background-color 0.3s ease, color 0.3s ease, opacity 0.3s ease;
}

.button:active { transform: translateY(1px) scale(0.99); }
.button:disabled { opacity: 0.55; cursor: default; }

.button--ghost {
  display: inline-flex;
  margin-top: 28px;
  border: 1px solid rgba(216, 180, 106, 0.6);
  background-color: transparent;
  color: var(--gold);
}

.form__status {
  min-height: 1.5em;
  margin-top: 14px;
  font-size: 17px;
  text-align: center;
  color: var(--gold-pale);
}

.ticket__done {
  display: none;
  padding-top: 18px;
  text-align: center;
}

.ticket__done.visible {
  display: block;
  animation: rise-in 1s var(--ease-out) both;
}

.ticket__done-title {
  font-size: 26px;
  line-height: 1.3;
  color: var(--gold);
}

.ticket__done-sub {
  margin-top: 10px;
  font-size: 19px;
  color: var(--ivory-soft);
}

.text-link {
  margin-top: 24px;
  border: 0;
  border-bottom: 1px solid var(--hair);
  background-color: transparent;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--ivory-soft);
  cursor: pointer;
}

/* Success feedback: a gold ring spreads from the middle of the ticket. */
.ticket__ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  border: 1px solid rgba(255, 214, 150, 0.85);
  opacity: 0;
  pointer-events: none;
}

.ticket__ring.go { animation: touch 1.6s var(--ease-out) forwards; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ===== Venue ===== */
.plaque {
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
}

/* A thin beam of gold falling onto the title, like the stage light above. */
.plaque::before {
  content: '';
  display: block;
  width: 1px;
  height: 64px;
  margin: 0 auto 26px;
  background-image: linear-gradient(to bottom, rgba(216, 180, 106, 0), var(--gold));
}

.venue__name {
  font-size: 26px;
  line-height: 1.3;
  color: var(--ivory);
}

.venue__address {
  margin-top: 8px;
  font-size: 19px;
  color: var(--ivory-soft);
}

/* ===== Agenda ===== */
.programme {
  padding-top: 40px;
  padding-bottom: 120px;
}

.programme__list {
  list-style: none;
  max-width: 420px;
  margin: 40px auto 0;
}

.programme__item {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: baseline;
  gap: 18px;
  padding: 22px 4px;
}

.programme__item + .programme__item { border-top: 1px solid rgba(216, 180, 106, 0.22); }

.programme__time {
  font-size: 32px;
  line-height: 1;
  color: var(--gold);
}

.programme__what {
  font-size: 20px;
  line-height: 1.35;
  color: var(--ivory);
}

/* ===== Footer ===== */
.footer {
  padding: 56px 22px calc(env(safe-area-inset-bottom, 0px) + 40px);
  text-align: center;
  background-color: var(--night);
  border-top: 1px solid rgba(216, 180, 106, 0.14);
}

.footer__name {
  font-size: 38px;
  line-height: 1.2;
  color: var(--gold);
}

.footer__date {
  margin-top: 6px;
  font-family: var(--font-body);
  font-size: 16px;
  letter-spacing: 0.3em;
  color: var(--ivory-faint);
}

.footer__credit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-family: var(--font-body);
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--ivory);
  text-decoration: none;
  opacity: 0.3;
  transition: opacity 0.3s ease;
}

.footer__credit:hover,
.footer__credit:focus-visible { opacity: 0.7; }

.footer__logo {
  width: 22px;
  height: 22px;
}

/* ===== Larger phones and small tablets ===== */
@media (min-width: 481px) {
  .curtain-text__line { font-size: 18px; }
  body.lang-en .curtain-text__line { font-size: 23px; }
  .story__p { font-size: 23px; }
  .trio__word { font-size: 46px; }
  .celebrate__title { font-size: 34px; }
  body.lang-en .celebrate__title { font-size: 52px; }
  .section__title { font-size: 34px; }
}

/* ===== Desktop notice ===== */
#desktop-notice { display: none; }

@media (min-width: 769px) {
  body > *:not(#desktop-notice) { display: none !important; }

  body::after { display: none; }

  #desktop-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 24px;
    gap: 10px;
    background-color: var(--night);
  }

  .desktop-notice__logo {
    width: 52px;
    height: auto;
    opacity: 0.8;
    margin-bottom: 24px;
  }

  .desktop-notice__ka,
  .desktop-notice__en {
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.5;
    letter-spacing: 0.02em;
    text-align: center;
    color: var(--ivory);
  }

  .desktop-notice__en { font-family: var(--font-body); }

  .desktop-notice__sub {
    margin-top: 2px;
    font-size: 14px;
    color: var(--ivory-soft);
  }
}

/* ===== Reduced motion =====
   Everything lands in its final state at once: lit candles, written curtain,
   gold already lit. */
@media (prefers-reduced-motion: reduce) {
  .mote,
  .spot__glow,
  .flame__px,
  .intro-ui__hint,
  .scroll-hint__line::after,
  .loader__ring { animation: none !important; }

  .flame { transition-delay: 0s !important; }

  .curtain-text .ln {
    -webkit-mask-image: none;
    mask-image: none;
    animation: none !important;
  }

  .gilt {
    animation: none !important;
    background-position: 0 0;
  }

  /* Panels still swap (only one can be shown), just without movement. */
  .panel,
  .panel.is-past,
  .trio__row {
    transform: none;
    transition: opacity 0.3s linear;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
