/**
 * Structural and accessibility primitives shared by all three versions.
 * Deliberately carries no colour, type, or art direction — those belong to each
 * version's own stylesheet, and sharing them would make the versions rhyme when
 * the brief asks for them to differ.
 */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  /* The player is the point of the page; never let a stray element scroll it
     sideways on a phone. */
  overflow-x: hidden;
}

img, picture, video, iframe { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

.visually-hidden:not(:focus):not(:active) {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 0.5rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
}
.skip-link:focus { top: 0; }

/* A single visible focus treatment for the whole page. Versions restyle the
   colour; none of them removes it. */
:focus-visible {
  outline: 3px solid var(--focus, #FFB909);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ------------------------------------------------------------------ *
 * State visibility
 *
 * One rule set decides what each stream state shows. The submit control is
 * absent from the fallback state entirely — not merely dimmed — because the
 * brief requires that the page never implies submissions are open when the
 * show is offline.
 * ------------------------------------------------------------------ */

/* A panel declares how it wants to lay out via --panel-display; this rule owns
   *whether* it shows. Versions must not put `display` on a panel class — a
   later `.panel-x { display: grid }` in a version's stylesheet would beat the
   `display: none` here on source order and pin the panel on screen in every
   state. Setting the custom property instead keeps the two concerns apart. */
[data-panel] { display: none; }
body[data-state="loading"]   [data-panel="loading"],
body[data-state="countdown"] [data-panel="countdown"],
body[data-state="live"]      [data-panel="live"],
body[data-state="fallback"]  [data-panel="fallback"] { display: var(--panel-display, block); }

body[data-state="fallback"] [data-submit-region] { display: none; }

[data-subs-text] { display: none; }
body[data-subs="open"]      [data-subs-text="open"],
body[data-subs="paid-only"] [data-subs-text="paid-only"] { display: inline; }

/* ------------------------------------------------------------------ *
 * Embeds
 * ------------------------------------------------------------------ */

/* The stage box holds every state — player, countdown, fallback — at a locked
   16:9. Reserving it here rather than in each version's CSS is deliberate: the
   video ID arrives asynchronously from detection, and a hero that resizes when
   it lands is a layout shift the brief explicitly rules out. */
.stage-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.stage-media [data-panel] { position: absolute; inset: 0; }

[data-player-slot] { position: absolute; inset: 0; }
[data-player-slot] iframe,
[data-chat-slot] iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

[data-chat-slot] { position: relative; min-height: 0; }

/* ------------------------------------------------------------------ *
 * Carousel
 *
 * Two layers, cross-fading. Structure only — each version sets its own
 * duration, scrim and any pan, and decides which slides to run.
 * ------------------------------------------------------------------ */

[data-carousel] { position: absolute; inset: 0; overflow: hidden; }

.carousel-layer {
  position: absolute;
  /* Oversized so the drift never exposes an edge. */
  inset: -3%;
  background-position: 50% 50%;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.1s ease-in-out;
  will-change: opacity, transform;
}
.carousel-layer.is-on { opacity: 1; }

/* Ken Burns. The slide is always moving, so the panel never reads as a static
   picture — but slowly enough that you notice the room breathing rather than
   the animation. Only ever applied to the layer that is on screen. */
@media (prefers-reduced-motion: no-preference) {
  .carousel-layer.is-drifting { animation: kenburns 14s ease-out forwards; }
}
@keyframes kenburns {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to   { transform: scale(1.11) translate3d(-1.2%, -1%, 0); }
}

/* Slide rail — shows how many slides there are and which one is up. */
.carousel-rail { display: flex; gap: 5px; }
.carousel-dot {
  width: 18px;
  height: 2px;
  border: 0;
  padding: 0;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.28);
  transition: background 0.3s ease, width 0.3s ease;
}
.carousel-dot[aria-current="true"] { background: var(--focus, #FFB909); width: 30px; }

/* ------------------------------------------------------------------ *
 * Intro
 *
 * Sits above everything for under a second, then removes itself. It is
 * aria-hidden and untabbable, so it never exists for assistive tech, and the
 * page underneath is fully rendered the whole time.
 * ------------------------------------------------------------------ */

[data-intro] {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: #08060A;
  transition: opacity 0.55s ease, visibility 0.55s;
}
[data-intro].is-out { opacity: 0; visibility: hidden; pointer-events: none; }

/* The site is not shown until the intro has finished. The page still *loads*
   underneath — markup, CSS and images are all fetched during the reveal, so the
   site is ready the instant it appears rather than starting from scratch — it
   simply is not revealed until then.
   Nothing here can strand the page: the class is removed by a timer, and if
   scripting never runs at all the intro markup is never activated and the site
   shows normally. */
body.is-intro { overflow: hidden; }
body.is-intro main,
body.is-intro .masthead,
body.is-intro .colophon,
body.is-intro .scene { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  [data-intro] { display: none; }
}

/* ------------------------------------------------------------------ *
 * Modal mechanics
 * ------------------------------------------------------------------ */

body.is-modal-open { overflow: hidden; }

[data-modal] {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: clamp(0.75rem, 3vw, 2rem);
}
[data-modal][hidden] { display: none; }

[data-modal-backdrop] {
  position: fixed;
  inset: 0;
  border: 0;
  padding: 0;
  cursor: default;
}

[data-modal-scroll] {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* The submission destinations do not exist until the rules are acknowledged.
   display:none rather than opacity — a keyboard or screen-reader user must not
   reach them early. */
[data-modal][data-acknowledged="false"] [data-ack-gated] { display: none; }
[data-modal][data-acknowledged="true"]  [data-ack-prompt] { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
