/* The narrated film (js/narration/, owner 2026-10-10): the card that asks
   first, the night sky behind it, the subtitles and the bar while it plays,
   and the Resume button once the visitor takes over.

   Stacking: above the cold open (#loader, 100), below the cookie banner (150)
   so its buttons are never covered, and below the pilot form (200). */

.ap { position: relative; z-index: 140; font-family: var(--mono); }
.ap button { font: inherit; cursor: pointer; }
.ap [hidden] { display: none !important; }
.ap audio { display: none; }

/* ---- until the visitor chooses: nothing but a dark sky with stars behind the card.
   html.ap-asking is set by the head's inline script, so without JavaScript none of
   this shows and the page reads as it always did. */
html.ap-asking, html.ap-asking body { overflow: hidden; }
html.ap-asking body > :not(.ap) { visibility: hidden !important; }
.ap-choice, .ap-sky { display: none; }
html.ap-asking .ap-choice, html.js .ap-sky { display: block; }

.ap-sky { position: fixed; inset: 0; background: radial-gradient(120% 80% at 70% 20%, #0b1430 0%, #060a18 45%, var(--bg) 75%);
  transition: opacity 2s ease, visibility 0s linear 2s; }
html:not(.ap-asking) .ap-sky { opacity: 0; visibility: hidden; }
/* two star tiles too large to see repeat, moved by transform and opacity alone */
.ap-sky::before, .ap-sky::after { content: ""; position: absolute; inset: -12%; background-repeat: repeat; will-change: transform, opacity; }
.ap-sky::before { background-image: url(../assets/stars-faint.svg); animation: ap-drift 180s linear infinite alternate; }
.ap-sky::after { background-image: url(../assets/stars-bright.svg); animation: ap-twinkle 4.5s ease-in-out infinite alternate, ap-drift 260s linear infinite alternate; }
@keyframes ap-drift { to { transform: translate3d(-6%, 3%, 0); } }
@keyframes ap-twinkle { from { opacity: .35; } to { opacity: 1; } }

.ap-choice { position: fixed; inset: 0; margin: auto; inline-size: min(30rem, calc(100vw - 32px)); block-size: max-content;
  padding: 30px 30px 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(6, 9, 18, .82);
  backdrop-filter: blur(14px); box-shadow: 0 30px 90px rgba(0, 0, 0, .6); text-align: center;
  animation: ap-in .7s cubic-bezier(.2, .7, .3, 1); }
@keyframes ap-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.ap-kicker { margin: 0; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--belt); }
.ap-choice h2 { margin: 12px 0 8px; font-family: var(--head); font-size: clamp(24px, 3vw, 30px); font-weight: 500;
  letter-spacing: -.02em; color: var(--text); line-height: 1.15; }
.ap-sub { margin: 0 0 22px; font-size: 13px; color: var(--mute); line-height: 1.6; }
.ap-buttons { display: flex; flex-direction: column; gap: 10px; }
.ap-watch { padding: 14px 22px; border: 0; border-radius: 999px; background: var(--anchor); color: #04121a;
  font-size: 13.5px; letter-spacing: .06em; font-weight: 600; }
.ap-watch:hover { filter: brightness(1.08); }
.ap-self { padding: 12px 22px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--mute);
  font-size: 12.5px; letter-spacing: .06em; }
.ap-self:hover { color: var(--text); border-color: var(--mute); }
.ap-note { margin: 16px 0 0; font-size: 10.5px; color: var(--mute-2); letter-spacing: .04em; }

/* ---- while it plays: one or two sentences of subtitle, the words said lit */
.ap-caption { position: fixed; inset-inline: 0; inset-block-end: 88px; margin: 0 auto; inline-size: max-content;
  max-inline-size: min(38rem, calc(100vw - 32px)); padding: 8px 16px; border-radius: 10px;
  background: rgba(4, 6, 12, .66); backdrop-filter: blur(8px); font-family: var(--head);
  font-size: clamp(15px, 1.35vw, 18px); line-height: 1.45; color: var(--mute); text-align: center; text-wrap: balance; }
.ap-caption.swap { animation: ap-sub .35s ease; }
@keyframes ap-sub { from { opacity: 0; transform: translateY(4px); } }
.ap-caption .said { color: var(--text); }

.ap-bar { position: fixed; inset-inline: 0; inset-block-end: 24px; margin: 0 auto; inline-size: max-content;
  max-inline-size: calc(100vw - 24px); display: flex; align-items: center; gap: 6px; padding: 6px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(6, 9, 18, .82); backdrop-filter: blur(12px); }
.ap-bar > button { display: inline-flex; align-items: center; justify-content: center; min-inline-size: 36px; block-size: 36px;
  padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--mute); font-size: 12px; letter-spacing: .06em; }
.ap-bar > button:hover { color: var(--text); background: rgba(160, 178, 214, .1); }
.ap-bar > .ap-play { color: var(--text); background: rgba(79, 198, 218, .16); }
.ap-cc[aria-pressed="false"] { text-decoration: line-through; opacity: .6; }
.ap-chapters { display: flex; gap: 3px; margin: 0 6px; padding: 0; list-style: none; }
.ap-chapters button { display: block; inline-size: 14px; block-size: 6px; padding: 0; border: 0; border-radius: 3px; background: var(--line); }
.ap-chapters button.done { background: var(--mute-2); }
.ap-chapters button.now { background: var(--anchor); box-shadow: 0 0 10px var(--anchor); }

.ap-resume { position: fixed; inset-inline: 0; inset-block-end: 24px; margin: 0 auto; inline-size: max-content; padding: 12px 20px;
  border: 1px solid rgba(79, 198, 218, .5); border-radius: 999px; background: rgba(6, 9, 18, .86); color: var(--anchor);
  font-size: 12px; letter-spacing: .06em; }

/* the player moves the page itself: the page's smooth scrolling would fight it */
html.ap-on { scroll-behavior: auto !important; }

@media (prefers-reduced-motion: reduce) {
  .ap-sky::before, .ap-sky::after, .ap-choice, .ap-caption.swap { animation: none; }
}
/* a phone keeps every control but the chapter dots; the narrowest drop the skip
   too, or the bar would run off the screen */
@media (max-width: 640px) {
  .ap-chapters { display: none; }
  .ap-caption { inset-block-end: 84px; }
}
@media (max-width: 380px) { .ap-bar > .ap-skip { display: none; } }
