/* =====================================================================
   ctrlINT design tokens — "Field Notebook"
   Desk (calm, default)  ·  Loupe (internal name of the cockpit, [data-mode="cockpit"]; never shown in the UI)
   Light is :root. Dark is [data-theme="dark"] and prefers-color-scheme
   (unless the user forced [data-theme="light"]).
   Components read ONLY these tokens; they never hardcode a colour.
   Contrast ratios for key pairs: docs/design/design-language.md §5.
   ===================================================================== */

/* ---------- Fonts (self-hosted, SIL OFL 1.1, latin + cyrillic) ---------- */
@font-face { font-family: "Literata"; src: url("fonts/literata-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Literata"; src: url("fonts/literata-cyrillic-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Literata"; src: url("fonts/literata-latin-wght-italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Literata"; src: url("fonts/literata-cyrillic-wght-italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-cyrillic-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-cyrillic-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-cyrillic-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 800; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-cyrillic-wght-normal.woff2") format("woff2"); font-weight: 100 800; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

/* ============================ LIGHT (Paper) ============================ */
:root {
  color-scheme: light;

  /* --- Type families --- */
  --font-read: "Literata", "Iowan Old Style", Georgia, serif;          /* the notebook voice: titles, summaries, notes */
  --font-ui:   "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; /* chrome, labels, buttons */
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace; /* IOCs, ids, counts in the Loupe */

  /* --- Type scale (desk) --- */
  --fs-11: 0.6875rem; --fs-12: 0.75rem; --fs-13: 0.8125rem; --fs-14: 0.875rem;
  --fs-15: 0.9375rem; --fs-17: 1.0625rem; --fs-20: 1.25rem; --fs-24: 1.5rem;
  --fs-30: 1.875rem; --fs-38: 2.375rem;
  --fs-body: var(--fs-15);
  --lh-tight: 1.2; --lh-snug: 1.35; --lh-body: 1.55;
  --fw-regular: 400; --fw-medium: 500; --fw-semi: 600;
  --tracking-caps: 0.06em;

  /* --- Space (4-pt) --- */
  --sp-1: 2px; --sp-2: 4px; --sp-3: 8px; --sp-4: 12px; --sp-5: 16px;
  --sp-6: 20px; --sp-7: 24px; --sp-8: 32px; --sp-9: 40px; --sp-10: 56px; --sp-11: 80px;

  /* --- Density (switched by the Loupe) --- */
  --row-h: 44px;          /* list rows, task rows */
  --control-h: 36px;      /* buttons, inputs */
  --card-pad: var(--sp-6);
  --gap-list: var(--sp-4);
  --measure: 68ch;        /* reading width for summaries and notes */

  /* --- Radius --- */
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-pill: 999px;

  /* --- Motion --- */
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --ease-in-out: cubic-bezier(.45, 0, .2, 1);
  --dur-1: 90ms;    /* press, hover */
  --dur-2: 160ms;   /* reveal, toast in */
  --dur-3: 240ms;   /* Desk <-> Loupe switch */

  /* --- Surfaces: warm paper --- */
  --paper:      #F4F1EA;  /* page canvas (design v8) */
  --surface:    #FFFFFF;  /* lists, panels, the report page */
  --surface-2:  #FAF8F3;  /* hover, secondary panel */
  --sunk:       #EFECE5;  /* wells, chips, inputs at rest */
  --overlay:    rgba(25, 27, 34, .32);
  --line:       #E2DDD2;  /* hairlines (decorative, not a control boundary) */
  --line-2:     #CFC8BA;  /* stronger rules: buttons, chips */
  --ev-unsure:  #7F5A00;
  --line-strong:#8E8A80;  /* control boundaries: inputs, checkboxes (3:1 on surface) */

  /* --- Text --- */
  --text:   #191B22;   /* ink black */
  --text-2: #464A56;   /* secondary */
  --text-3: #62666F;   /* meta: dates, sources (AA on paper and surface) */
  --text-defang: #6F6A60; /* the [.] and hxxp inside a defanged IOC: lighter than the value, still AA */

  /* --- Brand: ultramarine ink --- */
  --ink:        #23262D;  /* graphite: actions and selection (owner, 2026-10-11) — the brand red lives in the mark only */
  --ink-hover:  #33373F;
  --ink-press:  #15171B;
  --ink-tint:   #ECEAE4;
  --ink-tint-2: #E0DDD5;
  --on-ink:     #FFFFFF;
  --brand:      #A11717;  /* the keycap in the logo; never a button, so nothing reads as "known bad" */
  /* Evidence (fixed; the brand never moves them): strong lead, kit-level, known bad, new */
  --ev-strong: #17744A; --ev-strong-tint: #E6F3EB; --ev-strong-line: #9FD0B3;
  --ev-kit: #9A5A06;    --ev-kit-tint: #FAF0DF;    --ev-kit-line: #E3C089;
  --ev-bad: #A8231B;    --ev-bad-tint: #F9E4E2;
  --ev-new: #C9431B;    --ev-new-tint: #FCE9E2;
  --focus:      #23262D;
  --focus-ring: 0 0 0 2px var(--paper), 0 0 0 4px var(--focus);
  --selection:  #E0DDD5;

  /* --- Signal kinds (small marks + text; never large fills) --- */
  --sig-interest: #464A56;  --sig-interest-tint: #EFEDE7;   /* you follow it: neutral, the default reason */
  --sig-watch:    #1F7A59;  --sig-watch-tint:    #E1F2EA;   /* your own asset was named */
  --sig-retro:    #7A3490;  --sig-retro-tint:    #F2E7F5;   /* your memory: a case IOC reappeared */
  --sig-kev:      #A3401A;  --sig-kev-tint:      #FAEAE2;   /* exploited in the wild (CISA KEV) */

  /* --- Severity (CVE/KEV only; shown as a word, colour is redundant) --- */
  --sev-critical: #B3261E; --sev-high: #A3401A; --sev-medium: #7F5A00; --sev-low: #5E6370;

  /* --- Status --- */
  --ok: #1D6E36;     --ok-tint: #E2F2E6;
  --warn: #7F5A00;   --warn-tint: #FAF0D6;
  --danger: #B3261E; --danger-tint: #FBE7E5;
  --pending: #62666F;--pending-tint: #EDEAE3;

  /* --- TLP 2.0 (FIRST): fixed in every theme — coloured text on black --- */
  --tlp-bg: #000000;
  --tlp-red: #FF2B2B; --tlp-amber: #FFC000; --tlp-green: #33FF00; --tlp-clear: #FFFFFF;
  --tlp-edge: transparent;   /* a 1px edge only where black sits on black */

  /* --- TLP mini (Desk lists): the word in text-2 plus a dot in the FIRST colour; dark theme uses the colour as text --- */
  --tlp-mini-text: var(--text-2);

  /* --- Google sign-in button: colours fixed by Google's branding guidelines, not ours --- */
  --google-bg: #FFFFFF; --google-edge: #747775; --google-text: #1F1F1F;

  /* --- Elevation --- */
  --shadow-0: none;
  --shadow-1: 0 1px 0 rgba(25, 27, 34, .04), 0 1px 2px rgba(25, 27, 34, .05);
  --shadow-2: 0 2px 6px rgba(25, 27, 34, .06), 0 8px 24px rgba(25, 27, 34, .08);
  --shadow-3: 0 12px 48px rgba(25, 27, 34, .18), 0 2px 8px rgba(25, 27, 34, .08);

  /* --- Loupe (cockpit) identity, used only in [data-mode="cockpit"] --- */
  --loupe-rail: var(--ink);
  --grid-minor: transparent;
  --grid-major: transparent;
  --grid-size: 8px;
  /* Control markers and canvas (docs/design/tokens.css) */
}

/* ============================ DARK (Night desk) ============================ */
/* Two selectors, same values: explicit choice, and the OS preference unless light was forced. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #111214; --surface: #1C1E23; --surface-2: #22252A; --sunk: #2A2C32; --ev-unsure: #E6C35A;
  --overlay: rgba(0, 0, 0, .55);
  --line: #33363D; --line-2: #4C5059; --line-strong: #7A7F8A;
  --text: #F1EFE9; --text-2: #CDC9C0; --text-3: #A9A59D; --text-defang: #8E8A82;
  --ink: #E6E2D8; --ink-hover: #F1EFE9; --ink-press: #FFFFFF; --ink-tint: #2C2E34; --ink-tint-2: #383B42; --brand: #F07575;
  --ev-strong: #6FD39B; --ev-strong-tint: #1C3226; --ev-strong-line: #4E9F74; --ev-kit: #EDB45E; --ev-kit-tint: #33281A; --ev-kit-line: #A27A3A;
  --ev-bad: #FF7C70; --ev-bad-tint: #3B1C1C; --ev-new: #FF8A5E; --ev-new-tint: #3A2219;
  --on-ink: #15171B; --focus: #E6E2D8; --selection: #383B42;
  --sig-interest: #B6BAC5; --sig-interest-tint: #23272F;
  --sig-watch: #58E0A6;    --sig-watch-tint: #10301F;
  --sig-retro: #D6A0E8;    --sig-retro-tint: #33203B;
  --sig-kev: #F2976F;      --sig-kev-tint: #3A2118;
  --sev-critical: #F28B82; --sev-high: #F2976F; --sev-medium: #E3B55B; --sev-low: #A2A7B3;
  --ok: #72CF8F; --ok-tint: #15301E; --warn: #E3B55B; --warn-tint: #33280F;
  --danger: #F28B82; --danger-tint: #3A1B19; --pending: #9398A5; --pending-tint: #22262E;
  --tlp-edge: #4A515E;
  --tlp-mini-text: currentColor;
  --google-bg: #131314; --google-edge: #8E918F; --google-text: #E3E3E3;
  --shadow-1: 0 1px 0 rgba(0, 0, 0, .3);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
  --shadow-3: 0 16px 56px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #111214; --surface: #1C1E23; --surface-2: #22252A; --sunk: #2A2C32; --ev-unsure: #E6C35A;
    --overlay: rgba(0, 0, 0, .55);
    --line: #33363D; --line-2: #4C5059; --line-strong: #7A7F8A;
    --text: #F1EFE9; --text-2: #CDC9C0; --text-3: #A9A59D; --text-defang: #8E8A82;
    --ink: #E6E2D8; --ink-hover: #F1EFE9; --ink-press: #FFFFFF; --ink-tint: #2C2E34; --ink-tint-2: #383B42; --brand: #F07575;
  --ev-strong: #6FD39B; --ev-strong-tint: #1C3226; --ev-strong-line: #4E9F74; --ev-kit: #EDB45E; --ev-kit-tint: #33281A; --ev-kit-line: #A27A3A;
  --ev-bad: #FF7C70; --ev-bad-tint: #3B1C1C; --ev-new: #FF8A5E; --ev-new-tint: #3A2219;
    --on-ink: #15171B; --focus: #E6E2D8; --selection: #383B42;
    --sig-interest: #B6BAC5; --sig-interest-tint: #23272F;
    --sig-watch: #58E0A6;    --sig-watch-tint: #10301F;
    --sig-retro: #D6A0E8;    --sig-retro-tint: #33203B;
    --sig-kev: #F2976F;      --sig-kev-tint: #3A2118;
    --sev-critical: #F28B82; --sev-high: #F2976F; --sev-medium: #E3B55B; --sev-low: #A2A7B3;
    --ok: #72CF8F; --ok-tint: #15301E; --warn: #E3B55B; --warn-tint: #33280F;
    --danger: #F28B82; --danger-tint: #3A1B19; --pending: #9398A5; --pending-tint: #22262E;
    --tlp-edge: #4A515E;
    --tlp-mini-text: currentColor;
    --google-bg: #131314; --google-edge: #8E918F; --google-text: #E3E3E3;
    --shadow-1: 0 1px 0 rgba(0, 0, 0, .3);
    --shadow-2: 0 2px 8px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-3: 0 16px 56px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
  }
}

/* ============================ LOUPE (cockpit) ============================ */
/* Same palette, same ink — different paper and density. Plain paper becomes graph paper;
   the page gains an ink rail; rows tighten; numbers go mono and tabular. Esc returns to the Desk. */
[data-mode="cockpit"] {
  --paper: #EEF0F3;
  --surface: #FFFFFF;
  --surface-2: #F6F7F9;
  --line: #DCE0E6;
  --grid-minor: rgba(43, 58, 184, .045);
  --grid-major: rgba(43, 58, 184, .08);
  --grid-size: 8px;
  --sheet: #F7F8FA;          /* the solid sheet the table sits on: no grid under data */

  --fs-body: var(--fs-13);
  --row-h: 30px;
  --control-h: 28px;
  --card-pad: var(--sp-4);
  --gap-list: 0px;
  --r-md: 6px; --r-lg: 8px;
  --shadow-1: none;
  --dur-2: 90ms;             /* the instrument answers faster */
}
:root[data-theme="dark"] [data-mode="cockpit"],
:root[data-theme="dark"][data-mode="cockpit"] {
  --paper: #0B0D11; --surface: #13161B; --surface-2: #191D24; --line: #232832;
  --grid-minor: rgba(154, 165, 255, .035); --grid-major: rgba(154, 165, 255, .07); --sheet: #101318;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [data-mode="cockpit"],
  :root:not([data-theme="light"])[data-mode="cockpit"] {
    --paper: #0B0D11; --surface: #13161B; --surface-2: #191D24; --line: #232832;
    --grid-minor: rgba(154, 165, 255, .035); --grid-major: rgba(154, 165, 255, .07); --sheet: #101318;
  }
}

/* ============================ Reduced motion ============================ */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; }
}
