/* Project cards. Every card has the same frame: one border, a head strip (code, kind of view,
   dates), a stage (the card's own live scene) and a body (name, line, chart). What is inside
   the stage and the chart is different on each card (js/sections/projects/).
   On a phone every card is one column with the same edges. On wide screens the three wide
   cards put the stage beside the body.
   Charts are inline SVG drawn to scale; ok = a good result, hot = over budget. */

/* The phone screen and the thermal camera stay dark in Day and Nite. */
:root { --scr: 11 12 13; --scr-ink: 229 229 223; }

.pgrid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-flow: dense; gap: 16px; }
.pc-coast { grid-column: span 8; }
.pc-phone { grid-column: span 4; grid-row: span 2; }
.pc-orbit { grid-column: span 8; }
.pc-survey { grid-column: span 7; }
.pc-plan { grid-column: span 5; }
.pc-thermal, .pc-deck, .pc-term { grid-column: span 4; }
@media (max-width: 1099px) {
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pgrid > .pc { grid-column: span 1; grid-row: auto; }
  .pgrid > .pc-coast, .pgrid > .pc-survey { grid-column: span 2; }
}
@media (max-width: 699px) {
  .pgrid { grid-template-columns: minmax(0, 1fr); }
  .pgrid > .pc, .pgrid > .pc-coast, .pgrid > .pc-survey { grid-column: auto; }
}

/* ---------- The common frame ---------- */
.pc { min-width: 0; display: grid; grid-template-rows: auto auto 1fr; border: 1px solid rgb(var(--ink) / .24); background: rgb(var(--panel) / .9); }
.pc .pc-head {
  margin: 0; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-bottom: 1px solid rgb(var(--ink) / .16);
  font: 500 10.5px/1 var(--f-data); letter-spacing: .12em; text-transform: uppercase; color: rgb(var(--ink-2));
}
.code { padding: 5px 8px; background: rgb(var(--ink)); color: rgb(var(--bg)); }
.kind { display: flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kind-live i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: rgb(var(--hot)); animation: blink 1.4s steps(2, jump-none) infinite; }
.when { margin-left: auto; white-space: nowrap; }
.pc-stage { position: relative; min-width: 0; aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 1px solid rgb(var(--ink) / .16); }
.pc-stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.pc-body { min-width: 0; display: grid; gap: 12px; align-content: start; padding: 16px 18px 18px; }
.pc h3 { font-size: 17px; }
.pc p { margin: 0; font-size: 15px; color: rgb(var(--ink-2)); }

/* Shared chart text. */
.st { display: grid; gap: 6px; }
.pc .st-k { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font: 500 10px/1.4 var(--f-data); letter-spacing: .12em; text-transform: uppercase; }
.st-k b { font: 500 15px/1 var(--f-data); letter-spacing: 0; text-transform: none; color: rgb(var(--ink)); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc .st-n { font-size: 13.5px; }
.pc .st-n b { color: rgb(var(--ink)); font-weight: 600; }
.pc svg { display: block; width: 100%; height: auto; }
.pc svg text { font-family: var(--f-data); font-size: 8.5px; fill: rgb(var(--ink-2)); }

/* Wide cards: stage beside the body (S8 and S3 from 700 px, S7 from 1100 px). */
@media (min-width: 700px) {
  .pc-coast, .pc-survey { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .pc-coast .pc-head, .pc-survey .pc-head { grid-column: 1 / -1; }
  .pc-coast .pc-stage, .pc-survey .pc-stage { aspect-ratio: auto; min-height: 340px; border-bottom: 0; border-right: 1px solid rgb(var(--ink) / .16); }
}
@media (min-width: 1100px) {
  .pc-orbit { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .pc-orbit .pc-head { grid-column: 1 / -1; }
  .pc-orbit .pc-stage { aspect-ratio: auto; min-height: 320px; border-bottom: 0; border-right: 1px solid rgb(var(--ink) / .16); }
  .pc-phone { grid-template-rows: auto 1fr auto; }
}

/* ---------- S8: the coast ---------- */
.legs .b-old { fill: rgb(var(--ink) / .22); }
.legs .b-new { fill: rgb(var(--ok)); }
.pc .legs .b-t-on { fill: rgb(var(--bg)); }
.ticks .tk { stroke: rgb(var(--ink)); stroke-width: 3; }

/* ---------- Nightfall Ops: a handset on the stage ---------- */
.pc-phone .pc-stage { aspect-ratio: auto; display: grid; place-items: center; padding: 22px 16px; background: rgb(var(--ink) / .04); }
.handset {
  position: relative; width: min(58%, 200px); aspect-ratio: 9 / 17; padding: 12px 9px 16px;
  border: 2px solid rgb(var(--ink)); border-radius: 28px; background: rgb(var(--panel));
}
.handset::before { content: ""; position: absolute; left: 50%; top: 5px; width: 40px; height: 4px; border-radius: 2px; translate: -50% 0; background: rgb(var(--ink) / .5); }
.handset canvas { display: block; width: 100%; height: 100%; border-radius: 16px; background: rgb(var(--scr)); }
.phases { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.phases li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: center; font-size: 14.5px; color: rgb(var(--ink-2)); }
.phases b { display: grid; place-items: center; height: 26px; font: 500 12px/1 var(--f-data); border: 1px solid rgb(var(--ink) / .5); color: rgb(var(--ink)); }
.phases li:last-child b { background: rgb(var(--ink)); color: rgb(var(--bg)); }

/* ---------- S7: orbit and dial ---------- */
.dial { margin: 0; display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 16px; align-items: end; }
.d-bg, .d-val { fill: none; stroke-width: 12; }
.d-bg { stroke: rgb(var(--ink) / .14); }
.d-val { stroke: rgb(var(--ok)); }
.d-floor { stroke: rgb(var(--hot)); stroke-width: 2; }
.d-needle { stroke: rgb(var(--ink)); stroke-width: 2.5; stroke-linecap: round; }
.d-hub { fill: rgb(var(--ink)); }
.dial figcaption { display: grid; gap: 2px; font: 500 11px/1.3 var(--f-data); color: rgb(var(--ink-2)); text-transform: uppercase; letter-spacing: .1em; }
.dial figcaption b { font: 400 34px/1 var(--f-display); color: rgb(var(--ink)); letter-spacing: 0; }
.dial figcaption span { font: 400 13px/1.4 var(--f-body); text-transform: none; letter-spacing: 0; }

/* ---------- S3: survey sheet ---------- */
.pc-survey .pc-stage { background: rgb(var(--bg)); }
.legend { border-collapse: collapse; width: 100%; font-size: 13px; }
.legend caption { text-align: left; padding-bottom: 6px; font: 500 10px/1.4 var(--f-data); letter-spacing: .14em; text-transform: uppercase; color: rgb(var(--ink-2)); }
.legend th, .legend td { border-top: 1px solid rgb(var(--ink) / .25); padding: 7px 8px 7px 0; text-align: left; vertical-align: baseline; }
.legend th { font: 500 10px/1.4 var(--f-data); letter-spacing: .1em; text-transform: uppercase; color: rgb(var(--ink-2)); }
.legend td:nth-child(2) { font: 500 15px/1.2 var(--f-data); white-space: nowrap; font-variant-numeric: tabular-nums; }
.legend td:last-child { color: rgb(var(--ink-2)); }
@media (max-width: 420px) { .legend td:last-child { display: none; } }

/* ---------- S4: floor plan ---------- */
.pc-plan .pc-stage { aspect-ratio: 16 / 9; }
.alive line { stroke-width: 12; }
.alive .a-bg { stroke: rgb(var(--ink) / .12); }
.alive .a-old { stroke: rgb(var(--hot)); stroke-dasharray: 1.5 .5; }
.alive .a-new { stroke: rgb(var(--ok)); stroke-dasharray: 1.5 .5; }
.pc .alive-k { display: flex; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; font-size: 13.5px; }
.alive-k b { font: 500 14px var(--f-data); color: rgb(var(--ink)); }

/* ---------- S6: thermal camera on a dark stage ---------- */
.pc-thermal .pc-stage { aspect-ratio: 4 / 3; background: rgb(var(--scr)); }
.pc-thermal .pc-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(rgb(var(--scr-ink) / .035) 0 1px, transparent 1px 3px); }
.th-stats { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; align-items: center; }
.pc .th-stats p { font-size: 14px; }
.th-stats b { color: rgb(var(--ink)); font: 500 14px var(--f-data); }
.ring .r-tk { fill: none; stroke: rgb(var(--ok)); stroke-width: 9; }
.pc .ring .r-t { fill: rgb(var(--ink)); font-size: 15px; }
.pc .ring .r-s { font-size: 9px; }

/* ---------- The Sailors: blueprint grid on the stage ---------- */
.pc-deck .pc-stage {
  aspect-ratio: 2 / 1;
  background:
    linear-gradient(rgb(var(--ink) / .07) 1px, transparent 1px) 0 0 / 12px 12px,
    linear-gradient(90deg, rgb(var(--ink) / .07) 1px, transparent 1px) 0 0 / 12px 12px,
    rgb(var(--bg));
}
.race .rc-old { fill: rgb(var(--hot) / .75); }
.race .rc-new { fill: rgb(var(--ok)); }
.race .rc-bud { stroke: rgb(var(--ink)); stroke-width: 1.2; stroke-dasharray: 3 2; }
.pc .race .rc-on { fill: rgb(var(--ink)); }

/* ---------- Economy monitor: a terminal on the stage ---------- */
.pc-term .pc-stage { aspect-ratio: auto; background: rgb(var(--bg)); }
.pc .tty-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid rgb(var(--ink) / .14); font: 500 10px/1 var(--f-data); letter-spacing: .08em; }
.tty-bar i { width: 8px; height: 8px; border: 1px solid rgb(var(--ink) / .5); }
.tty-bar span { margin-left: auto; }
.tty-out { margin: 0; padding: 12px; overflow-x: auto; font: 400 12.5px/1.7 var(--f-data); color: rgb(var(--ink)); }
.tty-out .p { color: rgb(var(--ok)); }
.tty-out .d { color: rgb(var(--ink-2)); }
.pc .files { font: 400 15px/1.2 var(--f-data); color: rgb(var(--ok)); word-break: break-all; letter-spacing: .05em; }

/* ---------- Flight lab: the super card. The stage is a rail of sub-card tiles on a floor
   (the srail-stack pattern); a live hangar sits under it (the picked aircraft's data is a board in its scene), and the body holds the intro.
   Without JS every panel shows, one after another. ---------- */
.pgrid > .pc-fleet { grid-column: 1 / -1; grid-row: auto; }
.fleet-stage { aspect-ratio: auto; padding: 24px 0 20px; }
.rail-floor {
  position: absolute; left: -15%; right: -15%; bottom: -30px; height: 130px; pointer-events: none;
  transform: perspective(520px) rotateX(64deg); transform-origin: 50% 100%;
  background:
    linear-gradient(rgb(var(--ink) / .13) 1px, transparent 1px) 0 0 / 44px 22px,
    linear-gradient(90deg, rgb(var(--ink) / .13) 1px, transparent 1px) 0 0 / 44px 22px;
  -webkit-mask-image: linear-gradient(transparent, #000 70%); mask-image: linear-gradient(transparent, #000 70%);
}
.rail {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(148px, 1fr); gap: 10px;
  padding: 8px 18px 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 18px; scrollbar-width: thin;
}
.tile {
  scroll-snap-align: start; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-content: start; text-align: left;
  padding: 10px 12px 12px; border: 1px solid rgb(var(--ink) / .26); background: rgb(var(--bg)); color: rgb(var(--ink));
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.tile .gl { grid-column: 1 / -1; width: 100%; height: 46px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.tile .gl .rot { stroke-dasharray: 2 3; opacity: .6; }
.tile .t-no { font: 500 10px/1 var(--f-data); color: rgb(var(--ink-2)); }
.tile .t-name { grid-column: 1 / -1; font: 400 11.5px/1.3 var(--f-display); letter-spacing: .03em; }
.tile .chip { grid-row: 1; grid-column: 2; padding: 3px 5px; font-size: 9px; }
.tile:hover { border-color: rgb(var(--ink) / .6); }
.tile[aria-selected="true"] { border-color: rgb(var(--signal)); transform: translateY(-6px); box-shadow: 0 12px 0 -7px rgb(var(--signal) / .4); }
.tile.st-plan .gl { opacity: .6; }
.tile.st-none .gl { opacity: .35; stroke-dasharray: 1.5 2.5; }
.chip.st-built, .st-built .chip { color: rgb(var(--ok)); border-color: rgb(var(--ok)); }
.chip.st-work, .st-work .chip { background: rgb(var(--ink)); color: rgb(var(--bg)); border-color: rgb(var(--ink)); }
.chip.st-plan, .st-plan .chip { color: rgb(var(--ink-2)); border-style: dashed; }
.chip.st-none, .st-none .chip { color: rgb(var(--ink-2)); border-style: dotted; }

.fleet-body { gap: 20px; }
.fleet-intro { display: grid; gap: 10px; max-width: 78ch; }
.pc-fleet h3 { font-size: 20px; }
.pc .fleet-sum { display: flex; flex-wrap: wrap; gap: 6px 20px; font: 500 11px/1.2 var(--f-data); letter-spacing: .1em; text-transform: uppercase; }
.fleet-sum b { font: 400 22px/1 var(--f-display); letter-spacing: 0; color: rgb(var(--ink)); margin-right: 4px; }

/* the Flight lab hangar (hangar-card.js): the canvas under the rail, with the picked aircraft's data on a board in the scene;
   the canvas is hidden in the markup, so no empty box without the script (the data below it stays). Narrower than 960 px the data sits under the canvas. */
.hangar { position: relative; display: block; background: rgb(var(--bg)); border-bottom: 1px solid rgb(var(--ink) / .16); }
.hg-view[hidden] { display: none !important; }
.hg-view { position: relative; aspect-ratio: 2 / 1; min-height: 300px; overflow: hidden; }
.hg-view canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.hg-view.loading::after { content: "Loading the hangar"; position: absolute; inset: 0; display: grid; place-items: center; font: 500 10px/1 var(--f-data); letter-spacing: .14em; text-transform: uppercase; color: rgb(var(--ink-2)); }
.hg-sr { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hg-cap { position: absolute; left: 12px; top: 10px; max-width: calc(100% - 190px); display: grid; gap: 4px; margin: 0; padding: 6px 10px; background: rgb(var(--bg) / .72); pointer-events: none; }
.hg-k { font: 500 10px/1.3 var(--f-data); letter-spacing: .12em; text-transform: uppercase; color: rgb(var(--ink-2)); }
.hg-n { font: 400 15px/1.3 var(--f-display); letter-spacing: .02em; color: rgb(var(--ink)); }
.hg-over { position: absolute; right: 12px; top: 10px; min-height: 44px; }
.hg-note, .hg-legend { position: absolute; bottom: 10px; margin: 0; padding: 4px 8px; background: rgb(var(--bg) / .72); font: 500 10px/1.3 var(--f-data); letter-spacing: .1em; text-transform: uppercase; color: rgb(var(--ink-2)); pointer-events: none; }
.hg-note { left: 12px; }
.hg-legend { right: 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; }
.lg { display: inline-block; width: 20px; height: 0; margin-right: 7px; vertical-align: middle; border-top: 2px solid rgb(var(--ink)); }
.lg-dim { border-top: 1px solid rgb(var(--ink) / .55); }
.lg-dot { border-top: 2px dotted rgb(var(--ink) / .6); }
@media (max-width: 899px) { .hg-view { aspect-ratio: 4 / 3; } }
@media (max-width: 599px) {
  .hg-view { aspect-ratio: 1 / 1; min-height: 0; }
  .hg-n { font-size: 13px; }
  .hg-legend { display: none; }
}

/* the data: under the canvas; when the canvas shows it on a board, only the screen reader reads this copy */
.hg-dock { padding: 18px 18px 20px; min-width: 0; }
.hangar.bd .sub-nav { display: none; }   /* the rail already picks; no hidden buttons for the keyboard */
.hangar.bd .hg-dock { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the text under the hangar: the intro, one column */
.fleet-body { grid-template-columns: minmax(0, 1fr); }
.fleet-intro { position: static; }
.subs { display: grid; gap: 14px; min-width: 0; }
.sub { display: grid; gap: 11px; align-content: start; min-width: 0; }
.sub + .sub { border-top: 1px solid rgb(var(--ink) / .16); padding-top: 14px; }
.subs.js-tabs .sub { border-top: 0; padding-top: 0; }
.pc .sub-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; font: 500 10.5px/1 var(--f-data); letter-spacing: .12em; text-transform: uppercase; }
.sub h4 { margin: 0; font: 400 18px/1.3 var(--f-display); text-wrap: balance; }
.track { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; }
.track li { display: grid; gap: 3px; padding-top: 7px; border-top: 4px solid rgb(var(--ink) / .14); font: 500 11px/1.2 var(--f-data); color: rgb(var(--ink-2)); min-width: 0; }
.track li span { font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track .done { border-top-color: rgb(var(--ok)); color: rgb(var(--ink)); }
.track .now { border-top-color: rgb(var(--ink)); color: rgb(var(--ink)); border-top-style: dashed; }
@media (max-width: 599px) { .track li span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
.pc .track-none { font: 500 11px/1.4 var(--f-data); letter-spacing: .08em; text-transform: uppercase; }
.facts { margin: 0; display: grid; gap: 1px; background: rgb(var(--ink) / .14); border: 1px solid rgb(var(--ink) / .14); }
.facts div { background: rgb(var(--panel)); padding: 9px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; }
.facts dt { font: 500 10px/1.4 var(--f-data); letter-spacing: .12em; text-transform: uppercase; color: rgb(var(--ink-2)); }
.facts dd { margin: 0; font: 500 15px/1.3 var(--f-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
.facts dd small { font-size: 10.5px; color: rgb(var(--ink-2)); }
.facts .n { grid-column: 1 / -1; font: 400 13px/1.4 var(--f-body); color: rgb(var(--ink-2)); white-space: normal; }
.pc .sub-when { font: 500 10.5px/1 var(--f-data); letter-spacing: .1em; text-transform: uppercase; }
.sub-nav { display: flex; align-items: center; gap: 8px; }
.sub-nav .idx { margin-left: auto; font: 500 11px/1 var(--f-data); color: rgb(var(--ink-2)); }

/* ---------- Coast Safari: the second super card. One wide film stage plays each scene's
   trailer in turn; the line of the day under it marks the stop and fills as it plays. ---------- */
.pgrid > .pc-safari { grid-column: 1 / -1; grid-row: auto; }
.safari-stage { aspect-ratio: 21 / 9; background: rgb(var(--scr)); }
@media (max-width: 1099px) { .safari-stage { aspect-ratio: 16 / 10; } }
@media (max-width: 599px) { .safari-stage { aspect-ratio: 4 / 3; } }
.day { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(118px, 1fr); overflow-x: auto; scrollbar-width: thin; border-bottom: 1px solid rgb(var(--ink) / .16); }
.day button { position: relative; display: grid; gap: 4px; align-content: start; text-align: left; padding: 12px 12px 12px; border-top: 3px solid rgb(var(--ink) / .14); color: rgb(var(--ink-2)); min-width: 0; }
.day button + button { border-left: 1px solid rgb(var(--ink) / .1); }
.day .d-time { font: 400 15px/1 var(--f-display); color: rgb(var(--ink)); font-variant-numeric: tabular-nums; }
.day .d-name { font-size: 13px; line-height: 1.3; }
.day .d-bar { position: absolute; left: 0; top: -3px; height: 3px; width: 0; background: rgb(var(--signal)); }
.day button[aria-pressed="true"] { color: rgb(var(--ink)); background: rgb(var(--ink) / .04); }
.day button[aria-pressed="true"] .d-time { color: rgb(var(--signal)); }
.day button:hover { color: rgb(var(--ink)); }
.safari-body { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 16px 28px; }
.safari-copy { display: grid; gap: 10px; max-width: 78ch; }
.pc-safari h3 { font-size: 20px; }
@media (max-width: 699px) { .safari-body { grid-template-columns: minmax(0, 1fr); } .safari-body .btn { justify-self: start; } }

@media (prefers-reduced-motion: reduce) { .kind-live i { animation: none; } .tile { transition: none; } }
