/* phunction.sh — canon v2: HERMETIC FORMALISM (design process rounds 1–4,
   record on /design; full rationale in docs/aesthetic.md).

   COLOR IS PHASE, and the wheel has eight named stations — the 8th roots of
   unity rotated 10°: blood·rust·phosphor·ichor·verdigris·aether·sigil·
   philtre. Each station owns things; any other hue must state its angle.
   Ground: synthwave midnight purple (round 1). Type: Redaction speaks,
   Iosevka operates, Computer Modern typesets mathematics only (round 3).
   Textures: noise/scanlines/vignette, deliberately present (round 2).
   Everything legible on a 1080p screenshare. */

/* ---- faces ---- */
@font-face {
  font-family: "Redaction 20";
  src: url("/fonts/redaction-20-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Redaction 50";
  src: url("/fonts/redaction-50-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Paper";
  src: url("/fonts/KaTeX_Main-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Paper";
  src: url("/fonts/KaTeX_Main-Italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "PaperMath";
  src: url("/fonts/KaTeX_Math-Italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Iosevka";
  src: url("/fonts/iosevka-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Iosevka";
  src: url("/fonts/iosevka-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Iosevka";
  src: url("/fonts/iosevka-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ---- tokens ---- */
:root {
  /* ground — midnight purple, the old site's signature */
  --plane: #1a1428;
  --surface: #221830;
  --line: #382e4a;
  /* ink */
  --ink: #f4f2fb;
  --annot: #b3accc;
  --faint: #6e6790;
  /* the eight stations — 8th roots of unity, +10° */
  --blood:     oklch(70% 0.19 10);
  --rust:      oklch(74% 0.16 55);
  --phosphor:  oklch(84% 0.15 100);
  --ichor:     oklch(80% 0.16 145);
  --verdigris: oklch(80% 0.12 190);
  --aether:    oklch(76% 0.12 235);
  --sigil:     oklch(70% 0.17 280);
  --philtre:   oklch(74% 0.17 325);
  /* type roles */
  --display: "Redaction 20", "IM Fell English", Georgia, serif;
  --prose: "Redaction 50", "IM Fell English", Georgia, serif;
  --math: "PaperMath", "Paper", Georgia, serif;
  --paper: "Paper", "STIX Two Text", Georgia, serif;
  --term: "Iosevka", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  /* vignette + the faint ruled grid + the plane */
  background:
    radial-gradient(ellipse at 50% 28%, transparent 24%, rgba(8, 5, 16, 0.78) 100%),
    linear-gradient(rgba(138, 108, 255, 0.045) 1px, transparent 1px) 0 0 / 100% 2.4rem,
    linear-gradient(90deg, rgba(138, 108, 255, 0.045) 1px, transparent 1px) 0 0 / 2.4rem 100%,
    var(--plane);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--term);
  font-size: 15px;
  line-height: 1.55;
}

/* print grain + scanlines over everything except the lab (z-order exempts) */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.10;
  mix-blend-mode: overlay;
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.45) 0 1px, transparent 1px 3px);
  opacity: 0.13;
}

a { color: var(--aether); text-decoration: none; }
a:hover { color: var(--philtre); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---- the sigil ---- */
.sigil { display: inline-block; vertical-align: middle; overflow: visible; }
.sigil .sigil-ring path { stroke: var(--annot); stroke-width: 1; fill: none; opacity: 0.9; }
.sigil .sigil-hepta polygon {
  stroke: var(--ink); stroke-width: 1.6; fill: none;
  stroke-linejoin: round; opacity: 0.85;
}
.sigil .sigil-inner { stroke: var(--faint); stroke-width: 1; fill: none; }
.sigil .sigil-phi {
  font-family: var(--math); font-style: italic; font-size: 15px;
  fill: var(--phosphor); stroke: none;
}
.sigil .sigil-ring, .sigil .sigil-hepta { transform-origin: 50% 50%; }
.sigil.spin .sigil-ring { animation: sigil-cw 240s linear infinite; }
.sigil.spin .sigil-hepta { animation: sigil-ccw 360s linear infinite; }
@keyframes sigil-cw { to { transform: rotate(1turn); } }
@keyframes sigil-ccw { to { transform: rotate(-1turn); } }

/* ---- chrome ---- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 1.4rem;
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 2;
}
.brand { color: var(--ink); font-weight: 700; display: inline-flex; align-items: center; gap: 0.55rem; }
.brand .brand-path::before { content: "~/"; color: var(--faint); font-weight: 400; }
.brand:hover { color: var(--phosphor); }
.links { display: flex; gap: 1.4rem; }

/* ---- landing ---- */
.hero { max-width: 64rem; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; position: relative; z-index: 2; }
.wordmark {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(3rem, 9vw, 5.5rem);
  line-height: 1.05;
  margin: 1.2rem 0 0.4rem;
  color: var(--ink);
  animation: breathe 11s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.92; } }
.theorem {
  font-family: var(--prose);
  font-size: 1.2rem;
  max-width: 42rem;
  margin: 0 0 3rem;
}
.theorem .thm-label { font-weight: 700; }
.theorem em { font-style: italic; }
.theorem .qed { color: var(--phosphor); }

/* fig. 0 — the phasor (hue = argument, station origin at blood 10°) */
.phasor-fig { margin: 1.5rem 0 0; }
.phasor-fig svg { width: 100%; height: auto; display: block; }
.phasor-fig .axis { stroke: var(--line); stroke-width: 1; }
.phasor-fig .unit { fill: none; stroke: var(--line); stroke-width: 1.5; }
.phasor-fig .radius {
  stroke: oklch(76% 0.16 var(--phase, 10)); stroke-width: 2.5; stroke-linecap: round;
}
.phasor-fig .tip { fill: oklch(80% 0.17 var(--phase, 10)); }
.phasor-fig .projection { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; }
.phasor-fig .trace {
  fill: none; stroke: oklch(74% 0.15 var(--phase, 10));
  stroke-width: 2; stroke-linecap: round;
}
.figcaption, .phasor-fig figcaption {
  font-family: var(--term); font-size: 0.8rem; color: var(--faint); margin-top: 0.4rem;
}

/* exhibits — phazor wears philtre, the lab wears aether */
.figs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.2rem; margin: 0 0 3rem;
}
.fig {
  --w: var(--aether);
  display: block;
  border: 1px solid var(--line);
  background: color-mix(in oklab, var(--surface) 90%, transparent);
  padding: 1.1rem 1.2rem 1.3rem;
  color: var(--ink);
  transition: border-color 0.15s, transform 0.2s;
}
.fig:hover { border-color: var(--w); transform: translateY(-3px) rotate(-0.4deg); color: var(--ink); }
.fig.hot { --w: var(--philtre); }
.fig.warm { --w: var(--phosphor); }
.fig .fig-label { font-size: 0.8rem; color: var(--faint); display: block; }
.fig .fig-name {
  font-family: var(--display); font-size: 1.5rem;
  color: var(--w); display: block; margin: 0.15rem 0 0.35rem;
}
.fig .fig-glyph { float: right; font-size: 1.6rem; color: var(--w); opacity: 0.4; }
.fig .fig-desc { color: var(--annot); font-size: 0.9rem; display: block; }

.colophon { border-top: 1px solid var(--line); padding-top: 1rem; color: var(--faint); font-size: 0.8rem; }

/* ---- phazor panel ---- */
.panel { max-width: 62rem; margin: 0 auto; padding: 2rem 1.5rem; position: relative; z-index: 2; }
.panel-head h1 { font-family: var(--display); font-weight: 400; font-size: 2.6rem; margin: 0; }
.panel-head .sub { color: var(--faint); font-size: 0.85rem; }

.power {
  display: block; margin: 4rem auto;
  padding: 1.1rem 2.4rem;
  font-family: var(--term); font-size: 1.2rem;
  color: var(--plane); background: var(--phosphor);
  border: none; cursor: pointer;
}
.power:hover { background: var(--ichor); }

.transport { display: flex; gap: 0.8rem; align-items: center; margin: 1.6rem 0; flex-wrap: wrap; }
.xport {
  font-family: var(--term); font-size: inherit;
  padding: 0.45rem 1.1rem; cursor: pointer;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line);
}
.xport:hover { border-color: var(--ink); }
.xport.lit { color: var(--plane); background: var(--phosphor); border-color: var(--phosphor); }
.xport.panic { border-color: var(--blood); color: var(--blood); }
.tempo { margin-left: auto; display: flex; gap: 0.6rem; align-items: center; color: var(--annot); }
.tempo .val { color: var(--phosphor); min-width: 3ch; }

/* the step row is the unit circle unrolled from station zero:
   step i sounds at phase 2πi/16 and wears hue 10° + i·22.5°. */
.steps { display: grid; grid-template-columns: repeat(16, 1fr); gap: 0.35rem; margin: 1.4rem 0; }
.step {
  aspect-ratio: 1 / 1.4; cursor: pointer; position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  color: transparent;
  font-family: var(--term);
}
.step:nth-child(4n + 1) { border-color: color-mix(in oklab, var(--line) 40%, var(--ink)); }
.step:hover { border-color: var(--ink); }
.step.on {
  background: oklch(74% 0.16 calc(10deg + var(--i) * 22.5deg));
  border-color: transparent;
  color: var(--plane);
}
.step.on .note { font-size: 0.7rem; }
.step.now { outline: 2px solid var(--ink); outline-offset: 1px; }

.knobs { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin: 1.6rem 0; }
.param { display: grid; grid-template-columns: 6.5rem 1fr 5.5rem; gap: 0.6rem; align-items: center; }
.param .name { color: var(--annot); }
.param .val { color: var(--phosphor); font-size: 0.85rem; text-align: right; font-variant-numeric: tabular-nums; }

input[type="range"] { accent-color: var(--philtre); width: 100%; }

.readout { display: flex; gap: 1.4rem; align-items: center; margin-top: 1.8rem; flex-wrap: wrap; }
.meter { display: flex; gap: 0.5rem; align-items: center; flex: 1; min-width: 14rem; }
.meter .ch { color: var(--annot); }
.meter .bar {
  position: relative; flex: 1; height: 0.7rem;
  background: var(--surface); border: 1px solid var(--line);
  overflow: hidden;
}
.meter .rms {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg in oklch, var(--verdigris), var(--phosphor));
}
.meter .peak { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--blood); }
.stats { display: flex; gap: 1.2rem; color: var(--annot); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.stats .warn { color: var(--blood); }

/* ---- lab ---- */
.lab-head { max-width: 64rem; margin: 0 auto; padding: 2.5rem 1.5rem 0; position: relative; z-index: 2; }
.lab-head h1 { font-family: var(--display); font-weight: 400; font-size: 2.6rem; margin: 0 0 0.2rem; }
.lab-head .tagline { color: var(--annot); margin: 0 0 2rem; }
.lab-figs { max-width: 64rem; margin: 0 auto; padding: 0 1.5rem 4rem; position: relative; z-index: 2; }

/* the lab viewer sits ABOVE the texture layers: shaders arrive unfiltered */
.labview { position: fixed; inset: 0; background: #000; z-index: 5; }
.labcanvas { width: 100%; height: 100%; display: block; touch-action: none; }
.labhud {
  position: absolute; left: 0.9rem; bottom: 0.7rem;
  display: flex; gap: 1.2rem; align-items: baseline;
  color: var(--annot); font-size: 0.8rem;
  text-shadow: 0 0 6px #000;
}
.labhud .hint { opacity: 0.7; }
.gfx-error { position: absolute; top: 40%; width: 100%; text-align: center; color: var(--blood); z-index: 6; }

/* ---- 404 ---- */
.nothing { text-align: center; padding: 5rem 1.5rem; position: relative; z-index: 2; }
.nothing .sigil { opacity: 0.55; margin-bottom: 1.4rem; }
.nothing h1 { font-family: var(--math); font-size: 4.5rem; margin: 0; color: var(--philtre); }
.nothing p { color: var(--annot); font-family: var(--prose); }

/* ---- debug HUD (ships to production, on purpose) ---- */
.hud {
  position: fixed; right: 0.8rem; bottom: 0.8rem; z-index: 99;
  width: min(38rem, calc(100vw - 2rem)); max-height: 45vh;
  display: flex; flex-direction: column;
  background: color-mix(in oklab, var(--plane) 95%, transparent);
  border: 1px solid var(--aether);
  font-size: 0.75rem;
}
.hud header { display: flex; justify-content: space-between; padding: 0.4rem 0.7rem; border-bottom: 1px solid var(--line); color: var(--aether); }
.hud .hud-build { color: var(--phosphor); }
.hud .hud-log { flex: 1; overflow: auto; margin: 0; padding: 0.5rem 0.7rem; color: var(--ink); white-space: pre-wrap; }
.hud footer { padding: 0.3rem 0.7rem; color: var(--faint); border-top: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) {
  .fig, .fig:hover { transition: none; transform: none; }
  .wordmark { animation: none; }
  .sigil.spin .sigil-ring, .sigil.spin .sigil-hepta { animation: none; }
}

/* ---- the fun layer (canon addendum: the site plays back) ---- */
.transmission {
  overflow: hidden; white-space: nowrap;
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem; color: var(--faint);
  position: relative; z-index: 2;
  padding: 0.25rem 0;
}
.transmission-track { display: inline-block; animation: transmit 150s linear infinite; }
@keyframes transmit { to { transform: translateX(-50%); } }

.wordmark.playable { display: flex; flex-wrap: wrap; }
.wordmark .key {
  all: unset; cursor: pointer; display: inline-block;
  font: inherit; color: inherit;
  transition: transform 0.12s, color 0.12s;
}
.wordmark .key:hover, .wordmark .key:focus-visible {
  color: oklch(78% 0.17 calc(var(--kh) * 1deg));
  transform: translateY(-0.08em) rotate(-2deg);
}
.wordmark .key:active { transform: translateY(0.05em) scale(0.97); }

.comet-dot {
  position: fixed; z-index: 3; pointer-events: none;
  width: 5px; height: 5px; border-radius: 50%;
  background: oklch(78% 0.17 calc(var(--h) * 1deg));
  transform: translate(-50%, -50%);
  animation: comet-fade 0.6s ease-out forwards;
}
@keyframes comet-fade { to { opacity: 0; transform: translate(-50%, -50%) scale(0.2); } }

html.ignite body { animation: ignition 1.4s ease-out; }
@keyframes ignition {
  0% { filter: none; }
  18% { filter: hue-rotate(140deg) brightness(1.35); }
  45% { filter: hue-rotate(300deg) brightness(1.1); }
  100% { filter: none; }
}
html.ignite .sigil.spin .sigil-ring { animation-duration: 3s; }
html.ignite .sigil.spin .sigil-hepta { animation-duration: 4s; }

html.fnord body { animation: fnord-storm 4s ease-in-out; }
@keyframes fnord-storm {
  0%, 100% { filter: none; }
  20% { filter: hue-rotate(90deg) saturate(1.6); }
  40% { filter: hue-rotate(200deg) saturate(2) contrast(1.1); }
  60% { filter: hue-rotate(280deg) saturate(1.8); }
  80% { filter: hue-rotate(350deg) saturate(1.4); }
}

.fortune {
  all: unset; cursor: pointer; font: inherit; color: var(--faint);
  font-style: italic;
}
.fortune:hover { color: var(--phosphor); }

@media (prefers-reduced-motion: reduce) {
  .transmission-track { animation: none; }
  html.ignite body, html.fnord body { animation: none; }
  .comet-dot { display: none; }
}

/* ---- the substrate: the field every page floats on ---- */
.substrate {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  width: 100%; height: 100%;
}

/* ---- the mark: sigil behind, playable name, .sh dangling ---- */
@font-face {
  font-family: "Redaction 20";
  src: url("/fonts/redaction-20-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
.mark-stack { position: relative; padding: 2.6rem 0 0.5rem; }
.mark-sigil {
  position: absolute; left: -3.2rem; top: -1.6rem;
  opacity: 0.5; filter: drop-shadow(0 0 22px oklch(70% 0.17 280 / 0.5));
  pointer-events: none;
}
.wordmark.playable { align-items: baseline; }
.wordmark .key.ph {
  font-style: italic;
  color: oklch(72% 0.19 300);
  text-shadow: 0 0 26px oklch(70% 0.17 280 / 0.75);
}
.wordmark .tld {
  font-family: var(--term); font-size: 0.32em;
  color: var(--aether);
  align-self: flex-end; margin-left: 0.18em; padding-bottom: 0.22em;
}
.wordmark .tld::before { content: "·"; margin-right: 0.2em; color: var(--faint); }

/* ---- aphorism: a stamped, tilted citation ---- */
.aphor {
  position: relative;
  max-width: 36rem;
  margin: 3.2rem 0 3.4rem;
  padding: 1.2rem 0.4rem;
  transform: rotate(-1.2deg);
  cursor: pointer;
  border-top: 1px solid;
  border-bottom: 1px solid;
  border-image: linear-gradient(90deg, var(--sigil), var(--verdigris), transparent) 1;
  user-select: none;
}
.aphor:hover { border-image: linear-gradient(90deg, var(--philtre), var(--phosphor), transparent) 1; }
.aphor-glyph {
  position: absolute; top: -0.85rem; left: -0.3rem;
  color: var(--phosphor); font-size: 1.1rem;
  background: var(--plane); padding: 0 0.3rem;
}
.aphor-q {
  margin: 0; font-family: var(--prose); font-size: 1.3rem; line-height: 1.45;
  color: var(--ink);
}
.aphor-by {
  margin-top: 0.55rem;
  font-family: var(--term); font-size: 0.72rem; letter-spacing: 0.14em;
  color: var(--faint);
}

@media (prefers-reduced-motion: reduce) {
  .aphor { transform: none; }
}

/* ---- the rack: machined modular-synth components ---- */
.rack { display: grid; grid-template-columns: repeat(12, 1fr); gap: 0.9rem; margin: 1.6rem 0; }
.rack-panel {
  position: relative;
  grid-column: span 12;
  padding: 0.85rem 1.1rem 1.1rem;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #2b2240, #211a34 55%, #1d1630);
  border: 1px solid #0d0a16;
  border-top-color: #4a3f64;
  box-shadow:
    inset 0 1px 0 rgba(244, 242, 251, 0.07),
    inset 0 -2px 6px rgba(0, 0, 0, 0.45),
    0 6px 18px rgba(0, 0, 0, 0.5);
}
@media (min-width: 860px) {
  .rack .span3 { grid-column: span 3; }
  .rack .span4 { grid-column: span 4; }
  .rack .span5 { grid-column: span 5; }
}
.rack-title {
  display: block;
  margin: 0 0 0.7rem;
  font-family: var(--term); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--annot);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9), 0 -1px 0 rgba(255, 255, 255, 0.05);
}
.rack-body { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: flex-end; }

.screw {
  position: absolute; width: 11px; height: 11px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7a7295, #262038 72%);
  border: 1px solid #0d0a16;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.6);
}
.screw::after {
  content: ""; position: absolute; left: 1px; right: 1px; top: 4px; height: 1.6px;
  background: rgba(10, 6, 18, 0.85); transform: rotate(var(--a, 20deg));
}
.screw.tl { top: 6px; left: 6px; --a: 14deg; }
.screw.tr { top: 6px; right: 6px; --a: -38deg; }
.screw.bl { bottom: 6px; left: 6px; --a: 64deg; }
.screw.br { bottom: 6px; right: 6px; --a: -11deg; }

/* knob */
.knob { display: flex; flex-direction: column; align-items: center; width: 5.6rem; user-select: none; }
.knob svg { width: 100%; height: auto; cursor: grab; touch-action: none; display: block; }
.knob svg:active { cursor: grabbing; }
.knob-tick { stroke: #55496f; stroke-width: 1; }
.knob-arc-bg { fill: none; stroke: #0e0a18; stroke-width: 3.5; stroke-linecap: round; }
.knob-arc {
  fill: none; stroke: oklch(76% 0.16 calc(var(--hue) * 1deg)); stroke-width: 3.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 5px oklch(76% 0.16 calc(var(--hue) * 1deg) / 0.8));
}
.knob-shadow { fill: rgba(0, 0, 0, 0.5); }
.knob-body { fill: #2f2545; stroke: #0d0a16; stroke-width: 1; }
.knob-knurl { fill: none; stroke: #171126; stroke-width: 2.6; stroke-dasharray: 1.7 2.5; }
.knob-cap {
  fill: #3b3054; stroke: rgba(244, 242, 251, 0.1); stroke-width: 1;
}
.knob-rotor { transform-box: view-box; transform-origin: center; }
.knob-needle { stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; }
.knob-label {
  margin-top: 0.15rem;
  font-family: var(--term); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--annot);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9), 0 -1px 0 rgba(255, 255, 255, 0.05);
}
.knob-value {
  font-family: var(--term); font-size: 0.78rem; font-variant-numeric: tabular-nums;
  color: oklch(82% 0.13 calc(var(--hue) * 1deg));
}

/* lamps */
.led-wrap { display: inline-flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.led {
  width: 11px; height: 11px; border-radius: 50%;
  background: #171126; border: 1px solid #0d0a16;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.85);
}
.led.lit {
  background: oklch(78% 0.17 calc(var(--hue) * 1deg));
  box-shadow:
    0 0 9px oklch(78% 0.17 calc(var(--hue) * 1deg) / 0.9),
    inset 0 0 2px rgba(255, 255, 255, 0.55);
}
.led-label {
  font-family: var(--term); font-size: 0.6rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--faint);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}

/* LED ladder meter */
.ledmeter { display: inline-flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.ledmeter-col {
  display: flex; flex-direction: column; gap: 3px;
  padding: 5px; background: #120d1e;
  border: 1px solid #0d0a16;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.65);
}
.seg { width: 1.6rem; height: 6px; background: #1e1731; }
.seg.lit {
  background: oklch(75% 0.17 calc(var(--hue) * 1deg));
  box-shadow: 0 0 6px oklch(75% 0.17 calc(var(--hue) * 1deg) / 0.8);
}
.ledmeter-label { font-family: var(--term); font-size: 0.62rem; letter-spacing: 0.18em; color: var(--faint); text-transform: uppercase; }

/* digital readout */
.lcd {
  display: inline-flex; gap: 1.1rem;
  padding: 0.35rem 0.7rem;
  background: #120d1e; border: 1px solid #0d0a16;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
  font-family: var(--term); font-size: 0.8rem; font-variant-numeric: tabular-nums;
  color: var(--phosphor);
  text-shadow: 0 0 6px oklch(84% 0.15 100 / 0.55);
}
.lcd .warn { color: var(--blood); text-shadow: 0 0 6px oklch(70% 0.19 10 / 0.7); }

/* machined buttons (restyle of .xport) */
.xport {
  background: linear-gradient(180deg, #342a4a, #251c38);
  border: 1px solid #0d0a16; border-top-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 0 #0d0a16, inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.xport:hover { border-color: #0d0a16; border-top-color: rgba(255, 255, 255, 0.2); color: var(--ink); }
.xport:active { transform: translateY(1px); box-shadow: 0 1px 0 #0d0a16; }
.xport.lit { box-shadow: 0 2px 0 #0d0a16, 0 0 14px oklch(84% 0.15 100 / 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2); }

/* mechanical step pads */
.step {
  border: 1px solid #0d0a16; border-top-color: rgba(255, 255, 255, 0.09);
  background: linear-gradient(180deg, #2c2340, #211a34);
  box-shadow: 0 2px 0 #0d0a16, inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.step:hover { border-color: #0d0a16; border-top-color: rgba(255, 255, 255, 0.2); }
.step:active { transform: translateY(1px); box-shadow: 0 1px 0 #0d0a16; }
.step.on {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 40%),
    oklch(66% 0.15 calc(10deg + var(--i) * 22.5deg));
  border-color: #0d0a16;
  box-shadow:
    0 2px 0 #0d0a16,
    0 0 16px oklch(70% 0.16 calc(10deg + var(--i) * 22.5deg) / 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.step.now { outline-offset: 2px; }

/* key hints (stolen with love from qualia's bottom bar) */
.keyhints {
  display: flex; gap: 1.1rem; flex-wrap: wrap;
  margin-top: 1rem;
  font-size: 0.72rem; color: var(--faint);
}
.keyhints kbd {
  font-family: var(--term);
  padding: 0 0.35rem;
  background: #241b36; border: 1px solid #0d0a16; border-top-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 0 #0d0a16;
  color: var(--annot);
}

/* ═══════ rack material pass v2 — grit, light, silkscreen ═══════
   One light source, top-left. Every surface answers to it: bevels catch
   it, countersinks swallow it, corners hold grime, glass streaks it. */

.rack { position: relative; padding: 16px 2px; }
/* mounting rails with threaded holes */
.rack::before, .rack::after {
  content: ""; position: absolute; left: -8px; right: -8px; height: 13px; z-index: 0;
  background:
    radial-gradient(circle 2.6px at 13px 6.5px, #0b0714 42%, #3a3154 55%, transparent 62%) repeat-x,
    linear-gradient(180deg, #423861, #292040 45%, #171126);
  background-size: 30px 13px, 100% 100%;
  border: 1px solid #0a0713;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 2px 5px rgba(0, 0, 0, 0.5);
}
.rack::before { top: -3px; }
.rack::after { bottom: -3px; }

.rack-panel {
  border: 1px solid #070510;
  border-top-color: #5b4d79;
  background:
    /* top sheen */
    radial-gradient(140% 80% at 30% 0%, rgba(255, 255, 255, 0.055), transparent 42%),
    /* floor ambient occlusion */
    radial-gradient(120% 110% at 50% 125%, rgba(0, 0, 0, 0.55), transparent 55%),
    /* fine brush */
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.016) 0 1px, transparent 1px 2px),
    /* anisotropic streaks */
    repeating-linear-gradient(88.5deg, transparent 0 17px, rgba(255, 255, 255, 0.02) 17px 18px, transparent 18px 43px),
    linear-gradient(180deg, #2f2648, #221a36 50%, #1a142e);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    inset 1px 0 0 rgba(255, 255, 255, 0.035),
    inset -1px 0 0 rgba(0, 0, 0, 0.4),
    inset 0 -3px 9px rgba(0, 0, 0, 0.55),
    0 12px 28px -8px rgba(0, 0, 0, 0.7),
    0 2px 5px rgba(0, 0, 0, 0.55);
}
/* corner grime + speckle */
.rack-panel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(70px 45px at 0% 0%, rgba(0, 0, 0, 0.33), transparent 70%),
    radial-gradient(70px 45px at 100% 0%, rgba(0, 0, 0, 0.28), transparent 70%),
    radial-gradient(80px 50px at 0% 100%, rgba(0, 0, 0, 0.38), transparent 70%),
    radial-gradient(80px 50px at 100% 100%, rgba(0, 0, 0, 0.36), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23s)' opacity='0.055'/%3E%3C/svg%3E");
}
/* hairline scratches, screen-blended */
.rack-panel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  mix-blend-mode: screen; opacity: 0.06;
  background:
    repeating-linear-gradient(23deg, transparent 0 47px, rgba(255, 255, 255, 0.7) 47px 47.5px, transparent 48px 111px),
    repeating-linear-gradient(-34deg, transparent 0 83px, rgba(255, 255, 255, 0.5) 83px 83.4px, transparent 84px 167px);
}
.rack-title, .rack-body, .screw { position: relative; z-index: 1; }
/* silkscreened title with rule */
.rack-title {
  color: #d3ccE2;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.95), 0 0 0.5px currentColor;
}
.rack-title::after {
  content: ""; display: block; height: 1px; margin-top: 0.4rem;
  background: linear-gradient(90deg, rgba(244, 242, 251, 0.22), rgba(244, 242, 251, 0.05) 70%, transparent);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

/* countersunk screws with cross slots */
.screw {
  width: 13px; height: 13px;
  background: radial-gradient(circle at 34% 28%, #a9a1c4, #5c5178 55%, #2b2344 85%);
  box-shadow:
    0 0 0 2px #100b1d,
    0 0 0 3px rgba(255, 255, 255, 0.05),
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    inset 0 -1px 2px rgba(0, 0, 0, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.7);
}
.screw::before {
  content: ""; position: absolute; left: 5.5px; top: 1.5px; width: 1.6px; bottom: 1.5px;
  background: rgba(8, 5, 15, 0.9); transform: rotate(var(--a, 20deg));
}
.screw::after { top: 5.5px; left: 1.5px; right: 1.5px; height: 1.6px; }

/* knob machining */
.knob-sink { fill: #131022; stroke: #090612; stroke-width: 1; }
.knob-shadow { fill: rgba(0, 0, 0, 0.55); }
.knob-body { fill: #322949; stroke: #0b0816; stroke-width: 1; }
.knob-wall { fill: none; stroke: #191330; stroke-width: 2.2; }
.knob-tooth { stroke: #0e0a1b; stroke-width: 1.7; stroke-linecap: round; }
.knob-cap { fill: #3d3258; stroke: rgba(0, 0, 0, 0.6); stroke-width: 0.8; }
.knob-dome { fill: rgba(255, 255, 255, 0.05); }
.knob-spec { fill: none; stroke: rgba(255, 255, 255, 0.3); stroke-width: 2; stroke-linecap: round; }
.knob-knurl { display: none; }

/* LED bezels + light spill */
.led {
  box-shadow:
    0 0 0 2px #191330,
    0 0 0 3px rgba(255, 255, 255, 0.06),
    inset 0 1px 3px rgba(0, 0, 0, 0.9),
    0 1px 1px rgba(0, 0, 0, 0.6);
}
.led.lit {
  box-shadow:
    0 0 0 2px #191330,
    0 0 0 3px rgba(255, 255, 255, 0.07),
    inset 0 0 2px rgba(255, 255, 255, 0.6),
    0 0 10px oklch(78% 0.17 calc(var(--hue) * 1deg) / 0.95),
    0 0 22px 6px oklch(78% 0.17 calc(var(--hue) * 1deg) / 0.3);
}

/* meter wells */
.ledmeter-col {
  border-color: #070510;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.8),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.05);
}
.seg { box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5); }
.seg.lit { box-shadow: 0 0 7px oklch(75% 0.17 calc(var(--hue) * 1deg) / 0.9), inset 0 0 2px rgba(255, 255, 255, 0.4); }

/* LCD: glass, ghost cells, streak */
.lcd {
  position: relative;
  background:
    repeating-linear-gradient(90deg, rgba(160, 220, 120, 0.028) 0 8px, rgba(160, 220, 120, 0.012) 8px 9px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #10160a, #0b1106);
  border-color: #050803;
  box-shadow:
    inset 0 3px 9px rgba(0, 0, 0, 0.85),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.lcd::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.055) 47%, transparent 53%);
}

/* rubber pads with LED windows */
.step {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cfilter id='r'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='60' height='60' filter='url(%23r)' opacity='0.05'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #2e2544, #221a36 60%, #1d1732);
  box-shadow: 0 3px 0 #0d0a16, inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 4px 6px rgba(0, 0, 0, 0.45);
}
.step:active { transform: translateY(2px); box-shadow: 0 1px 0 #0d0a16, inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.step::before {
  content: ""; position: absolute; top: 7%; left: 16%; right: 16%; height: 9%;
  background: #131022;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.05);
}
.step.on {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 45%),
    linear-gradient(180deg, #2e2544, #221a36 60%, #1d1732);
  box-shadow:
    0 3px 0 #0d0a16,
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 0 16px oklch(70% 0.16 calc(10deg + var(--i) * 22.5deg) / 0.35);
}
.step.on::before {
  background: oklch(74% 0.17 calc(10deg + var(--i) * 22.5deg));
  box-shadow:
    0 0 9px oklch(74% 0.17 calc(10deg + var(--i) * 22.5deg) / 0.95),
    inset 0 0 2px rgba(255, 255, 255, 0.5);
}
.step .note {
  color: rgba(244, 242, 251, 0.5);
  position: absolute; left: 0; right: 0; bottom: 8%;
  font-size: 0.62rem;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}
.step.on .note { color: rgba(244, 242, 251, 0.8); }

/* jacks */
.jack { display: inline-flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.jack svg { width: 2.6rem; height: auto; display: block; }
.jack-nut { fill: #4c4168; stroke: #0a0713; stroke-width: 1; }
.jack-ring { fill: #756c93; stroke: #0a0713; stroke-width: 0.8; }
.jack-throat { fill: #262038; }
.jack-socket { fill: #06040c; }
.jack-glint { fill: none; stroke: rgba(255, 255, 255, 0.35); stroke-width: 1.6; stroke-linecap: round; }
.jack-label {
  font-family: var(--term); font-size: 0.6rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--faint); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}

/* the patch cable: shadow under, rubber core, sheen on top */
/* the decorative cable retired 2026-07-15: superseded by the patchbay
   (real typed cables). Kept classes for the patchbay renderer. */
.cable { position: absolute; inset: 0; pointer-events: none; z-index: 2; display: none; }
.cable path { fill: none; }
.cable .cable-shadow { stroke: rgba(0, 0, 0, 0.5); stroke-width: 8px; vector-effect: non-scaling-stroke; }
.cable .cable-core { stroke: oklch(52% 0.16 325); stroke-width: 6px; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.cable .cable-sheen { stroke: oklch(72% 0.14 325 / 0.5); stroke-width: 1.8px; vector-effect: non-scaling-stroke; }

/* ---- toolkit: collapsible latch + compact density ---- */
.rack-latch {
  all: unset; cursor: pointer; display: flex; align-items: baseline; gap: 0.5rem;
  width: 100%; position: relative; z-index: 1;
}
.rack-latch:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.rack-latch .rack-title { flex: 1; }
.rack-fold {
  font-size: 0.7rem; color: var(--faint);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}
.rack-latch:hover .rack-fold { color: var(--phosphor); }
.rack-panel.folded { padding-bottom: 0.85rem; }
.rack-body.hidden { display: none; }

/* ---- fader ---- */
.fader { display: flex; flex-direction: column; align-items: center; width: 2.8rem; user-select: none; }
.fader svg { width: 100%; height: auto; cursor: grab; touch-action: none; display: block; }
.fader svg:active { cursor: grabbing; }
.fader-slot { fill: #120d1e; stroke: #090612; stroke-width: 1;
}
.fader-fill { fill: oklch(72% 0.16 calc(var(--hue) * 1deg)); }
.fader-cap-shadow { fill: rgba(0, 0, 0, 0.55); }
.fader-cap {
  fill: #3a2f55; stroke: #0d0a16; stroke-width: 1;
}
.fader-grip { stroke: #171126; stroke-width: 1.6; }
.fader-grip.dim { stroke: rgba(23, 17, 38, 0.55); }
.fader-cap-g { will-change: transform; }

/* ---- xy pad ---- */
.xypad { display: flex; flex-direction: column; align-items: center; user-select: none; }
.xypad-surface {
  position: relative; width: 13rem; height: 9rem; touch-action: none; cursor: crosshair;
  background:
    linear-gradient(rgba(138, 108, 255, 0.06) 1px, transparent 1px) 0 0 / 100% 1.5rem,
    linear-gradient(90deg, rgba(138, 108, 255, 0.06) 1px, transparent 1px) 0 0 / 1.5rem 100%,
    linear-gradient(180deg, #141021, #0f0b1a);
  border: 1px solid #090612;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.75), 0 1px 0 rgba(255, 255, 255, 0.05);
}
.xypad-vline { position: absolute; top: 0; bottom: 0; width: 1px; background: oklch(78% 0.12 calc(var(--hx) * 1deg) / 0.75); }
.xypad-hline { position: absolute; left: 0; right: 0; height: 1px; background: oklch(76% 0.17 calc(var(--hy) * 1deg) / 0.75); }
.xypad-dot {
  position: absolute; width: 13px; height: 13px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #fff, oklch(76% 0.15 calc(var(--hx) * 1deg)) 45%, oklch(70% 0.17 calc(var(--hy) * 1deg)));
  box-shadow: 0 0 12px oklch(75% 0.16 calc(var(--hx) * 1deg) / 0.8);
}

/* ---- wide console LCD ---- */
.lcd-wide { display: flex; flex-direction: column; gap: 0.15rem; width: 100%; min-height: 4.6rem; }
.lcd-dim { opacity: 0.45; }

/* ---- text fx module ---- */
.textfx {
  flex: 1; min-width: 16rem;
  font-family: var(--prose); font-size: clamp(1.1rem, 2.6vw, 1.9rem);
  line-height: 1.3; letter-spacing: 0.01em;
  padding: 0.6rem 0.2rem;
}
.textfx-glyph { color: oklch(80% 0.13 calc(var(--gh) * 1deg)); transition: color 0.12s; }
.textfx-glyph.hot { color: oklch(88% 0.17 calc(var(--gh) * 1deg)); text-shadow: 0 0 12px oklch(80% 0.17 calc(var(--gh) * 1deg) / 0.8); }
.textfx-knobs { display: flex; gap: 1rem; }

/* ---- scene module ---- */
.scene-canvas {
  width: 100%; height: 15rem; display: block;
  border: 1px solid #090612;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 255, 255, 0.05);
  background: #050308;
}
@media (min-width: 860px) { .rack .span7 { grid-column: span 7; } }

/* citadel viewport: taller, letterboxed dark */
.fractal-canvas { height: 22rem; }
.fold-side { display: flex; flex-direction: column; gap: 0.7rem; align-items: center; }

/* ---- spectrum analyzer ---- */
.spectrum-row {
  display: flex; gap: 4px; align-items: flex-end;
  width: 100%; height: 6.5rem;
  padding: 6px; background: #120d1e;
  border: 1px solid #090612;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
}
.spec-band { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.spec-fill {
  width: 100%;
  background: oklch(74% 0.16 calc(10deg + var(--i) * 22.5deg));
  box-shadow: 0 0 8px oklch(74% 0.16 calc(10deg + var(--i) * 22.5deg) / 0.6);
  transition: height 0.05s linear;
}

/* ---- presets ---- */
.xport.preset { font-size: 1rem; padding: 0.7rem 1.4rem; }
.preset-hint { color: var(--faint); font-size: 0.75rem; align-self: center; }

/* viewport mind selector */
.vp-select { display: flex; gap: 0.5rem; flex-wrap: wrap; width: 100%; margin-bottom: 0.6rem; }
.xport.vp { font-size: 0.82rem; padding: 0.35rem 0.9rem; }

/* ── the scope: master-bus waveform on a little green LCD ─────────────── */
.scope-lcd {
  width: 100%;
  height: 72px;
  background:
    linear-gradient(oklch(0.16 0.02 300 / 0.9), oklch(0.13 0.02 300 / 0.95));
  border: 1px solid oklch(0.3 0.03 300);
  border-radius: 4px;
  box-shadow: inset 0 2px 8px oklch(0 0 0 / 0.5);
}
.scope-axis {
  stroke: oklch(0.35 0.04 145 / 0.5);
  stroke-width: 0.4;
  stroke-dasharray: 1 1.5;
}
.scope-trace {
  fill: none;
  stroke: oklch(0.78 0.19 145);
  stroke-width: 0.7;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 2px oklch(0.7 0.2 145 / 0.8));
}

/* ── expr: the little language's rack module ──────────────────────────── */
.expr-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}
.expr-input {
  flex: 1;
  min-width: 220px;
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.95rem;
  color: oklch(0.85 0.16 145);
  background: linear-gradient(oklch(0.15 0.02 300 / 0.95), oklch(0.12 0.02 300));
  border: 1px solid oklch(0.32 0.03 300);
  border-radius: 4px;
  padding: 9px 12px;
  box-shadow: inset 0 2px 8px oklch(0 0 0 / 0.5);
  caret-color: oklch(0.85 0.16 145);
}
.expr-input:focus {
  outline: none;
  border-color: oklch(0.55 0.12 280);
  box-shadow: inset 0 2px 8px oklch(0 0 0 / 0.5), 0 0 0 2px oklch(0.45 0.12 280 / 0.35);
}
.expr-status {
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: oklch(0.62 0.1 145);
  padding-top: 6px;
}
.expr-status.err {
  color: oklch(0.68 0.19 10);
}

/* ── maximum immersion: the mind field is the room ────────────────────── */
.mind-field {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}
/* the rack floats above the field on glass */
.panel { position: relative; z-index: 1; }
.panel .rack-panel {
  background:
    linear-gradient(oklch(0.19 0.03 300 / 0.62), oklch(0.16 0.03 300 / 0.7));
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
}

/* ── zen mode: the field, nothing else ────────────────────────────────── */
/* fade panels one by one — the mind-field canvas lives inside .rack and
   must survive zen (a parent opacity would drag it down too) */
nav, .panel-head, .rack > .rack-panel, .rack > .cable, .keyhints,
.transmission, .power {
  transition: opacity 0.6s ease;
}
.zen nav, .zen .panel-head, .zen .rack > .rack-panel, .zen .rack > .cable,
.zen .keyhints, .zen .transmission, .zen .power {
  opacity: 0;
  pointer-events: none;
}
.zen-toggle {
  position: fixed;
  right: 18px;
  bottom: 14px;
  z-index: 40;
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: oklch(0.7 0.05 300);
  background: oklch(0.18 0.03 300 / 0.55);
  border: 1px solid oklch(0.35 0.04 300 / 0.6);
  border-radius: 4px;
  padding: 5px 12px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  opacity: 0.6;
}
.zen-toggle:hover { opacity: 1; }
.zen .zen-toggle { opacity: 0.28; }

/* ── the patchbay ─────────────────────────────────────────────────────── */
.pb-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  padding-bottom: 8px;
}
.pb-add { font-size: 0.66rem; padding: 4px 8px; }
.pb-canvas {
  position: relative;
  width: 100%;
  height: 400px;
  border: 1px solid oklch(0.3 0.03 300 / 0.7);
  border-radius: 6px;
  background:
    radial-gradient(circle at 1px 1px, oklch(0.32 0.03 300 / 0.5) 1px, transparent 1.5px)
    0 0 / 22px 22px,
    linear-gradient(oklch(0.14 0.02 300 / 0.75), oklch(0.12 0.02 300 / 0.85));
  overflow: hidden;
  touch-action: none;
}
.pb-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.pb-cable-shadow {
  fill: none;
  stroke: oklch(0 0 0 / 0.55);
  stroke-width: 4;
  transform: translateY(1.5px);
}
.pb-cable {
  fill: none;
  stroke: oklch(0.72 0.17 calc(var(--hue) * 1deg));
  stroke-width: 2.25;
  filter: drop-shadow(0 0 3px oklch(0.65 0.17 calc(var(--hue) * 1deg) / 0.7));
}
.pb-cable.adapted { stroke-dasharray: 7 3; }
.pb-cable.live { stroke-dasharray: 4 4; opacity: 0.85; }
.pb-node {
  position: absolute;
  width: 170px;
  background: linear-gradient(oklch(0.22 0.03 300 / 0.94), oklch(0.18 0.03 300 / 0.96));
  border: 1px solid oklch(0.36 0.04 300);
  border-radius: 6px;
  box-shadow: 0 6px 18px oklch(0 0 0 / 0.45);
  user-select: none;
}
.pb-node header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: oklch(0.8 0.04 300);
  background: oklch(0.27 0.035 300 / 0.85);
  border-radius: 6px 6px 0 0;
  cursor: grab;
}
.pb-node header:active { cursor: grabbing; }
.pb-x {
  background: none;
  border: none;
  color: oklch(0.6 0.1 10);
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0 2px;
}
.pb-ports {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  min-height: 26px;
}
.pb-col { display: flex; flex-direction: column; gap: 4px; }
.pb-col.out { align-items: flex-end; }
.pb-portrow { display: flex; align-items: center; gap: 5px; height: 16px; }
.pb-port {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid oklch(0.72 0.17 calc(var(--hue) * 1deg));
  background: oklch(0.16 0.02 300);
  box-shadow: 0 0 5px oklch(0.65 0.17 calc(var(--hue) * 1deg) / 0.55);
  cursor: crosshair;
  padding: 0;
}
.pb-port.in { margin-left: -7px; }
.pb-port.out { margin-right: -7px; }
.pb-portname {
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.6rem;
  color: oklch(0.65 0.04 300);
}
.pb-spark {
  display: block;
  width: calc(100% - 16px);
  height: 22px;
  margin: 2px 8px 6px;
  background: oklch(0.13 0.02 300 / 0.9);
  border-radius: 3px;
}
.pb-spark polyline {
  fill: none;
  stroke: oklch(0.78 0.19 145);
  stroke-width: 1.1;
}
.pb-thumb { width: calc(100% - 16px); margin: 0 8px 8px; accent-color: oklch(0.7 0.15 280); }
.pb-code {
  width: calc(100% - 16px);
  margin: 0 8px 8px;
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.68rem;
  color: oklch(0.85 0.16 145);
  background: oklch(0.13 0.02 300);
  border: 1px solid oklch(0.3 0.03 300);
  border-radius: 3px;
  padding: 4px 6px;
}
.pb-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 0 8px 8px;
}
.pb-key {
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.58rem;
  padding: 2px 5px;
  color: oklch(0.68 0.04 300);
  background: oklch(0.2 0.02 300);
  border: 1px solid oklch(0.32 0.03 300);
  border-radius: 3px;
  cursor: pointer;
}
.pb-key.lit {
  color: oklch(0.92 0.18 100);
  border-color: oklch(0.7 0.15 100);
  box-shadow: 0 0 6px oklch(0.7 0.15 100 / 0.5);
}
.pb-status {
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.68rem;
  color: oklch(0.62 0.06 300);
  padding-top: 6px;
}

/* ── rack rearrangement: drag a panel onto another to swap places ─────── */
.rack-panel.dragover {
  outline: 2px dashed oklch(0.7 0.15 100 / 0.7);
  outline-offset: 3px;
}

/* ── the patch as text: cables in code ────────────────────────────────── */
.pb-codebar {
  display: flex;
  gap: 10px;
  width: 100%;
  padding-top: 10px;
  align-items: flex-start;
}
.pb-script {
  flex: 1;
  min-height: 96px;
  resize: vertical;
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.74rem;
  line-height: 1.5;
  color: oklch(0.85 0.16 145);
  background: linear-gradient(oklch(0.14 0.02 300 / 0.95), oklch(0.12 0.02 300));
  border: 1px solid oklch(0.32 0.03 300);
  border-radius: 4px;
  padding: 8px 10px;
  box-shadow: inset 0 2px 8px oklch(0 0 0 / 0.5);
  caret-color: oklch(0.85 0.16 145);
}
.pb-script:focus {
  outline: none;
  border-color: oklch(0.55 0.12 280);
}
.pb-codeside {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 170px;
}
.pb-status.err { color: oklch(0.68 0.19 10); }

/* ── the analyzer: 96 bands as one lit curve ──────────────────────────── */
.analyzer {
  width: 100%;
  height: 110px;
  background:
    repeating-linear-gradient(to right, oklch(0.3 0.03 300 / 0.18) 0 1px, transparent 1px 12.5%),
    linear-gradient(oklch(0.15 0.02 300 / 0.92), oklch(0.12 0.02 300 / 0.96));
  border: 1px solid oklch(0.3 0.03 300);
  border-radius: 5px;
  box-shadow: inset 0 2px 10px oklch(0 0 0 / 0.5);
}
.an-fill {
  fill: url(#specgrad);
  opacity: 0.28;
  stroke: none;
}
.an-line {
  fill: none;
  stroke: url(#specgrad);
  stroke-width: 0.6;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 2px oklch(0.7 0.15 280 / 0.7));
}

/* ── the freeform workspace: panels live where your hand left them ────── */
.rack { position: relative; min-height: 40vh; }
.rack-panel.floating {
  position: absolute;
  z-index: 20;
  box-shadow: 0 18px 48px oklch(0 0 0 / 0.55);
}
.rack-latch { touch-action: none; user-select: none; -webkit-user-select: none; }
.rack-panel.dragover { outline: none; }

/* rock-solid interaction basics */
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid oklch(0.7 0.15 280 / 0.85);
  outline-offset: 2px;
}
.pb-node header, .pb-port, .fader svg, .knob svg { touch-action: none; }
.pb-canvas, .pb-node { user-select: none; -webkit-user-select: none; }

/* ── the app, not a page: fullscreen panes like qualia ────────────────── */
.panel {
  position: fixed;
  inset: 42px 0 0 0;
  overflow: hidden;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}
.panel .panel-head { display: none; }
.panel .rack {
  flex: 1;
  display: flex;
  gap: 10px;
  min-height: 0;
  align-items: stretch;
}
.ws-col {
  width: 302px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: oklch(0.35 0.04 300 / 0.6) transparent;
  padding-right: 2px;
}
.ws-mid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}
.ws-mid-spacer { flex: 1; min-height: 40px; pointer-events: none; }
.rack > .ws-col .rack-panel, .rack > .ws-mid .rack-panel { width: 100%; }
.keyhints {
  position: fixed;
  left: 14px;
  bottom: 10px;
  z-index: 30;
  opacity: 0.55;
  margin: 0;
}

/* density: the pane era — tighter everything */
.rack-panel { border-radius: 6px; }
.rack-panel .rack-body { padding: 8px 10px 10px; gap: 8px; }
.rack-latch { padding: 5px 9px; font-size: 0.62rem; }
.knob svg { width: 46px; height: 46px; }
.fader svg { width: 30px; height: 104px; }
.lcd { font-size: 0.62rem; }
.xport { font-size: 0.66rem; padding: 4px 9px; }
.analyzer { height: 64px; }
.scope-lcd { height: 52px; }
.pb-canvas { height: 320px; }
.steps { gap: 4px; }
.step { min-width: 0; }

/* pane era: the app fills the room — no page-column ghosts */
.panel {
  max-width: none;
  margin: 0;
}
.zen .ws-col .rack-panel, .zen .ws-mid .rack-panel {
  opacity: 0;
  pointer-events: none;
}
.ws-col .rack-panel, .ws-mid .rack-panel { transition: opacity 0.6s ease; }

/* ── the pedalboard: every pane is a digital stompbox, color = wayfinding */
.rack-panel {
  border-top: 3px solid oklch(0.62 0.14 calc(var(--enclosure, 280) * 1deg) / 0.9);
  background:
    linear-gradient(
      oklch(0.24 0.045 calc(var(--enclosure, 280) * 1deg) / 0.68),
      oklch(0.16 0.03 300 / 0.72)
    );
}
.rack-latch .rack-title {
  color: oklch(0.82 0.1 calc(var(--enclosure, 280) * 1deg));
}
.rack-panel .rack-latch::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: 8px;
  background: oklch(0.68 0.16 calc(var(--enclosure, 280) * 1deg));
  box-shadow: 0 0 6px oklch(0.68 0.16 calc(var(--enclosure, 280) * 1deg) / 0.7);
}

/* ── the pages around the instrument ──────────────────────────────────── */
.page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 6rem;
  position: relative;
  z-index: 1;
}
.page h1 {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
}
.page-lede {
  color: oklch(0.72 0.05 300);
  margin-bottom: 2.5rem;
}
.entry {
  border-left: 3px solid oklch(0.55 0.13 280 / 0.8);
  padding: 0.2rem 0 0.4rem 1.2rem;
  margin-bottom: 2rem;
}
.entry-date {
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: oklch(0.6 0.08 190);
}
.entry h2 { margin: 0.3rem 0 0.6rem; font-size: 1.3rem; }
.entry-link {
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.78rem;
  color: oklch(0.7 0.12 190);
}
.page-note { color: oklch(0.55 0.04 300); font-style: italic; }
.info-grid { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem 1.4rem; }
.info-grid dt {
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: oklch(0.65 0.1 280);
  padding-top: 0.15rem;
}
.info-grid dd a, .entry a { color: oklch(0.75 0.11 190); }

/* library + help in the bay */
.pb-shelf-label {
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: oklch(0.6 0.06 300);
  align-self: center;
}
.pb-help {
  width: 100%;
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.68rem;
  line-height: 1.55;
  color: oklch(0.72 0.08 190);
  background: oklch(0.13 0.02 300 / 0.9);
  border: 1px solid oklch(0.3 0.03 300);
  border-radius: 4px;
  padding: 10px 12px;
  margin: 8px 0 0;
  white-space: pre-wrap;
}

/* inline numeric entry: the readout is a door */
.knob-value-btn {
  background: none;
  border: none;
  cursor: text;
  padding: 0;
}
.knob-entry {
  width: 62px;
  font-family: var(--font-mono, "Iosevka Web", monospace);
  font-size: 0.68rem;
  text-align: center;
  color: oklch(0.88 0.12 calc(var(--hue, 280) * 1deg));
  background: oklch(0.14 0.02 300);
  border: 1px solid oklch(0.5 0.1 calc(var(--hue, 280) * 1deg));
  border-radius: 3px;
  padding: 2px 4px;
}

/* hit-target sweep: ports and removers reach 24px without growing visually */
.pb-port { position: relative; }
.pb-port::after {
  content: "";
  position: absolute;
  inset: -6px;
}
.pb-x {
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.led-wrap { min-width: 18px; }

/* texture round 2: grain quieter, scanlines subtler, vignette deeper —
   the room reads as depth, not as a filter */
.mind-field { filter: saturate(1.04) contrast(1.02); }

/* ── colorized math: variables wear their station hues (canon, sacred) ── */
.identity {
  font-family: "PaperMath", "Paper", Georgia, serif;
  font-style: italic;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  color: oklch(0.72 0.03 300);
  margin: 0.4rem 0 1.6rem;
}
.identity sup { font-size: 0.72em; }
.mvar {
  color: oklch(0.8 0.15 calc(var(--mh, 280) * 1deg));
  text-shadow: 0 0 10px oklch(0.7 0.15 calc(var(--mh, 280) * 1deg) / 0.35);
}
