:root {
  --charcoal: #17171a;
  --charcoal-2: #1f1f23;
  --graphite: #2a2a2e;
  --graphite-hi: #3a3a40;
  --text: #f3ede2;
  --text-dim: #b9b2a6;
  --amber: #f2a93b;
  --amber-dim: #7a5620;
  --rec: #e2382f;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --fade: 220ms;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--charcoal);
  color: var(--text);
  font: 400 1.0625rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--text); text-underline-offset: 3px; }
a:hover { color: var(--amber); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.skip {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--amber); color: #111; padding: .6rem 1rem; z-index: 10;
}
.skip:focus { top: 1rem; }

/* ---------- Masthead ---------- */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--graphite);
}
.wordmark { font-weight: 650; text-decoration: none; letter-spacing: .01em; }
.masthead ul { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.masthead nav a {
  display: inline-block; padding: .55rem .75rem; text-decoration: none; color: var(--text-dim);
  min-height: 44px; line-height: 1.7;
}
.masthead nav a:hover { color: var(--text); }
.wordmark { white-space: nowrap; }
@media (max-width: 480px) {
  .masthead { padding-inline: .75rem; }
  .masthead nav a { padding-inline: .5rem; font-size: .95rem; }
}

/* ---------- Hero ---------- */
.desk {
  display: grid;
  gap: 1.5rem;
  padding: 1.25rem clamp(1rem, 3vw, 2.5rem) 2.5rem;
  grid-template-areas: "intro" "monitor" "shelf" "profile";
}
.intro { grid-area: intro; }
.monitor { grid-area: monitor; }
.shelf { grid-area: shelf; }
.profile { grid-area: profile; }

h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.02; letter-spacing: -.02em;
  margin: 0 0 .5rem; font-weight: 700;
}
.lede { margin: 0; color: var(--text-dim); font-size: 1.1rem; max-width: 30ch; }

@media (min-width: 1100px) {
  .desk {
    grid-template-columns: minmax(190px, 230px) minmax(0, 1fr) minmax(240px, 290px);
    grid-template-areas: "shelf monitor intro" "shelf monitor profile";
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: clamp(1.25rem, 2.2vw, 2.25rem);
    row-gap: 1.5rem;
    padding-top: 1.75rem;
  }
  h1 { font-size: clamp(2.2rem, 3.2vw, 3rem); }
}
@media (min-width: 700px) and (max-width: 1099px) {
  .desk {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    grid-template-areas: "intro intro" "monitor monitor" "shelf profile";
  }
}

/* ---------- Field monitor ---------- */
.monitor { margin: 0; }
.bezel {
  background: linear-gradient(180deg, #333338 0%, #232326 40%, #1c1c1f 100%);
  border-radius: 14px;
  padding: 10px 14px 12px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.12),
    inset 0 -2px 0 rgba(0,0,0,.5),
    0 0 0 1px #0c0c0e,
    0 18px 40px -12px rgba(0,0,0,.75),
    0 4px 10px rgba(0,0,0,.4);
}
.bezel-top, .bezel-bottom {
  display: flex; align-items: center; gap: .75rem;
  font: 500 .72rem/1 var(--mono); letter-spacing: .08em; color: var(--text-dim);
  min-height: 22px;
}
.bezel-top { padding: 0 2px 8px; }
.bezel-top .spec { margin-left: auto; }
.bezel-bottom { justify-content: flex-end; padding: 9px 2px 0; gap: .5rem; }
.knob {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #55555c, #1a1a1d 70%);
  box-shadow: 0 1px 1px rgba(0,0,0,.6);
}
.tally {
  width: 8px; height: 8px; border-radius: 50%; background: #3b2321;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.5);
}

.screen {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #050506;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px #000, inset 0 0 24px rgba(0,0,0,.8);
}
.feed {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
}
.feed img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; }

.frame {
  display: grid; align-content: center; justify-items: start;
  padding: clamp(1.25rem, 5vw, 4rem);
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px),
    #111114;
}
.frame p { margin: 0; }
.frame-kicker { font: 500 .8rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }
.frame-title { font-size: clamp(1.6rem, 5vw, 3.4rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.05; margin: .6rem 0 .8rem !important; }
.frame-note { color: var(--text-dim); }

/* Hide all per-source labels by default */
.input-name, .spec, .slate-item { display: none; }

/* Source selection: pure CSS via :has() */
body:has(input[value="game"]:checked)  .feed[data-src="game"],
body:has(input[value="field"]:checked) .feed[data-src="field"],
body:has(input[value="comms"]:checked) .feed[data-src="comms"] {
  opacity: 1; visibility: visible;
  transition: opacity var(--fade) ease, visibility 0s;
}
body:has(input[value="game"]:checked)  [data-for="game"],
body:has(input[value="field"]:checked) [data-for="field"],
body:has(input[value="comms"]:checked) [data-for="comms"] { display: inline; }
body:has(input[value="game"]:checked)  .slate-item[data-for="game"],
body:has(input[value="field"]:checked) .slate-item[data-for="field"],
body:has(input[value="comms"]:checked) .slate-item[data-for="comms"] { display: flex; }

/* Tally glows red only on the real, live picture */
body:has(input[value="game"]:checked) .tally { background: var(--rec); box-shadow: 0 0 6px var(--rec); }

/* Fallback for browsers without :has(): show the first feed */
@supports not selector(:has(*)) {
  .feed[data-src="game"] { opacity: 1; visibility: visible; }
  [data-for="game"] { display: inline; }
  .slate-item[data-for="game"] { display: flex; }
}

/* Slate line beneath the monitor */
.slate { margin-top: .85rem; }
.slate-item {
  align-items: center; justify-content: space-between; gap: .75rem 1.25rem; flex-wrap: wrap;
}
.slate-item p { margin: 0; }
.slate-title { font-weight: 650; font-size: 1.3rem; line-height: 1.2; }
.credit { color: var(--text-dim); font-size: .95rem; }
.tbc { color: var(--amber); }
.soon { color: var(--text-dim); font-size: .95rem; min-height: 48px; display: inline-flex; align-items: center; }
.action {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 1.25rem;
  background: var(--amber); color: #1a1408; font-weight: 650; text-decoration: none;
  border-radius: 6px;
}
.action::after { content: "→"; margin-left: .5rem; }
.action:hover { color: #1a1408; background: #ffbf5c; }

/* ---------- Left panel: project shelf ---------- */
.shelf { border: 0; margin: 0; padding: 0; display: grid; gap: .9rem; min-width: 0; align-content: start; }
.shelf legend, .profile h2 {
  font: 500 .75rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim); margin: 0 0 .75rem; padding: 0;
}
.tile {
  position: relative;
  display: grid; grid-template-columns: 112px 1fr; gap: .8rem; align-items: center;
  padding: .5rem; min-height: 76px;
  background: var(--charcoal-2);
  border: 2px solid var(--graphite-hi);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 3px 0 #0b0b0d, inset 0 1px 0 rgba(255,255,255,.05);
  transition: border-color 120ms, background 120ms, transform 80ms;
}
.tile:hover { border-color: #5a5a62; }
.tile:active { transform: translateY(2px); box-shadow: 0 1px 0 #0b0b0d; }
.tile input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.tile img, .tile-frame {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 5px; background: #111114;
}
.tile-frame {
  display: grid; place-items: center; border: 1px dashed var(--graphite-hi);
  font-weight: 650; font-size: .85rem; color: var(--text-dim);
}
.tile-text { display: grid; gap: .1rem; min-width: 0; }
.tile-meta { font: 500 .68rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.tile-title { font-weight: 650; font-size: 1rem; line-height: 1.25; }
.tile:has(input:checked) { border-color: var(--amber); background: #2a2216; }
.tile:has(input:checked) .tile-meta { color: var(--amber); }
.tile:has(input:checked) .tile-meta::before { content: "▶ "; }
.tile:has(input:focus-visible) { outline: 3px solid var(--amber); outline-offset: 3px; }

@media (min-width: 1100px) {
  /* Stacked shelf on desktop: full-width thumbnail, title beneath */
  .tile { grid-template-columns: 1fr; gap: .55rem; padding: .5rem .5rem .7rem; }
  .tile-text { padding: 0 .25rem; }
}

/* ---------- Right panel: profile ---------- */
.profile { display: grid; gap: 1.75rem; align-content: start; min-width: 0; }
.profile section { scroll-margin-top: 1rem; }
.profile p { margin: 0; }
.now-card {
  display: grid; grid-template-columns: 96px 1fr; gap: .8rem; align-items: center;
  padding: .5rem; border: 1px solid var(--graphite-hi); border-radius: 8px;
  text-decoration: none; min-height: 48px;
}
.now-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; }
.now-sub { color: var(--text-dim); font-size: .9rem; }
.now-card:hover strong { color: var(--amber); }
h2 { font-size: 1.6rem; margin: 0 0 1.25rem; letter-spacing: -.01em; }

.preview-flag {
  border-left: 3px solid var(--amber-dim); padding: .5rem .9rem; color: var(--text-dim);
  background: var(--charcoal-2); font-size: .95rem;
}
.preview-flag.blocker { border-left-color: var(--rec); color: var(--text); }

.footer {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1.5rem clamp(1rem, 3vw, 2.5rem); border-top: 1px solid var(--graphite);
  color: var(--text-dim); font-size: .9rem;
}
.footer p { margin: 0; }

/* ---------- Case study page ---------- */
.case { padding: 2rem clamp(1rem, 3vw, 2.5rem) 3rem; max-width: 1100px; }
.crumb { font-size: .95rem; }
.case h1 { margin-top: .5rem; }
.case .kicker { font: 500 .8rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); margin: 1.5rem 0 0; }
.case-figure { margin: 1.5rem 0 2rem; }
.case-figure .bezel { max-width: 1000px; }
.case-figure .screen img { width: 100%; height: 100%; object-fit: cover; }
.case-figure figcaption { margin-top: .75rem; color: var(--text-dim); font-size: .95rem; }
.case-grid { display: grid; gap: 1.5rem 3rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.case-grid h2 { font-size: 1.15rem; margin-bottom: .4rem; }
.case-grid p { margin: 0; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { --fade: 0ms; }
  html { scroll-behavior: auto; }
  .tile { transition: none; }
  .tile:active { transform: none; }
}

/* ---------- Selat Saga: prototype preview and locations ---------- */
.case-sub { font-size: 1.25rem; margin: 1.75rem 0 0; }
.case-sub + .case-figure { margin-top: .75rem; }
.explore { margin-top: 3rem; }
.explore h2 { font-size: 1.6rem; }
.locations { list-style: none; margin: 0; padding: 0; display: grid; gap: 2rem; }
.locations figure { margin: 0; }
.locations img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.locations figcaption { margin-top: .6rem; font-weight: 650; font-size: 1.1rem; }
