/* ==========================================================================
   Photography Lab Notes
   Two themes share one stylesheet, toggled by a `neutral` class on <body>:
     · default   = DARKROOM  (loud · chemical · glowing · near-black)
     · .neutral  = NEUTRAL   (darktable-accurate 18% grey editor chrome)
   The <body> starts in DARKROOM.
   ========================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── THEME A · DARKROOM (default) ───────────────────────────────────────── */
:root {
  --bg: #0a0406;
  --bg-2: #080c12;
  --panel: rgba(10, 16, 20, 0.66);
  --panel-solid: #070b0f;
  --ink: #ecfff2;
  --ink-dim: #63e39a;
  --line: #14361f;
  --acid: #5bff00;      /* toxic developer green */
  --volt: #00e9ff;      /* electric fixer cyan   */
  --stop: #ff10b0;      /* hot stop-bath magenta */
  --safe: #ff0033;      /* safelight red         */
  --rebate: #f0ead6;
  --radius: 4px;
  --display: 'Space Grotesk', sans-serif;
  --body: 'Inter', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --glow-acid: 0 0 10px rgba(91,255,0,0.7), 0 0 22px rgba(91,255,0,0.35);
  --glow-volt: 0 0 10px rgba(0,233,255,0.7), 0 0 22px rgba(0,233,255,0.35);
  --glow-stop: 0 0 10px rgba(255,16,176,0.7), 0 0 22px rgba(255,16,176,0.35);
}

/* ── THEME B · NEUTRAL (darktable-accurate 18% grey) ────────────────────── */
body.neutral {
  --bg: #6e6e6e;
  --bg-2: #686868;
  --panel: #767676;
  --panel-solid: #727272;
  --ink: #f0f0f0;
  --ink-dim: #cfcfcf;
  --line: #565656;
  --acid: #e8df26;      /* darktable accent yellow (used sparingly) */
  --volt: #e8df26;
  --stop: #c9a24a;
  --safe: #e8df26;
  --rebate: #1c1c1c;
  --radius: 2px;
  --glow-acid: none;
  --glow-volt: none;
  --glow-stop: none;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: clip;   /* `hidden` here would make body a scroll container and break position:sticky */
  transition: background 0.45s ease, color 0.45s ease;
}

/* safelight + chemical wash (darkroom only) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 52% at 107% -6%, rgba(255,24,52,0.80) 0%, rgba(255,12,42,0.40) 18%, transparent 46%),
    radial-gradient(150% 130% at 102% -2%, rgba(150,0,26,0.24) 0%, rgba(90,0,16,0.12) 44%, transparent 74%),
    radial-gradient(130% 130% at 50% 45%, rgba(120,0,22,0.12) 0%, rgba(80,0,14,0.06) 55%, transparent 78%),
    radial-gradient(85% 75% at -12% 114%, rgba(0,233,255,0.09) 0%, transparent 52%),
    radial-gradient(75% 70% at 45% 128%, rgba(91,255,0,0.08) 0%, transparent 55%);
  transition: opacity 0.45s ease;
}
body.neutral::before { display: none; }

/* grain + scanlines (darkroom only) */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.9;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
body.neutral::after { display: none; }

.shell { position: relative; z-index: 1; }

/* ── TOP BAR + NAV ──────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 0.7rem 1.3rem;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
body:not(.neutral) .topbar { border-bottom-color: var(--acid); box-shadow: 0 1px 16px rgba(91,255,0,0.22); }

.brand { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; margin-right: auto; }
.flask { width: 28px; height: 28px; flex-shrink: 0; }
body:not(.neutral) .flask { filter: drop-shadow(0 0 6px rgba(91,255,0,0.7)); }
.brand-txt {
  font-family: var(--mono); font-size: 0.54rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--ink-dim); line-height: 1.3;
}
.brand-txt strong {
  display: block; font-family: var(--display); font-weight: 700;
  font-size: 0.86rem; letter-spacing: 0.02em; color: var(--ink);
}
body:not(.neutral) .brand-txt strong { color: var(--acid); text-shadow: var(--glow-acid); }

nav { display: flex; flex-wrap: wrap; gap: 0; justify-content: flex-end; }
nav button {
  font-family: var(--mono); font-size: 0.58rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-dim); background: transparent; border: none;
  padding: 0.4rem 0.5rem; cursor: pointer; transition: color 0.18s;
  position: relative; white-space: nowrap;
}
nav button:hover { color: var(--ink); }
nav button.active { color: var(--acid); }
body:not(.neutral) nav button.active { text-shadow: var(--glow-acid); }
body.neutral nav button.active { color: #1c1c1c; }

/* mobile menu toggle */
.nav-toggle {
  display: none; align-items: center; gap: 0.45rem;
  background: transparent; border: 1px solid var(--line); border-radius: 6px;
  padding: 0.4rem 0.6rem; cursor: pointer;
  font-family: var(--mono); font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim);
}
.nav-toggle .nt-bars, .nav-toggle .nt-bars::before, .nav-toggle .nt-bars::after {
  display: inline-block; width: 15px; height: 2px; background: currentColor;
  border-radius: 2px; transition: transform 0.2s ease, top 0.2s ease, background 0.2s ease;
}
.nav-toggle .nt-bars { position: relative; }
.nav-toggle .nt-bars::before, .nav-toggle .nt-bars::after { content: ''; position: absolute; left: 0; }
.nav-toggle .nt-bars::before { top: -5px; }
.nav-toggle .nt-bars::after { top: 5px; }
.topbar.nav-open .nav-toggle .nt-bars { background: transparent; }
.topbar.nav-open .nav-toggle .nt-bars::before { top: 0; transform: rotate(45deg); }
.topbar.nav-open .nav-toggle .nt-bars::after { top: 0; transform: rotate(-45deg); }

/* theme toggle */
.toggle { display: flex; align-items: center; gap: 0.55rem; flex-shrink: 0; }
.toggle .t-lab {
  font-family: var(--mono); font-size: 0.56rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim);
  transition: color 0.2s, text-shadow 0.2s;
}
.toggle .t-lab.on { color: var(--ink); }
body:not(.neutral) .toggle .t-lab.on { color: var(--acid); text-shadow: var(--glow-acid); }
body.neutral .toggle .t-lab.on { color: #1c1c1c; }
.track {
  width: 44px; height: 24px; border-radius: 999px;
  background: var(--panel-solid); border: 1px solid var(--line);
  position: relative; cursor: pointer; flex-shrink: 0;
}
.knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--safe); transition: transform 0.26s cubic-bezier(0.3,1.4,0.5,1), background 0.26s;
}
body:not(.neutral) .knob { box-shadow: 0 0 14px rgba(255,0,51,0.9); }
body.neutral .knob { transform: translateX(20px); background: var(--acid); }

/* ── PAGE SYSTEM ────────────────────────────────────────────────────────── */
.page { display: none; animation: rise 0.4s ease; }
.page.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.wrap { max-width: 760px; margin: 0 auto; padding: 3rem 1.4rem 5rem; }

/* ── TYPOGRAPHY ─────────────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--mono); font-size: 0.64rem; font-weight: 700;
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--volt);
  display: inline-block; margin-bottom: 1.1rem;
  padding: 0.25rem 0.6rem; border: 1px solid var(--volt); border-radius: 3px;
}
body:not(.neutral) .eyebrow { text-shadow: var(--glow-volt); box-shadow: var(--glow-volt); }
body.neutral .eyebrow { color: #1c1c1c; border-color: #1c1c1c; background: var(--acid); }

h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2.5rem, 7vw, 4.2rem); line-height: 0.98;
  letter-spacing: -0.03em; margin-bottom: 1rem; color: var(--ink);
}
body:not(.neutral) h1 {
  color: #fff;
  text-shadow: -3px 0 0 rgba(255,16,176,0.9), 3px 0 0 rgba(0,233,255,0.9), 0 0 26px rgba(91,255,0,0.5);
}
h1 .glow-g { color: var(--acid); }
body:not(.neutral) h1 .glow-g { text-shadow: -3px 0 0 var(--stop), 3px 0 0 var(--volt), 0 0 24px rgba(91,255,0,0.85); }

.tagline {
  font-family: var(--display); font-weight: 400; font-size: 1.25rem;
  color: var(--ink-dim); max-width: 42ch; margin-bottom: 2rem;
}
body:not(.neutral) .tagline { color: #b6ffcf; }

h2 {
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
  letter-spacing: 0.02em; text-transform: uppercase;
  margin: 2.6rem 0 1rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line); color: var(--ink);
}
body:not(.neutral) h2 { border-bottom-color: var(--stop); }
h2 .n { font-family: var(--mono); font-size: 0.7rem; color: var(--volt); margin-right: 0.6rem; }
body:not(.neutral) h2 .n { text-shadow: var(--glow-volt); }

h3 { font-family: var(--display); font-weight: 600; font-size: 1rem; color: var(--ink); margin: 1.6rem 0 0.5rem; }

p.body { margin-bottom: 1rem; color: var(--ink); }
body:not(.neutral) p.body { color: #d7f7e2; }
p.body strong { color: var(--ink); font-weight: 600; }
body:not(.neutral) p.body strong { color: var(--acid); text-shadow: var(--glow-acid); }
p.body em { color: var(--volt); font-style: italic; }
body.neutral p.body em { color: #1c1c1c; font-weight: 600; }

blockquote.verbatim {
  border-left: 3px solid var(--stop); margin: 1.4rem 0; padding: 0.4rem 0 0.4rem 1.3rem;
  color: var(--ink); font-family: var(--body);
}
blockquote.verbatim p { margin-bottom: 0.9rem; }
blockquote.verbatim p:last-child { margin-bottom: 0; }

/* ── SIGNATURE: DEVELOP (before/after) SLIDER ───────────────────────────── */
.develop {
  position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden;
  margin: 2rem 0 1rem; user-select: none; touch-action: none;
  border: 1px solid var(--line);
}
body:not(.neutral) .develop { border-color: var(--volt); box-shadow: 0 0 26px rgba(0,233,255,0.22); }
.develop .layer { position: absolute; inset: 0; background-size: cover; background-position: center; }
/* "graded" — the finished look */
.develop .after {
  background: linear-gradient(115deg, #10233b 0%, #1f5f6e 34%, #b98a3f 66%, #e4b15a 100%);
}
/* "flat RAW" — muddy, low-contrast, desaturated */
.develop .before {
  background: linear-gradient(115deg, #3a4048 0%, #545a5c 40%, #6f6a5c 70%, #8f8a7d 100%);
  clip-path: inset(0 calc(100% - var(--pos, 55%)) 0 0);
  filter: saturate(0.55) contrast(0.82);
}
.develop .divider {
  position: absolute; top: 0; bottom: 0; left: var(--pos, 55%);
  width: 2px; background: var(--rebate); transform: translateX(-1px); cursor: ew-resize;
}
body:not(.neutral) .develop .divider { background: #fff; box-shadow: 0 0 10px rgba(255,255,255,0.8); }
.develop .handle {
  position: absolute; top: 50%; left: var(--pos, 55%); transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--rebate); color: #111; cursor: ew-resize;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 0.8rem; font-weight: 700;
}
body:not(.neutral) .develop .handle { box-shadow: 0 0 16px rgba(0,233,255,0.7); }
.develop .d-lab {
  position: absolute; bottom: 0.6rem; font-family: var(--mono); font-size: 0.58rem;
  font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.2rem 0.5rem; border-radius: 3px; background: rgba(0,0,0,0.5); color: #fff;
}
.develop .d-lab.left { left: 0.6rem; }
.develop .d-lab.right { right: 0.6rem; }

/* ── LANDING CHAPTER GRID ───────────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.8rem; margin: 1.5rem 0; }
.mini-card {
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; cursor: pointer; transition: transform 0.18s, border-color 0.18s;
}
.mini-card:hover { transform: translateY(-3px); border-color: var(--acid); }
body:not(.neutral) .mini-card:hover { box-shadow: var(--glow-acid); }
.mini-card .mc-num { font-family: var(--mono); font-size: 0.62rem; color: var(--volt); letter-spacing: 0.1em; }
body:not(.neutral) .mini-card .mc-num { text-shadow: var(--glow-volt); }
.mini-card h4 { font-family: var(--display); font-weight: 600; font-size: 1.05rem; color: var(--ink); margin: 0.25rem 0; }
.mini-card p { font-size: 0.82rem; color: var(--ink-dim); margin: 0; }

/* ── CALLOUT (loud chemical sticker) ────────────────────────────────────── */
.callout {
  position: relative; border-radius: var(--radius); padding: 1.2rem 1.4rem; margin: 1.8rem 0;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--stop);
}
body:not(.neutral) .callout { background: rgba(255,16,176,0.10); border: 1px solid var(--stop); box-shadow: var(--glow-stop), inset 0 0 30px rgba(255,16,176,0.08); }
.callout .c-tag {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--stop); display: block; margin-bottom: 0.4rem;
}
body:not(.neutral) .callout .c-tag { color: var(--acid); text-shadow: var(--glow-acid); }
.callout p { color: var(--ink); font-size: 0.95rem; margin-bottom: 0.5rem; }
.callout p:last-child { margin-bottom: 0; }
body:not(.neutral) .callout p { color: #ffdff4; }

/* ── DEEPER (technical sidebar) ─────────────────────────────────────────── */
.deeper {
  border-radius: var(--radius); padding: 1.2rem 1.4rem; margin: 1.8rem 0;
  background: var(--panel); border: 1px dashed var(--volt);
}
body.neutral .deeper { border-color: var(--line); background: var(--bg-2); }
.deeper .d-tag {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--volt); display: block; margin-bottom: 0.4rem;
}
body:not(.neutral) .deeper .d-tag { text-shadow: var(--glow-volt); }
body.neutral .deeper .d-tag { color: #1c1c1c; }
.deeper p { color: var(--ink); font-size: 0.9rem; margin-bottom: 0.5rem; }
.deeper p:last-child { margin-bottom: 0; }
body:not(.neutral) .deeper p { color: #cfeef7; }

/* ── EDITOR COMPARISON ROWS ─────────────────────────────────────────────── */
.compare-block { border: 1px solid var(--line); border-radius: var(--radius); margin: 1.8rem 0; overflow: hidden; }
.compare-head {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-dim); padding: 0.6rem 1rem; background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.compare-row { display: grid; grid-template-columns: 130px 1fr; gap: 0.5rem; padding: 0.7rem 1rem; font-size: 0.88rem; }
.compare-row:not(:last-child) { border-bottom: 1px solid var(--line); }
.compare-row .app { font-family: var(--mono); font-size: 0.72rem; font-weight: 700; color: var(--acid); }
body:not(.neutral) .compare-row .app { text-shadow: var(--glow-acid); }
.compare-row .how { color: var(--ink-dim); }

/* ── EDITOR MODULE (slider mock) ────────────────────────────────────────── */
.module { border-radius: var(--radius); background: var(--panel-solid); border: 1px solid var(--line); overflow: hidden; margin: 1.8rem 0; }
body:not(.neutral) .module { border-color: var(--acid); box-shadow: var(--glow-acid); }
.module-head {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-dim); padding: 0.7rem 1rem; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; background: var(--bg-2);
}
body:not(.neutral) .module-head { color: var(--acid); }
.slider-row { padding: 0.9rem 1rem; }
.slider-row:not(:last-child) { border-bottom: 1px solid var(--line); }
.slider-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; }
.slider-top .s-name { font-size: 0.82rem; color: var(--ink); }
.slider-top .s-val { font-family: var(--mono); font-size: 0.78rem; font-weight: 500; color: var(--acid); }
body:not(.neutral) .slider-top .s-val { text-shadow: var(--glow-acid); }
body.neutral .slider-top .s-val { color: var(--ink); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 3px; background: var(--line); border-radius: 3px; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--acid); cursor: pointer; border: 2px solid var(--bg); }
body:not(.neutral) input[type=range]::-webkit-slider-thumb { box-shadow: var(--glow-acid); }
input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--acid); cursor: pointer; border: 2px solid var(--bg); }

/* ── TONE BAR ───────────────────────────────────────────────────────────── */
.tonebar { height: 46px; border-radius: var(--radius); margin: 1.6rem 0 0.4rem; border: 1px solid var(--line);
  background: linear-gradient(90deg, #000 0%, #3a3a3a 30%, #808080 50%, #c9c9c9 72%, #fff 100%); }
body:not(.neutral) .tonebar { box-shadow: var(--glow-volt); border-color: var(--volt); }
.tonebar-scale { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 0.58rem; color: var(--ink-dim); letter-spacing: 0.1em; text-transform: uppercase; }

/* ── HAZARD CHIPS ───────────────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.6rem 0; }
.chip { font-family: var(--mono); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.3rem 0.6rem; border-radius: 3px; border: 1px solid var(--line); color: var(--ink-dim); }
body:not(.neutral) .chip.c1 { color: #04060a; background: var(--acid); box-shadow: var(--glow-acid); border-color: var(--acid); }
body:not(.neutral) .chip.c2 { color: #04060a; background: var(--volt); box-shadow: var(--glow-volt); border-color: var(--volt); }
body:not(.neutral) .chip.c3 { color: #04060a; background: var(--stop); box-shadow: var(--glow-stop); border-color: var(--stop); }
body:not(.neutral) .chip.c4 { color: #fff; background: var(--safe); border-color: var(--safe); box-shadow: 0 0 12px rgba(255,0,51,0.7); }
body.neutral .chip { color: #1c1c1c; background: var(--acid); border-color: var(--acid); }

/* ── DIAGRAM WRAPPER (gamut etc.) ───────────────────────────────────────── */
.diagram { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; margin: 1.6rem 0; }
.diagram .cap { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); margin-top: 0.6rem; text-align: center; }

/* ── PHOTO SLOT (drop-in placeholder for the reader's own image) ─────────── */
.photo-slot {
  border: 2px dashed var(--volt); border-radius: 8px; margin: 1.8rem 0;
  min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 2rem 1.4rem; gap: 0.5rem; background: var(--panel);
}
body.neutral .photo-slot { border-color: var(--line); background: var(--bg-2); }
.photo-slot .ps-icon { font-size: 1.8rem; }
.photo-slot .ps-title { font-family: var(--display); font-weight: 600; color: var(--ink); }
.photo-slot .ps-note { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-dim); max-width: 44ch; line-height: 1.5; }
.photo-slot code { background: var(--bg-2); padding: 0.1rem 0.35rem; border-radius: 3px; color: var(--acid); }

/* ── MANIFESTO ──────────────────────────────────────────────────────────── */
.manifesto p { font-family: var(--display); font-weight: 400; font-size: 1.3rem; line-height: 1.55; color: var(--ink); margin-bottom: 1.2rem; }
body:not(.neutral) .manifesto p { color: #eafff0; }
.manifesto p:first-of-type::first-letter { font-size: 3rem; font-weight: 700; color: var(--acid); }

/* ── DISCLAIMER ─────────────────────────────────────────────────────────── */
.disclaimer { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem 1.8rem; margin: 1.5rem 0; background: var(--panel); }
.disclaimer p { font-size: 0.95rem; color: var(--ink-dim); margin-bottom: 0.9rem; }
.disclaimer p:last-child { margin-bottom: 0; }

/* ── NOTE / STUB MARKER ─────────────────────────────────────────────────── */
.note { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-dim); border: 1px dashed var(--line); border-radius: var(--radius); padding: 0.8rem 1rem; margin: 1.6rem 0; }
.stub { opacity: 0.85; }
.stub-tag { font-family: var(--mono); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--safe); border: 1px solid var(--safe); border-radius: 3px; padding: 0.15rem 0.5rem; display: inline-block; margin-bottom: 1rem; }
body.neutral .stub-tag { color: #7a2020; border-color: #7a2020; }

/* ── NEXT BUTTON ────────────────────────────────────────────────────────── */
.next-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700;
  color: var(--bg); background: var(--acid); border: none; padding: 0.8rem 1.4rem; border-radius: var(--radius);
  cursor: pointer; margin-top: 2rem; transition: transform 0.2s, box-shadow 0.2s;
}
body:not(.neutral) .next-btn { box-shadow: var(--glow-acid); }
.next-btn:hover { transform: translateX(3px); }
body.neutral .next-btn { color: #1c1c1c; }

/* ── FOOTER ─────────────────────────────────────────────────────────────── */
.foot { max-width: 760px; margin: 0 auto; padding: 2rem 1.4rem 3rem; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }

/* ── MOBILE ─────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  /* CRITICAL: `backdrop-filter` (like `transform`) makes an element a CONTAINING
     BLOCK for position:fixed descendants — which would size the drawer to the
     header instead of the viewport. It must be off for the drawer to work. */
  .topbar {
    position: relative;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg);
    flex-wrap: nowrap;              /* keep the header ONE row so the drawer's top padding clears it */
    gap: 0.5rem;
    padding: 0.6rem 1rem;
  }
  .brand { min-width: 0; }
  .brand-txt { overflow: hidden; }
  .nav-toggle { display: inline-flex; flex-shrink: 0; }
  .toggle { flex-shrink: 0; }
  .nerd-switch { flex-shrink: 0; font-size: 0.5rem; padding: 0.3rem 0.45rem; white-space: nowrap; }

  /* The drawer is a CHILD of the header, so the header's background paints BELOW
     it — scrolled items would show through behind the logo. This repaints the bar
     ABOVE the drawer (z 155) but BELOW the controls (z 160). */
  .topbar::after {
    content: '';
    position: absolute; inset: 0; z-index: 155;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  }
  .topbar.nav-open::after { opacity: 1; }

  /* header controls stay clickable on top of the open drawer */
  .brand, .nav-toggle, .toggle, .nerd-switch { position: relative; z-index: 160; }

  nav {
    position: fixed;
    inset: 0;                       /* measured against the viewport, not the header */
    z-index: 150;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;              /* base nav sets `wrap`; in a column that spills
                                       items into a SECOND COLUMN instead of scrolling */
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    background: var(--bg);
    padding: 4.4rem 1.1rem 2.5rem;  /* clears the single-row header */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.26s ease, visibility 0.26s;
  }
  .topbar.nav-open nav { transform: translateX(0); visibility: visible; }

  nav button {
    width: 100%; text-align: left;
    padding: 0.95rem 0.6rem; font-size: 0.8rem;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0; white-space: normal;
  }
  nav button:last-child { border-bottom: none; }
}

@media (max-width: 520px) {
  .nav-toggle span:last-child { display: none; }   /* icon-only hamburger */
  .nerd-switch { font-size: 0.46rem; padding: 0.3rem 0.4rem; }
  .toggle .t-lab { display: none; }                /* just the theme knob */
}

/* Stop sideways scrolling. NOTE: `overflow-x: hidden` on html/body creates a scroll
   container and BREAKS position:sticky (our header). `clip` clips without that. */
html, body { max-width: 100%; overflow-x: clip; }
img, canvas, svg, table, pre { max-width: 100%; }
@media (max-width: 560px) {
  h2 { font-size: 0.95rem; }
  .brand-txt strong { font-size: 0.78rem; }
  .compare-row { grid-template-columns: 1fr; gap: 0.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ── v1 additions: lists, natural-case nerd-box labels, author notes ── */
.wrap ul, .wrap ol { margin: 0.4rem 0 1.2rem 1.3rem; }
.wrap li { margin-bottom: 0.5rem; color: var(--ink); }
body:not(.neutral) .wrap li { color: #d7f7e2; }
.deeper ul, .deeper ol { margin: 0.5rem 0 0.5rem 1.15rem; }
.deeper li { font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--ink); }
body:not(.neutral) .deeper li { color: #cfeef7; }
.deeper .d-tag { text-transform: none; letter-spacing: 0.02em; font-size: 0.72rem; line-height: 1.4; }
.deeper p + p { margin-top: 0.4rem; }
.author-note { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-dim); border: 1px dashed var(--safe); border-radius: var(--radius); padding: 0.7rem 1rem; margin: 1.4rem 0; }
h3 { text-transform: none; }

/* ── NERD BOXES: collapsed bar → drawer (desktop) / bottom sheet (mobile) ── */
.nerd { margin: 1.8rem 0; border: 1px dashed var(--volt); border-radius: var(--radius); overflow: hidden; }
body.neutral .nerd { border-color: var(--line); }
.nerd-bar {
  width: 100%; text-align: left; background: var(--bg-2); border: none; cursor: pointer;
  color: var(--volt); font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.02em; line-height: 1.4;
  padding: 0.75rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
body:not(.neutral) .nerd-bar { text-shadow: var(--glow-volt); }
body.neutral .nerd-bar { color: #1c1c1c; }
.nerd-bar:hover { filter: brightness(1.15); }
.nerd-bar .chev { transition: transform 0.2s ease; flex-shrink: 0; }
.nerd-body { display: none; padding: 1.1rem 1.3rem; }
.nerd-body p { color: var(--ink); font-size: 0.9rem; margin-bottom: 0.5rem; }
body:not(.neutral) .nerd-body p { color: #cfeef7; }
.nerd-body ul, .nerd-body ol { margin: 0.5rem 0 0.5rem 1.15rem; }
.nerd-body li { font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--ink); }
body:not(.neutral) .nerd-body li { color: #cfeef7; }
/* nerd-mode: reveal all inline (unless individually collapsed) */
body.nerdmode .nerd-body { display: block; }
body.nerdmode .nerd.collapsed .nerd-body { display: none; }
body.nerdmode .nerd .chev { transform: rotate(90deg); }
body.nerdmode .nerd.collapsed .chev { transform: rotate(0deg); }

/* header nerd-mode switch */
.nerd-switch {
  font-family: var(--mono); font-size: 0.56rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-dim); background: transparent; border: 1px solid var(--line); border-radius: 6px;
  padding: 0.35rem 0.6rem; cursor: pointer; flex-shrink: 0;
}
.nerd-switch[aria-pressed="true"] { color: var(--volt); border-color: var(--volt); }
body:not(.neutral) .nerd-switch[aria-pressed="true"] { box-shadow: var(--glow-volt); }
body.neutral .nerd-switch[aria-pressed="true"] { color: #1c1c1c; border-color: #1c1c1c; background: var(--acid); }

/* drawer + scrim */
.nerd-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(460px, 92vw);
  background: var(--panel-solid); border-left: 1px solid var(--volt);
  transform: translateX(100%); transition: transform 0.28s ease; z-index: 120; overflow-y: auto;
}
body:not(.neutral) .nerd-drawer { box-shadow: -8px 0 40px rgba(0,0,0,0.5); }
body.drawer-open .nerd-drawer { transform: translateX(0); }
.drawer-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); opacity: 0; pointer-events: none;
  transition: opacity 0.28s ease; z-index: 110;
}
body.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }
.nd-head {
  position: sticky; top: 0; background: var(--bg-2); display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 0.9rem 1.2rem; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.02em; color: var(--volt); line-height: 1.4;
}
body:not(.neutral) .nd-head { text-shadow: var(--glow-volt); }
body.neutral .nd-head { color: #1c1c1c; }
.nd-close { background: none; border: none; color: var(--ink); font-size: 1.1rem; cursor: pointer; flex-shrink: 0; line-height: 1; }
.nd-body { padding: 1.2rem 1.3rem 3rem; }
.nd-body p { color: var(--ink); font-size: 0.92rem; margin-bottom: 0.7rem; }
body:not(.neutral) .nd-body p { color: #cfeef7; }
.nd-body ul, .nd-body ol { margin: 0.5rem 0 0.7rem 1.1rem; }
.nd-body li { font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--ink); }
body:not(.neutral) .nd-body li { color: #cfeef7; }

@media (max-width: 640px) {
  .nerd-drawer {
    top: auto; bottom: 0; right: 0; left: 0; width: 100%; height: 82vh;
    border-left: none; border-top: 1px solid var(--volt); border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  body.drawer-open .nerd-drawer { transform: translateY(0); }
}

/* ── INTERACTIVE WIDGETS ── */
.widget { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); margin: 2rem 0; overflow: hidden; }
body:not(.neutral) .widget { border-color: var(--acid); box-shadow: var(--glow-acid); }
.w-head { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 1rem; background: var(--bg-2); border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); }
body:not(.neutral) .w-head .w-name { color: var(--acid); }
.w-tools { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.w-btn { font-family: var(--mono); font-size: 0.54rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-dim); background: transparent; border: 1px solid var(--line); border-radius: 3px; padding: 0.25rem 0.5rem; cursor: pointer; }
.w-btn:hover, .w-btn.on { color: var(--ink); border-color: var(--acid); }
body.neutral .w-btn.on { color: #1c1c1c; background: var(--acid); }
.w-canvas { display: block; width: 100%; height: auto; background: #000; touch-action: none; }
.w-hist { display: block; width: 100%; height: 56px; background: var(--bg-2); border-top: 1px solid var(--line); }
.w-body { padding: 1rem; }
.w-info { display: flex; gap: 1rem; flex-wrap: wrap; font-family: var(--mono); font-size: 0.6rem; color: var(--ink-dim); margin-bottom: 1rem; }
.w-info b { color: var(--ink); } .w-info .warn { color: var(--safe); }
.widget .row { margin-bottom: 0.9rem; } .widget .row:last-child { margin-bottom: 0; }
.widget .row-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.35rem; }
.widget .r-name { font-size: 0.8rem; color: var(--ink); }
.widget .r-val { font-family: var(--mono); font-size: 0.74rem; color: var(--acid); }
body.neutral .widget .r-val { color: var(--ink); }
.widget input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 3px; background: var(--line); border-radius: 3px; outline: none; }
.widget input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--acid); cursor: pointer; border: 2px solid var(--bg); }
body:not(.neutral) .widget input[type=range]::-webkit-slider-thumb { box-shadow: var(--glow-acid); }
.widget input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--acid); cursor: pointer; border: 2px solid var(--bg); }
.chan-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.chan-btns button { width: 30px; height: 26px; border-radius: 3px; border: 1px solid var(--line); background: transparent; color: var(--ink-dim); font-family: var(--mono); font-size: 0.66rem; font-weight: 700; cursor: pointer; }
.chan-btns button.on { border-color: var(--ink); color: var(--ink); }
.pad-wrap { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.pad { width: 240px; height: 240px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 3px; touch-action: none; cursor: crosshair; flex-shrink: 0; }
.pad-side { flex: 1; min-width: 180px; }

/* ── Neutral theme: emphasis in the yellow accent for legibility ── */
body.neutral p.body strong, body.neutral p.body b, body.neutral p.body em,
body.neutral .nerd-body strong, body.neutral .nerd-body b,
body.neutral .nd-body strong, body.neutral .nd-body b { color: var(--acid); }

/* ── "HERE'S A TIP!" — a real paper note (grain texture), cyan accent, always open ── */
.tip {
  position: relative; margin: 2.3rem 0; padding: 1.3rem 1.4rem 1.2rem; border-radius: 2px;
  color: #2b2a24; border-left: 3px solid var(--volt); transform: rotate(-0.7deg);
  background-color: #ece5d0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)' opacity='0.55'/%3E%3C/svg%3E");
  background-blend-mode: multiply;
  box-shadow: 0 8px 22px rgba(0,0,0,0.45);
}
body.neutral .tip { box-shadow: 0 6px 16px rgba(0,0,0,0.26); }
.tip::before {
  content: ''; position: absolute; top: -9px; left: 50%; transform: translateX(-50%) rotate(2.5deg);
  width: 96px; height: 20px; border-radius: 2px;
  background: color-mix(in srgb, var(--volt) 32%, #d7d0ba);
  border: 1px solid color-mix(in srgb, var(--volt) 55%, transparent);
}
body:not(.neutral) .tip::before { box-shadow: 0 0 10px rgba(0,233,255,0.4); }
.tip-label {
  font-family: var(--mono); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: #0e6b78; display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.55rem;
}
.tip p { color: #2b2a24; font-size: 0.95rem; margin-bottom: 0.5rem; }
.tip p:last-child { margin-bottom: 0; }
.tip strong { color: #14130f; }

/* Neutral theme: absolutely clean — no grain, no wash, no blend repaints */
body.neutral .tip { background-image: none; background-color: #ece5d0; background-blend-mode: normal; }

/* HSL band swatches */
.band-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.band-btns button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.band-btns button.on { border-color: var(--ink); }
