/* @theme-name Custom */
/* G-Scapes — the original application palette, kept as a selectable theme.
 *
 * WHY THIS FILE EXISTS. Until 01/09/2026 these greens WERE the application.
 * The SiteTensor restyle replaced them, and the owner asked for the original
 * look to stay available as a choice rather than only in git history. Root
 * selects between this and sitetensor.css; nothing here is read from
 * company_details, so ADR-0004's boundary is untouched — this is a shipped
 * stylesheet, not tenant data.
 *
 * PROVENANCE, AND THE MISTAKE THAT TOOK THREE ATTEMPTS TO FIND. The reference
 * for this theme is THE RUNNING APPLICATION, not the repository. Those are not
 * the same thing and the difference is not subtle.
 *
 * On `main`, ai.js::loadBrandColours runs on every page load, reads
 * company_details, and calls applyBrandColours to write six values as INLINE
 * STYLES on documentElement -- which beat any stylesheet. So static/css/main.css
 * :root is only the FALLBACK, used when primary_colour is null. Nobody running
 * G-Scapes has ever seen it.
 *
 * This file was twice certified "byte-identical to main" against that fallback
 * (D-106, D-110). Both times the verification was sound and answered a narrower
 * question than the one asked; both times the owner found the gap by opening the
 * page. The green was the third and largest instance (D-111).
 *
 * The light values are therefore main's :root WITH the live company_details
 * colours applied over it, exactly as the browser composited them:
 *
 *   --gs-green        #2d5a27   company_details.primary_colour
 *   --gs-green-hover  #1a3a17   company_details.secondary_colour
 *   --gs-focus-ring   rgba(45, 90, 39, 0.25)
 *                               derived from primary at 0.25 alpha, which is
 *                               precisely what applyBrandColours did
 *
 * Everything else is main's :root verbatim, in rgb() notation, because the
 * override touched only those. bg_colour #f7f9f8, card_colour #ffffff and
 * text_colour #1e2a28 were checked against the live record and are IDENTICAL to
 * the repository defaults, so they need no special handling and are not listed
 * above. accent_colour #4a7c44 is deliberately absent: it only ever fed
 * --accent-sage, which no var() in the current tree reads.
 *
 * ADR-0004's boundary is untouched. Nothing here is READ from company_details at
 * runtime; these are shipped values, transcribed once, in a reviewed file. That
 * is the whole point of the separation -- the colours survive, the coupling does
 * not.
 *
 * TWO OF THEM FAIL WCAG AA, AND THAT IS NOW DELIBERATE. This file previously
 * shipped corrected values and this passage argued for them: --gs-success had
 * been raised to #0E7C45 and --gs-ink-2 to #5C6B67, on the grounds that
 * shipping the originals would knowingly reintroduce two accessibility
 * defects. The owner reversed that on 02/09/2026 (D-106), instructing that the
 * theme be identical to the original. The passage is rewritten rather than
 * removed, because a file that quietly reverses its own reasoning tells the
 * next reader nothing.
 *
 * The measured cost, against this theme's own --bg-app rgb(247,249,248):
 *
 *   --gs-success   rgb(47,191,113) at 2.25:1. Less than half the 4.5:1 floor.
 *                  Roughly 25 use sites.
 *   --gs-ink-2     rgb(107,124,120) at 4.16:1, a near miss. Roughly 279 use
 *                  sites, which makes it the most-used colour in the interface
 *                  after the primary ink.
 *
 * That is a real accessibility failure and it is not hidden. It is confined to
 * this theme, which is optional and is not the default; sitetensor.css is held
 * to the full standard. tests/smoke/test_theming.py carries seven exempt pairs
 * PINNED TO THEIR MEASURED RATIOS, so an exemption cannot drift to cover a
 * worse colour later and cannot cover a second theme. The reasoning, and why
 * this sits beside D-103 upholding WCAG 1.4.1 against a brand rule rather than
 * contradicting it, is in docs/project/DECISION_LOG.md at D-106.
 *
 * ONE PROPERTY THIS FILE DELIBERATELY OMITS, AND ONE IT NO LONGER DOES.
 * --bg-main and --forest are both CONSUMED on main -- 36 and 17 sites -- and
 * declared nowhere at all, by CSS or by JavaScript, so those elements render
 * untinted there. main.css says so itself: "inert today and NOT silently
 * 'fixed' here (reported, not actioned)". Both were omitted here on 02/09/2026
 * to reproduce that.
 *
 * --bg-main came back the same day (D-110), because omitting it did NOT
 * reproduce main. Fourteen further sites carried a real grey literal --
 * #f5f5f5, #f8f9fa, #f0f7f2 -- which the restyle converted to var(--bg-main).
 * Leaving the role unmapped therefore reproduced main at 36 sites and LOST a
 * visible panel background at 14. --gs-surface-2 rgb(242,245,244) sits 4/765
 * from the most common of those greys, so mapping it is the closer
 * reproduction on both counts. --forest had no such sites, so it stays absent
 * and the asymmetry is asserted in both directions by a test.
 *
 * --accent-sage is absent for a different reason again, and that one is not a
 * judgement call: nothing reads it. It is declared on main (rgb(143,191,179))
 * and overridden live (#4a7c44), and neither value ever appears in a var(),
 * because it was only ever written at runtime by applyBrandColours in ai.js,
 * which ADR-0004 deleted. Restoring it would restore a dead token.
 *
 * THE DARK VARIANT IS NEW. G-Scapes never had one; there is nothing to be
 * faithful to. The greens are lightened for a dark ground and the neutrals are
 * given a slight green cast so the theme still reads as itself. Every ratio
 * below is measured against this theme's own ground, not assumed, and
 * tests/smoke/test_theming.py recomputes them.
 *
 * NO RAW COLOUR APPEARS IN THE MAPPING BLOCKS. The primitives are declared once
 * here, because unlike SiteTensor this palette has no published brand sheet to
 * check them against; the mappings below reference them and nothing else. A
 * test enforces that split.
 *
 * THE CAUTION PAIR IS MAIN'S OWN AMBER, NOT SITETENSOR'S OCHRE. It briefly
 * shared SiteTensor's #9A5B06 on the reasoning that neither palette publishes
 * an amber and a status colour is not a brand colour. On screen that was
 * plainly wrong for this theme: #9A5B06 is a dark ochre and main's amber is a
 * bright orange, so the one theme whose job is to look like the original did
 * not (D-110).
 *
 * main has no --warning token to copy, because the restyle created that role;
 * it had NINE different ambers hardcoded across the page and the render
 * functions. A single token has to choose, and it chooses the most-used:
 * #f39c12 for the ink, 4 sites, and #fff3cd for the tint, 5 sites.
 *
 * Both fail AA -- 2.07:1 and, ink on tint, 1.98:1 -- for the same reason and
 * under the same terms as --gs-success and --gs-ink-2 above: this theme
 * reproduces the original, the original was not accessible, and each failure is
 * PINNED to its measured ratio in tests/smoke/test_theming.py rather than
 * waved through. Text on the tint is unaffected at 13.38:1.
 *
 * The amber exists at all because the owner overruled the SiteTensor brand rule
 * forbidding a third status state (D-103); see docs/project/SOURCE_OF_TRUTH.md,
 * "Committed specifications".
 *
 * SITETENSOR NO LONGER KEEPS THE ACCESSIBLE OCHRE, which this header claimed
 * until 02/09/2026. The owner made the same judgement on the default theme that
 * they made here, and #f39c12 is now the caution ink in BOTH (D-130). The two
 * themes still differ in the tint -- #fff3cd here, main's own, against
 * SiteTensor's #FDF3E3 -- so the ratios and their pins are not shared.
 */

/* --- Primitives ----------------------------------------------------------
 * Declared here rather than in tokens.css: that file is the SiteTensor brand,
 * checked against the committed brand sheet, and green has no business in it.
 */
:root {
    /* Light. Ratios against --gs-ground #F7F9F8, the harder of the two grounds. */
    --gs-green: #2d5a27;             /* 7.63:1 — the LIVE brand green, see header */
    --gs-green-hover: #1a3a17;       /* 11.95:1 — the live secondary */
    --gs-green-soft: rgb(230, 240, 237);        /* selected row tint */
    --gs-success: rgb(47, 191, 113); /* 2.25:1 — FAILS AA, see header */
    --gs-ground: rgb(247, 249, 248);
    --gs-surface: rgb(255, 255, 255);
    --gs-surface-2: rgb(242, 245, 244);
    --gs-line: rgb(227, 231, 229);
    --gs-ink: rgb(30, 42, 40);               /* 14.02:1 */
    --gs-ink-2: rgb(107, 124, 120);  /* 4.16:1 — FAILS AA, see header */
    --gs-disabled-ink: rgb(160, 170, 167);      /* 2.26:1, WCAG 1.4.3 exempts inactive controls */
    --gs-danger: rgb(185, 28, 28);            /* 6.12:1 */
    --gs-danger-soft: rgb(254, 242, 242);
    --gs-success-soft: #E8F5E9;      /* carries --gs-success at 2.12:1; no
                                        lighter tint reaches AA under an ink
                                        this light, and --success-bg is not
                                        part of the original in any case */
    --gs-caution: #f39c12;           /* 2.07:1 — FAILS AA, see header */
    --gs-caution-soft: #fff3cd;      /* carries --gs-caution at 1.98:1 */
    --gs-focus-ring: rgba(45, 90, 39, 0.25);

    /* The Gallery's ink, over glass and a photographic backdrop rather than a
       flat ground. Transcribed verbatim from main, where it is declared on
       #section-gallery: rgb(19, 84, 67), 8.36:1 on this theme's own ground.
       It is much deeper than the accent (5.22:1) and that gap is the point. */
    --gs-green-deep: rgb(19, 84, 67);

    /* The typeface, transcribed from main's `body` rule verbatim. It is a
       primitive rather than a mapping because it is a value, and it is in
       this file rather than tokens.css because tokens.css is the SiteTensor
       brand and Inter is not part of it. The stack ships as-is so a page
       still reads correctly when fonts.googleapis.com is unreachable. */
    --gs-font-ui: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* Dark. Ratios against --gs-ground-dark #0E1211. */
    --gs-green-dark: #6FBF63;        /* 8.36:1 — was #4FBF95 at 8.28:1 */
    --gs-green-hover-dark: #8AD47E;  /* 10.60:1 — was #7FD3AE at 10.63:1 */
    --gs-green-soft-dark: #172611;   /* carries --gs-ink-dark at 13.36:1 */
    --gs-success-dark: #5CC79F;      /* 9.09:1 */
    --gs-ground-dark: #0E1211;
    --gs-surface-dark: #161B19;
    --gs-surface-2-dark: #1C2320;
    --gs-line-dark: #252C29;
    --gs-ink-dark: #E9ECEB;          /* 15.87:1 */
    --gs-ink-2-dark: #B9C2BE;        /* 10.35:1 */
    --gs-disabled-ink-dark: #4A534F; /* 2.37:1, mirroring the light pair */
    --gs-danger-dark: #FF5A5A;       /* 6.16:1 */
    --gs-danger-soft-dark: #2A1416;  /* carries --gs-danger-dark at 5.67:1 */
    --gs-success-soft-dark: #12261F; /* carries --gs-success-dark at 7.65:1 */
    --gs-caution-dark: #F5B027;      /* 9.99:1 */
    --gs-caution-soft-dark: #2A1E08; /* carries --gs-caution-dark at 8.64:1 */
    --gs-focus-ring-dark: rgba(111, 191, 99, 0.35);
}

/* --- Light: the default, and what a system with no preference gets ------- */
:root {
    --primary: var(--gs-green);
    --primary-hover: var(--gs-green-hover);
    --font-ui: var(--gs-font-ui);
    --gal-ink: var(--gs-green-deep);
    --success: var(--gs-success);

    --bg-app: var(--gs-ground);
    --bg-card: var(--gs-surface);
    --border: var(--gs-line);
    --text-primary: var(--gs-ink);
    --text-secondary: var(--gs-ink-2);
    --text-disabled: var(--gs-disabled-ink);
    --bg-main: var(--gs-surface-2);
    /* --forest is DELIBERATELY ABSENT; --bg-main is not. See the header:
       both are undeclared on main, but 14 sites carried a real grey that
       became var(--bg-main) in the restyle, so omitting it LOST a
       background rather than reproducing one. --forest had no such
       sites. A test asserts the omission in both directions. */

    --focus-ring: var(--gs-focus-ring);
    --row-hover: var(--gs-surface-2);
    --row-selected: var(--gs-green-soft);

    --danger: var(--gs-danger);
    --danger-bg: var(--gs-danger-soft);
    --success-bg: var(--gs-success-soft);
    --warning: var(--gs-caution);
    --warning-bg: var(--gs-caution-soft);
}

/* --- Dark: the operating system asked, and the user has not said otherwise */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary: var(--gs-green-dark);
        --primary-hover: var(--gs-green-hover-dark);
        --font-ui: var(--gs-font-ui);
        --gal-ink: var(--gs-green-dark);
        --success: var(--gs-success-dark);
        --bg-app: var(--gs-ground-dark);
        --bg-card: var(--gs-surface-dark);
        --bg-main: var(--gs-surface-2-dark);
        --border: var(--gs-line-dark);
        --text-primary: var(--gs-ink-dark);
        --text-secondary: var(--gs-ink-2-dark);
        --text-disabled: var(--gs-disabled-ink-dark);
        --focus-ring: var(--gs-focus-ring-dark);
        --row-hover: var(--gs-surface-2-dark);
        --row-selected: var(--gs-green-soft-dark);
        --danger: var(--gs-danger-dark);
        --danger-bg: var(--gs-danger-soft-dark);
        --success-bg: var(--gs-success-soft-dark);
        --warning: var(--gs-caution-dark);
        --warning-bg: var(--gs-caution-soft-dark);
    }
}

/* --- Dark: the user chose it ---------------------------------------------- */
:root[data-theme="dark"] {
    --primary: var(--gs-green-dark);
    --primary-hover: var(--gs-green-hover-dark);
    --font-ui: var(--gs-font-ui);
    --gal-ink: var(--gs-green-dark);
    --success: var(--gs-success-dark);
    --bg-app: var(--gs-ground-dark);
    --bg-card: var(--gs-surface-dark);
    --bg-main: var(--gs-surface-2-dark);
    --border: var(--gs-line-dark);
    --text-primary: var(--gs-ink-dark);
    --text-secondary: var(--gs-ink-2-dark);
    --text-disabled: var(--gs-disabled-ink-dark);
    --focus-ring: var(--gs-focus-ring-dark);
    --row-hover: var(--gs-surface-2-dark);
    --row-selected: var(--gs-green-soft-dark);
    --danger: var(--gs-danger-dark);
    --danger-bg: var(--gs-danger-soft-dark);
    --success-bg: var(--gs-success-soft-dark);
    --warning: var(--gs-caution-dark);
    --warning-bg: var(--gs-caution-soft-dark);
}
