/* ──────────────────────────────────────────────────────────
   CCTrack — base styles
   ────────────────────────────────────────────────────────── */

/* JetBrains Mono, self-hosted (SIL OFL 1.1, see fonts/OFL.txt) — no request to
   Google. Variable font: one file per subset covers weights 400–700. */
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Latin.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-LatinExt.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #000;
  --fg: #ededed;
  --fg-soft: #b8b8b8;
  --fg-mute: #6a6a6a;
  --fg-faint: #3a3a3a;
  --rule: rgba(255, 255, 255, 0.08);
  --rule-strong: rgba(255, 255, 255, 0.18);
  --panel: #0a0a0a;
  --panel-2: #111;
  /* Keep in sync with TWEAK_DEFAULTS.accent in app.jsx. The app re-applies the
     accent once React mounts — and Babel compiles the JSX in-browser, so that
     takes a moment — which makes any other value here flash on first paint. */
  --accent: #60a5fa;            /* blue */
  --accent-soft: rgba(96, 165, 250, 0.16);
  --accent-glow: rgba(96, 165, 250, 0.35);
  --hint: #8494ad;              /* blue-gray: inline usage hints */

  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-display: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --maxw: 1080px;
  --gutter: 32px;
  --section-pad: 96px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #000; }

a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--fg-faint);
  transition: border-color 0.15s, color 0.15s;
}
a:hover { border-color: var(--accent); color: var(--accent); }

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--panel-2);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--fg);
  border: 1px solid var(--rule);
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
}

/* ── Layout shell ──────────────────────────────────────── */

.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ── Top nav ───────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--fg);
  border: 0;
}
.nav-brand .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.9); }
  50%      { opacity: 1;    transform: scale(1.05); }
}
.nav-links {
  display: flex;
  gap: 22px;
  color: var(--fg-mute);
}
.nav-links a {
  border: 0;
  color: var(--fg-mute);
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--fg); }
.nav-links .idx {
  color: var(--fg-faint);
  margin-right: 4px;
  font-variant-numeric: tabular-nums;
}

/* ── Sections ──────────────────────────────────────────── */

section {
  padding: var(--section-pad) 0;
  border-bottom: 1px solid var(--rule);
}
section:last-of-type { border-bottom: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 36px;
}
.section-head .num {
  font-size: 11px;
  color: var(--fg-mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.section-head h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.section-head .rule {
  flex: 1;
  height: 1px;
  background: var(--rule);
  align-self: center;
  margin-left: 8px;
}

/* ── Hero ──────────────────────────────────────────────── */

.hero {
  padding-top: 72px;
  padding-bottom: 72px;
  border-bottom: 1px solid var(--rule);
}
.hero-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--fg-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 56px;
}
.hero-meta .status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hero-meta .status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}
.hero-title {
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin: 0 0 24px;
  color: var(--fg);
}
.hero-title .slash { color: var(--accent); }
.hero-tag {
  font-size: 18px;
  line-height: 1.5;
  color: var(--fg-soft);
  max-width: 640px;
  margin: 0 0 56px;
  font-weight: 400;
}
.hero-tag em {
  font-style: normal;
  color: var(--fg);
}

/* Quiet consultancy credit under the tagline */
.hero-credit {
  font-size: 12px;
  color: var(--fg-mute);
  letter-spacing: 0.02em;
  margin: -36px 0 56px;
  max-width: 640px;
}
.hero-credit a {
  color: var(--fg-soft);
  border-bottom-color: var(--fg-faint);
}
.hero-credit a:hover { color: var(--accent); }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 80px;
}

/* ── Buttons ───────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  border-radius: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover {
  border-color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}
.btn-primary:hover {
  background: #fff;
  border-color: #fff;
  color: #000;
}
.btn .arrow {
  font-size: 14px;
  line-height: 1;
}
.btn .size {
  margin-left: auto;
  padding-left: 12px;
  color: var(--fg-mute);
  font-size: 11px;
  border-left: 1px solid var(--rule);
}
.btn-primary .size {
  color: rgba(0, 0, 0, 0.55);
  border-left-color: rgba(0, 0, 0, 0.18);
}

/* ── Quick-overview video ──────────────────────────────── */

.video-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 12px;
  color: var(--accent);
  border-bottom: 0;
}
.video-link:hover { color: var(--fg); }
.video-link-icon { font-size: 10px; }

/* Overlay: dimmed backdrop, centered 16:9 player. Stays mounted (hidden) so
   the video element keeps its buffer between openings. */
.video-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.82);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s, visibility 0.15s;
}
.video-overlay.is-open { visibility: visible; opacity: 1; }
.video-dialog {
  width: min(1100px, 100%, calc((100vh - 90px) * 16 / 9));
  border: 1px solid var(--rule-strong);
  background: var(--panel);
}
.video-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.video-close {
  background: transparent;
  border: 0;
  color: var(--hint);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.video-close:hover { color: var(--fg); }
.video-dialog video {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
}

/* ── 3D preview block ──────────────────────────────────── */

.preview {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0;
  border: 1px solid var(--rule);
  background:
    linear-gradient(180deg, #050505, #000);
  position: relative;
  min-height: 420px;
}
.preview-canvas {
  position: relative;
  border-right: 1px solid var(--rule);
  overflow: hidden;
}
.preview-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
/* Head-facing switch — sits inside the 3D pane, bottom-left. Governs what you're looking at, so it lives in the view
   rather than in the readout column. Segmented rather than a checkbox:
   both states need a name, and "on/off" names neither. */
.facing-switch {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.facing-switch .facing-label { color: var(--fg-faint); }
.facing-switch .facing-segs {
  display: flex;
  border: 1px solid var(--rule-strong);
  background: rgba(0, 0, 0, 0.35);
}
.facing-switch button {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--rule-strong);
  color: var(--fg-mute);
  font: inherit;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 9px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.facing-switch button:last-child { border-right: 0; }
.facing-switch button:hover { color: var(--fg); }
.facing-switch button.is-on {
  color: var(--accent);
  background: var(--accent-soft);
}

.preview-hint {
  position: absolute;
  bottom: 14px;
  left: 16px;
  font-size: 10.5px;
  color: var(--fg-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-readout {
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.readout-head {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin-bottom: 8px;
  padding-bottom: 12px;
  padding-right: 60px;   /* clear of the "? help" button */
  border-bottom: 1px solid var(--rule);
}
.readout-head .live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
}
.readout-head .live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  animation: pulse 1.2s ease-in-out infinite;
}
.readout-head .sim {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-mute);
}
.readout-head .sim::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-mute);
  opacity: 0.6;
}
.midi-btn {
  background: transparent;
  border: 1px solid var(--rule-strong);
  color: var(--fg-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 10px;
  min-width: 88px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.midi-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 255, 255, 0.02);
}

/* Pink-noise audio toggle, sits just above the MIDI status bar. Same
   visual weight as the status bar — left-aligned label, right-aligned
   button — so the two rows read as a single stacked control area. */
.audio-row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 10.5px;
  color: var(--fg-mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
/* Blue-gray usage hint after a row label, e.g. "(use headphones)". */
.audio-row .hint,
.midi-status .hint {
  color: var(--hint);
  margin-left: 6px;
  text-transform: none;
  letter-spacing: 0.05em;
}
.audio-btn.is-on {
  border-color: var(--accent);
  color: var(--accent);
}

/* Source-direction + picked-HRIR readout, under the audio toggle */
.hrir-row {
  font-size: 10.5px;
  color: var(--fg-mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -2px;
  font-variant-numeric: tabular-nums;
}
.hrir-row span:last-child { color: var(--fg-faint); }
.hrir-row span.pick { color: var(--accent); }
.audio-btn.is-on::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  margin-right: 8px;
  vertical-align: middle;
  animation: pulse 1.4s ease-in-out infinite;
}

/* Bottom status bar in the readout pane — sticks to the bottom of the
   right column and pairs a short device-state label with the connect /
   disconnect / retry button. */
.midi-status {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 10.5px;
  color: var(--fg-mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.midi-status > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}
.cc-row .cc-num {
  font-size: 10.5px;
  color: var(--fg-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-width: 72px;
}
.cc-row .cc-bar {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.cc-row .cc-bar i {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  transition: width 0.05s linear;
}
.cc-row .cc-val {
  font-size: 13px;
  color: var(--fg);
  min-width: 36px;
  text-align: right;
}

/* ── BOM table ─────────────────────────────────────────── */

.bom {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.bom th, .bom td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
}
.bom th {
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-mute);
  border-bottom: 1px solid var(--rule-strong);
}
.bom td.qty {
  width: 48px;
  color: var(--fg-mute);
  font-variant-numeric: tabular-nums;
}
.bom td.part {
  color: var(--fg);
}
.bom td.part .sub {
  display: block;
  color: var(--fg-mute);
  font-size: 11px;
  margin-top: 2px;
}
.bom td.price {
  width: 110px;
  text-align: right;
  color: var(--fg-soft);
  font-variant-numeric: tabular-nums;
}
.bom td.src {
  width: 140px;
  text-align: right;
}
.bom td.src a { border-bottom-color: var(--fg-faint); font-size: 12px; }
.bom tfoot td {
  border-bottom: 0;
  padding-top: 18px;
  font-size: 11px;
  color: var(--fg-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.bom tfoot .total {
  text-align: right;
  color: var(--fg);
  font-size: 13px;
}
/* Phones: four columns don't fit, so each row becomes a small grid —
   qty · part · price on top, the source link tucked under the part. */
@media (max-width: 600px) {
  .bom thead { display: none; }
  .bom tr {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    grid-template-areas: "qty part price" ". src src";
    column-gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--rule);
  }
  .bom tfoot tr { border-bottom: 0; }
  .bom th, .bom td { display: block; padding: 0; border-bottom: 0; width: auto; }
  .bom td.qty { grid-area: qty; width: auto; }
  .bom td.part { grid-area: part; }
  .bom td.price { grid-area: price; width: auto; }
  .bom td.src { grid-area: src; width: auto; text-align: left; margin-top: 6px; }
  .bom tfoot td { padding: 0; }
  .bom tfoot td:nth-child(1), .bom tfoot td:nth-child(3) { display: none; }
  .bom tfoot td:nth-child(2) { grid-area: part; }
  .bom tfoot td.total { grid-area: price; }
}

/* ── Wiring / steps ────────────────────────────────────── */

.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}
.cols-narrow {
  grid-template-columns: 1.2fr 0.8fr;
}

.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: s;
}
.steps li {
  position: relative;
  padding: 14px 0 14px 44px;
  border-bottom: 1px solid var(--rule);
  counter-increment: s;
  color: var(--fg-soft);
  font-size: 14px;
  line-height: 1.6;
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(s, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 16px;
  font-size: 10.5px;
  color: var(--fg-mute);
  letter-spacing: 0.1em;
}
.steps li strong {
  color: var(--fg);
  font-weight: 600;
}

/* placeholder image */
.assembly-body .steps {
  max-width: 62ch;
}

/* The assembled-device shot is panoramic (5.6:1), so it spans the full shell
   rather than sitting in a narrow column where it would be ~65px tall. */
.shot {
  margin: 44px 0 0;
  padding: 0;
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  background: #0a0a0a;
}
/* Callout on the assembly photo: a red ring on the QT Py's reset button
   and a label linking to the flash steps. Positions are percentages of the
   photo, so the marks track it at any width. */
.shot-frame { position: relative; }
.shot-frame .reset-mark {
  position: absolute;
  width: 2.6%;
  min-width: 18px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 3px solid #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
  pointer-events: none;
}
.shot-frame .reset-lead {
  position: absolute;
  top: 22px;
  width: 2px;
  transform: translateX(-50%);
  background: #ef4444;
  pointer-events: none;
}
.shot-frame .reset-label {
  position: absolute;
  top: 6px;
  transform: translateX(-10px);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: #dc2626;
  border-bottom: 0;
}
.shot-frame .reset-label:hover { color: #ef4444; text-decoration: underline; }
.shot figcaption {
  margin-top: 12px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--fg-mute);
  letter-spacing: 0.01em;
}
.shot figcaption code {
  font-size: 11px;
}

/* Mount section: photo beside the steps. */
.shot-side { margin: 0; }
#mount .cols > * { min-width: 0; }   /* let the photo shrink in the grid */

/* ── Source / GitHub ───────────────────────────────────── */

.repo {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 28px 28px;
  border: 1px solid var(--rule);
  background: var(--panel);
}
.repo .repo-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  margin: 0 0 4px;
}
.repo .repo-meta {
  font-size: 12px;
  color: var(--fg-mute);
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.repo .repo-meta span::before {
  content: "·";
  margin-right: 18px;
  color: var(--fg-faint);
}
.repo .repo-meta span:first-child::before { content: ""; margin: 0; }
.repo .repo-meta .ic {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.repo .repo-meta .ic::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

/* ── FAQ ───────────────────────────────────────────────── */

.faq details {
  border-bottom: 1px solid var(--rule);
  padding: 18px 0;
}
.faq details:first-of-type { border-top: 1px solid var(--rule); }
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .q-mark {
  font-size: 10.5px;
  color: var(--fg-mute);
  letter-spacing: 0.12em;
  width: 28px;
}
.faq summary .q-toggle {
  color: var(--fg-mute);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.2s;
}
.faq details[open] .q-toggle { transform: rotate(45deg); color: var(--accent); }
.faq .q-body {
  padding: 16px 0 4px 44px;
  color: var(--fg-soft);
  font-size: 13.5px;
  line-height: 1.65;
  max-width: 720px;
}

/* ── Footer ────────────────────────────────────────────── */

/* Colophon — quiet consultancy note near the foot of the page */
.colophon {
  max-width: 680px;
}
.colophon p {
  color: var(--fg-soft);
  font-size: 14px;
  line-height: 1.7;
  margin: 0 0 18px;
}
.colophon p:last-child { margin-bottom: 0; }
.colophon em { font-style: italic; color: var(--fg); }

/* Compare mode (hero-only iframes on the options page) */
.compare .hero {
  border-bottom: 0;
  min-height: 100vh;
}

.foot {
  padding: 48px 0 64px;
  font-size: 11px;
  color: var(--fg-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.foot a { color: var(--fg-mute); border: 0; }
.foot a:hover { color: var(--accent); }

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 800px) {
  .preview { grid-template-columns: 1fr; }
  .preview-canvas { border-right: 0; border-bottom: 1px solid var(--rule); aspect-ratio: 4/3; }
  .cols, .cols-narrow { grid-template-columns: 1fr; gap: 32px; }
  .nav-links { gap: 14px; }
  .nav-links .idx { display: none; }
  .repo { grid-template-columns: 1fr; }
  :root { --section-pad: 64px; --gutter: 20px; }
  /* Nav: the links scroll sideways instead of running under the brand. */
  .nav-inner { gap: 18px; }
  .nav-brand { flex-shrink: 0; }
  .nav-links {
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  /* Preview: let the stacked panes shrink to the screen. Horizontal drags
     on the 3D view aim the head; vertical ones still scroll the page. */
  .preview > * { min-width: 0; }
  .preview-canvas { touch-action: pan-y; }
}

@media (max-width: 600px) {
  .preview-readout { padding: 18px 16px; }
  .readout-head { padding-right: 76px; }
  /* Hints drop under their label so label, hint and button all fit. */
  .audio-row .hint,
  .midi-status .hint { display: block; margin: 4px 0 0; }
  .midi-status > span { white-space: normal; }
}

/* Touch screens: finger-sized controls. */
@media (pointer: coarse) {
  .midi-btn { padding: 10px 12px; }
  .facing-switch button { padding: 8px 12px; }
}

/* ── Legal pages (impressum.html, datenschutz.html) ────── */

.legal {
  max-width: 760px;
  padding-top: 56px;
  padding-bottom: 80px;
}
.legal-back {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mute);
  border-bottom: 0;
}
.legal h1 {
  margin: 20px 0 36px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.legal h2 {
  margin: 32px 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.legal p {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--fg-soft);
}
.legal .legal-stand { margin-top: 40px; color: var(--fg-mute); font-size: 12px; }
.legal .legal-foot { margin-top: 24px; font-size: 12px; }
