/* v5 - The Console. Studio amber. */

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14100C;
  --panel: #1C1712;
  --raised: #241E17;
  --line: #3A3128;
  --text: #EDE3D0;
  --muted: #A6988A;
  --amber: #E8A54B;
  --amber-dim: #8A6430;
  --olive: #8A8A5C;
  --red: #C24534;
  --slot: #0D0A07;
  --lamp-glow: rgba(194, 69, 52, 0.35);
  --amber-glow: rgba(232, 165, 75, 0.18);
  --shadow-ink: rgba(0, 0, 0, 0.5);
  --noise-alpha: 0.55;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F2EBDD;
  --panel: #E7DEC9;
  --raised: #DFD4BA;
  --line: #C9BCA2;
  --text: #241D14;
  --muted: #6E6353;
  --amber: #B4741F;
  --amber-dim: #A08650;
  --olive: #6B6B3F;
  --red: #A9432F;
  --slot: #A2926F;
  --lamp-glow: rgba(169, 67, 47, 0);
  --amber-glow: rgba(180, 116, 31, 0.10);
  --shadow-ink: rgba(60, 45, 25, 0.14);
  --noise-alpha: 0.4;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  position: relative;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "iA Writer Quattro", Georgia, serif;
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* matte grain over everything, very quiet
   (absolute, not fixed: fixed overlays seam in stitched full-page captures) */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: var(--noise-alpha);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 48px 28px 40px;
}

::selection { background: var(--amber); color: var(--bg); }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ================= CONSOLE ================= */

.console {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 44px -18px var(--shadow-ink);
  overflow: hidden;
}

.rail {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 26px 15px;
  border-bottom: 1px solid var(--line);
}

.plate {
  margin: 0;
  font-family: "iA Writer Quattro Var", "iA Writer Quattro", serif;
  font-weight: 660;
  font-size: 21px;
  letter-spacing: 0.09em;
}

.rail-note {
  font-family: "Martian Mono", monospace;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.24em;
  color: var(--muted);
  white-space: nowrap;
}

.deck {
  display: flex;
  align-items: stretch;
  gap: 30px;
  padding: 26px 26px 22px;
  background:
    linear-gradient(180deg, var(--panel) 0%, color-mix(in srgb, var(--panel) 88%, black 12%) 160%);
}

:root[data-theme="light"] .deck {
  background:
    linear-gradient(180deg, var(--panel) 0%, color-mix(in srgb, var(--panel) 92%, #8a744e 8%) 160%);
}

/* --- channels --- */

.channels {
  display: flex;
  gap: 8px;
}

.ch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 84px;
  padding: 14px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  text-decoration: none;
  color: var(--muted);
}

.ch + .ch { margin-left: 0; }

.led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--line);
  margin-bottom: 2px;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.ch.active .led {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 0 8px 1px var(--amber-glow), 0 0 3px var(--amber);
}

.fader { width: 44px; height: 132px; display: block; }

.fader .slot {
  stroke: var(--slot);
  stroke-width: 4;
  stroke-linecap: round;
}

.fader .ticks line {
  stroke: var(--line);
  stroke-width: 1;
}

.fader .cap {
  transform: translateY(86px);
  transition: transform 0.55s cubic-bezier(0.3, 1, 0.4, 1);
}

.ch.active .fader .cap { transform: translateY(18px); }

.fader .cap rect {
  fill: var(--panel);
  stroke: var(--line);
  stroke-width: 1;
}

.fader .cap-line {
  stroke: var(--muted);
  stroke-width: 1.6;
  transition: stroke 0.3s;
}

.ch.active .cap-line { stroke: var(--amber); }

.ch:hover { border-color: color-mix(in srgb, var(--line) 40%, var(--amber-dim) 60%); }
.ch:hover .cap-line { stroke: var(--amber); }
.ch:hover .ch-label { color: var(--text); }

.ch-num {
  font-family: "Martian Mono", monospace;
  font-size: 7.5px;
  letter-spacing: 0.2em;
  color: var(--muted);
  opacity: 0.75;
}

.ch-label {
  font-family: "Martian Mono", monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--muted);
  transition: color 0.3s;
}

.ch.active .ch-label { color: var(--amber); }

/* --- master: meters + lamp --- */

.master {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-width: 0;
  border-left: 1px solid var(--line);
  padding-left: 28px;
}

.meters {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
}

.vu {
  width: 204px;
  max-width: calc(50% - 8px);
  height: auto;
  display: block;
}

.vu-face {
  fill: var(--raised);
  stroke: var(--line);
  stroke-width: 1;
}

.vu-arc {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
  opacity: 0.75;
}

.vu-red {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.vu-ticks line {
  stroke: var(--muted);
  stroke-width: 1;
}

.vu-ticks .t0 { stroke: var(--text); stroke-width: 1.4; }
.vu-ticks .tr { stroke: var(--red); }

.vu-nums text {
  font-family: "Martian Mono", monospace;
  font-size: 7.5px;
  fill: var(--muted);
  text-anchor: middle;
}

.vu-nums .nr { fill: var(--red); }

.vu-brand {
  font-family: "Martian Mono", monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3em;
  fill: var(--muted);
  text-anchor: middle;
  opacity: 0.85;
}

.vu-chan {
  font-family: "Martian Mono", monospace;
  font-size: 8px;
  fill: var(--amber-dim);
}

:root[data-theme="light"] .vu-chan { fill: var(--amber); }

.needle line {
  stroke: var(--amber);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.pivot {
  fill: var(--panel);
  stroke: var(--line);
  stroke-width: 1;
}

/* --- ON AIR lamp = theme toggle --- */

.lamp-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.onair {
  appearance: none;
  cursor: pointer;
  width: 108px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--raised);
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.35s, box-shadow 0.35s, border-color 0.35s;
}

.onair-text {
  font-family: "Martian Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.24em;
  padding-left: 0.24em; /* optically recenter tracked caps */
  color: var(--muted);
  transition: color 0.35s, text-shadow 0.35s;
}

/* lit = dark studio */
:root[data-theme="dark"] .onair {
  background: color-mix(in srgb, var(--red) 26%, var(--raised) 74%);
  border-color: color-mix(in srgb, var(--red) 55%, var(--line) 45%);
  box-shadow: 0 0 22px 2px var(--lamp-glow), inset 0 0 14px rgba(194, 69, 52, 0.4);
}

:root[data-theme="dark"] .onair-text {
  color: #F5D9C8;
  text-shadow: 0 0 10px rgba(245, 180, 150, 0.75);
}

.onair:hover { border-color: var(--amber-dim); }

.engraved {
  font-family: "Martian Mono", monospace;
  font-size: 7.5px;
  letter-spacing: 0.3em;
  padding-left: 0.3em;
  color: var(--muted);
  opacity: 0.8;
}

/* ================= LEAD ================= */

.lead {
  font-family: "iA Writer Quattro Var", "iA Writer Quattro", serif;
  font-weight: 620;
  font-size: clamp(24px, 4vw, 33px);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 56px 4px 48px;
  max-width: 21ch;
}

/* ================= MODULES ================= */

.module {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 26px 30px 30px;
  margin-bottom: 22px;
  scroll-margin-top: 24px;
}

.module-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 18px;
}

.mod-num {
  font-family: "Martian Mono", monospace;
  font-size: 8.5px;
  letter-spacing: 0.22em;
  color: var(--amber-dim);
}

:root[data-theme="light"] .mod-num { color: var(--amber); }

.module-head h2 {
  margin: 0;
  font-family: "Martian Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--text);
}

.mod-rule {
  flex: 1;
  height: 1px;
  background: var(--line);
  align-self: center;
}

.module-body {
  max-width: 62ch;
}

/* the patchbay is hardware, not prose: rules run to the panel edge */
#links .module-body { max-width: none; }

.module-body p { margin: 0 0 1em; }
.module-body p:last-child { margin-bottom: 0; }

/* ---- patch bay ---- */

.patch-note {
  color: var(--muted);
  font-size: 15px;
  margin-top: 0;
}

.patchbay {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.patchbay li { border-bottom: 1px solid var(--line); }

.patchbay a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 6px;
  text-decoration: none;
}

.jack {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  position: relative;
  flex: none;
  transition: border-color 0.25s;
}

.jack::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.25s;
}

/* a patched jack lights olive: the palette's third voice, used once */
.patchbay a:hover .jack { border-color: var(--olive); }
.patchbay a:hover .jack::after { background: var(--olive); }

.out {
  font-family: "Martian Mono", monospace;
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: var(--muted);
  flex: none;
  width: 52px;
}

.dest {
  font-family: "iA Writer Quattro Var", "iA Writer Quattro", serif;
  font-weight: 620;
  font-size: 17px;
}

.patchbay a:hover .dest { color: var(--amber); }

.handle {
  font-family: "iA Writer Mono", monospace;
  font-size: 13px;
  color: var(--muted);
  margin-left: auto;
}

.arrow {
  color: var(--amber-dim);
  font-size: 14px;
  transition: color 0.25s, transform 0.25s;
}

.patchbay a:hover .arrow {
  color: var(--amber);
  transform: translate(2px, -2px);
}

/* ---- extras notes ---- */

.notes {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notes li {
  padding: 10px 0 10px 26px;
  position: relative;
}

.notes li + li { border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }

.notes li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 1.05em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--amber-dim);
  background: transparent;
}

/* ================= FOOTER ================= */

.foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-top: 44px;
  padding: 16px 6px 0;
  border-top: 1px solid var(--line);
  font-family: "iA Writer Mono", monospace;
  font-size: 11.5px;
  color: var(--muted);
}

.foot-mark {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
}

.foot-mark:hover { color: var(--amber); border-color: var(--amber); }

/* ================= RESPONSIVE ================= */

@media (max-width: 860px) {
  .deck {
    flex-direction: column;
    gap: 24px;
  }
  .channels { justify-content: center; }
  .master {
    justify-content: center;
    flex-wrap: wrap;
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 22px;
  }
  .meters { justify-content: center; flex: none; }
}

@media (max-width: 480px) {
  .wrap { padding: 20px 14px 32px; }
  .rail { padding: 15px 18px 12px; }
  .plate { font-size: 17px; }
  .rail-note { display: none; }
  .deck { padding: 20px 14px 18px; }
  .channels { gap: 6px; }
  .ch { width: 78px; padding: 12px 4px 10px; }
  .fader { height: 116px; }
  .meters { gap: 10px; }
  .vu { width: 165px; }
  .lead { margin: 40px 2px 34px; }
  .module { padding: 20px 18px 24px; }
  .handle { display: none; }
  .out { width: 46px; }
  .foot { flex-wrap: wrap; }
}

/* ================= MOTION ================= */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fader .cap,
  .led, .cap-line, .ch-label,
  .onair, .onair-text,
  .jack, .jack::after, .dest, .arrow { transition: none; }
}
