@charset "UTF-8";
/* Design tokens: the light theme in :root, the dark theme in :root[data-theme="dark"] (docs/dark-theme-design.md),
   screen only, so print always uses the light values. data-theme is set before first paint by /js/boot-lang.js.
   No other stylesheet or script holds a colour literal (tools/check-static.js); the dark block holds only custom
   properties and color-scheme. Light theme: docs/ui-spec.md §3.6. Curve colours are Okabe–Ito based,
   darkened to >= 3:1 contrast on white. Group colours: text (fg) and muted text on the tinted
   background are >= 4.5:1 (asserted by tests/style/contrast.test.js). Canvas code reads these
   variables via getComputedStyle so there is a single source of truth. */
:root {
  color-scheme: light;

  --c-bg: #ffffff;
  --c-panel: #f7f8fa;
  --c-panel-strong: #eef1f4;
  --c-text: #1f2328;
  --c-text-muted: #555a60;
  --c-text-soft: #374151; /* secondary text (dialog changelog) */
  --c-border: #d0d7de;
  --c-border-strong: #aeb7c0;
  --c-grid: #d0d7de;
  --c-link: #0072b2;
  --c-focus: #0072b2;
  --c-highlight: #f0e442;
  --c-search-mark: #fff1a8; /* search hits in the result list (ui/search.js): --c-text and --c-text-muted on it >= 4.5:1 */
  --c-search-mark-fg: #1f2328;

  /* Page look: a faint grid with three soft light-green / gold glows behind the page (the icon is light green), a
     black-gold site name, a blue–violet brand gradient for accents and a translucent header. Decorative layers only — no text relies on them: the
     brand colours are >= 4.98:1 on white and on the glow tint, the grid ink is 4.5 %, figures and formulas sit
     on plain --c-bg. */
  --c-brand: #4a48d6; /* solid fallback of the brand gradient (6.6:1 on white) */
  --c-brand-from: #2f5bd3;
  --c-brand-to: #7a3ce0;
  /* site name "ADC Study" (header and home title): black to gold; every stop >= 4.5:1 on white and on the glows */
  --c-name: #2b2620;
  --c-name-from: #15171b;
  --c-name-mid: #3b3020;
  --c-name-to: #94690c;
  /* the light green of the site icon (img/logo.svg), used for the header logo outline glow and circuit fills */
  --c-icon-green: #d9f99d;
  --c-icon-green-edge: #4d7c0f;
  --c-page-grid: rgb(31 35 40 / 0.045);
  --c-glow-1: rgb(150 214 40 / 0.16);
  --c-glow-2: rgb(214 168 50 / 0.11);
  --c-glow-3: rgb(90 190 110 / 0.07);
  --c-header-glass: rgb(255 255 255 / 0.78);
  --grid-step: 28px;
  /* white sheen over cards, the jump links and the current table-of-contents entry; the colour the group outlines
     are mixed towards; shadows of menus, popovers, dialogs and cards; the label strip of the oscilloscope (canvas) */
  --c-sheen: rgb(255 255 255 / 0.7);
  --c-sheen-soft: rgb(255 255 255 / 0.6);
  --c-sheen-clear: rgb(255 255 255 / 0);
  --c-edge-base: #ffffff;
  --c-shadow-xs: rgb(31 35 40 / 0.04);
  --c-shadow-sm: rgb(31 35 40 / 0.08);
  --c-shadow-md: rgb(31 35 40 / 0.12);
  --c-shadow-lg: rgb(31 35 40 / 0.16);
  --c-shadow-xl: rgb(31 35 40 / 0.18);
  --c-label-glass: rgb(255 255 255 / 0.88);
  --c-label-glass-strong: rgb(255 255 255 / 0.9);

  /* Neutral "coming soon" badge and header controls */
  --c-badge-bg: #eef1f4;
  --c-badge-fg: #555a60;
  --c-pill-bg: #f7f8fa;
  --c-pill-bg-hover: #e4e8ec;
  --c-pill-border: #c9d1d9;
  --c-backdrop: rgb(31 35 40 / 0.4);
  /* Hint boxes (ui/hint.js): text uses --c-text (≥ 4.5:1 on both backgrounds), icons ≥ 3:1. */
  --c-hint-action-bg: #e8f2fb;
  --c-hint-action-border: #b7d4ec;
  --c-hint-action-icon: #0b5c8f;
  --c-hint-tip-bg: #fdf5d4;
  --c-hint-tip-border: #e6d27f;
  --c-hint-tip-icon: #7a5600;
  /* parameter error boxes (bench, lab); quiz answers; the failure region of the CDR jitter-tolerance plot */
  --c-error-bg: #fdecea;
  --c-error-border: #e3a59c;
  --c-error-border-soft: #e3b4ae;
  --c-ok-bg: #e7f4ef;
  --c-ok-text: #00664c;
  --c-wrong-bg: #fbece4;
  --c-wrong-text: #a8430a;
  /* form fields: the browser's own light values, written out so that the dark theme can replace them */
  --c-field-bg: #ffffff;
  --c-placeholder: #757575;

  /* Chapter groups: tinted background, same-hue title text, left accent bar */
  --grp-foundation-bg: #e6f4ee; /* green (the colour of the site icon): getting started (what an ADC does, sampling, quantization) */
  --grp-foundation-fg: #00573f;
  --grp-foundation-accent: #00785a;
  --grp-arch-bg: #f5eaf2; /* purple: ADC architectures (flash, SAR, pipeline, time-interleaved, delta-sigma) */
  --grp-arch-fg: #7e2f69;
  --grp-arch-accent: #aa4499;
  --grp-highspeed-bg: #fcefe1; /* orange: high-speed systems (ADC-based SerDes receivers) */
  --grp-highspeed-fg: #7f4300;
  --grp-highspeed-accent: #c26a00;
  --grp-metrics-bg: #eaf2fb; /* blue: performance metrics (FFT testing, linearity, sampling noise and jitter) */
  --grp-metrics-fg: #0b4f82;
  --grp-metrics-accent: #0072b2;
  --grp-practice-bg: #e9f0f1; /* grey-teal: quiz, glossary */
  --grp-practice-fg: #36575e;
  --grp-practice-accent: #5a7f87;
  --grp-circuit-bg: #f1f1e0; /* olive (Tol muted "olive"): key circuits (comparator, track-and-hold, DAC) */
  --grp-circuit-fg: #4d4d12;
  --grp-circuit-accent: #77771c;

  /* Circuit diagrams drawn with Analog Circuit Canvas (css/plots.css .circuit, tools/export-circuits.js): the
     canvas palette's light fills and strong strokes; the dark theme uses deep fills and brighter strokes. */
  --c-cc-fill-green: #d9f99d;
  --c-cc-fill-blue: #bfdbfe;
  --c-cc-fill-amber: #fde68a;
  --c-cc-fill-pink: #fbcfe8;
  --c-cc-fill-grey: #e5e7eb;
  --c-cc-fill-violet: #e9d5ff;
  --c-cc-fill-teal: #99f6e4;
  --c-cc-red: #dc2626;
  --c-cc-blue: #2563eb;
  --c-cc-green: #15803d;
  --c-cc-violet: #9333ea;
  --c-cc-amber: #b45309;
  --c-cc-grey: #6b7280;
  /* Signal curves */
  --c-ref: #0072b2;
  --c-fb: #b36b00;
  --c-up: #00785a;
  --c-dn: #d55e00;
  --c-icp: #5f6368;
  --c-vctrl: #aa4499;
  --c-theta: #1f2328;
  --c-df: #2b83ba;
  /* loop-filter elements (1A-4b): C1 voltage / R–C1 current, R voltage, C2 current */
  --c-v1: #1b7f79;
  --c-vr: #8c564b;
  --c-ic2: #6a51a3;
  /* radical sign of display formulas (css/plots.css .formula .rad): its stroke is --c-text of the theme */
  /* opacities that differ between the themes (fills over the plot background) */
  --o-band: 0.08; /* log plots: shaded band (integration band, time difference) */
  --img-rad: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 100' preserveAspectRatio='none'%3E%3Cpath d='M2 58 L14 50 L28 96 L59 1' fill='none' stroke='%231f2328' stroke-width='1.25' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");

  /* Font stacks: kept verbatim from the author's shared font definition so the author's sites
     render alike. Latin fonts first (Latin letters and digits use them; CJK fonts' Latin glyphs look
     worse), then the language's CJK fonts, then sans-serif. Japanese puts Meiryo UI first (Windows);
     Macs have no Meiryo and fall through to Hiragino Sans. System fonts only: no font files, no
     external requests. tests/fixtures/font-stacks.js holds the same strings (unit + browser tests). */
  --font-en: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-zh-hans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, "Helvetica Neue", Arial, "PingFang SC", "微软雅黑", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-zh-hant: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, "Helvetica Neue", Arial, "PingFang TC", "微軟正黑體", "Microsoft JhengHei", "Noto Sans CJK TC", sans-serif;
  --font-ja: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, "Helvetica Neue", Arial, "Meiryo UI", "メイリオ", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Noto Sans CJK JP", sans-serif;
  /* Diagrams drawn with Analog Circuit Canvas: Calibri, as in the canvas's own font menu (Carlito is its metric twin;
     Macs without Office fall back to Arial). */
  --font-diagram: Calibri, Carlito, Arial, "Helvetica Neue", Helvetica, sans-serif;
  /* Monospace: the matching shared stack. */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Compact scale */
  --fs-base: 15px;
  --lh-base: 1.5;
  --lh-cjk: 1.65;
  --space-1: 3px;
  --space-2: 6px;
  --space-3: 9px;
  --space-4: 12px;
  --space-5: 18px;
  --space-6: 24px;
  --space-7: 36px;

  --radius: 6px;
  --header-h: 44px;
  --control-h: 32px;
  --pill-h: 28px;
  --gutter: 16px;
  --maxw-page: 1200px;
  --maxw-text: 1100px; /* paragraphs follow the text column but never exceed ~1100 px */
  --page-pad-wide: 18px; /* desktop chapter pages: side padding (sidebar sits at the left edge) */
  --transition: 0.15s ease;
}

/* Dark theme (docs/dark-theme-design.md §2.3; contrast: tests/style/contrast.test.js). Screen only: print keeps the
   light values above. Same names and order as :root; nothing but custom properties and color-scheme. */
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;

    --c-bg: #12161c;
    --c-panel: #1a2028;
    --c-panel-strong: #242c36;
    --c-text: #e6e9ed;
    --c-text-muted: #a8b1bc;
    --c-text-soft: #c5ccd4;
    --c-border: #343d49;
    --c-border-strong: #697685;
    --c-grid: #343d49;
    --c-link: #6cb8f0;
    --c-focus: #6cb8f0;
    --c-highlight: #f0e442;
    --c-search-mark: #5b4d00;
    --c-search-mark-fg: #fff6c2;
    --c-brand: #a5a2ff;
    --c-brand-from: #82a8ff;
    --c-brand-to: #c49aff;
    --c-name: #ead9a8;
    --c-name-from: #f4efe2;
    --c-name-mid: #e9d6a3;
    --c-name-to: #d9a940;
    --c-icon-green: #3d5a1a;
    --c-icon-green-edge: #a3d65c;
    --c-page-grid: rgb(230 233 237 / 0.045);
    --c-glow-1: rgb(150 220 60 / 0.10);
    --c-glow-2: rgb(222 178 72 / 0.09);
    --c-glow-3: rgb(100 190 120 / 0.06);
    --c-header-glass: rgb(18 22 28 / 0.78);
    --c-sheen: rgb(255 255 255 / 0.05);
    --c-sheen-soft: rgb(255 255 255 / 0.04);
    --c-sheen-clear: rgb(255 255 255 / 0);
    --c-edge-base: #12161c;
    --c-shadow-xs: rgb(0 0 0 / 0.3);
    --c-shadow-sm: rgb(0 0 0 / 0.4);
    --c-shadow-md: rgb(0 0 0 / 0.45);
    --c-shadow-lg: rgb(0 0 0 / 0.5);
    --c-shadow-xl: rgb(0 0 0 / 0.55);
    --c-label-glass: rgb(18 22 28 / 0.88);
    --c-label-glass-strong: rgb(18 22 28 / 0.9);
    --c-badge-bg: #242c36;
    --c-badge-fg: #a8b1bc;
    --c-pill-bg: #1a2028;
    --c-pill-bg-hover: #2b3440;
    --c-pill-border: #434e5c;
    --c-backdrop: rgb(0 0 0 / 0.6);
    --c-hint-action-bg: #132a3d;
    --c-hint-action-border: #2a5578;
    --c-hint-action-icon: #7cc4f5;
    --c-hint-tip-bg: #2e2810;
    --c-hint-tip-border: #6b5a1e;
    --c-hint-tip-icon: #e8c35a;
    --c-error-bg: #3a1c1a;
    --c-error-border: #8a4038;
    --c-error-border-soft: #8a4038;
    --c-ok-bg: #12322a;
    --c-ok-text: #5ed3ac;
    --c-wrong-bg: #38231a;
    --c-wrong-text: #ff9d66;
    --c-field-bg: #12161c;
    --c-placeholder: #8e98a4;
    --grp-foundation-bg: #122f28;
    --grp-foundation-fg: #9fdcc4;
    --grp-foundation-accent: #35b58d;
    --grp-arch-bg: #301c2c;
    --grp-arch-fg: #ecb4dd;
    --grp-arch-accent: #d27ac0;
    --grp-highspeed-bg: #33240f;
    --grp-highspeed-fg: #f5c48c;
    --grp-highspeed-accent: #e2902f;
    --grp-metrics-bg: #14283a;
    --grp-metrics-fg: #a8d4f5;
    --grp-metrics-accent: #4aa3df;
    --grp-practice-bg: #1a2c31;
    --grp-practice-fg: #b2d4da;
    --grp-practice-accent: #75a3ac;
    --grp-circuit-bg: #2a2a12;
    --grp-circuit-fg: #dada92;
    --grp-circuit-accent: #a9a93a;
    --c-cc-fill-green: #2f4416;
    --c-cc-fill-blue: #1e3352;
    --c-cc-fill-amber: #43360f;
    --c-cc-fill-pink: #4a2038;
    --c-cc-fill-grey: #2b3440;
    --c-cc-fill-violet: #35224d;
    --c-cc-fill-teal: #123f3a;
    --c-cc-red: #ff7b72;
    --c-cc-blue: #79a8ff;
    --c-cc-green: #6ad38a;
    --c-cc-violet: #c99bff;
    --c-cc-amber: #f0b45a;
    --c-cc-grey: #a8b1bc;
    --c-ref: #56b4e9;
    --c-fb: #e69f00;
    --c-up: #39cea0;
    --c-dn: #ef6134;
    --c-icp: #a3abb5;
    --c-vctrl: #e285cc;
    --c-theta: #e6e9ed;
    --c-df: #8fdcf0;
    --c-v1: #45c4bb;
    --c-vr: #af7f72;
    --c-ic2: #a993e6;
    --o-band: 0.14;
    --img-rad: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 100' preserveAspectRatio='none'%3E%3Cpath d='M2 58 L14 50 L28 96 L59 1' fill='none' stroke='%23e6e9ed' stroke-width='1.25' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  }
}
