/* The Golden Bloom. Brand tokens from repo/src/styles/global.css (ink, paper, gold), as in the Invitation. */
@font-face {
  font-family: 'Instrument Serif';
  src: url('fonts/instrument-serif-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('fonts/instrument-serif-latin-400-italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Archivo';
  src: url('fonts/archivo-latin-wdth-normal.woff2') format('woff2-variations');
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
}

:root {
  --ink: #0b0b0c;
  --paper: #f3efe6;
  --gold: #c9a063;
  --gold-hi: #e2c18c;
  --muted: #b9b2a5;
  /* Type on mother-of-pearl: dark warm ink and a deep gold, both well above 4.5:1 on the pale pearl. */
  --pearl-ink: #2b2118;
  --pearl-gold: #6f5124;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --vh: 100vh;
}
@supports (height: 100dvh) { :root { --vh: 100dvh; } }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--paper); overscroll-behavior: none; }
body {
  font-family: var(--sans);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }

/* ---------- Stage: one 9:16 film frame, always full height. Phones lose a little at the sides, desktops get black sides.
   Height is capped at 222vw so very narrow windows lose at most 10 % per side (same rule as the Invitation). */
.stage {
  position: fixed; top: 50%; left: 50%;
  height: min(var(--vh), 222.2vw); width: calc(min(var(--vh), 222.2vw) * 9 / 16);
  transform: translate(-50%, -50%);
  overflow: hidden;
  container-type: inline-size;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
/* Where the window is wider than the 9:16 frame (desktop, tablet landscape), the frame's sides melt into the black
   page instead of ending in a hard edge (visible during the dive, when the enlarged flower fills the frame). */
@media (min-aspect-ratio: 10/16) {
  .stage {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%);
  }
}
.cam { position: absolute; inset: 0; transform-origin: 50% 49.06%; will-change: transform; }
.still, .seq {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; display: block;
  pointer-events: none;
}
.seq { z-index: 1; opacity: 0; }
.seq.is-on { opacity: 1; }
.still { z-index: 2; transition: opacity 0.35s ease; }
.still.is-off { opacity: 0; }
.still.blur { z-index: 3; opacity: 0; transition: none; }

/* Arrival: the light finds the bud (a soft mask that opens from the top) while the camera settles. */
.cam { opacity: 0; }
.is-arriving .cam, .is-ready .cam { opacity: 1; transition: opacity 1.6s ease; }
.is-arriving .cam {
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 var(--reveal, 0%), transparent calc(var(--reveal, 0%) + 30%));
          mask-image: linear-gradient(to bottom, #000 0%, #000 var(--reveal, 0%), transparent calc(var(--reveal, 0%) + 30%));
}

/* ---------- Awakening layers. Bud box on K1 (1080 x 1920): x 330-790, y 360-870. */
.sweep, .warmth { position: absolute; z-index: 4; pointer-events: none; opacity: 0; }
.sweep {
  left: 30.5%; top: 18.75%; width: 42.6%; height: 26.6%;
  overflow: hidden;
  mix-blend-mode: overlay;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 55%, transparent 100%);
          mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 55%, transparent 100%);
}
.sweep::before {
  content: ''; position: absolute; left: -60%; top: -20%; width: 60%; height: 140%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 236, 200, 0.85) 50%, transparent 100%);
  transform: translateX(var(--sweep-x, 0%)) skewX(-12deg);
}
.warmth {
  left: 30.5%; top: 18.75%; width: 42.6%; height: 26.6%;
  background: radial-gradient(ellipse 38% 46% at 52% 55%, rgba(255, 196, 120, 0.55), rgba(255, 170, 90, 0) 70%);
  mix-blend-mode: screen;
}
.dial {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; opacity: 0;
  transition: opacity 0.4s ease;
}
.dial path { fill: none; vector-effect: non-scaling-stroke; }
.dial-track { stroke: rgba(201, 160, 99, 0.18); stroke-width: 1; }
.dial-fill {
  stroke: var(--gold-hi); stroke-width: 1.6; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  filter: drop-shadow(0 0 2px rgba(226, 193, 140, 0.6));
}
.is-dial .dial { opacity: 1; }

/* One warm wave of light when the flower unlocks (no glitter, no lasting glow). */
.flash {
  position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse 60% 45% at 51% 33%, rgba(255, 226, 170, 0.9), rgba(255, 190, 110, 0.25) 45%, transparent 75%);
  mix-blend-mode: screen;
}

/* "Move from here, in any direction": two golden rings that pulse outward from the finger after the unlock. */
.touch-ring {
  position: absolute; z-index: 9; left: 50%; top: 42%; width: 0; height: 0; pointer-events: none;
  opacity: 0; transition: opacity 0.3s ease;
}
.touch-ring.is-on { opacity: 1; }
.touch-ring::before, .touch-ring::after {
  content: ''; position: absolute; left: -36px; top: -36px; width: 72px; height: 72px; border-radius: 50%;
  /* Light ring with a dark edge, so it reads on the gold bud as well as on black. */
  border: 2px solid #fff3dc;
  box-shadow: 0 0 0 1px rgba(20, 12, 4, 0.45), inset 0 0 0 1px rgba(20, 12, 4, 0.3), 0 0 14px rgba(255, 220, 160, 0.55);
  opacity: 0;
}
.touch-ring.is-on::before { animation: outward 1.6s ease-out infinite; }
.touch-ring.is-on::after { animation: outward 1.6s ease-out 0.8s infinite; }
@keyframes outward {
  0% { transform: scale(0.4); opacity: 0; }
  20% { opacity: 0.95; }
  100% { transform: scale(2.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .touch-ring.is-on::before { animation: none; opacity: 0.9; transform: scale(1.2); }
}

/* ---------- Heart. Ring centre on K3 (1080 x 1920): 540, 942; pearl radius 91.5. Canvas = 201 px square around it. */
.iris {
  position: absolute; z-index: 4; pointer-events: none;
  left: 40.68%; top: 43.82%; width: 18.64%; height: 10.47%;
}
.bud, .heart {
  position: absolute; z-index: 6; padding: 0; border: 0; background: transparent; cursor: pointer;
  touch-action: none;
  -webkit-touch-callout: none;
}
.bud { left: 25%; top: 16%; width: 50%; height: 36%; border-radius: 40%; }
/* While the bloom follows the finger, the whole frame is the handle. */
.is-scrub .bud { left: 0; top: 0; width: 100%; height: 100%; border-radius: 0; cursor: ns-resize; }
.heart {
  left: 37.96%; top: 42.29%; width: 24.07%; aspect-ratio: 1; border-radius: 50%;
}
.heart-ring {
  position: absolute; left: 50%; top: 50%; width: 80.8%; aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(226, 193, 140, 0.6);
  opacity: 0;
}
.is-heart-hint .heart-ring { animation: ring 2.8s ease-in-out infinite; }
@keyframes ring {
  0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.94); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

/* ---------- Dive into the pearl: the veil darkens the enlarged flower, the pearl canvas lies on top. */
.veil { position: absolute; inset: 0; z-index: 7; pointer-events: none; background: #070605; opacity: 0; }
.pearl { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 8; pointer-events: none; }

/* ---------- Cues: in the black band above the object (K1: bud starts at y 370 = 19 %; K3: flower at y 480 = 25 %).
   Below is no room on K1: the plinth runs down to 86 % of the frame. */
.cue {
  position: absolute; z-index: 9; left: 12%; right: 12%; top: 7.5%;
  text-align: center; pointer-events: none;
  transition: opacity 0.5s ease;
}
.cue[hidden] { display: none; }
.cue.is-gone { opacity: 0; }
.cue-title {
  margin: 0; font-family: var(--sans); font-weight: 500; font-stretch: 112%;
  font-size: clamp(11px, 3.3cqw, 15px); letter-spacing: 0.32em; text-transform: uppercase; color: var(--gold-hi);
  opacity: 0; transform: translateY(6px); transition: opacity 0.9s ease, transform 0.9s ease;
}
.cue-sub {
  margin: 0.6em 0 0; font-family: var(--serif); font-style: italic;
  font-size: clamp(14px, 4.2cqw, 19px); color: var(--muted);
  opacity: 0; transition: opacity 0.9s ease 0.25s;
}
.cue.is-on .cue-title { opacity: 1; transform: none; }
.cue.is-on .cue-sub { opacity: 1; }
.hint {
  margin: 0.8em 0 0; min-height: 1.4em; font-size: clamp(12px, 3.6cqw, 15px); color: var(--paper);
  opacity: 0; transition: opacity 0.3s ease;
}
.hint.is-on { opacity: 0.9; }
.text-button {
  pointer-events: auto; border: 0; background: none; padding: 0.7em 0.4em; cursor: pointer;
  color: var(--gold-hi); font-size: clamp(13px, 3.8cqw, 16px); letter-spacing: 0.04em;
  text-decoration: underline; text-decoration-color: rgba(226, 193, 140, 0.4); text-underline-offset: 0.3em;
  min-height: 44px;
}
.text-button:hover { text-decoration-color: var(--gold-hi); }

.skip, .sound {
  position: fixed; z-index: 20; top: max(12px, env(safe-area-inset-top));
  padding: 10px 14px; color: var(--muted); font-size: 13px; letter-spacing: 0.08em; text-decoration: none;
  border: 0; border-radius: 999px; background: rgba(11, 11, 12, 0.45); cursor: pointer; min-height: 40px;
}
.skip { right: max(12px, env(safe-area-inset-right)); }
.sound { left: max(12px, env(safe-area-inset-left)); }
.skip:hover, .skip:focus-visible, .sound:hover, .sound:focus-visible { color: var(--paper); }
.skip[hidden], .sound[hidden] { display: none; }

/* ---------- The announcement, set inside the pearl. --d (diameter) and the centre are set by app.js. */
.message { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.message[hidden] { display: none; }
.message:focus { outline: none; }
.medallion {
  position: absolute; left: 50%; top: 49.06%;
  width: var(--d, 80cqw); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  container-type: inline-size;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 0 15%;
  text-align: center; color: var(--pearl-ink);
}
/* --fit (set by app.js) shrinks every size together when a long text would not fit inside the pearl. */
.msg-eyebrow {
  margin: 0; font-weight: 600; font-stretch: 112%;
  font-size: clamp(calc(9px * var(--fit, 1)), calc(3.4cqw * var(--fit, 1)), calc(14px * var(--fit, 1)));
  letter-spacing: 0.28em; text-transform: uppercase; color: var(--pearl-gold);
}
.msg-headline {
  margin: 0.9em 0 0; font-family: var(--serif); font-style: italic;
  font-size: clamp(calc(16px * var(--fit, 1)), calc(7.4cqw * var(--fit, 1)), calc(32px * var(--fit, 1))); line-height: 1.1;
}
.msg-name {
  margin: 0.05em 0 0; font-family: var(--serif); font-weight: 400;
  font-size: clamp(calc(30px * var(--fit, 1)), calc(16cqw * var(--fit, 1)), calc(70px * var(--fit, 1)));
  line-height: 1; letter-spacing: -0.01em; color: var(--pearl-gold);
  overflow-wrap: anywhere;
}
.msg-date { margin: 0.7em 0 0; font-family: var(--serif); font-size: clamp(calc(14px * var(--fit, 1)), calc(5.6cqw * var(--fit, 1)), calc(24px * var(--fit, 1))); }
.msg-details { margin: 0.3em 0 0; font-size: clamp(calc(10px * var(--fit, 1)), calc(3.4cqw * var(--fit, 1)), calc(14px * var(--fit, 1))); letter-spacing: 0.14em; }
.msg-from { margin: 0.9em 0 0; font-family: var(--serif); font-style: italic; font-size: clamp(calc(12px * var(--fit, 1)), calc(4.8cqw * var(--fit, 1)), calc(20px * var(--fit, 1))); }
.actions {
  position: absolute; left: 8%; right: 8%; top: calc(49.06% + var(--d, 80cqw) / 2 + 2%);
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.2em;
  pointer-events: auto;
}
.dot { color: var(--muted); }
.share-status { flex-basis: 100%; margin: 0; min-height: 1.2em; font-size: 13px; color: var(--muted); text-align: center; overflow-wrap: anywhere; }

.message [data-reveal] { opacity: 0; transform: translateY(6px); }
.message.is-open [data-reveal] {
  opacity: 1; transform: none;
  transition: opacity 1.2s ease, transform 1.2s cubic-bezier(0.2, 0, 0.2, 1);
  transition-delay: var(--delay, 0s);
}

/* Film mode (WhatsApp MP4): nobody can touch a video, so no cues, buttons or touch hints. */
.is-film .cue, .is-film .actions, .is-film .touch-ring, .is-film .heart-ring, .is-film .skip, .is-film .sound { display: none !important; }

.error { position: fixed; inset: auto 0 40%; text-align: center; color: var(--paper); font-family: var(--serif); font-size: 20px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}

/* Accessible alternative to text inside the decorative pearl; the scene remains available. */
.is-film #reading{display:none!important}
body.is-reading{overflow:auto;background:#0b0b0c}
.is-reading .stage{position:relative;inset:auto;transform:none;width:min(680px,100%);height:auto;min-height:100dvh;margin:auto;padding:80px 20px 40px;overflow:visible;touch-action:auto;user-select:text;-webkit-user-select:text}
.is-reading .cam,.is-reading .pearl,.is-reading .veil,.is-reading .cue,.is-reading .flash,.is-reading .touch-ring{display:none!important}
.is-reading .message{position:relative;inset:auto;pointer-events:auto}
.is-reading .medallion{position:static;transform:none;width:100%;aspect-ratio:auto;display:block;padding:32px 22px;background:#f3efe6;border:1px solid #c9a063;border-radius:18px;box-shadow:0 0 40px #c9a06316}
.is-reading .medallion [data-field]{overflow-wrap:anywhere;max-width:100%;line-height:1.5;letter-spacing:normal}
.is-reading .msg-eyebrow,.is-reading .msg-details{font-size:16px}
.is-reading .msg-headline,.is-reading .msg-date,.is-reading .msg-from{font-size:20px}
.is-reading .msg-name{font-size:clamp(30px,8vw,44px);line-height:1.15}
.is-reading .message [data-reveal]{opacity:1;transform:none;transition:none}
.is-reading .actions{position:static;margin-top:22px;gap:12px}
.is-reading .text-button{font-size:16px;min-height:44px}
#reading{min-height:44px;font-size:16px}
