/* passive_peak_detector.html  ·  page-specific styles
   Tokens mirror the Week 9 sample-and-hold palette so that the case study,
   sample-and-hold and peak-detector pages share a consistent visual language. */

:root {
    --bg: #0a0a10;
    --bg-2: #12131c;
    --bg-panel: rgba(22, 23, 32, 0.75);
    --fg: #eef0f5;
    --text: #eef0f5;
    --text-dim: #d4d7e0;
    --muted: #8b90a3;
    --border: rgba(255, 255, 255, 0.09);
    --border-hover: rgba(255, 255, 255, 0.18);

    --c-input:    #58a6ff;
    --c-output:   #34d399;
    --c-output2:  #7be089;
    --c-thresh:   #ff5c7a;
    --c-low:      #8b90a3;
    --c-high:     #7be089;
    --c-hot:      #f97066;
    --c-amber:    #f5c451;

    --accent: var(--site-accent);
    --accent-soft: var(--site-accent-soft);
    --accent-soft-faint: var(--site-accent-soft-faint);
    --accent-soft-edge: var(--site-accent-soft-edge);

    --grid-line: rgba(255, 255, 255, 0.06);
    --grid-zero: rgba(255, 255, 255, 0.30);
    --tick-line: rgba(255, 255, 255, 0.25);
    --slider-track: rgba(255, 255, 255, 0.12);
    --pill-bg: rgba(255, 255, 255, 0.03);

    --body-size: 17px;
    --math-size: 18px;
    --hero-size: 60px;
}

[data-theme="light"] {
    --bg: #f5f5f7;
    --bg-2: #ffffff;
    --bg-panel: rgba(255, 255, 255, 0.92);
    --fg: #1a1a1e;
    --text: #1a1a1e;
    --text-dim: #2b2d38;
    --muted: #6a6f7c;
    --border: rgba(0, 0, 0, 0.10);
    --border-hover: rgba(0, 0, 0, 0.22);

    --c-input:    #1d4ed8;
    --c-output:   #059669;
    --c-output2:  #2f8f3f;
    --c-thresh:   #dc2626;
    --c-low:      #6a6f7c;
    --c-high:     #2f8f3f;
    --c-hot:      #c0382b;
    --c-amber:    #b8801f;

    --grid-line: rgba(0, 0, 0, 0.07);
    --grid-zero: rgba(0, 0, 0, 0.32);
    --tick-line: rgba(0, 0, 0, 0.22);
    --slider-track: rgba(0, 0, 0, 0.12);
    --pill-bg: rgba(0, 0, 0, 0.03);
}

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

html, body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: var(--body-size);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
body { overflow-x: hidden; min-height: 100vh; }

.katex { font-size: var(--math-size) !important; }
.katex-display { margin: 0.6em 0 !important; }
h1 .katex, h2 .katex, h3 .katex { font-size: inherit !important; }

a { color: var(--accent); }

.brand {
    position: fixed; top: 20px; left: 24px; z-index: 40;
    font-size: 12px; color: var(--muted);
    letter-spacing: 0.08em; text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
    display: flex; align-items: center; gap: 10px;
}
.brand .mark {
    width: 10px; height: 10px; border-radius: 50%;
    background: conic-gradient(var(--c-input), var(--c-output), var(--c-thresh), var(--c-output2), var(--c-input));
}
.back-btn {
    position: fixed; top: 14px; right: 56px; z-index: 9999;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 14px; border-radius: 999px;
    background: var(--bg-panel); border: 1px solid var(--border);
    color: var(--fg); text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
    backdrop-filter: blur(8px); transition: all 0.15s;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

.landing {
    min-height: 100vh; display: grid; place-items: center;
    padding: 120px 56px 80px; text-align: center; position: relative;
}
.landing .meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px; color: var(--muted);
    letter-spacing: 0.2em; text-transform: uppercase;
    margin-bottom: 28px;
}
h1.hero {
    font-size: var(--hero-size); line-height: 1.02;
    font-weight: 600; letter-spacing: -0.025em;
    margin: 0 auto 24px; max-width: 22ch;
}
h1.hero em {
    font-style: normal;
    background: linear-gradient(135deg, var(--c-input), var(--c-output));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.landing .sub {
    color: var(--muted); font-size: 18px;
    max-width: 64ch; margin: 12px auto 0; line-height: 1.6;
}
.landing .tags {
    margin-top: 36px; display: flex; gap: 12px;
    justify-content: center; flex-wrap: wrap;
}
.field-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px; color: var(--muted);
    letter-spacing: 0.12em; text-transform: uppercase;
    display: inline-block; padding: 4px 10px;
    border: 1px solid var(--border); border-radius: 4px;
}
.scroll-hint {
    position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px; letter-spacing: 0.2em;
    color: var(--muted); text-transform: uppercase;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.scroll-hint .line {
    width: 1px; height: 32px;
    background: linear-gradient(var(--muted), transparent);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.3; } 50% { opacity: 1; }
}

.section-divider {
    padding: 40px 56px 0;
    max-width: 1200px;
    margin: 0 auto;
}
.section-divider .lab {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px; color: var(--accent);
    letter-spacing: 0.22em; text-transform: uppercase;
    display: flex; align-items: center; gap: 12px;
}
.section-divider .lab .bar {
    flex: 1; height: 1px; background: var(--border);
}

section.scene {
    min-height: 100vh; padding: 80px 40px 80px;
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.5fr);
    gap: 28px; align-items: start;
    border-bottom: 1px solid var(--border);
    max-width: 1400px; margin: 0 auto;
}
section.scene .copy { max-width: 560px; }

.eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 18px;
    display: flex; align-items: center; gap: 10px;
}
.eyebrow .num { color: var(--accent); }
.eyebrow .bar { flex: 0 0 28px; height: 1px; background: var(--accent); }

h2 {
    font-size: 34px; line-height: 1.12;
    font-weight: 600; letter-spacing: -0.02em;
    margin: 0 0 18px; color: var(--fg);
}
h2 em { font-style: normal; }
h2 em.input  { color: var(--c-input); }
h2 em.output { color: var(--c-output); }
h2 em.thresh { color: var(--c-thresh); }
h2 em.high   { color: var(--c-high); }

h3 {
    font-size: 17px; font-weight: 600;
    margin: 22px 0 8px; color: var(--fg); letter-spacing: -0.01em;
}

p { margin: 0 0 14px; color: var(--text-dim); }
p.lead { font-size: calc(var(--body-size) + 1px); color: var(--fg); }
p.dim  { color: var(--muted); }

strong { color: var(--fg); font-weight: 600; }

.callout {
    margin-top: 18px; padding: 14px 18px;
    border-left: 2px solid var(--accent);
    background: var(--accent-soft-faint);
    border-radius: 0 8px 8px 0;
    font-size: 14px; color: var(--text-dim); line-height: 1.7;
}

.plot-stack {
    display: flex; flex-direction: column; gap: 14px;
    width: 100%; max-width: 760px;
}
.plot-box {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 12px; background: var(--bg-2);
    overflow: hidden; width: 100%;
}
.plot-box.trace-box   { aspect-ratio: 2.2 / 1; }
.plot-box.short-box   { aspect-ratio: 3.4 / 1; }
.plot-box.circuit-box { aspect-ratio: 1.8 / 1; }

.plot-box svg { display: block; width: 100%; height: 100%; }

.plot-box .label {
    position: absolute; top: 10px; left: 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--muted); z-index: 2; pointer-events: none;
}
.plot-box .label b {
    font-weight: 600; letter-spacing: 0.06em; color: var(--fg);
}

.toolbar {
    display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: center;
    padding: 10px 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border); border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}
.toolbar .pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: var(--pill-bg);
    border: 1px solid var(--border); border-radius: 999px;
    color: var(--text-dim); cursor: pointer;
    text-transform: uppercase; letter-spacing: 0.08em;
    font-size: 10px; transition: all 0.12s; user-select: none;
}
.toolbar .pill:hover { border-color: var(--border-hover); color: var(--fg); }
.toolbar .pill.active {
    background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}
.toolbar .divider {
    width: 1px; height: 18px; background: var(--border); margin: 0 4px;
}
.toolbar .slider-group {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 4px 8px;
}
.toolbar .slider-group .lab {
    color: var(--muted); font-size: 10px;
    letter-spacing: 0.1em; text-transform: uppercase;
}
.toolbar .slider-group .val {
    color: var(--fg); min-width: 6ch; text-align: right;
}
.toolbar input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 130px; height: 4px;
    background: var(--slider-track); border-radius: 999px;
    outline: none;
}
.toolbar input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent); cursor: pointer;
    border: 2px solid var(--bg-2);
}
.toolbar input[type="range"]::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent); cursor: pointer;
    border: 2px solid var(--bg-2);
}

.readout {
    display: flex; gap: 16px; flex-wrap: wrap;
    padding: 10px 14px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-panel);
    font-family: 'JetBrains Mono', monospace; font-size: 11px;
}
.readout .item {
    display: flex; flex-direction: column; gap: 2px; min-width: 90px;
}
.readout .item .k {
    color: var(--muted); font-size: 9.5px;
    letter-spacing: 0.16em; text-transform: uppercase;
}
.readout .item .v {
    color: var(--fg); font-size: 14px;
    display: inline-block; transform-origin: left center;
}
.readout .item .v.on   { color: var(--c-high); }
.readout .item .v.off  { color: var(--c-low); }
.readout .item .v.warn { color: var(--c-hot); }
.readout .item .v.amber { color: var(--c-amber); }

svg.ov text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px; fill: var(--muted);
}
svg.ov .grid line { stroke: var(--grid-line); stroke-width: 1; }
svg.ov .axis text { fill: var(--muted); font-size: 11px; }
svg.ov .axis line { stroke: var(--tick-line); stroke-width: 1; }
svg.ov .axis path { stroke: var(--tick-line); stroke-width: 1; fill: none; }
svg.ov .axis-title { fill: var(--text-dim); font-size: 12px;
    letter-spacing: 0.06em; text-transform: uppercase; }

svg.ov .trace { fill: none; stroke-width: 2.0; stroke-linecap: round; stroke-linejoin: round; }
svg.ov .trace.input   { stroke: var(--c-input); }
svg.ov .trace.output  { stroke: var(--c-output); stroke-width: 2.4; }
svg.ov .trace.output2 { stroke: var(--c-output2); stroke-width: 2.2; }
svg.ov .trace.thresh  { stroke: var(--c-thresh); stroke-dasharray: 5 4; stroke-width: 1.4; }
svg.ov .trace.amber   { stroke: var(--c-amber); stroke-width: 2.2; }

footer {
    padding: 60px 56px 80px; text-align: center;
    color: var(--muted); font-size: 13px;
    border-top: 1px solid var(--border);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.08em; text-transform: uppercase;
}

@media (max-width: 900px) {
    section.scene { grid-template-columns: 1fr; padding: 80px 24px 60px; }
    h1.hero { font-size: 42px; }
    h2 { font-size: 26px; }
    .brand { top: 16px; left: 16px; }
}

/* ══════════════════════════════════════════════════════════
   Slide-deck layout. Mirrors the structure used on
   active_peak_detector.html and case_study.html so this
   page can be navigated as a deck rather than scrolled. The
   colour palette and the existing .plot-stack / .toolbar /
   .readout rules above are reused; only the deck shell,
   slide transitions and deck navigation are defined here.
   ══════════════════════════════════════════════════════════ */
html, body { overflow: hidden; height: 100vh; min-height: 0; }

.deck {
    position: fixed; inset: 0;
    width: 100vw; height: 100vh;
    overflow: hidden;
}

.slide {
    position: absolute; inset: 0;
    padding: 78px 56px 90px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateX(40px);
    transition: opacity 0.32s ease, transform 0.32s ease, visibility 0s linear 0.32s;
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.5fr);
    gap: 32px;
    align-items: start;
    max-width: 1500px; margin: 0 auto;
}
.slide::-webkit-scrollbar { display: none; }
.slide.full { grid-template-columns: 1fr; }
.slide.active {
    opacity: 1; visibility: visible; transform: translateX(0);
    transition: opacity 0.32s ease, transform 0.32s ease, visibility 0s linear 0s;
}
.slide.prev { transform: translateX(-40px); }

.slide .copy { max-width: 600px; }

h1.slide-hero {
    font-size: 46px; line-height: 1.08;
    font-weight: 600; letter-spacing: -0.02em;
    margin: 0 0 22px;
}
h1.slide-hero em {
    font-style: normal;
    background: linear-gradient(135deg, var(--c-input), var(--c-output));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

.slide.title-slide { grid-template-columns: 1fr; place-items: center; text-align: center; }
.slide.title-slide .copy { max-width: 760px; }
.slide.title-slide h1.slide-hero { font-size: 60px; }
.slide.title-slide .meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px; color: var(--muted);
    letter-spacing: 0.2em; text-transform: uppercase;
    margin-bottom: 26px;
}
.slide.title-slide .tags {
    margin-top: 32px; display: flex; gap: 10px;
    justify-content: center; flex-wrap: wrap;
}

.brief-box {
    margin: 28px auto 8px;
    max-width: 720px;
    padding: 22px 26px 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-panel);
    text-align: left;
    box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset;
}
.brief-box .brief-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: var(--accent);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.brief-box .brief-body {
    font-size: 15.5px;
    color: var(--fg);
    line-height: 1.65;
    margin: 0;
}

.nav-hint {
    position: fixed;
    bottom: 78px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--muted);
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.2s;
}
.nav-hint.hidden { opacity: 0; visibility: hidden; }

.deck-nav {
    position: fixed; bottom: 18px; left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex; align-items: center; gap: 14px;
    padding: 8px 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 999px;
    backdrop-filter: blur(10px);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}
.deck-nav .arrow {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--pill-bg);
    color: var(--text-dim);
    display: grid; place-items: center;
    cursor: pointer;
    transition: all 0.12s;
    user-select: none;
}
.deck-nav .arrow:hover:not(.disabled) { color: var(--accent); border-color: var(--accent); }
.deck-nav .arrow.disabled { opacity: 0.3; cursor: not-allowed; }
.deck-nav .dots { display: flex; gap: 8px; }
.deck-nav .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--border);
    cursor: pointer;
    transition: all 0.12s;
}
.deck-nav .dot:hover { background: var(--border-hover); }
.deck-nav .dot.active {
    background: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.deck-nav .counter {
    color: var(--muted);
    letter-spacing: 0.08em;
    min-width: 48px;
    text-align: center;
}
.deck-nav .counter b { color: var(--fg); }

.plot-stack { padding-top: 36px; }

@media (max-width: 1000px) {
    .slide { grid-template-columns: 1fr; padding: 70px 24px 100px; }
    .slide.title-slide h1.slide-hero { font-size: 40px; }
    h1.slide-hero { font-size: 32px; }
}
