/*
 * static/css/tokens.css — the design tokens: colour roles for both themes, type, shape, space, elevation, motion,
 * the stacking order and the brand-image hooks. A fork's /brand/theme.css overrides tokens only and loads after
 * this file.
 *
 * Owner: WP A-13 (Phase 1), B-13 (Phase 2); the UI overhaul (plan R-106, batch 4 §9 phase 2) replaced the legacy
 * palette with the role tokens of docs/plan/specs/ui-overhaul.md §4 ("gold on graphite, ink on ivory").
 * Every selector is defined once, in one file (I7; T-CSS checks the critical ones). Every token here is read
 * somewhere (W20): the legacy names (--gold-accent, --text-muted, --card-bg, …) are gone, not kept as aliases.
 * Dark is the default (:root, Purdue black and Boilermaker Gold); light is data-theme="light" on <html> (ivory,
 * ink and aged gold: ink buttons with gold accents, Ray 2026-11-08).
 */

:root {
    color-scheme: dark;
    /* surfaces: a warm near-black canvas and four graphite steps */
    --c-bg: #0E0E0D;
    --c-surface-low: #151413;           /* sidebar, side viewer, notes, table heads */
    --c-surface: #1A1917;               /* cards, composer, file manager, dashboard panels */
    --c-surface-high: #232220;          /* user bubble, inline code, chips, menus, dialogs */
    --c-surface-highest: #2D2B28;       /* tracks, disabled fills */
    --c-surface-raised: #232220;        /* menus, popovers, dialogs, toasts, the computer-use banner (white in light) */
    /* text and marks */
    --c-on: #F3EFE6;
    --c-on-2: #C8C2B5;                  /* secondary text, icons */
    --c-on-3: #9C968A;                  /* meta, timestamps, placeholders (AA on every surface) */
    --c-on-disabled: #69655D;           /* disabled glyphs only, never text that must be read */
    --c-outline: #75716A;               /* field and control boundaries (>= 3:1) */
    --c-outline-variant: #2E2C28;       /* hairlines, card edges, dividers */
    /* Boilermaker Gold: the brand fill (badges, counts, the cursor), the primary action, the accent */
    --c-brand: #CFB991;
    --c-on-brand: #1A1407;
    --c-primary: #CFB991;               /* the one filled action per view: gold, black label */
    --c-primary-hover: #DBC8A2;
    --c-on-primary: #1A1407;
    --c-on-primary-accent: #1A1407;     /* an icon on the primary fill (gold accents on ink in light) */
    --c-primary-edge: transparent;      /* the primary's hairline (a gold edge on ink in light) */
    --c-accent: #CFB991;                /* focus ring, switch on, slider, ring arc, active edges, avatar ring */
    --c-accent-text: #E2CFA6;           /* gold words: links, kickers, running steps */
    --c-accent-container: #2E281C;      /* active rows, tonal buttons */
    --c-on-accent-container: #ECDDBA;
    --c-danger: #F2A39B;
    --c-danger-container: #3A1B18;
    --c-on-danger-container: #F9C9C3;
    --c-danger-fill: #C9372C;           /* filled destructive button, white label 5.2:1 */
    --c-danger-fill-hover: #B02F25;
    --c-on-danger-fill: #FFFFFF;
    --c-warning: #E8CF8E;
    --c-warning-container: #2A2415;
    --c-on-warning-container: #F1DFAE;
    --c-success: #9FD3A8;
    --c-code: #151413;
    /* syntax roles for highlight.js (syntax.css): each AA on the code and surface tones */
    --c-syn-base: #E6E0D4;
    --c-syn-comment: #9C968A;
    --c-syn-keyword: #D2A8E6;
    --c-syn-tag: #EE9A8C;
    --c-syn-literal: #7FC8CF;
    --c-syn-string: #A9D49A;
    --c-syn-number: #E3B27E;
    --c-syn-title: #8FB8E8;
    --c-syn-builtin: #E2CFA6;
    /* earth accents (rustic charm): categories only (file kinds), never states */
    --c-sage: #A9C3A1;
    --c-clay: #E0A587;
    --c-slate: #A7BACD;
    /* state layers, scrim, focus */
    --c-hover: rgb(243 239 230 / 0.06);
    --c-pressed: rgb(243 239 230 / 0.10);
    --c-scrim: rgb(0 0 0 / 0.62);
    --c-focus: #CFB991;
    --c-glow-edge: color-mix(in srgb, var(--c-brand) 38%, transparent);   /* the computer-use glow's soft inner edge */
    /* the conversation's veil over the chat photograph (layout.css): pure black in dark (Ray 2026-11-13: "a purely
       black one"), the canvas in light */
    --c-chat-veil: #000;
    /* the sidebar motif's hairlines (sidebar.css): gold on graphite, ink on ivory, faint enough for any row's text */
    --c-sidebar-motif: color-mix(in srgb, var(--c-brand) 16%, transparent);
    /* the same drawings' hairlines on the home card's corner and the sign-in page (home.css, layout.css; R-115) */
    --c-motif: color-mix(in srgb, var(--c-brand) 28%, transparent);
    /* a fine paper grain over the canvases (Ray 2026-11-08: about 7 %); static, one raster per tile */
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.96 0 0 0 0 0.92 0 0 0 0 0.84 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    /* the select chevron and the search glyph, drawn as background images in --c-on-2 / --c-on-3 */
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C8C2B5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 9.5l5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
    --search-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239C968A' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.2'/%3E%3Cpath d='M19.5 19.5l-4.1-4.1'/%3E%3C/svg%3E");
    /* fixed canvases (L10): artifacts, the checkerboard, the media viewer's scrim */
    --canvas-light: #fff;
    --canvas-dark: #1b1b1b;
    --checker-a: #2a2a30;
    --checker-b: #1f1f24;
    --lightbox-scrim: rgba(10, 10, 12, 0.86);

    /* type */
    --font-sans: 'AIW Symbols', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, ui-serif, serif;
    --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
    --t-display-l: 500 clamp(2.4rem, 4.4vw, 3.4rem) / 1.08 var(--font-display);
    --t-display-m: 500 clamp(1.9rem, 3.2vw, 2.4rem) / 1.12 var(--font-display);
    --t-headline: 600 1.5rem / 1.25 var(--font-sans);
    --t-title-l: 600 1.125rem / 1.4 var(--font-sans);
    --t-title-m: 600 0.9375rem / 1.4 var(--font-sans);
    --t-body-l: 400 1rem / 1.65 var(--font-sans);
    --t-body-m: 400 0.875rem / 1.5 var(--font-sans);
    --t-body-s: 400 0.8125rem / 1.45 var(--font-sans);
    --t-label-l: 500 0.875rem / 1.25 var(--font-sans);
    --t-label-m: 500 0.8125rem / 1.2 var(--font-sans);
    --t-label-s: 600 0.6875rem / 1.2 var(--font-sans);
    --t-mono: 400 0.84375rem / 1.6 var(--font-mono);

    /* shape */
    --radius-xs: 6px;                   /* badges, inline code */
    --radius-sm: 8px;                   /* small buttons, tabs, menu items */
    --radius-md: 12px;                  /* fields, code, tables, callouts, popovers */
    --radius-lg: 16px;                  /* cards, starters, file columns */
    --radius-xl: 24px;                  /* composer, dialogs, file manager */
    --radius-pill: 999px;               /* buttons, chips, rows, switches */
    /* space: a 4 px grid */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
    --col: 760px;                       /* the chat column: about 75 characters a line */
    /* elevation: tone first; shadows are deep but rare in dark, soft and warm in light */
    --elev-1: 0 1px 2px rgb(0 0 0 / 0.5);
    --elev-2: 0 6px 20px rgb(0 0 0 / 0.42), 0 1px 3px rgb(0 0 0 / 0.4);
    --elev-3: 0 18px 56px rgb(0 0 0 / 0.6), 0 2px 8px rgb(0 0 0 / 0.4);
    --elev-card: 0 0 0 0 transparent;   /* cards lift only in light, where tone alone is too faint */
    /* motion: short and eased; prefers-reduced-motion turns it off (base.css) */
    --dur-1: 100ms;                     /* hover, press */
    --dur-2: 160ms;                     /* switches, chips, segments */
    --dur-3: 240ms;                     /* menus, popovers, dialogs */
    --dur-4: 320ms;                     /* sidebar, sheets, drawers */
    --dur-5: 450ms;                     /* photo, cursor glide */
    --ease-standard: cubic-bezier(0.2, 0, 0, 1);
    --ease-enter: cubic-bezier(0.05, 0.7, 0.1, 1);

    /* stacking order (I1, UX-11): nav < stage (pane or sheet) < files pane < lightbox < system notices < dialogs
       < the computer-use layer. The files pane is a modal overlay, so it opens above the stage (X36); its previews'
       lightbox and menus, notices and confirm dialogs stay above it. Computer use sits above the dialogs, so the user
       can always stop the model (batch 4 §3). */
    --z-nav: 30;
    --z-stage: 40;
    --z-files-pane: 42;
    --z-lightbox: 45;
    --z-system-notice: 50;
    --z-dialog: 180;
    --z-cu: 200;

    /* brand images: main.js sets them from site.json (url("/brand/…")); none until then */
    --brand-home-image: none;
    --brand-auth-image: none;
    --brand-chat-image: none;
    --brand-avatar-image: none;
    /* the profile's sidebar motif, a mask image the profile's theme.css names (Baseline: /brand/sidebar-pattern.svg).
       The default is an empty image, not `none`: a mask of `none` would show the whole layer, so a fork without a
       motif would get a tinted sidebar instead of none. */
    --brand-sidebar-pattern: linear-gradient(transparent, transparent);
    /* the profile's home card corner sprig and sign-in motif (R-115; Baseline: /brand/home-sprig.svg and
       /brand/auth-motif.svg), masks like the sidebar's, with the same empty default */
    --brand-home-sprig: linear-gradient(transparent, transparent);
    --brand-auth-motif: linear-gradient(transparent, transparent);
}

/* Light theme: ivory, ink and aged gold. */
[data-theme="light"] {
    color-scheme: light;
    --c-bg: #FAF9F5;
    --c-surface-low: #F3F0E9;
    --c-surface: #FFFFFF;
    --c-surface-high: #F0ECE3;
    --c-surface-highest: #E7E2D7;
    --c-surface-raised: #FFFFFF;
    --c-on: #1D1B17;
    --c-on-2: #4A463E;
    --c-on-3: #645F55;
    --c-on-disabled: #A39E93;
    --c-outline: #8E887C;
    --c-outline-variant: #E2DDD2;
    --c-primary: #1D1B17;               /* ink, ivory label, gold accents (Q4, Ray 2026-11-08) */
    --c-primary-hover: #34312B;
    --c-on-primary: #FAF9F5;
    --c-on-primary-accent: #CFB991;     /* Boilermaker Gold on ink: 9.0:1 */
    --c-primary-edge: #CFB991;          /* a crisp Boilermaker Gold hairline inside the ink (review: 62 % read as brown) */
    --c-accent: #7A5C1F;                /* aged gold, AA on ivory and white */
    --c-accent-text: #7A5C1F;
    --c-accent-container: #F3E9D2;
    --c-on-accent-container: #4A3810;
    --c-danger: #B3261E;
    --c-danger-container: #FBE4E1;
    --c-on-danger-container: #7A1A14;
    --c-danger-fill: #B3261E;
    --c-danger-fill-hover: #961F18;
    --c-warning: #7A5A0E;
    --c-warning-container: #FBF1D9;
    --c-on-warning-container: #5C430A;
    --c-success: #2E6B3A;
    --c-code: #F5F2EB;
    --c-syn-base: #2A2722;
    --c-syn-comment: #645F55;
    --c-syn-keyword: #8A3A9A;
    --c-syn-tag: #A8402F;
    --c-syn-literal: #006E8A;
    --c-syn-string: #3D6E2A;
    --c-syn-number: #7A5512;
    --c-syn-title: #2F5FB8;
    --c-syn-builtin: #7A5C1F;
    --c-sage: #4D6B47;
    --c-clay: #9A4A2C;
    --c-slate: #3F5A75;
    --c-hover: rgb(29 27 23 / 0.05);
    --c-pressed: rgb(29 27 23 / 0.09);
    --c-scrim: rgb(29 27 23 / 0.36);
    --c-focus: #7A5C1F;
    --c-glow-edge: color-mix(in srgb, var(--c-brand) 62%, transparent);   /* gold reads weaker on ivory */
    --c-chat-veil: var(--c-bg);
    --c-sidebar-motif: color-mix(in srgb, var(--c-on) 9%, transparent);
    --c-motif: color-mix(in srgb, var(--c-on) 12%, transparent);
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.36 0 0 0 0 0.29 0 0 0 0 0.18 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A463E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 9.5l5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
    --search-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23645F55' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.2'/%3E%3Cpath d='M19.5 19.5l-4.1-4.1'/%3E%3C/svg%3E");
    --checker-a: #e9e6df;
    --checker-b: #f6f4ef;
    --elev-1: 0 1px 2px rgb(60 52 34 / 0.08), 0 1px 3px 1px rgb(60 52 34 / 0.05);
    --elev-2: 0 2px 6px 2px rgb(60 52 34 / 0.07), 0 1px 2px rgb(60 52 34 / 0.10);
    --elev-3: 0 12px 40px rgb(60 52 34 / 0.16), 0 2px 8px rgb(60 52 34 / 0.08);
    --elev-card: 0 1px 2px rgb(60 52 34 / 0.08), 0 1px 3px 1px rgb(60 52 34 / 0.05);
}
