/*
 * Fowlguard theme tokens: the one copy, for fowlguard.com and the console alike.
 *
 * Imported at build time by both surfaces (site/src/main.tsx, control-plane/console/web/src/main.tsx);
 * Vite inlines it into each bundle, so nothing reaches across the repo at run time and there is no
 * second copy in the tree to drift. The values are fowlguard.com's Clearway palette
 * (docs/UI-CONVENTIONS.md, "Theme: fowlguard.com's, shared rather than copied").
 *
 * # Channels, not colors
 *
 * Every color is stored as RGB channels (`--c-ink: 14 19 32`), because Tailwind needs channels to
 * apply an opacity (`rgb(var(--foreground) / <alpha-value>)`). A color that is itself translucent
 * carries its alpha beside it (`--a-ok-bg`), 1 where it is opaque. Each surface adapts:
 *
 * - the site writes `var(--ink)` as a whole color, so clearway.css declares `--ink: rgb(var(--c-ink))`;
 * - the console points its own names at the channels in globals.css (`--foreground: var(--c-ink)`).
 *
 * # Modes
 *
 * Light by default; dark when the visitor's system asks for it and nobody chose light, or when
 * `data-theme="dark"` is stamped on <html>. Both surfaces stamp `data-theme` (the console always
 * does, the site when a visitor has chosen), so the same three selectors serve both.
 *
 * Change a value here and both surfaces move together. Never copy a value out of this file.
 */

:root {
    color-scheme: light;

    /* Neutrals */
    --c-bg: 245 246 248;            /* #F5F6F8 */
    --c-bg-2: 236 238 242;          /* #ECEEF2 */
    --c-surface: 255 255 255;       /* #FFFFFF */
    --c-surface-2: 248 249 251;     /* #F8F9FB inputs, table heads */
    --c-surface-3: 238 240 244;     /* #EEF0F4 tracks, chip ground */
    --c-line: 224 228 234;          /* #E0E4EA */
    --c-line-2: 204 211 221;        /* #CCD3DD controls rule a step harder */
    --c-ink: 14 19 32;              /* #0E1320 */
    --c-ink-2: 38 46 61;            /* #262E3D table cells */
    --c-dim: 82 92 110;             /* #525C6E secondary text */
    --c-faint: 122 131 148;         /* #7A8394 table headers, timestamps */

    /* The pine stage: the one bold surface */
    --c-pine: 18 23 34;             /* #121722 */
    --c-pine-2: 25 31 43;           /* #191F2B */
    --c-pine-3: 34 42 57;           /* #222A39 */
    --c-pine-ink: 238 241 246;      /* #EEF1F6 */
    --c-pine-dim: 156 166 183;      /* #9CA6B7 */
    --c-pine-line: 220 228 240; --a-pine-line: 0.14;

    /* Signal: the brand orange, for the one action on a screen */
    --c-signal: 194 65 12;          /* #C2410C */
    --c-signal-hover: 166 54 9;     /* #A63609 */
    --c-signal-ink: 255 255 255;
    --c-signal-soft: 194 65 12; --a-signal-soft: 0.09;

    /* Four tints that tell things apart; never decoration */
    --c-mint: 227 233 246;          /* #E3E9F6 */
    --c-mint-ink: 42 74 138;        /* #2A4A8A */
    --c-sky: 220 233 251;           /* #DCE9FB */
    --c-sky-ink: 29 79 154;         /* #1D4F9A */
    --c-sand: 246 230 210;          /* #F6E6D2 */
    --c-sand-ink: 138 74 18;        /* #8A4A12 */
    --c-lilac: 231 226 250;         /* #E7E2FA */
    --c-lilac-ink: 75 58 154;       /* #4B3A9A */

    /* State only */
    --c-ok: 14 122 87;              /* #0E7A57 */
    --c-ok-bg: 221 243 234; --a-ok-bg: 1;          /* #DDF3EA */
    --c-deny: 180 35 47;            /* #B4232F */
    --c-deny-bg: 251 227 229; --a-deny-bg: 1;      /* #FBE3E5 */
    --c-report: 38 86 184;          /* #2656B8 */
    --c-report-bg: 225 234 251; --a-report-bg: 1;  /* #E1EAFB */
    --c-warn: 142 91 0;             /* #8E5B00 */
    --c-warn-bg: 251 239 214; --a-warn-bg: 1;      /* #FBEFD6 */

    --c-focus: 194 65 12;
    --c-nav-bg: 245 246 248; --a-nav-bg: 0.86;
    --c-code-bg: 18 23 34;          /* #121722 */

    /* The console's sidebar, as fowlguard.com's console mockup draws it (.app-side). Dark in both
       modes: it is the console's one bold surface, as the pine stage is the site's. */
    --c-sidebar: 14 19 27;          /* #0E131B */
    --c-sidebar-fg: 185 193 206;    /* #B9C1CE */
    --c-sidebar-heading: 122 132 151; /* #7A8497 */
    --c-sidebar-ink: 255 255 255;   /* the current page, and the organization's name */
    --c-sidebar-active: 159 184 255; --a-sidebar-active: 0.12;
    --c-sidebar-line: 220 228 240; --a-sidebar-line: 0.1;

    /* Shadows, radii and faces */
    --shadow-sm: 0 1px 2px rgba(14, 19, 32, 0.06);
    --shadow: 0 1px 2px rgba(14, 19, 32, 0.05), 0 18px 40px -22px rgba(14, 19, 32, 0.28);
    --r-lg: 28px;
    --r: 20px;
    --r-sm: 12px;
    --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --c-bg: 10 13 18;            /* #0A0D12 */
        --c-bg-2: 13 17 24;          /* #0D1118 */
        --c-surface: 18 23 34;       /* #121722 */
        --c-surface-2: 22 28 39;     /* #161C27 */
        --c-surface-3: 27 34 48;     /* #1B2230 */
        --c-line: 37 44 57;          /* #252C39 */
        --c-line-2: 50 59 75;        /* #323B4B */
        --c-ink: 237 240 245;        /* #EDF0F5 */
        --c-ink-2: 201 208 219;      /* #C9D0DB */
        --c-dim: 151 161 178;        /* #97A1B2 */
        --c-faint: 110 120 138;      /* #6E788A */
        --c-pine: 14 18 26;          /* #0E121A */
        --c-pine-2: 21 27 38;        /* #151B26 */
        --c-pine-3: 29 36 51;        /* #1D2433 */
        --c-pine-ink: 238 241 246;   /* #EEF1F6 */
        --c-pine-dim: 152 162 179;   /* #98A2B3 */
        --c-pine-line: 220 228 240; --a-pine-line: 0.12;
        --c-signal: 240 102 43;      /* #F0662B */
        --c-signal-hover: 255 122 66; /* #FF7A42 */
        --c-signal-ink: 20 10 5;     /* #140A05 */
        --c-signal-soft: 240 102 43; --a-signal-soft: 0.13;
        --c-mint: 26 36 64;          /* #1A2440 */
        --c-mint-ink: 159 184 255;   /* #9FB8FF */
        --c-sky: 20 38 63;           /* #14263F */
        --c-sky-ink: 147 184 244;    /* #93B8F4 */
        --c-sand: 51 36 26;          /* #33241A */
        --c-sand-ink: 240 184 130;   /* #F0B882 */
        --c-lilac: 34 29 61;         /* #221D3D */
        --c-lilac-ink: 185 171 245;  /* #B9ABF5 */
        --c-ok: 79 209 160;          /* #4FD1A0 */
        --c-ok-bg: 79 209 160; --a-ok-bg: 0.13;
        --c-deny: 242 114 124;       /* #F2727C */
        --c-deny-bg: 242 114 124; --a-deny-bg: 0.13;
        --c-report: 141 177 255;     /* #8DB1FF */
        --c-report-bg: 141 177 255; --a-report-bg: 0.13;
        --c-warn: 240 190 90;        /* #F0BE5A */
        --c-warn-bg: 240 190 90; --a-warn-bg: 0.13;
        --c-focus: 240 102 43;
        --c-nav-bg: 10 13 18; --a-nav-bg: 0.84;
        --c-code-bg: 8 11 16;        /* #080B10 */
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 22px 50px -26px rgba(0, 0, 0, 0.75);
    }
}

/* The same dark values, for a page whose visitor chose dark. Kept identical to the block above. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --c-bg: 10 13 18;
    --c-bg-2: 13 17 24;
    --c-surface: 18 23 34;
    --c-surface-2: 22 28 39;
    --c-surface-3: 27 34 48;
    --c-line: 37 44 57;
    --c-line-2: 50 59 75;
    --c-ink: 237 240 245;
    --c-ink-2: 201 208 219;
    --c-dim: 151 161 178;
    --c-faint: 110 120 138;
    --c-pine: 14 18 26;
    --c-pine-2: 21 27 38;
    --c-pine-3: 29 36 51;
    --c-pine-ink: 238 241 246;
    --c-pine-dim: 152 162 179;
    --c-pine-line: 220 228 240; --a-pine-line: 0.12;
    --c-signal: 240 102 43;
    --c-signal-hover: 255 122 66;
    --c-signal-ink: 20 10 5;
    --c-signal-soft: 240 102 43; --a-signal-soft: 0.13;
    --c-mint: 26 36 64;
    --c-mint-ink: 159 184 255;
    --c-sky: 20 38 63;
    --c-sky-ink: 147 184 244;
    --c-sand: 51 36 26;
    --c-sand-ink: 240 184 130;
    --c-lilac: 34 29 61;
    --c-lilac-ink: 185 171 245;
    --c-ok: 79 209 160;
    --c-ok-bg: 79 209 160; --a-ok-bg: 0.13;
    --c-deny: 242 114 124;
    --c-deny-bg: 242 114 124; --a-deny-bg: 0.13;
    --c-report: 141 177 255;
    --c-report-bg: 141 177 255; --a-report-bg: 0.13;
    --c-warn: 240 190 90;
    --c-warn-bg: 240 190 90; --a-warn-bg: 0.13;
    --c-focus: 240 102 43;
    --c-nav-bg: 10 13 18; --a-nav-bg: 0.84;
    --c-code-bg: 8 11 16;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 22px 50px -26px rgba(0, 0, 0, 0.75);
}
