/* =============================================================
   Section Nine — Colors & Type
   The shared spine. Products inherit from here and override only
   their signal colour + surface registers.
   ============================================================= */

/* ---------- Webfonts ---------- */
/* System: Outfit — self-hosted variable font (brand-supplied).
   Content: Literata — Google Fonts CDN (no self-hosted file yet).
   Code:    DM Mono  — Google Fonts CDN (no self-hosted file yet). */

@font-face {
  font-family: 'Outfit';
  src: url('fonts/Outfit-VariableFont_wght.ttf') format('truetype-variations'),
       url('fonts/Outfit-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@import url('https://fonts.googleapis.com/css2?family=Literata:ital,opsz,wght@0,7..72,400;0,7..72,500;0,7..72,700;1,7..72,400&family=DM+Mono:ital,wght@0,300;0,400;0,500;1,400&display=swap');

:root {
  /* =========================================================
     COLOR — warm neutrals
     The spine. Every product draws from this ladder.
     ========================================================= */

  /* Parchment family — light surfaces */
  --parchment-50:  #FAF6EF;  /* lightest page */
  --parchment-100: #F4EEE1;  /* page default */
  --parchment-200: #ECE3D0;  /* subtle panel */
  --parchment-300: #DDD0B5;  /* stripes, dividers on warm */
  --parchment-400: #C4B393;  /* muted text on parchment */

  /* Umber family — mid-warm, ink tones */
  --umber-500: #8A6E44;      /* accent ink */
  --umber-600: #6E5636;      /* strong ink */
  --umber-700: #4E3D26;      /* heading ink on parchment */

  /* Graphite family — warm dark neutrals */
  --graphite-100: #E9E4DA;
  --graphite-200: #C9C2B3;
  --graphite-300: #9A9082;
  --graphite-400: #6B6359;
  --graphite-500: #4A443C;   /* body text, corporate */
  --graphite-600: #332F29;
  --graphite-700: #222019;
  --graphite-800: #1A1813;
  --graphite-900: #14110E;   /* ink — darkest value in system */

  /* =========================================================
     COLOR — semantic foreground / background (light mode default)
     ========================================================= */
  --fg-1: var(--graphite-900);   /* primary text */
  --fg-2: var(--graphite-500);   /* secondary text, meta */
  --fg-3: var(--graphite-300);   /* tertiary, disabled */
  --fg-on-dark: var(--parchment-50);

  --bg-1: var(--parchment-50);   /* page */
  --bg-2: var(--parchment-100);  /* card / panel */
  --bg-3: var(--parchment-200);  /* sunken / stripe */

  --border-1: var(--parchment-300);  /* hairlines */
  --border-2: var(--graphite-200);   /* stronger */

  /* =========================================================
     COLOR — product signal colours
     Each product owns one. Never mix product signals.
     ========================================================= */
  --signal-gapanalyzer: #4A6A7A;   /* steel — compliance */
  --signal-manifest:    #8A6E44;   /* umber — publishing */
  --signal-genkaku:     #8E7AB5;   /* muted purple — LLM */
  --signal-section9:    #4A443C;   /* graphite — corporate */

  /* Steel scale — GapAnalyzer signal family
     Tint for selected rows, hover surfaces, subtle data-dense backgrounds.
     Note: --info also uses steel #5B7A95 — they are intentionally adjacent
     but not identical. Use --steel-* when the surface belongs to the
     GapAnalyzer product signal; use --info* when the meaning is semantic. */
  --steel-50:  #EAF0F4;   /* selected row, subtle background */
  --steel-200: #C7D4DC;   /* border on steel surfaces */
  --steel-400: #7A94A3;   /* hover, muted accent */
  --steel-600: #4A6A7A;   /* primary signal — same as --signal-gapanalyzer */
  --steel-800: #3A5566;   /* pressed, dark accent */

  /* =========================================================
     COLOR — status (four semantic families)
     Applied identically across products.
     ========================================================= */
  --info:       #5B7A95;  /* steel blue */
  --info-bg:    #E5ECF2;
  --info-ink:   #2E4558;

  --warning:    #C48327;  /* warm amber */
  --warning-bg: #F7EBD3;
  --warning-ink:#6E4814;

  --error:      #B2574B;  /* muted red */
  --error-bg:   #F3DFD9;
  --error-ink:  #6E2E25;

  --success:    #4E6B4A;  /* forest green */
  --success-bg: #E0E9DC;
  --success-ink:#2E4229;

  /* =========================================================
     TYPE — family stacks
     ========================================================= */
  --font-system:  "Outfit", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-content: "Literata", Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --font-mono:    "DM Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* =========================================================
     TYPE — scale (system / Outfit)
     ========================================================= */
  --fs-meta:   10px;   /* 10–11px meta, nav, labels */
  --fs-meta-2: 11px;
  --fs-caption:12px;
  --fs-small:  13px;
  --fs-body:   15px;
  --fs-lede:   18px;
  --fs-h4:     20px;
  --fs-h3:     24px;
  --fs-h2:     32px;
  --fs-h1:     44px;
  --fs-display:64px;

  /* Tracking: headings negative, meta positive */
  --track-display: -0.025em;
  --track-h1:      -0.02em;
  --track-h2:      -0.015em;
  --track-h3:      -0.01em;
  --track-body:     0;
  --track-meta:     0.04em;    /* 0.3–0.5px @ 10–11px ≈ 0.04em */

  /* Line heights */
  --lh-display: 1.02;
  --lh-heading: 1.12;
  --lh-body:    1.5;
  --lh-prose:   1.65;    /* Literata body */
  --lh-tight:   1.25;

  /* =========================================================
     SPACING — 4px base, doubled scale
     ========================================================= */
  --sp-0:  0;
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  24px;
  --sp-6:  32px;
  --sp-7:  48px;
  --sp-8:  64px;
  --sp-9:  96px;
  --sp-10: 128px;

  /* =========================================================
     RADII — three tiers only
     4px subtle, 8px cards, 12px pills
     ========================================================= */
  --radius-sm: 4px;   /* inputs, subtle chrome */
  --radius-md: 8px;   /* cards, panels, buttons */
  --radius-pill: 12px;/* pills, badges, tags */
  --radius-full: 999px;

  /* =========================================================
     ELEVATION — restrained, warm
     No blue-tinted shadows. All warm-black based.
     ========================================================= */
  --shadow-1: 0 1px 2px rgba(20, 17, 14, 0.06);
  --shadow-2: 0 2px 8px rgba(20, 17, 14, 0.08), 0 1px 2px rgba(20, 17, 14, 0.06);
  --shadow-3: 0 8px 24px rgba(20, 17, 14, 0.10), 0 2px 6px rgba(20, 17, 14, 0.06);
  --shadow-inset: inset 0 1px 0 rgba(20, 17, 14, 0.04);

  /* =========================================================
     MOTION
     Short, quiet, no bounces. Hover = 120ms. Press = 80ms.
     ========================================================= */
  --ease-out: cubic-bezier(0.2, 0.6, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-hover: 120ms;
  --dur-press: 80ms;
  --dur-enter: 200ms;
}

/* ===============================================================
   Product dark overrides
   GapAnalyzer & Genkaku run a dark register by default.
   Apply via  <html data-theme="gapanalyzer">  etc.
   =============================================================== */
[data-theme="gapanalyzer"] {
  --fg-1: #F4EEE1;
  --fg-2: #C4B393;
  --fg-3: #6B6359;
  --bg-1: #1A1813;           /* dark industrial */
  --bg-2: #222019;
  --bg-3: #2A2721;
  --border-1: #332F29;
  --border-2: #4A443C;
}

[data-theme="genkaku"] {
  --fg-1: #ECE3D0;
  --fg-2: #A89BB8;
  --fg-3: #6B6359;
  --bg-1: #161319;           /* deep dark */
  --bg-2: #1E1A23;
  --bg-3: #26222E;
  --border-1: #332E3A;
  --border-2: #463F51;
}

[data-theme="manifest"] {
  --bg-1: #FAF6EF;           /* warm parchment, reading */
  --bg-2: #F4EEE1;
  --bg-3: #ECE3D0;
  --fg-1: #14110E;
  --fg-2: #6E5636;
}

/* ===============================================================
   Semantic element styles
   Use classes, not type selectors, so products can opt in.
   =============================================================== */

.s9-display {
  font-family: var(--font-system);
  font-weight: 700;
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--track-display);
  color: var(--fg-1);
}
.s9-h1 {
  font-family: var(--font-system);
  font-weight: 700;
  font-size: var(--fs-h1);
  line-height: var(--lh-heading);
  letter-spacing: var(--track-h1);
  color: var(--fg-1);
}
.s9-h2 {
  font-family: var(--font-system);
  font-weight: 700;
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  letter-spacing: var(--track-h2);
  color: var(--fg-1);
}
.s9-h3 {
  font-family: var(--font-system);
  font-weight: 600;
  font-size: var(--fs-h3);
  line-height: var(--lh-heading);
  letter-spacing: var(--track-h3);
  color: var(--fg-1);
}
.s9-h4 {
  font-family: var(--font-system);
  font-weight: 600;
  font-size: var(--fs-h4);
  line-height: var(--lh-tight);
  color: var(--fg-1);
}
.s9-lede {
  font-family: var(--font-system);
  font-weight: 400;
  font-size: var(--fs-lede);
  line-height: 1.4;
  color: var(--fg-2);
}
.s9-body {
  font-family: var(--font-system);
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--fg-1);
}
.s9-prose {
  font-family: var(--font-content);
  font-weight: 400;
  font-size: 18px;
  line-height: var(--lh-prose);
  color: var(--fg-1);
}
.s9-small {
  font-family: var(--font-system);
  font-size: var(--fs-small);
  line-height: 1.45;
  color: var(--fg-2);
}
.s9-meta {
  font-family: var(--font-system);
  font-weight: 500;
  font-size: var(--fs-meta);
  line-height: 1.2;
  letter-spacing: var(--track-meta);
  text-transform: uppercase;
  color: var(--fg-2);
}
.s9-meta-2 {
  font-family: var(--font-system);
  font-weight: 500;
  font-size: var(--fs-meta-2);
  line-height: 1.2;
  letter-spacing: var(--track-meta);
  text-transform: uppercase;
  color: var(--fg-2);
}
.s9-code,
code, pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}

/* Code blocks ALWAYS run on dark, regardless of page theme */
pre.s9-code-block,
.s9-code-block {
  background: var(--graphite-900);
  color: var(--parchment-100);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  overflow: auto;
}
