/* ==========================================================================
   dreamucxe — terminal / HUD diagnostics console
   Monochrome. Hierarchy carried by contrast steps, never by hue.
   ========================================================================== */

:root {
  --background: #000;
  --surface: #0c0c0c;
  --surface-hover: #111;
  --surface-sunk: #060606;
  --border: #292929;
  --border-hover: #555;
  --border-bright: #7a7a7a;
  --foreground: #ededed;
  --muted-strong: #b9b9b9;
  --muted: #929292;
  --dim: #5e5e5e;
  --faint: #333;

  --frame-width: 1400px;
  --gutter: clamp(16px, 4vw, 44px);

  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono",
    Menlo, Consolas, "Liberation Mono", monospace;

  /* HUD systems don't have lazy hovers. */
  --snap: 70ms cubic-bezier(0.2, 0, 0, 1);
  --cut: 120ms steps(4, end);

  --switch-h: 116px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--background);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

/* Faint scanline wash + vignette over the whole console. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(237, 237, 237, 0.022) 0 1px,
      transparent 1px 3px
    ),
    radial-gradient(120% 90% at 50% 0%, transparent 45%, rgba(0, 0, 0, 0.55) 100%);
  mix-blend-mode: screen;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 1em;
}

ul,
ol,
dl,
dd {
  margin: 0;
  padding: 0;
}

li {
  list-style: none;
}

img,
video,
canvas {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 1px solid var(--foreground);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 8px 14px;
  background: var(--foreground);
  color: #000;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* --------------------------------------------------------------------------
   Micro-label — the slash-delimited system-state text used everywhere
   -------------------------------------------------------------------------- */

.mlabel,
.route-kicker,
.panel-head span,
.capture-bar span,
.capture-foot span,
.switch-register span,
.spec dt {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mlabel--bright {
  color: var(--muted-strong);
}

.mlabel b {
  font-weight: 500;
  color: var(--foreground);
}

/* --------------------------------------------------------------------------
   Particles
   -------------------------------------------------------------------------- */

.particle-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms linear;
}

.particle-background[data-on="1"] {
  opacity: 1;
}

.particle-controls {
  position: fixed;
  right: var(--gutter);
  bottom: calc(var(--switch-h) + 16px);
  z-index: 40;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(6, 6, 6, 0.86);
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

html[data-js] .particle-controls {
  display: flex;
}

.particle-controls > span {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.particle-controls button {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted-strong);
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 3px 8px;
  cursor: pointer;
  transition: border-color var(--snap), color var(--snap), background var(--snap);
}

.particle-controls button:hover {
  border-color: var(--border-bright);
  color: var(--foreground);
  background: var(--surface-hover);
}

.particle-controls button[aria-pressed="true"] {
  color: #000;
  background: var(--foreground);
  border-color: var(--foreground);
}

/* --------------------------------------------------------------------------
   Shell / header / footer
   -------------------------------------------------------------------------- */

.route-shell {
  position: relative;
  z-index: 1;
  max-width: var(--frame-width);
  margin: 0 auto;
  padding: 0 var(--gutter) calc(var(--switch-h) + 40px);
}

.route-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--border);
}

.route-brand {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--foreground);
  transition: opacity var(--snap);
}

.route-brand:hover {
  opacity: 0.65;
}

.route-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.route-nav a {
  position: relative;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 2px;
  transition: color var(--snap);
}

.route-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--foreground);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--snap);
}

.route-nav a:hover,
.route-nav a[aria-current="page"] {
  color: var(--foreground);
}

.route-nav a:hover::after,
.route-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* Breadcrumbs */
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 0 0;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.crumbs a {
  color: var(--muted);
  transition: color var(--snap);
}

.crumbs a:hover {
  color: var(--foreground);
}

.crumbs [aria-current="page"] {
  color: var(--muted-strong);
}

.crumbs li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 48px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.route-footer a {
  transition: color var(--snap);
  color: var(--muted);
}

.route-footer a:hover {
  color: var(--foreground);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
  padding: clamp(28px, 5vw, 56px) 0 0;
}

.hero-copy {
  min-width: 0;
}

.back-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 8px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color var(--snap), background var(--snap);
}

.back-control:hover {
  border-color: var(--border-bright);
  background: var(--surface-hover);
}

.back-control strong {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.back-control i {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.route-kicker {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(38px, 7vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  text-transform: lowercase;
}

.hero-tagline {
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.75;
  max-width: 62ch;
}

/* Bracketed stack metadata — plain, not badges. */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 22px 0;
}

.tags li {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
  transition: color var(--snap), text-shadow var(--snap);
}

.tags li::before {
  content: "[";
  color: var(--faint);
}

.tags li::after {
  content: "]";
  color: var(--faint);
}

.tags li:hover {
  color: var(--foreground);
  text-shadow: 0 0 8px rgba(237, 237, 237, 0.45);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-strong);
  transition: border-color var(--snap), color var(--snap), background var(--snap);
}

.action:hover {
  border-color: var(--border-bright);
  color: var(--foreground);
  background: var(--surface-hover);
}

.action--primary {
  background: var(--foreground);
  border-color: var(--foreground);
  color: #000;
}

.action--primary:hover {
  background: #fff;
  border-color: #fff;
  color: #000;
}

.action--note {
  border-style: dashed;
  color: var(--dim);
  cursor: default;
}

.action--note:hover {
  border-color: var(--border);
  color: var(--dim);
  background: var(--surface);
}

/* --------------------------------------------------------------------------
   Capture frame
   -------------------------------------------------------------------------- */

.capture {
  border: 1px solid var(--border);
  background: var(--surface-sunk);
  min-width: 0;
}

.capture-bar,
.capture-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.capture-foot {
  border-bottom: 0;
  border-top: 1px solid var(--border);
}

.capture-foot span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.capture-foot i {
  width: 5px;
  height: 5px;
  background: var(--muted);
  border-radius: 50%;
  flex: none;
}

.capture[data-state="verified"] .capture-foot i {
  background: var(--foreground);
  box-shadow: 0 0 7px rgba(237, 237, 237, 0.8);
  animation: capturePulse 2.4s ease-in-out infinite;
}

.capture[data-state="pending"] .capture-foot i {
  background: transparent;
  border: 1px solid var(--dim);
}

@keyframes capturePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.capture-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
}

.capture-stage {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(rgba(237, 237, 237, 0.028) 1px, transparent 1px) 0 0 / 100% 4px,
    linear-gradient(90deg, rgba(237, 237, 237, 0.02) 1px, transparent 1px) 0 0 / 28px 100%,
    var(--surface-sunk);
}

.capture-stage img,
.capture-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.12) brightness(0.9);
}

/* Placeholder: a framed void with a reticle, clearly not a real capture. */
.capture-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
}

.capture-placeholder::before {
  content: "";
  position: absolute;
  inset: 26px;
  border: 1px dashed var(--faint);
}

.capture-placeholder span {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.capture-placeholder strong {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.capture-reticle {
  position: absolute;
  inset: 14px;
  pointer-events: none;
}

.capture-reticle::before,
.capture-reticle::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-hover);
}

.capture-reticle::before {
  top: 0;
  left: 0;
  border-right: 0;
  border-bottom: 0;
}

.capture-reticle::after {
  bottom: 0;
  right: 0;
  border-left: 0;
  border-top: 0;
}

.capture-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 44px;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(237, 237, 237, 0.07) 45%,
    rgba(237, 237, 237, 0.12) 50%,
    transparent
  );
  animation: captureScan 5.4s cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

@keyframes captureScan {
  0% { transform: translateY(-60px); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateY(340px); opacity: 0; }
}

.capture-viewlabel {
  position: absolute;
  left: 16px;
  bottom: 14px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.capture-viewlabel b {
  color: var(--foreground);
  font-weight: 500;
}

.capture-aside {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
}

.capture-aside > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.capture-aside > header i {
  width: 4px;
  height: 4px;
  background: var(--dim);
  border-radius: 50%;
}

.capture-thumb {
  height: 74px;
  border-bottom: 1px solid var(--border);
  background:
    repeating-linear-gradient(
      135deg,
      rgba(237, 237, 237, 0.045) 0 1px,
      transparent 1px 7px
    ),
    var(--surface-sunk);
}

.capture-thumb img,
.capture-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.1);
}

.specs {
  padding: 4px 0;
}

.spec {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
}

.spec dd {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Panels (environment, index, archive)
   -------------------------------------------------------------------------- */

.panel {
  border: 1px solid var(--border);
  background: var(--surface-sunk);
  margin-top: 40px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.panel-head h2 {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--foreground);
  font-weight: 500;
}

.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.env-cell {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.env-cell dt {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 5px;
}

.env-cell dd {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--foreground);
}

/* Project index rows */
.index-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--snap);
}

.index-row:last-child {
  border-bottom: 0;
}

.index-row:hover {
  background: var(--surface-hover);
}

.index-ch {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  transition: color var(--snap);
}

.index-row:hover .index-ch {
  color: var(--foreground);
}

.index-main {
  min-width: 0;
}

.index-name {
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--foreground);
  margin-bottom: 3px;
}

.index-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.index-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

.index-row:hover .index-meta {
  color: var(--muted-strong);
}

/* Archive grid */
.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}

.archive-cell {
  padding: 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-width: 0;
  transition: background var(--snap);
}

.archive-cell:hover {
  background: var(--surface-hover);
}

.archive-cell h3 {
  font-size: 13px;
  margin-bottom: 6px;
}

.archive-cell h3 a {
  transition: opacity var(--snap);
}

.archive-cell h3 a:hover {
  opacity: 0.7;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.archive-cell p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 10px;
}

/* --------------------------------------------------------------------------
   README section + fake-fetch terminal loader
   -------------------------------------------------------------------------- */

.readme-section {
  margin-top: 48px;
  border: 1px solid var(--border);
  background: var(--surface-sunk);
}

.readme-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.readme-head h2 {
  font-size: 16px;
  letter-spacing: -0.01em;
  margin-top: 4px;
}

.readme-loader {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}

.readme-loader[hidden] {
  display: none;
}

.readme-prompt {
  font-size: 12px;
  color: var(--muted-strong);
  margin: 0 0 14px;
  white-space: pre-wrap;
}

.readme-prompt b {
  color: var(--foreground);
  font-weight: 500;
}

.readme-prompt .cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  margin-left: 1px;
  vertical-align: -2px;
  background: var(--foreground);
  animation: caret 1s steps(1, end) infinite;
}

@keyframes caret {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

.readme-skel {
  display: grid;
  gap: 9px;
}

.readme-skel i {
  display: block;
  height: 8px;
  background: linear-gradient(90deg, var(--faint), #1b1b1b, var(--faint));
  background-size: 220% 100%;
  animation: skelSweep 1.5s linear infinite;
  animation-delay: var(--d, 0ms);
  opacity: 0;
}

.readme-loader[data-run] .readme-skel i {
  opacity: 1;
  transition: opacity 90ms steps(2, end) var(--d, 0ms);
}

@keyframes skelSweep {
  to { background-position: -220% 0; }
}

.readme-skel i:nth-child(1) { width: 92%; --d: 0ms; }
.readme-skel i:nth-child(2) { width: 78%; --d: 60ms; }
.readme-skel i:nth-child(3) { width: 85%; --d: 120ms; }
.readme-skel i:nth-child(4) { width: 46%; --d: 180ms; }
.readme-skel i:nth-child(5) { width: 88%; --d: 240ms; }
.readme-skel i:nth-child(6) { width: 71%; --d: 300ms; }
.readme-skel i:nth-child(7) { width: 90%; --d: 360ms; }
.readme-skel i:nth-child(8) { width: 62%; --d: 420ms; }
.readme-skel i:nth-child(9) { width: 40%; --d: 480ms; }

.readme-loader small {
  display: block;
  margin-top: 14px;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.readme-body {
  padding: clamp(20px, 3vw, 34px);
  max-width: 84ch;
}

/* Staggered line-by-line reveal as content "loads". */
html[data-js] .readme-body[data-reveal="pending"] > * {
  opacity: 0;
}

.readme-body[data-reveal="run"] > * {
  animation: lineIn 200ms cubic-bezier(0.2, 0, 0, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

@keyframes lineIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.readme-body h3 {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 30px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.readme-body > h3:first-child {
  margin-top: 0;
}

.readme-body p {
  color: var(--muted-strong);
  line-height: 1.78;
  max-width: 74ch;
}

.readme-body ul {
  display: grid;
  gap: 9px;
  margin: 0 0 18px;
}

.readme-body ul li {
  position: relative;
  padding-left: 20px;
  color: var(--muted-strong);
  line-height: 1.7;
}

.readme-body ul li::before {
  content: "▸";
  position: absolute;
  left: 2px;
  top: 0;
  color: var(--dim);
}

.readme-body pre {
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--border);
  background: #050505;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted-strong);
  tab-size: 4;
}

.readme-body pre code {
  font: inherit;
}

.readme-kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  margin: 0 0 18px;
}

.readme-kv > div {
  padding: 11px 14px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.readme-kv dt {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 4px;
}

.readme-kv dd {
  font-size: 12px;
  color: var(--foreground);
}

/* --------------------------------------------------------------------------
   Channel strip — numbered tabs, timecode markers
   -------------------------------------------------------------------------- */

.switch {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgba(3, 3, 3, 0.94);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.switch-inner {
  max-width: var(--frame-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  gap: 22px;
  align-items: center;
  min-height: var(--switch-h);
}

.switch-banks {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 14px 0;
}

/* The sliding/snapping active indicator. */
.switch-cursor {
  position: absolute;
  top: 14px;
  left: 0;
  width: 0;
  height: 44px;
  border: 1px solid var(--foreground);
  pointer-events: none;
  opacity: 0;
  transition: transform 150ms cubic-bezier(0.2, 0, 0, 1),
    width 150ms cubic-bezier(0.2, 0, 0, 1), opacity 90ms linear;
}

.switch-cursor[data-ready] {
  opacity: 1;
}

.switch-cell {
  position: relative;
  display: grid;
  place-items: center;
  gap: 3px;
  width: 52px;
  height: 44px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color var(--snap), background var(--snap), color var(--snap);
}

.switch-cell i {
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  transition: color var(--snap);
}

.switch-cell u {
  width: 14px;
  height: 1px;
  background: var(--faint);
  text-decoration: none;
  transition: background var(--snap), width var(--snap);
}

.switch-cell:hover {
  border-color: var(--border-bright);
  background: var(--surface-hover);
}

.switch-cell:hover i {
  color: var(--foreground);
}

.switch-cell:hover u {
  background: var(--muted);
  width: 22px;
}

.switch-cell[aria-current="page"] {
  border-color: var(--border-hover);
  background: #131313;
}

.switch-cell[aria-current="page"] i {
  color: var(--foreground);
}

.switch-cell[aria-current="page"] u {
  background: var(--foreground);
  width: 22px;
}

.switch-register {
  border-left: 1px solid var(--border);
  padding: 14px 0 14px 22px;
  min-width: 0;
}

.switch-register-head,
.switch-register-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.switch-route {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  min-width: 0;
}

.switch-route span {
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switch-route strong {
  color: var(--foreground);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switch-route i {
  font-style: normal;
  color: var(--dim);
  flex: none;
}

.switch-progress {
  display: flex;
  gap: 3px;
  margin: 10px 0;
}

.switch-progress i {
  flex: 1;
  height: 3px;
  background: var(--faint);
}

.switch-progress[data-run] i {
  animation: progCell 480ms steps(2, end) both;
  animation-delay: calc(var(--n) * 18ms);
}

.switch-progress i:nth-child(1) { --n: 1; }
.switch-progress i:nth-child(2) { --n: 2; }
.switch-progress i:nth-child(3) { --n: 3; }
.switch-progress i:nth-child(4) { --n: 4; }
.switch-progress i:nth-child(5) { --n: 5; }
.switch-progress i:nth-child(6) { --n: 6; }
.switch-progress i:nth-child(7) { --n: 7; }
.switch-progress i:nth-child(8) { --n: 8; }
.switch-progress i:nth-child(9) { --n: 9; }
.switch-progress i:nth-child(10) { --n: 10; }

@keyframes progCell {
  0% { background: var(--faint); }
  50% { background: var(--foreground); }
  100% { background: var(--border-hover); }
}

/* --------------------------------------------------------------------------
   Glitch / cut transition on route change
   -------------------------------------------------------------------------- */

.route-shell[data-cut] {
  animation: routeCut 130ms steps(3, end) both;
}

@keyframes routeCut {
  0% { opacity: 1; transform: none; filter: none; }
  33% { opacity: 0.25; transform: translateX(-2px); filter: brightness(2.4) contrast(0.6); }
  66% { opacity: 0.6; transform: translateX(1px); filter: brightness(0.5); }
  100% { opacity: 1; transform: none; filter: none; }
}

.route-shell[data-in] {
  animation: routeIn 180ms cubic-bezier(0.2, 0, 0, 1) both;
}

@keyframes routeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Brief scanline flicker across the viewport on a cut. */
.cut-flash {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(237, 237, 237, 0.14) 0 2px,
    transparent 2px 5px
  );
  animation: cutFlash 150ms steps(3, end) forwards;
}

@keyframes cutFlash {
  0% { opacity: 0.9; }
  50% { opacity: 0.25; }
  100% { opacity: 0; }
}

/* --------------------------------------------------------------------------
   Boot sequence — only when JS is on, so no-JS never sees a stuck overlay
   -------------------------------------------------------------------------- */

.boot {
  display: none;
}

html[data-boot] .boot {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-content: center;
  gap: 16px;
  padding: 32px;
  background: #000;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

html[data-boot="leaving"] .boot {
  animation: bootOut 220ms steps(3, end) forwards;
  pointer-events: none;
}

@keyframes bootOut {
  to { opacity: 0; visibility: hidden; }
}

/* Hold the page still underneath while booting. */
html[data-boot]:not([data-boot="leaving"]) body {
  overflow: hidden;
}

html[data-boot]:not([data-boot="leaving"]) .route-shell,
html[data-boot]:not([data-boot="leaving"]) .switch,
html[data-boot]:not([data-boot="leaving"]) .particle-controls {
  opacity: 0;
}

.boot-line {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  opacity: 0.25;
  transition: opacity 90ms linear, color 90ms linear;
}

.boot-line[data-done] {
  opacity: 1;
  color: var(--foreground);
}

.boot-line b {
  font-weight: 500;
  color: var(--dim);
}

.boot-line[data-done] b {
  color: var(--foreground);
}

.boot-bar {
  width: min(340px, 74vw);
  height: 2px;
  background: var(--faint);
  margin-top: 8px;
}

.boot-bar span {
  display: block;
  height: 100%;
  width: var(--p, 0%);
  background: var(--foreground);
  transition: width 180ms cubic-bezier(0.2, 0, 0, 1);
}

.boot-pct {
  font-variant-numeric: tabular-nums;
  color: var(--muted-strong);
}

/* Page-load stagger — panels arrive like a boot sequence, top to bottom. */
.stagger > * {
  animation: panelIn 240ms cubic-bezier(0.2, 0, 0, 1) both;
  animation-delay: calc(var(--s, 0) * 70ms);
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */

.error-block {
  padding: clamp(40px, 9vw, 110px) 0;
  max-width: 70ch;
}

.error-block h1 {
  font-size: clamp(30px, 6vw, 54px);
  letter-spacing: -0.03em;
  margin: 12px 0 18px;
  text-transform: lowercase;
}

.error-trace {
  margin: 26px 0;
  padding: 16px;
  border: 1px solid var(--border);
  background: #050505;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}

.error-trace b {
  color: var(--foreground);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1040px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .switch-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .switch-register {
    display: none;
  }
}

@media (max-width: 720px) {
  :root {
    --switch-h: 82px;
  }

  .capture-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .capture-stage {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    min-height: 220px;
  }

  .capture-aside {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .capture-thumb {
    display: none;
  }

  .specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .index-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .index-meta {
    grid-column: 2;
  }

  .switch-banks {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 12px 0;
  }

  .switch-banks::-webkit-scrollbar {
    display: none;
  }

  .switch-cell {
    flex: none;
    width: 46px;
    height: 38px;
  }

  .switch-cursor {
    height: 38px;
    top: 12px;
  }

  .particle-controls {
    bottom: calc(var(--switch-h) + 10px);
    right: 10px;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion — instant state changes, no scramble, static particle frame
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .capture-scan,
  .readme-prompt .cursor {
    display: none;
  }

  .readme-skel i {
    opacity: 1;
    animation: none;
    background: var(--faint);
  }

  html[data-js] .readme-body[data-reveal="pending"] > *,
  .readme-body[data-reveal="run"] > *,
  .stagger > * {
    opacity: 1;
    transform: none;
  }
}
