/* ship/ship.css: the vessel's chrome, shared by every deck.
 *
 * Built on the vendored scifi-ui tokens (--holo-*) and its panel surface
 * (.holopanel) rather than beside them. Each deck sets --deck, its accent as a
 * bare "r g b" triplet, on <body>; everything accent coloured reads it, so the
 * bridge glows beam white, the gamma deck magenta, and nothing is repainted.
 *
 * The hull (the WebGL canvas) sits fixed behind the page. Instruments are
 * ordinary DOM boxes with the class .viewport; ship.js renders a 3D view into
 * each one's rectangle on the shared canvas, so the page still scrolls, still
 * reflows on a phone, and every control stays a real control.
 */

:root {
  --deck: 178 216 248;
  --void: 2 4 9;
  --ink: var(--holo-ink, 239 244 251);
  --dim: var(--holo-dim, 154 162 177);
  --line: var(--holo-line, 196 228 255);
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --bar-h: 58px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 12px;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
html, body { margin: 0; padding: 0; }
body {
  background: rgb(var(--void));
  color: rgb(var(--ink) / .92);
  font-family: var(--sans);
  font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}
*, *::before, *::after { box-sizing: border-box; }
a { color: rgb(var(--deck)); }
.mono, .num, svg text, .u { font-family: var(--mono); }
.u { color: rgb(var(--dim)); font-weight: 400; font-size: .72em; letter-spacing: .04em; }
sup { font-size: .68em; }
b, strong { color: rgb(var(--ink)); font-weight: 600; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid rgb(var(--deck)); outline-offset: 3px; border-radius: 4px; }

/* ---- the hull: the one canvas every instrument draws on ----------------- */
.hull {
  position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%;
  display: block; pointer-events: none;
}
/* a thin haze over the hull so panels float on space rather than on black */
.hull-haze {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% -10%, rgb(var(--deck) / .10), transparent 60%),
    linear-gradient(to bottom, rgb(var(--void) / 0) 0%, rgb(var(--void) / .35) 100%);
}
body.no-webgl .hull { display: none; }
.deck { position: relative; z-index: 1; }

/* ---- the deck bar ------------------------------------------------------- */
.deckbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  height: var(--bar-h); padding: 0 var(--gutter);
  background: linear-gradient(to bottom, rgb(4 8 16 / .92), rgb(4 8 16 / .72));
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid rgb(var(--line) / .14);
}
.deckbar::after {
  content: ""; position: absolute; left: 10%; right: 10%; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgb(var(--deck) / .9) 50%, transparent);
  box-shadow: 0 0 14px rgb(var(--deck) / .5);
}
.deckbar .brand {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: rgb(var(--ink)); min-width: 0;
}
.deckbar .brand img { position: relative; z-index: 1; width: 26px; height: 26px; flex: none; }
/* the glow sits behind the icon, not over it */
.deckbar .brand .ico { position: relative; flex: none; width: 26px; height: 26px; }
.deckbar .brand .ico::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; background: radial-gradient(circle, rgb(var(--deck) / .35), transparent 70%); z-index: 0; }
.deckbar .brand .name { font-family: var(--mono); font-size: 13px; letter-spacing: .22em; text-transform: uppercase; white-space: nowrap; }
.deckbar .brand .sub { display: block; font-size: 9.5px; letter-spacing: .26em; color: rgb(var(--dim)); margin-top: 2px; white-space: nowrap; }
.decknav {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 21; height: var(--bar-h);
  display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0;
}
.decknav a {
  position: relative; font-family: var(--mono); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase;
  color: rgb(var(--dim)); text-decoration: none; padding: 9px 12px; border-radius: 6px; white-space: nowrap;
  transition: color .3s, background .3s;
}
.decknav a:hover, .decknav a.holo-on, .decknav a:focus-visible { color: rgb(var(--ink)); background: rgb(var(--line) / .06); }
.decknav a[aria-current="page"] { color: rgb(var(--deck)); }
.decknav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 4px; height: 1px;
  background: rgb(var(--deck)); box-shadow: 0 0 8px rgb(var(--deck));
}
.decknav .k { display: inline-block; margin-right: 7px; color: rgb(var(--line) / .35); }
.deckbar .share {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase;
  background: none; border: 1px solid rgb(var(--line) / .22); color: rgb(var(--dim));
  padding: 8px 14px; border-radius: 6px; cursor: pointer; white-space: nowrap; transition: .3s;
}
.deckbar .share:hover, .deckbar .share.holo-on { color: rgb(var(--deck)); border-color: rgb(var(--deck) / .6); box-shadow: 0 0 16px rgb(var(--deck) / .25); }

/* on a phone the deck rail becomes a dock along the bottom edge */
@media (max-width: 980px) {
  .decknav {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; transform: none; height: auto; z-index: 20; justify-content: space-around; gap: 0;
    background: linear-gradient(to top, rgb(4 8 16 / .96), rgb(4 8 16 / .80));
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgb(var(--line) / .14); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .decknav a { font-size: 9px; letter-spacing: .12em; padding: 8px 6px; }
  .decknav .k { display: none; }
  .decknav a[aria-current="page"]::after { left: 6px; right: 6px; bottom: 2px; }
  body { padding-bottom: 64px; }
}
@media (max-width: 480px) { .deckbar .brand .sub { display: none; } .decknav a { padding: 8px 3px; letter-spacing: .06em; font-size: 8.5px; } }

/* ---- page structure ----------------------------------------------------- */
.deck-wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }
.stage { position: relative; padding: clamp(48px, 8vh, 96px) 0; }
.stage + .stage { border-top: 1px solid rgb(var(--line) / .08); }
.stage-head { display: grid; gap: 10px; margin-bottom: 28px; max-width: 760px; }
.tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .3em; text-transform: uppercase; color: rgb(var(--deck));
  display: flex; align-items: center; gap: 12px;
}
.tag::before { content: ""; width: 26px; height: 1px; background: rgb(var(--deck)); box-shadow: 0 0 8px rgb(var(--deck)); }
h1, h2, h3 { margin: 0; font-weight: 300; letter-spacing: -.01em; line-height: 1.1; color: rgb(var(--ink)); }
h1 { font-size: clamp(34px, 5.2vw, 64px); }
h2 { font-size: clamp(26px, 3.4vw, 40px); }
h3 { font-size: 18px; font-weight: 500; }
h1 em, h2 em { font-style: normal; color: rgb(var(--deck)); }
.lede { font-size: clamp(16px, 1.5vw, 19px); color: rgb(var(--ink) / .78); max-width: 68ch; margin: 0; }
.lede b { color: rgb(var(--ink)); }
p.note { font-size: 13px; color: rgb(var(--dim)); line-height: 1.6; max-width: 76ch; }
.caveat { font-size: 12.5px; color: rgb(var(--dim)); line-height: 1.6; }

/* ---- a viewport: a DOM box the ship renders into -------------------------- */
.viewport {
  position: relative; width: 100%; border-radius: var(--radius);
  border: 1px solid rgb(var(--line) / .16);
  background: transparent;            /* the render sits behind the DOM; ship.js dims the pane itself */
  overflow: hidden; isolation: isolate;
  touch-action: pan-y;
}
.viewport.is-grabbing { cursor: grabbing; }
.viewport::before, .viewport::after,
.viewport > .corner::before, .viewport > .corner::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; z-index: 3;
  border-color: rgb(var(--deck) / .75); border-style: solid; border-width: 0;
}
.viewport::before { left: 8px; top: 8px; border-left-width: 1px; border-top-width: 1px; }
.viewport::after { right: 8px; top: 8px; border-right-width: 1px; border-top-width: 1px; }
.viewport > .corner { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.viewport > .corner::before { left: 8px; bottom: 8px; border-left-width: 1px; border-bottom-width: 1px; }
.viewport > .corner::after { right: 8px; bottom: 8px; border-right-width: 1px; border-bottom-width: 1px; }
/* the overlay layer for anything a deck draws over its 3D view */
.vhud { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.vhud > * { pointer-events: auto; }
.vhud .label {
  position: absolute; font-family: var(--mono); font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: rgb(var(--line) / .7); white-space: nowrap; transform: translate(-50%, 0);
}
.vhud .tick { position: absolute; bottom: 10px; font-family: var(--mono); font-size: 9.5px; color: rgb(var(--dim) / .8); transform: translateX(-50%); white-space: nowrap; }
.vhud .tick::before { content: ""; position: absolute; left: 50%; bottom: 100%; width: 1px; height: 6px; background: rgb(var(--line) / .35); }
.vp-note {
  position: absolute; left: 14px; bottom: 12px; z-index: 2; font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: rgb(var(--dim) / .85); pointer-events: none;
}
.vp-note.right { left: auto; right: 14px; text-align: right; }
.vp-note { max-width: 60%; line-height: 1.4; }
@media (max-width: 640px) {
  .chips.rail { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); scrollbar-width: none; }
  .chips.rail::-webkit-scrollbar { display: none; }
  .chips.rail .chip { flex: none; }
  .vp-note.right { display: none; } .vp-note { max-width: 90%; font-size: 11.5px; letter-spacing: .08em; } .readout .k, .dial .dial-k, .tag, .vhud .label { font-size: 11.5px; } .probe .cap { font-size: 12px; padding: 4px 8px; } .caveat, p.note { font-size: 14px; } }
body.no-webgl .viewport .fallback { display: grid; }
.viewport .fallback {
  display: none; position: absolute; inset: 0; place-items: center; z-index: 1; padding: 24px; text-align: center;
  font-size: 13px; color: rgb(var(--dim));
}

/* the focus button and the full-screen state */
.vp-focus {
  position: absolute; right: 10px; top: 10px; z-index: 5; width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgb(var(--line) / .25); background: rgb(4 8 16 / .6); color: rgb(var(--ink) / .85); font-size: 16px; line-height: 1;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.vp-focus .close { display: none; }
.viewport.is-full .vp-focus .close { display: inline; }
.viewport.is-full .vp-focus .open { display: none; }
.viewport.is-full {
  position: fixed; inset: 0; z-index: 40; height: auto !important; width: auto; border-radius: 0; border: 0;
  background: transparent;            /* the render is behind the DOM; an opaque box here would hide it */
  touch-action: none; visibility: visible;
}
.viewport.is-full .vp-focus { top: calc(10px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right)); width: 44px; height: 44px; }
/* everything else on the deck steps out of sight while one instrument has
   the screen, so the page behind cannot show through the transparent box */
body.vp-lock .deck { visibility: hidden; }
body.vp-lock { overflow: hidden; }
body.vp-lock .deckbar, body.vp-lock .decknav { visibility: hidden; }
@media (hover: hover) and (pointer: fine) { .vp-focus { opacity: 0; transition: opacity .3s; } .viewport:hover .vp-focus, .viewport:focus-within .vp-focus, .viewport.is-full .vp-focus { opacity: 1; } }

/* ---- probes: the draggable markers on an instrument ---------------------- */
.probe {
  position: absolute; top: 0; bottom: 0; width: 44px; transform: translateX(-50%); cursor: grab; z-index: 4;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
.probe:active { cursor: grabbing; }
.probe::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-50%);
  background: rgb(var(--p, var(--deck)) / .9); box-shadow: 0 0 10px rgb(var(--p, var(--deck)) / .8);
}
.probe .cap {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; font-weight: 600;
  color: rgb(var(--void)); background: rgb(var(--p, var(--deck)));
  padding: 2px 6px; border-radius: 3px; box-shadow: 0 0 14px rgb(var(--p, var(--deck)) / .8);
}
.probe .cap small { display: block; font-weight: 400; font-size: 9px; letter-spacing: .06em; opacity: .85; margin-top: 1px; }
.probe:focus-visible { outline: none; }
.probe:focus-visible::before { width: 3px; }

/* ---- readouts ----------------------------------------------------------- */
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 14px; }
.readout {
  position: relative; padding: 14px 16px 12px; border-radius: 10px;
  border: 1px solid rgb(var(--line) / .14); background: rgb(var(--holo-panel, 15 18 24) / .55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color .4s, box-shadow .4s;
}
.readout::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; background: rgb(var(--p, var(--deck))); box-shadow: 0 0 10px rgb(var(--p, var(--deck)) / .7); border-radius: 2px; }
.readout:hover, .readout.holo-on { border-color: rgb(var(--p, var(--deck)) / .5); box-shadow: 0 0 24px rgb(var(--p, var(--deck)) / .12); }
.readout .k { font-family: var(--mono); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: rgb(var(--p, var(--deck)) / .9); margin: 0 0 6px; }
.readout .v { font-family: var(--mono); font-size: clamp(20px, 2.2vw, 26px); font-weight: 400; line-height: 1.1; margin: 0; color: rgb(var(--ink)); font-variant-numeric: tabular-nums; }
.readout .d { font-size: 12.5px; color: rgb(var(--dim)); margin: 6px 0 0; line-height: 1.5; }
.readout .d b { color: rgb(var(--ink) / .9); }

/* ---- chips: landmark presets ------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.chip {
  font-size: 12.5px; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgb(var(--line) / .18); background: rgb(var(--line) / .04); color: rgb(var(--ink) / .82);
  transition: border-color .3s, background .3s, color .3s, box-shadow .3s;
}
.chip:hover, .chip.holo-on { border-color: rgb(var(--deck) / .6); color: rgb(var(--ink)); background: rgb(var(--deck) / .08); }
.chip[aria-pressed="true"], .chip.is-on { border-color: rgb(var(--deck)); color: rgb(var(--deck)); background: rgb(var(--deck) / .10); box-shadow: 0 0 16px rgb(var(--deck) / .25); }
.chip .b { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; margin-right: 6px; color: rgb(var(--dim)); }

/* ---- dials: range inputs as beams of light ------------------------------- */
.dial { display: grid; gap: 8px; margin-top: 16px; }
.dial .dial-k { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--mono); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: rgb(var(--dim)); }
.dial .dial-k b { color: rgb(var(--ink)); font-size: 13px; letter-spacing: .04em; text-transform: none; }
input[type="range"].beam {
  -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; margin: 0; cursor: pointer; touch-action: none;   /* a finger on the dial drags the dial, never the page */
}
input[type="range"].beam::-webkit-slider-runnable-track { height: 2px; border-radius: 2px; background: var(--track, linear-gradient(90deg, rgb(var(--line) / .15), rgb(var(--deck) / .9))); box-shadow: 0 0 10px rgb(var(--deck) / .25); }
input[type="range"].beam::-moz-range-track { height: 2px; border-radius: 2px; background: var(--track, linear-gradient(90deg, rgb(var(--line) / .15), rgb(var(--deck) / .9))); }
input[type="range"].beam::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; margin-top: -12px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff, rgb(var(--deck)) 55%, rgb(var(--deck) / .6));
  border: 1px solid rgb(var(--deck)); box-shadow: 0 0 16px rgb(var(--deck) / .8), 0 0 32px rgb(var(--deck) / .35);
}
input[type="range"].beam::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgb(var(--deck));
  background: radial-gradient(circle at 40% 35%, #fff, rgb(var(--deck)) 55%, rgb(var(--deck) / .6));
  box-shadow: 0 0 16px rgb(var(--deck) / .8);
}

/* ---- glass panels ------------------------------------------------------- */
.glass { padding: clamp(18px, 3vw, 30px); border-radius: var(--radius); }
.glass p { margin: 0 0 12px; color: rgb(var(--ink) / .86); }
.glass p:last-child { margin-bottom: 0; }
.glass h3 { margin-bottom: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: rgb(var(--deck)); font-weight: 500; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

/* ---- doorways: links to other decks that read as hatches ------------------ */
.hatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-top: 18px; }
.hatch {
  display: grid; gap: 6px; padding: 16px 18px; border-radius: 10px; text-decoration: none;
  border: 1px solid rgb(var(--line) / .16); background: rgb(var(--holo-panel, 15 18 24) / .5); color: rgb(var(--ink) / .88);
  transition: border-color .35s, box-shadow .35s, transform .35s;
}
.hatch:hover, .hatch.holo-on, .hatch:focus-visible { border-color: rgb(var(--deck) / .7); box-shadow: 0 0 28px rgb(var(--deck) / .15); transform: translateY(-2px); }
.hatch .k { font-family: var(--mono); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: rgb(var(--deck)); }
.hatch .t { font-size: 15px; }
.hatch .d { font-size: 12.5px; color: rgb(var(--dim)); }
.hatch .k::after { content: " \2197"; }

/* ---- the vessel's footer ------------------------------------------------ */
.deck-foot { padding: 40px 0 56px; font-size: 13px; color: rgb(var(--dim)); line-height: 1.7; border-top: 1px solid rgb(var(--line) / .08); }
.deck-foot p { margin: 0 0 8px; max-width: 80ch; }

/* ---- motion ------------------------------------------------------------- */
.rise { opacity: 0; transform: translateY(12px); transition: opacity .8s cubic-bezier(.16, 1, .3, 1), transform .8s cubic-bezier(.16, 1, .3, 1); }
.rise.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .rise { opacity: 1; transform: none; transition: none; }
  .hatch, .chip, .readout { transition: none; }
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.no-webgl .viewport { background: rgb(var(--void) / .7); }
