/*
  csp-demos.css — shared design system for the interactive demo portfolio.
  Used by all five demos + the process piece. Edit here, not per-page.

  Typography: IBM Plex Sans (UI/body) + IBM Plex Mono (figures, data, code),
  matching christopherspenn.com. Chart colors follow the Trust Insights
  dataviz skill's validated default palette verbatim (categorical order,
  sequential ramp, diverging pair, status colors) — these are pre-validated
  for CVD-safety and contrast, so chart marks reference --series-*, --good,
  --warning, --serious, --critical directly rather than brand hex.

  Brand chrome (nav, buttons, page bands, headings) uses the site's navy/cyan
  identity, which happens to sit near categorical slot 1 (blue), so the two
  systems read as one family rather than two competing palettes.
*/

:root {
  color-scheme: light;

  /* ---- Brand chrome (site identity) ---- */
  --ink:            #0F1A2E;
  --ink-soft:       #2b3a52;
  --accent:         #3EC1DB;
  --accent-strong:  #1D8FA8;
  --page:           #FFFFFF;
  --band:           #F4F7FA;
  --border:         rgba(15, 26, 46, 0.12);

  /* ---- Chart chrome & ink (dataviz skill, light) ---- */
  --chart-surface:  #fcfcfb;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --baseline:       #c3c2b7;
  --success-text:   #006300;

  /* ---- Categorical series (fixed order — never cycle, never reassign) ---- */
  --series-1: #2a78d6; /* blue    */
  --series-2: #eb6834; /* orange  */
  --series-3: #1baf7a; /* aqua    */
  --series-4: #eda100; /* yellow  */
  --series-5: #e87ba4; /* magenta */
  --series-6: #008300; /* green   */
  --series-7: #4a3aa7; /* violet  */
  --series-8: #e34948; /* red     */

  /* ---- Sequential (blue ramp) ---- */
  --seq-100: #cde2fb; --seq-150: #b7d3f6; --seq-200: #9ec5f4; --seq-250: #86b6ef;
  --seq-300: #6da7ec; --seq-350: #5598e7; --seq-400: #3987e5; --seq-450: #2a78d6;
  --seq-500: #256abf; --seq-550: #1c5cab; --seq-600: #184f95; --seq-650: #104281;
  --seq-700: #0d366b;

  /* ---- Diverging (blue <-> red), neutral midpoint ---- */
  --div-neutral: #f0efec;

  /* ---- Status (fixed — never themed, never reused as series) ---- */
  --good:     #0ca30c;
  --warning:  #fab219;
  --serious:  #ec835a;
  --critical: #d03b3b;

  --radius: 10px;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --ink:            #EAF1F8;
    --ink-soft:       #C7D3E3;
    --accent:         #3EC1DB;
    --accent-strong:  #7BE0F2;
    --page:           #0B1220;
    --band:           #101A2C;
    --border:         rgba(234, 241, 248, 0.14);

    --chart-surface:  #1a1a19;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #9a9890;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --success-text:   #0ca30c;

    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;

    --div-neutral: #383835;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink:            #EAF1F8;
  --ink-soft:       #C7D3E3;
  --accent:         #3EC1DB;
  --accent-strong:  #7BE0F2;
  --page:           #0B1220;
  --band:           #101A2C;
  --border:         rgba(234, 241, 248, 0.14);

  --chart-surface:  #1a1a19;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #9a9890;
  --gridline:       #2c2c2a;
  --baseline:       #383835;
  --success-text:   #0ca30c;

  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;

  --div-neutral: #383835;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* page never scrolls horizontally; charts scroll internally */
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.wrap--narrow { max-width: 760px; }

/* ---- Nav ---- */
.demo-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.demo-nav__brand { font-weight: 700; font-size: 0.95rem; }
.demo-nav__brand a { color: var(--ink); text-decoration: none; }
.demo-nav__links { display: flex; gap: 20px; align-items: center; font-size: 0.9rem; }
.demo-nav__links a { color: var(--ink-soft); text-decoration: none; }
.demo-nav__links a:hover { color: var(--accent-strong); }
.theme-toggle {
  border: 1px solid var(--border); background: transparent; color: var(--ink);
  border-radius: 999px; width: 34px; height: 34px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.theme-toggle:hover { border-color: var(--accent); }

/* ---- Hero / headings ---- */
.eyebrow {
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 0.75rem; color: var(--accent-strong); font-weight: 600;
}
h1 { font-size: clamp(1.9rem, 3.2vw, 2.9rem); line-height: 1.12; margin: 0.4em 0 0.3em; }
h2 { font-size: clamp(1.4rem, 2.2vw, 1.9rem); margin: 2.2em 0 0.6em; }
h3 { font-size: 1.15rem; margin: 1.6em 0 0.5em; }
p.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 62ch; }
.section { padding: 48px 0; }
.section--band { background: var(--band); }

/* ---- Buttons / controls ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-sans); font-weight: 600; font-size: 0.92rem;
  padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  background: var(--ink); color: var(--page); cursor: pointer; text-decoration: none;
}
.btn--ghost { background: transparent; border-color: var(--border); color: var(--ink); }

/* ---- Sliders ---- */
.control { margin-bottom: 20px; }
.control__label {
  display: flex; justify-content: space-between; font-size: 0.9rem;
  margin-bottom: 6px; color: var(--ink-soft);
}
.control__value { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
input[type="range"] {
  width: 100%; accent-color: var(--accent-strong); height: 4px;
}

/* ---- Stat tiles ---- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat-tile {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
  background: var(--page);
}
.stat-tile__value { font-family: var(--font-mono); font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-tile__label { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }
.stat-tile__delta--good { color: var(--success-text); }
.stat-tile__delta--critical { color: var(--critical); }

/* ---- Chart container: internal scroll, never the page ---- */
.chart-scroll { overflow-x: auto; }
.chart-scroll > svg, .chart-scroll > .chart-inner { min-width: 480px; }
svg text { font-family: var(--font-sans); fill: var(--text-secondary); }
.viz-root { color-scheme: light; }

/* ---- Legend ---- */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.85rem; color: var(--text-secondary); margin-top: 8px; }
.legend__item { display: flex; align-items: center; gap: 6px; }
.legend__swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---- Disclosure component (Demo 2 / 4 hover-to-reveal) ---- */
.disclosable {
  border-bottom: 1px dashed var(--accent-strong); cursor: help; position: relative;
}
.disclosure-pop {
  display: none; position: absolute; z-index: 20; left: 0; top: 100%; margin-top: 8px;
  width: min(340px, 80vw); background: var(--page); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; font-size: 0.82rem; color: var(--text-secondary);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.disclosable:hover .disclosure-pop,
.disclosable:focus .disclosure-pop,
.disclosable.is-open .disclosure-pop { display: block; }
.disclosure-pop__label { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; color: var(--accent-strong); display: block; margin-bottom: 4px; }

/* ---- Standing disclaimer band ---- */
.standing-note {
  font-size: 0.82rem; color: var(--text-muted); border-top: 1px solid var(--border);
  padding: 20px 0; margin-top: 40px;
}
.standing-note strong { color: var(--text-secondary); }

/* ---- AI-visibility closing note ---- */
.ai-note {
  border-left: 3px solid var(--accent-strong); padding: 10px 16px; margin: 24px 0;
  background: var(--band); border-radius: 0 8px 8px 0; font-size: 0.92rem;
}
.ai-note a { color: var(--accent-strong); }

/* ---- Table view (accessibility companion to every chart) ---- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
table.data-table th, table.data-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--gridline); }
table.data-table th { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; }
details.table-toggle summary { cursor: pointer; color: var(--accent-strong); font-size: 0.85rem; margin: 10px 0; }

footer.demo-footer { padding: 32px 0 60px; font-size: 0.82rem; color: var(--text-muted); }

@media (max-width: 640px) {
  .demo-nav__links { display: none; }
  .wrap { padding: 0 16px; }
}
