/* Shared styles for the main index and the six exhibit pages. Lab pages use lab.css. */
:root {
  --paper: #f3efe6;
  --paper-2: #ebe5d8;
  --ink: #1f1d1a;
  --ink-dim: #57534b;
  --ink-faint: #8a8478;
  --rule: #d6cfbf;
  --red: #b8402b;
  --blue: #2c5d88;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;

  /* instrument panels are always dark, in both themes */
  --bezel: #0b0f14;
  --bezel-edge: #26303c;
  --scr-text: #9fb0c3;
  --scr-bright: #e8eef5;
  --sig: #6ee7a0;
  --fault: #ff6b5b;
  --caution: #ffc861;
  --ir: #69c9ff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121418;
    --paper-2: #181b21;
    --ink: #e7e3da;
    --ink-dim: #a9a397;
    --ink-faint: #756f64;
    --rule: #2a2e36;
    --red: #ef7a62;
    --blue: #7fb2e0;
    --bezel-edge: #2f3a48;
  }
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(184,64,43,.25); }
a { color: var(--blue); text-underline-offset: 2px; }
.wrap { max-width: 900px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
header { padding: 88px 0 56px; border-bottom: 2px solid var(--ink); }
.eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--red);
}
h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(38px, 7.2vw, 66px); line-height: 1.06;
  letter-spacing: -.015em; margin: 16px 0 24px; max-width: 15ch;
}
.lede { font-size: 19px; color: var(--ink-dim); max-width: 640px; }
.lede p + p { margin-top: 14px; }
.lede cite { font-style: italic; color: var(--ink); }
nav.toc {
  margin-top: 40px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 32px;
  border-top: 1px solid var(--rule);
}
nav.toc a {
  display: flex; gap: 12px; align-items: baseline;
  padding: 11px 4px; border-bottom: 1px solid var(--rule);
  color: var(--ink); text-decoration: none; font-size: 15.5px;
}
nav.toc a:hover { color: var(--red); }
nav.toc .n { font-family: var(--mono); font-size: 12px; color: var(--red); min-width: 22px; }
nav.toc .what { color: var(--ink-faint); font-size: 13px; margin-left: auto; font-family: var(--mono); }

/* ---------- exhibits ---------- */
section.ex { padding: 72px 0 64px; border-bottom: 1px solid var(--rule); }
.ex-head { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.ex-num { font-family: var(--mono); font-size: 13px; color: var(--red); letter-spacing: .08em; }
h2 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(28px, 4.6vw, 38px); line-height: 1.15; letter-spacing: -.01em;
}
.ex-sub { font-family: var(--mono); font-size: 12.5px; color: var(--ink-faint); margin: 6px 0 22px; }
.prose { max-width: 680px; color: var(--ink-dim); }
.prose p + p { margin-top: 13px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose em { color: var(--ink); }
.prose code, .mono { font-family: var(--mono); font-size: .88em; }

/* instrument panel */
.panel {
  margin: 30px 0 22px; background: var(--bezel); color: var(--scr-text);
  border: 1px solid var(--bezel-edge); border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 12px 30px -18px rgba(0,0,0,.45);
}
.screen { position: relative; line-height: 0; }
.screen canvas { display: block; width: 100%; touch-action: none; }
.screens { display: grid; grid-template-columns: 1.7fr 1fr; }
.screens > .screen + .screen { border-left: 1px solid var(--bezel-edge); }
@media (max-width: 640px) {
  .screens { grid-template-columns: 1fr; }
  .screens > .screen + .screen { border-left: 0; border-top: 1px solid var(--bezel-edge); }
}
.controls {
  display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end;
  padding: 14px 16px 16px; border-top: 1px solid var(--bezel-edge);
  font-family: var(--mono); font-size: 12px;
}
.ctl { display: flex; flex-direction: column; gap: 5px; min-width: 150px; flex: 1 1 150px; }
.ctl label { display: flex; justify-content: space-between; gap: 10px; color: var(--scr-text); letter-spacing: .02em; }
.ctl label b { color: var(--scr-bright); font-weight: 500; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; background: #2b3746; border-radius: 2px; }
input[type=range]::-moz-range-track { height: 3px; background: #2b3746; border-radius: 2px; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--scr-bright); margin-top: -6.5px; border: 0;
}
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--scr-bright); border: 0; }
input[type=range]:focus-visible { outline: 1px dashed var(--sig); outline-offset: 2px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
button, .seg label {
  font: inherit; font-family: var(--mono); font-size: 12px; color: var(--scr-bright);
  background: #151c25; border: 1px solid #2d3a4a; border-radius: 6px;
  padding: 7px 12px; cursor: pointer; letter-spacing: .02em;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
button:hover, .seg label:hover { border-color: #4a5d73; }
button:focus-visible { outline: 1px dashed var(--sig); outline-offset: 2px; }
button.on, .seg input:checked + label { background: #1f3a2c; border-color: var(--sig); color: var(--sig); }
button.warn.on { background: #3a1f1c; border-color: var(--fault); color: var(--fault); }
.seg { display: flex; flex-wrap: wrap; gap: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { border-radius: 0; margin-left: -1px; }
.seg label:first-of-type { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg label:last-of-type { border-radius: 0 6px 6px 0; }
.seg input:focus-visible + label { outline: 1px dashed var(--sig); outline-offset: 2px; position: relative; z-index: 1; }
.ctl .seg { gap: 0; }
input[type=text] {
  font-family: var(--mono); font-size: 14px; color: var(--scr-bright); background: #151c25;
  border: 1px solid #2d3a4a; border-radius: 6px; padding: 7px 10px; width: 100%;
}
input[type=text]:focus { outline: none; border-color: var(--sig); }

.readouts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-top: 1px solid var(--bezel-edge); font-family: var(--mono);
}
.ro { padding: 11px 16px 12px; border-right: 1px solid var(--bezel-edge); }
.ro:last-child { border-right: 0; }
.ro .k { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #6d7d90; }
.ro .v { font-size: 20px; color: var(--scr-bright); line-height: 1.35; font-variant-numeric: tabular-nums; }
.ro .v small { font-size: 12px; color: var(--scr-text); margin-left: 3px; }
.ok { color: var(--sig) !important; } .bad { color: var(--fault) !important; } .meh { color: var(--caution) !important; }
.note { padding: 10px 16px 12px; border-top: 1px solid var(--bezel-edge); font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--scr-text); }
.note b { color: var(--scr-bright); font-weight: 500; }

.try { max-width: 680px; margin-top: 8px; }
.try h3, .deep h3 {
  font-family: var(--mono); font-weight: 500; font-size: 11.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--red); margin-bottom: 8px;
}
.try ol { padding-left: 22px; color: var(--ink-dim); }
.try li { margin: 5px 0; padding-left: 4px; }
.try li::marker { font-family: var(--mono); font-size: 13px; color: var(--ink-faint); }
.deep {
  max-width: 680px; margin-top: 26px; padding: 16px 18px;
  background: var(--paper-2); border-left: 3px solid var(--ink); color: var(--ink-dim); font-size: 15.5px;
}
.deep p + p { margin-top: 10px; }

footer { padding: 64px 0 90px; color: var(--ink-dim); }
footer h2 { margin-bottom: 18px; }
footer .prose { font-size: 17px; }
.refs { margin-top: 34px; font-size: 14px; color: var(--ink-faint); max-width: 680px; }
.refs li { margin: 6px 0 6px 18px; }
.refs h3 { font-family: var(--mono); font-weight: 500; font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--red); margin-bottom: 6px; }
.colophon { margin-top: 40px; font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
video.hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- lab sub-index ---------- */
section.lab { padding: 64px 0 56px; border-bottom: 1px solid var(--rule); }
.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-top: 26px; }
.lab-card {
  display: block; padding: 18px 18px 16px; border: 1px solid var(--rule); border-radius: 10px;
  background: var(--paper-2); color: var(--ink); text-decoration: none; transition: border-color .15s;
}
.lab-card:hover { border-color: var(--red); }
.lab-card .top { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--mono); font-size: 12px; color: var(--red); }
.lab-card .st { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); }
.lab-card h3 { font-family: var(--serif); font-weight: 500; font-size: 22px; line-height: 1.2; margin: 8px 0 6px; }
.lab-card p { font-size: 15px; color: var(--ink-dim); line-height: 1.55; }
@media (max-width: 520px) {
  body { font-size: 16px; }
  header { padding-top: 60px; }
  .lede { font-size: 17.5px; }
  .controls { padding: 12px; gap: 12px 16px; }
  .ro { padding: 9px 12px 10px; }
  .ro .v { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- multi-page additions ---------- */
.crumb { padding-top: 28px; font-family: var(--mono); font-size: 12.5px; color: var(--ink-faint); }
.crumb a { color: var(--ink-faint); text-decoration: none; }
.crumb a:hover { color: var(--red); }
body.solo section.ex { padding-top: 40px; border-bottom: 0; }
body.solo section.ex h2 { font-size: clamp(34px, 6.4vw, 54px); line-height: 1.08; }
nav.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; padding-top: 22px; padding-bottom: 22px; border-top: 2px solid var(--ink); font-size: 15px; }
nav.pager a { color: var(--ink); text-decoration: none; }
nav.pager a:hover { color: var(--red); }
nav.pager .n { font-family: var(--mono); font-size: 12px; color: var(--red); margin: 0 6px; }
nav.pager .next { text-align: right; }
nav.pager .home { font-family: var(--mono); font-size: 12px; }
footer.page-foot { padding: 28px 0 80px; }
footer.page-foot .refs { margin-top: 0; }
section.exhibits { padding: 56px 0 60px; border-bottom: 1px solid var(--rule); }
@media (max-width: 520px) { nav.pager { grid-template-columns: 1fr 1fr; } nav.pager .home { grid-column: 1 / -1; grid-row: 1; text-align: center; } }
