/* ILM Launch Lab: the page around the 3D view, in the CONTROL ROOM look.
 *
 * Graphite first (the page opens dark unless the reader chose light), tokens
 * from shared/pren.css, the Matrix kit from shared/control.css. The scene reads
 * the same tokens at run time (assets/ilm.js): the model stands ON the Graphite
 * ground and its dot grid, with no panel behind it.
 *
 * Boxes and controls: 2px outline, 8px corners, no shadows. Steel Blue leads
 * (the play button, the big numbers), yellow is a highlighter only, red is
 * force and risk (a failing check). Matrix Green means "live / computing" and
 * appears only as small mono readouts, status lines and the rain behind the
 * header. Labels, units and numbers are Martian Mono capitals.
 */
[hidden] { display: none !important; }
body { color: var(--ink); font: 400 15.5px/1.5 var(--ui); }
.app { max-width: 1280px; margin: 0 auto; padding: clamp(18px, 3vw, 32px) clamp(14px, 3vw, 34px) 28px; }

.wrap { max-width: 1240px; margin: 0 auto; display: grid; gap: 18px; }
header { display: grid; gap: 14px; justify-items: start; }
header.pagehead { position: relative; overflow: hidden; padding: 6px 0 4px; }
header.pagehead > :not(canvas) { position: relative; z-index: 1; }
header.pagehead canvas.rain { z-index: 0; }
.eyebrow {
  display: inline-block; margin: 0; background: var(--hi); color: var(--on-hi);
  font: 600 11px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  padding: 6px 10px; border-radius: var(--r);
}
h1 {
  font: 400 clamp(38px, 6.4vw, 76px)/.95 var(--display); letter-spacing: -.02em;
  margin: 0; color: var(--head); text-wrap: balance;
}
.lede { color: var(--ink); max-width: 62ch; margin: 0; font-size: 17px; line-height: 1.45; }

.main { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }

/* THE VIEW IS THE GROUND. The 3D canvas is transparent and the dot grid shows
   through behind the model, so the bridge stands on Graphite (or paper). */
.view {
  position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: 72vh;
  border: 2px solid var(--rule); border-radius: var(--r); overflow: hidden;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--dot) 1.2px, transparent 1.6px);
  background-size: 24px 24px;
  touch-action: none; cursor: grab;
}
.view:active { cursor: grabbing; }
.view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { pointer-events: none; }
.hudbox.corner { position: absolute; left: 12px; top: 12px; min-width: 176px; pointer-events: none; z-index: 2; }
@media (max-width: 520px) { .hudbox.corner { left: 8px; top: 8px; min-width: 0; padding: 7px 9px; } .hudbox.corner .hudline { font-size: 9px; gap: 10px; } }

.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.btn {
  font: 600 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  background: var(--panel); color: var(--head); border: 2px solid var(--rule); border-radius: var(--r);
  padding: 11px 14px; cursor: pointer;
}
.btn:hover { background: var(--hi); color: var(--on-hi); border-color: var(--rule); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary { border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-deep); color: var(--on-accent); border-color: var(--accent-deep); }
.btn[aria-pressed="true"] { background: var(--head); color: var(--bg); }
.btn[aria-pressed="true"]:hover { background: var(--hi); color: var(--on-hi); }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="range"] { accent-color: var(--accent); width: 100%; }
input[type="range"]:disabled { opacity: .45; }
.scrub { flex: 1; min-width: 160px; }
.clock {
  font: 600 11.5px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mx-text);
  font-variant-numeric: tabular-nums; min-width: 150px; text-align: right;
}
.cams { display: flex; gap: 6px; flex-wrap: wrap; }
.hint { margin: 10px 0 0; }

aside { display: grid; gap: 14px; }
fieldset {
  border: 2px solid var(--rule); border-radius: var(--r); padding: 12px 14px 16px; margin: 0;
  background: var(--panel); display: grid; gap: 14px; min-width: 0;
}
legend {
  font: 700 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); padding: 0 6px;
}
.ctl { display: grid; gap: 6px; }
.ctl label, .ctl .lab {
  display: flex; justify-content: space-between; gap: 8px;
  font: 500 10.5px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--soft);
}
.ctl output { color: var(--head); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.seg { display: flex; gap: 0; border: 2px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.seg button {
  flex: 1; background: none; border: 0; color: var(--head);
  font: 600 10px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 9px 4px; cursor: pointer;
}
.seg button + button { border-left: 2px solid var(--rule); }
.seg button:hover { background: var(--hi); color: var(--on-hi); }
.seg button[aria-pressed="true"] { background: var(--head); color: var(--bg); }

/* the readouts: a HUD. Green label (live), the number in Steel Blue Archivo Black */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 2px solid var(--rule); border-radius: var(--r); padding: 11px 13px 12px; display: grid; gap: 7px; align-content: start; }
.stat .k { font: 500 10px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mx-text); }
.stat .k::before { content: "> "; }
.stat .v {
  font: 400 22px/1.1 var(--display); letter-spacing: -.01em; color: var(--accent);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}

/* the checks: status lines. OK in Matrix Green (it is computed live), FLAG in red only when a check fails */
.checks { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 14.5px; }
.checks li {
  display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; align-items: baseline; color: var(--ink);
  border: 2px solid var(--rule); border-radius: var(--r); padding: 10px 12px; background: var(--panel);
}
.checks li::before {
  content: "OK"; font: 700 10.5px/1 var(--mono); letter-spacing: .12em; color: var(--mx-text);
  border: 1px solid var(--mx-line); background: var(--mx-dim); border-radius: 4px; padding: 5px 0; text-align: center;
}
.checks li.warn { color: var(--head); border-color: var(--red); }
.checks li.warn::before { content: "FLAG"; color: var(--red); border-color: var(--red); background: transparent; }

.notes { display: grid; gap: 10px; color: var(--ink); font-size: 15px; max-width: 75ch; border-top: 2px solid var(--rule); padding-top: 16px; }
.notes p { margin: 0; }
.notes strong { color: var(--head); font-weight: 600; }
.fine { font: 400 11px/1.6 var(--mono); letter-spacing: .02em; color: var(--soft); }

/* film mode: just the square stage */
body.film header, body.film .openline, body.film .main, body.film .notes, body.film footer, body.film .scale, body.film .by { display: none; }
#stage { display: none; }
body.film #stage { display: block; width: min(100%, 720px); aspect-ratio: 1 / 1; margin: 0 auto; border: 2px solid var(--rule); border-radius: var(--r); }

.by {
  margin: 26px 0 18px; padding-top: 16px; border-top: 2px solid var(--rule);
  font: 400 11px/1.6 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--soft);
}
.by b { color: var(--head); font-weight: 600; }
.scale { margin-top: 4px; }
.openline { margin-bottom: 8px; }

@media (max-width: 520px) {
  .clock { text-align: left; min-width: 0; width: 100%; }
  .btn { padding: 10px 11px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
