/* ============================================================
   SPACE SUPREMACY — EXPERIENCE LAYER
   Scroll-driven cinematic landing. Loads on top of styles.css.
   Chapters are tall sections (.ch.pin) with a sticky .stage;
   JS writes --p (0..1) per chapter and per-frame effect values.
   ============================================================ */

body.exp {
  background: var(--bg-0);
}
[hidden] { display: none !important; }
body.exp::before { display: none; } /* kill the static grid; canvas owns the bg */

/* fine pointers get the reticle cursor */
@media (pointer: fine) {
  body.exp.cursor-on, body.exp.cursor-on a, body.exp.cursor-on button,
  body.exp.cursor-on .btn, body.exp.cursor-on input, body.exp.cursor-on label {
    cursor: none;
  }
}

/* ---------- warp canvas + overlays ---------- */
#warp {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(76, 224, 255, 0.012) 0px,
    rgba(76, 224, 255, 0.012) 1px,
    transparent 1px,
    transparent 4px
  );
}
.exp-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 55%, rgba(1, 3, 6, 0.62) 100%);
}

/* ---------- custom cursor ---------- */
.reticle-cursor {
  position: fixed;
  z-index: 200;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 1px solid rgba(76, 224, 255, 0.7);
  border-radius: 50%;
  pointer-events: none;
  display: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.reticle-cursor::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: var(--electric);
  box-shadow: 0 0 6px var(--electric);
}
.reticle-cursor::before {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px dashed rgba(76, 224, 255, 0.25);
  border-radius: 50%;
}
.reticle-cursor.hot {
  transform: scale(1.7);
  border-color: var(--electric);
  background: rgba(40, 238, 255, 0.08);
}
@media (pointer: fine) {
  body.exp.cursor-on .reticle-cursor { display: block; }
}

/* ---------- boot overlay ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg-0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}
.boot.gone { opacity: 0; pointer-events: none; }
.boot-inner { width: min(520px, 86vw); }
.boot-line {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 22px;
  white-space: nowrap;
  overflow: hidden;
}
.boot-line .ok { color: var(--green); }
.boot-line .hi { color: var(--cyan); }
.boot-bar {
  margin-top: 14px;
  height: 2px;
  background: rgba(76, 224, 255, 0.12);
  overflow: hidden;
}
.boot-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--electric);
  box-shadow: 0 0 12px var(--electric);
}
.boot-skip {
  margin-top: 18px;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
}

/* ---------- HUD chrome ---------- */
.hud-rail {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.hud-rail a {
  width: 8px;
  height: 8px;
  border: 1px solid var(--cyan-dim);
  border-radius: 50%;
  background: transparent;
  transition: background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
}
.hud-rail a:hover { border-color: var(--electric); }
.hud-rail a.on {
  background: var(--electric);
  border-color: var(--electric);
  box-shadow: 0 0 10px var(--electric);
}
.hud-rail a .tip {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cyan);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.hud-rail a:hover .tip { opacity: 1; }

.hud-stat {
  position: fixed;
  left: var(--gutter);
  bottom: 22px;
  z-index: 90;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 2.1;
  pointer-events: none;
}
.hud-stat div { white-space: nowrap; }
.hud-stat .hi { color: var(--cyan); }

/* ---------- chapter scaffolding ---------- */
.ch { position: relative; z-index: 2; }
.ch.pin { height: 300vh; }
.ch.pin.tall { height: 380vh; }
.landing-only .ch.pin { height: 240vh; }
.landing-only .ch.pin.tall { height: 300vh; }
.landing-only #top { height: 170vh !important; }
.ch .stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  display: grid;
  align-items: center;
}
.stage-inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--gutter);
  position: relative;
}

/* Authored imagery stays beneath the HUD and scroll choreography. */
.hero-gameplay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}


/* chapter heading kit */
.ch-kicker {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 22px;
}
.ch-kicker::before {
  content: "";
  width: 40px;
  height: 1px;
  background: var(--electric);
  box-shadow: 0 0 8px var(--electric);
}
.mega {
  margin: 0;
  font-weight: 700;
  font-size: clamp(38px, 7.2vw, 104px);
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--heading);
  text-wrap: balance;
}
.mega .ghost {
  display: block;
  color: transparent;
  -webkit-text-stroke: 1px rgba(76, 224, 255, 0.45);
}
.mega .lit {
  display: block;
  text-shadow: 0 0 30px rgba(76, 224, 255, 0.45);
}
.ch-sub {
  margin: 24px 0 0;
  max-width: 52ch;
  color: var(--body);
  font-size: clamp(13px, 1.4vw, 15px);
  letter-spacing: 0.04em;
}
.ch-read {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: 40px;
  padding: 8px 18px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.ch-read:hover { color: var(--cyan); border-color: var(--hairline-strong); }

/* generic scroll-driven helpers (driven by --p) */
.rise { transform: translateY(calc((1 - var(--p, 0)) * 60px)); opacity: var(--p, 0); }



/* ============================================================
   CH-05 GALLERY — horizontal film strip
   ============================================================ */
.strip-stage .stage-inner {
  width: 100vw;
  max-width: 100vw;
  min-width: 0;
  padding-inline: 0;
}
.strip-head { padding-inline: var(--gutter); max-width: var(--maxw); margin: 0 auto 5vh; }
.strip-note {
  max-width: 74ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.05em;
}
.film-strip {
  display: flex;
  gap: 18px;
  width: max-content;
  padding-inline: var(--gutter);
  will-change: transform;
}
.frame {
  position: relative;
  width: clamp(260px, 34vw, 460px);
  aspect-ratio: 16 / 10;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-1);
  flex: none;
  margin: 0;
}
.frame > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease, filter 0.45s ease;
}
.frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(1,5,8,0.08), transparent 42%, rgba(1,5,8,0.92));
  pointer-events: none;
}
.frame:hover > img { transform: scale(1.035); filter: saturate(1.12); }
.frame.store-frame > img { transform: scale(1.22); }
.frame.store-frame:hover > img { transform: scale(1.28); }
.frame figcaption {
  position: absolute;
  z-index: 2;
  left: 14px;
  right: 14px;
  bottom: 13px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  color: var(--heading);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.frame figcaption b { font-weight: 600; }
.frame figcaption small {
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-align: right;
}
.frame .ph { position: absolute; inset: 0; }
.frame .corner-id { position: absolute; top: 10px; left: 12px; font-size: 9px; letter-spacing: 0.2em; color: var(--cyan); text-transform: uppercase; z-index: 2; }
.frame.trailer { width: clamp(300px, 44vw, 620px); }

/* ============================================================
   CALM MEDIA BANDS
   ============================================================ */
.calm { position: relative; z-index: 2; }

/* ---------- reduced motion: unpin everything, show all ---------- */
@media (prefers-reduced-motion: reduce) {
  .ch.pin, .ch.pin.tall { height: auto; }
  .ch .stage { position: relative; height: auto; overflow: visible; padding-block: 16vh; }
  .rise { transform: none; opacity: 1; }
  .strip-stage { overflow: hidden; }
  .film-strip {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    transform: none !important;
  }
  .frame,
  .frame.trailer { width: 100%; }
  
  .boot { display: none; }
  .reticle-cursor { display: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  
  .hud-rail { right: 10px; }
  .hud-rail a .tip { display: none !important; }
  .hud-stat { display: none; }
  .ch.pin { height: 240vh; }
  .ch.pin.tall { height: 300vh; }
  .landing-only .ch.pin { height: 190vh; }
  .landing-only .ch.pin.tall { height: 230vh; }
  .landing-only #top { height: 150vh !important; }
  
}
