/* © 2026 Devello Inc. osmo.website: the choice (js/choices.js). Devello written by hand, then three
 * ways in set around the glass egg like a title card: Remember upper left of it, the Why Engine lower right, the East
 * Door's words beneath the egg. The site's own type and night (css/eastdoor.css's tokens), words, never icons, buttons
 * or a menu; amber only for the hairline that marks focus. Arrivals and departures are opacity and a soft blur, never a
 * keyframe, so the doors' copies of the page (cloned at the tap) show exactly what was on screen. */

.choices { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.way:not([data-scene="choose"]) .choices { pointer-events: none; }
.way:not([data-scene="choose"]) .choices .path { pointer-events: none; }

/* the opening: Devello, dead centre, written as Remember writes it */
.sign { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 24px; pointer-events: none; }
.sign > svg { display: block; overflow: visible; color: var(--ink); font-size: clamp(40px, min(16vw, 13vh), 112px);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
  transition: opacity 1s ease, filter 1s ease; }
.sign > svg.leave { opacity: 0; filter: blur(6px) drop-shadow(0 0 10px rgba(255, 255, 255, 0)); }
.sign .ink path { fill: currentColor; fill-opacity: 0; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1 1; stroke-dashoffset: 1;
  animation: choice-trace 1.15s cubic-bezier(0.65, 0, 0.35, 1) calc(var(--i) * var(--step) + 0.2s) forwards,
    choice-ink 0.95s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--i) * var(--step) + 0.95s) forwards; }
@keyframes choice-trace { to { stroke-dashoffset: 0; } }
@keyframes choice-ink { to { fill-opacity: 1; stroke-opacity: 0; } }
/* "tap to begin" and "Remember", as main's Remember sets them: small, italic, out of a soft blur, dead centre */
.sign > .line { grid-area: 1 / 1; margin: 0; font-style: italic; font-size: clamp(16px, 1.45vw, 21px); letter-spacing: 0.035em;
  color: var(--ink); text-align: center; text-wrap: balance; opacity: 0; filter: blur(5px); transition: opacity 1.3s ease, filter 1.3s ease; }
.sign > svg { grid-area: 1 / 1; }
.sign > .line.title { font-size: clamp(19px, 1.8vw, 26px); letter-spacing: 0.02em; }
.sign > .line.begin { letter-spacing: 0.06em; }
.sign > .line.in { opacity: 0.92; filter: blur(0); }
.sign > .line.leave { opacity: 0; filter: blur(5px); transition-duration: 1.1s; }

/* the opening is on black, as today; the night opens (the stars come out) as the choices come */
.way.choosing:not(.night-in) .sky { opacity: 0; }
.way.night-in .sky { transition: opacity 2.6s ease; }

/* the space (js/space.js): one canvas under the page, the night and its three objects; it comes in as the night opens
 * (its stars come out one by one in the shader, as sky.js reveals them) */
canvas.space { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; display: block; pointer-events: none;
  opacity: 0; transition: opacity 2.6s ease; }
canvas.space.in { opacity: 1; }
/* the first stars (js/first-stars.js): black with its stars from the first frame, over the opening's host
 * (mounted before it) until the scene's first frame, then cross-faded to it; under the page's own layer (.way, z 1) */
/* tap to begin (js/first-stars.js takes the tap): one quiet line, small, dead centre of the visible screen (the dynamic
   viewport: a phone's toolbar shown or hidden), breathing slowly, over the stars; it fades as the camera moves. The
   word alone is centred; the hint (an iPhone without audioSession) hangs below it and shows for 3 s after the tap. */
button.begin { position: fixed; inset: 0; z-index: 5; bottom: auto; height: 100vh; height: 100svh; height: 100dvh;
  display: grid; place-items: center; margin: 0; padding: 0 16px; border: 0;
  background: transparent; color: var(--ink, #f1ede4); font: 400 15px/1.3 var(--serif, serif); letter-spacing: 0.12em;
  cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
button.begin .begin-word { animation: begin-breathe 3.6s ease-in-out infinite; }
button.begin .begin-hint { position: absolute; left: 16px; right: 16px; top: calc(50% + 1.4em); text-align: center;
  font-size: 13px; letter-spacing: 0.06em; font-style: italic; opacity: 0; transition: opacity 0.6s ease; }
button.begin.begun { pointer-events: none; }
button.begin.begun .begin-word { animation: none; opacity: 0; transition: opacity 0.9s ease; }
button.begin.hint .begin-hint { opacity: 0.62; }
@keyframes begin-breathe { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.82; } }
@media (prefers-reduced-motion: reduce) { button.begin .begin-word { animation: none; opacity: 0.66; } }
canvas.first-stars { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; display: block; pointer-events: none;
  background: #000; }
/* the home's opening (js/opening.js): its own canvas in this host, from the first frame (the opening is black, then the
 * glass egg in the dark); a tap reaches the page, never the scene's canvas */
.opening { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.opening > canvas { display: block; width: 100%; height: 100%; }
/* while the opening plays, its own controls (the tap that unmutes, its quiet "skip" word) take taps: the page's layer
 * lets them through (the footer stays the footer) */
.opening.live { pointer-events: auto; }
/* End's way home (js/why-end.js): the opening it rebuilds is moved by End, never skipped; its "skip" word stays hidden */
html[data-end-beat] .opening .opening-skip { visibility: hidden !important; }
/* reduced motion has no opening to skip (js/opening.js takes the scene to its settle at the tap): no "skip" word */
@media (prefers-reduced-motion: reduce) { .opening .opening-skip { display: none !important; } }
.way.opening-on, .way.opening-on * { pointer-events: none; }
.way { background: transparent; }
/* the 2D night: shown only where WebGL2 is missing; otherwise it holds the night the Why Engine's collapse draws in */
.way:not(.no-gl) .sky { opacity: 0; visibility: hidden; transition: opacity 0.9s ease, visibility 0s linear 0.9s; }
/* the Remember hand-off and the East Door's film: the space's sky, still (js/far-sky.js), over the opening as its
 * objects fade (the sky stays); back from the film it fades out over the live opening again */
.way[data-veil="sky"]:not(.no-gl) .sky { opacity: 1; visibility: visible; transition: opacity 0.9s ease, visibility 0s; }

/* the three ways in: each object's words hang beneath it, placed by js/way-in.js where the object is drawn */
.paths { position: absolute; inset: 0; pointer-events: none; --name: clamp(22px, 2.3vw, 32px); --say: clamp(15px, 1.25vw, 18px); }
.path { position: absolute; left: 0; top: 0; display: grid; justify-items: center; gap: 0.2em; padding: 4px 6px 6px;
  text-align: center; pointer-events: auto; color: var(--ink); text-decoration: none; outline: none; will-change: transform;
  opacity: 0; filter: blur(6px); transition: opacity 2.4s ease, filter 2.4s ease; -webkit-tap-highlight-color: transparent; }
.path.in { opacity: 1; filter: none; }
/* words whose object is not on the screen, or that would print over other words, wait unseen (js/way-in.js onFrame) */
.way .path.unplaced { opacity: 0 !important; pointer-events: none !important; }
.name { position: relative; display: inline-block; font: 400 var(--name)/1.15 var(--serif); letter-spacing: 0.01em;
  color: rgba(246, 239, 232, 0.86); transition: color 0.5s ease; white-space: nowrap; }
.path .line { display: block; font: italic var(--say)/1.4 var(--serif); letter-spacing: 0.02em; color: var(--muted); white-space: nowrap; }
/* the bespoke focus: an amber hairline under the name, never a ring */
.name::after { content: ""; position: absolute; left: 6%; right: 6%; bottom: -2px; height: 1px; background: var(--amber);
  opacity: 0; transform: scaleX(0.4); transition: opacity 0.4s ease, transform 0.6s var(--rise); }
.path:hover .name, .path.near .name, .path:focus-visible .name, .door-button:hover .name, .door-button:focus-visible .name { color: var(--ink); }
.path:focus-visible .name::after, .door-button:focus-visible .name::after, .path.near .name::after { opacity: 0.8; transform: none; }
/* a 44 px target, as tall as a finger needs, its name centred in it */
.door-button { margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; outline: none;
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.door-words { margin: 0; max-width: min(86vw, 24em); text-wrap: balance; pointer-events: none; }
.door-words .line { white-space: normal; }
.way[data-door="open"] .door-hours { color: rgba(255, 214, 178, 0.78); }

/* where WebGL2 is missing: the stills, laid where the objects would be */
.stills { position: absolute; inset: 0; pointer-events: none; display: none; }
.way.no-gl .stills { display: block; }
.stills img { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity 2.4s ease; }
.way.no-gl.night-in .stills img { opacity: 1; }
.way.no-gl[data-leaving] .stills img { opacity: 0; transition-duration: 1.2s; }
.way.no-gl[data-leaving] .stills .still-door { transition-duration: 0.6s; }

/* at rest (js/choices.js rest(), on time or by its deadline): full ink, no transition left to run */
.way.choices-rest .path.in { transition: none; opacity: 1; filter: none; }

/* a choice made: the others' words leave as the camera goes; the chosen words stay a little longer (the Why Engine's
 * stay for the collapse to pull in) */
.way[data-leaving] .path { opacity: 0; filter: blur(6px); transition-duration: 1.1s; }
.way[data-leaving] .path.chosen { transition-delay: 1.4s; }
/* the Why Engine (the director's sheet, F1): every label fades, the chosen one with the rest, all gone by 1.0 s; no
 * letter falls (js/why-fall.js) */
.way[data-leaving="why"] .path, .way[data-leaving="why"] .path.chosen { opacity: 0; filter: none; transition: opacity 0.9s ease 0s; }
.way[data-leaving] ~ footer { opacity: 0; transition: opacity 1s ease; pointer-events: none; }
/* the hand-off to Remember's page: the swell's light gives way to the film's own black */
.way[data-veil="night"] .veil { opacity: 1; transition: opacity 0.7s ease; }
.way[data-veil="night"] ~ footer { opacity: 0; }

/* the theatre doors (js/choices.js partDoors): two halves of the page, made at the tap, meeting exactly at a whole
 * pixel, easing apart behind the egg (the eggs' canvas, z-index 2, stays above them). Their inner edges soften into the
 * night the egg ends on (#06050a) only once they move, and each casts a faint shadow inward onto what is revealed. */
.doors { position: absolute; inset: 0; z-index: 1; pointer-events: none; perspective: 1500px; perspective-origin: 50% 48%;
  --door-night: #06050a; }
.door { position: absolute; top: 0; bottom: 0; will-change: transform; }
.door-l { transform-origin: 0 50%; }
.door-r { transform-origin: 100% 50%; }
.door-leaf { position: absolute; inset: 0; overflow: hidden; }
.door-page { position: absolute; top: 0; }
.door-page > .door-sky { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.door-page > .door-words-layer { position: absolute; inset: 0; }
.door-page .paths .path { transition: none; }
.door-page .shell::before { display: none; }
.door-dim { position: absolute; inset: 0; background: var(--door-night); opacity: 0; }
.door-soft { position: absolute; top: 0; bottom: 0; width: var(--soft); opacity: 0; }
.door-l .door-soft { right: 0; background: linear-gradient(to left, var(--door-night), rgba(6, 5, 10, 0)); }
.door-r .door-soft { left: 0; background: linear-gradient(to right, var(--door-night), rgba(6, 5, 10, 0)); }
.door-shade { position: absolute; top: 0; bottom: 0; width: var(--shade); opacity: 0; }
.door-l .door-shade { left: 100%; background: linear-gradient(to right, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0)); }
.door-r .door-shade { right: 100%; background: linear-gradient(to left, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0)); }
/* the page itself steps out of the way the moment its halves exist (the egg's canvas stays in front) */
.way[data-doors="parted"] :is(.sky, .choices) { visibility: hidden; }
.way.no-gl[data-doors="parted"] .choices .path-door .shell { visibility: visible; }
.way[data-doors="fade"] :is(.sky, .choices) { opacity: 0; transition: opacity 0.6s ease; }

/* the record hook draws the film egg alone */
.way.record .choices { display: none; }
.eggs[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .sign .ink path { animation: none; fill-opacity: 1; stroke-opacity: 0; stroke-dashoffset: 0; }
  .sign > svg, .sign > svg.leave, .path, .way[data-leaving] .path { filter: none; }
  .path { transition: opacity 0.9s ease; }
  .way.door-in .eggs-gl { transition-duration: 0.9s; }
  .sign > .line, .sign > .line.leave { filter: none; }
  .way[data-leaving] .path.chosen { transition-delay: 0s; }
}
