/* ============================================================
   Colectica Catalog design tokens (imported from the Claude
   Design "Colectica Web Catalog" system).

   The design system is dark-first; the dark values below are the
   design's own tokens. Light values are derived (surfaces
   inverted, text/borders/semantics adjusted for contrast) so the
   theme picker keeps working. Non-color tokens (type ramp,
   spacing, radii, shadows, motion) are theme-independent.

   Load order (index.html): after default-fuib.css, before
   fast-compat.css / app.css / dashboard.css / variables-view.css.
   fast-compat.css aliases the legacy FAST token names the app CSS
   still consumes onto the surface, text, and brand tokens
   defined here, so the whole custom UI adopts this palette.
   ============================================================ */

@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("/fonts/source-sans-3.woff2") format("woff2");
}
@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("/fonts/jetbrains-mono.woff2") format("woff2");
}

:root {
    /* --- Families --- */
    --font-sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    /* Aliases for names already used in the app CSS */
    --font-monospace: var(--font-mono);
    --monospace-font-family: var(--font-mono);

    /* --- Type sizes (px) --- */
    --fs-display: 26px;
    --fs-title: 18px;
    --fs-section: 16px;
    --fs-card-title: 13.5px;
    --fs-body: 13px;
    --fs-secondary: 12.5px;
    --fs-small: 12px;
    --fs-micro: 11px;
    --fs-label: 11px;
    --fs-stat: 30px;

    /* --- Weights / line heights / label spacing --- */
    --fw-regular: 400;
    --fw-semibold: 600;
    --fw-bold: 700;
    --lh-tight: 1.2;
    --lh-snug: 1.3;
    --lh-normal: 1.45;
    --lh-relaxed: 1.5;
    --label-spacing: 0.4px;
    --label-spacing-wide: 0.5px;

    /* --- Spacing scale (px) --- */
    --space-1: 4px;
    --space-2: 7px;
    --space-3: 10px;
    --space-4: 12px;
    --space-5: 14px;
    --space-6: 16px;
    --space-7: 18px;
    --space-8: 22px;
    --space-9: 26px;
    --pad-card: 15px 16px;
    --pad-card-lg: 18px 20px;
    --pad-page: 22px 26px 64px;

    /* --- Radii --- */
    --radius-xs: 4px;
    --radius-sm: 5px;
    --radius-md: 6px;
    --radius-lg: 7px;
    --radius-xl: 8px;
    --radius-2xl: 10px;
    --radius-3xl: 12px;
    --radius-pill: 16px;
    --radius-round: 50%;

    /* --- Elevation / shadow --- */
    --shadow-toast: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-panel: -12px 0 40px rgba(0, 0, 0, 0.45);
    --shadow-dialog: 0 24px 64px rgba(0, 0, 0, 0.5);

    /* --- Motion --- */
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
    --dur-fast: 0.15s;
    --dur-base: 0.2s;
    --dur-slide: 0.24s;

    /* ========================================================
       COLOR TOKENS — dark (the design's own values; default)
       ======================================================== */
    --surface-app: #1d1d1d;        /* top app bar, primary nav, panels */
    --surface-canvas: #2b2b2b;     /* page background */
    --surface-card: #2f2f2f;       /* page-level cards, tables */
    --surface-card-elev: #333333;  /* nested cards inside a card */
    --surface-inset: #262626;      /* hash boxes, dialog inputs */
    --surface-input: #333333;      /* search / form fields */
    --surface-rail: #272727;       /* table header row */
    --surface-track: #1c1c1c;      /* progress track, segmented bg */

    --border-muted: rgba(255, 255, 255, 0.05);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.12);

    --text-primary: #ffffff;
    --text-secondary: #e6e6e6;
    --text-tertiary: #cfcfcf;
    --text-muted: #9a9a9a;
    --text-faint: #8a8a8a;
    --text-mono: #818181;

    --brand-primary: #0f6cbd;
    --brand-primary-hover: #1577c7;
    --brand-accent: #2899f5;
    --brand-accent-soft: #6cb6f5;

    --danger: #f08a90;
    --danger-dot: #e2575f;
    --warning: #eebf52;
    --warning-dot: #e8b13a;
    --sem-info: #3ba3f2;   /* NB: namespaced. FluentUI v5 injects `:root { --info: var(--colorNeutralForeground3) }` (gray!) via a constructed/adopted stylesheet, which cascades AFTER linked CSS and overrides a bare `--info`. Same trap exists for --success/--warning/--error/--font-monospace. */
    --info-dot: #4fa3f0;
    --success: #3fcf9f;
    --success-bright: #35d6a0;

    --danger-bg: rgba(240, 77, 82, 0.15);
    --warning-bg: rgba(240, 180, 41, 0.15);
    --info-bg: rgba(40, 153, 245, 0.15);
    --success-bg: rgba(53, 214, 160, 0.14);
    --neutral-bg: rgba(255, 255, 255, 0.08);
    --accent-bg: rgba(40, 153, 245, 0.10);

    --grad-sky: linear-gradient(135deg, #9fd3f7, #7cc0f5);
    --grad-blue: linear-gradient(135deg, #2eb3e6, #1c9fda);
    --grad-progress: linear-gradient(90deg, #1aa179, #35d6a0);
    --on-gradient-dark: #0b3a5c;
}

/* ============================================================
   COLOR TOKENS — light (derived; the design only specifies dark).

   FluentUI v5 marks dark mode with body[data-theme="dark"] and leaves the
   attribute ABSENT for light. So we apply the light palette whenever the theme
   is not explicitly dark (covers both data-theme="light" and no attribute),
   which keeps token-driven surfaces in sync with the Fluent components.
   ============================================================ */
body:not([data-theme="dark"]) {
    --surface-app: #ffffff;
    --surface-canvas: #f4f4f4;
    --surface-card: #ffffff;
    --surface-card-elev: #fafafa;
    --surface-inset: #f0f0f0;
    --surface-input: #ffffff;
    --surface-rail: #f2f2f2;
    --surface-track: #e6e6e6;

    --border-muted: rgba(0, 0, 0, 0.06);
    --border-subtle: rgba(0, 0, 0, 0.09);
    --border-strong: rgba(0, 0, 0, 0.14);

    --text-primary: #1b1b1b;
    --text-secondary: #333333;
    --text-tertiary: #4a4a4a;
    --text-muted: #6b6b6b;
    --text-faint: #808080;
    --text-mono: #6b6b6b;

    --brand-primary: #0f6cbd;
    --brand-primary-hover: #115ea3;
    --brand-accent: #0f6cbd;
    --brand-accent-soft: #2899f5;

    --danger: #b10e1c;
    --danger-dot: #c50f1f;
    --warning: #bc4b09;
    --warning-dot: #e8b13a;
    --sem-info: #0f6cbd;   /* namespaced to avoid FluentUI's injected --info (see dark block note) */
    --info-dot: #4fa3f0;
    --success: #0e700e;
    --success-bright: #1aa179;

    --danger-bg: rgba(196, 15, 31, 0.10);
    --warning-bg: rgba(232, 177, 58, 0.16);
    --info-bg: rgba(15, 108, 189, 0.10);
    --success-bg: rgba(14, 112, 14, 0.10);
    --neutral-bg: rgba(0, 0, 0, 0.06);
    --accent-bg: rgba(15, 108, 189, 0.08);

    --on-gradient-dark: #0b3a5c;
}

/* --- Base: adopt the design canvas, text colour and UI font. --- */
body {
    background-color: var(--surface-canvas);
    color: var(--text-secondary);
    font-family: var(--font-sans);
}
