/* Copied from template_system/tokens (tokens.light.css + tokens.dark.css). Re-copy when they change. */
/*
 * Light values.
 *
 * Every colour is derived from a hue + chroma pair, so a rebrand sets two numbers per
 * ramp rather than restating every step (see overrides.example.css). The lightness
 * numbers are not free: each was solved so that the pairs components actually render —
 * fg-on-fill and base-on-subtle — clear WCAG AA 4.5:1. Changing an L breaks that; change
 * the hue and chroma instead. Browsers gamut-map oklch to sRGB, so an over-saturated
 * chroma degrades rather than breaking.
 *
 * Verified ratios are in docs/TOKENS.md.
 */
:root {
    /* ---- Ramp inputs. Rebrand here, not below. ---- */
    --ts-neutral-h: 264;
    --ts-brand-h: 264;   --ts-brand-c: 0.217;
    --ts-danger-h: 27;   --ts-danger-c: 0.215;
    --ts-success-h: 149; --ts-success-c: 0.150;
    --ts-warning-h: 58;  --ts-warning-c: 0.131;
    --ts-info-h: 222;    --ts-info-c: 0.098;

    /* ---- Surfaces ---- */
    --ts-color-surface: oklch(1 0 0);
    --ts-color-surface-muted: oklch(0.968 0.007 var(--ts-neutral-h));
    --ts-color-surface-raised: oklch(1 0 0);

    /* ---- Lines ---- */
    --ts-color-border: oklch(0.929 0.013 var(--ts-neutral-h));
    --ts-color-border-strong: oklch(0.869 0.020 var(--ts-neutral-h));

    /* ---- Text ---- */
    --ts-color-fg: oklch(0.208 0.040 var(--ts-neutral-h));
    --ts-color-fg-muted: oklch(0.500 0.035 var(--ts-neutral-h));
    --ts-color-fg-subtle: oklch(0.554 0.030 var(--ts-neutral-h));

    /* ---- Brand ---- */
    --ts-color-brand: oklch(0.555 var(--ts-brand-c) var(--ts-brand-h));
    --ts-color-brand-hover: oklch(0.495 var(--ts-brand-c) var(--ts-brand-h));
    --ts-color-brand-fg: oklch(1 0 0);
    --ts-color-brand-subtle: oklch(0.965 0.015 var(--ts-brand-h));

    /* ---- Status ---- */
    --ts-color-danger: oklch(0.565 var(--ts-danger-c) var(--ts-danger-h));
    --ts-color-danger-fg: oklch(1 0 0);
    --ts-color-danger-subtle: oklch(0.965 0.017 var(--ts-danger-h));

    --ts-color-success: oklch(0.530 var(--ts-success-c) var(--ts-success-h));
    --ts-color-success-fg: oklch(1 0 0);
    --ts-color-success-subtle: oklch(0.965 0.055 var(--ts-success-h));

    --ts-color-warning: oklch(0.550 var(--ts-warning-c) var(--ts-warning-h));
    --ts-color-warning-fg: oklch(1 0 0);
    --ts-color-warning-subtle: oklch(0.965 0.021 var(--ts-warning-h));

    --ts-color-info: oklch(0.535 var(--ts-info-c) var(--ts-info-h));
    --ts-color-info-fg: oklch(1 0 0);
    --ts-color-info-subtle: oklch(0.965 0.023 var(--ts-info-h));

    /* ---- Elevation. Shadow colour tracks the neutral hue, not pure black. ---- */
    --ts-shadow-card: 0 1px 3px oklch(0.208 0.040 var(--ts-neutral-h) / 0.07),
                      0 1px 2px oklch(0.208 0.040 var(--ts-neutral-h) / 0.04);
    --ts-shadow-raised: 0 4px 12px oklch(0.208 0.040 var(--ts-neutral-h) / 0.08),
                        0 2px 4px oklch(0.208 0.040 var(--ts-neutral-h) / 0.04);
    --ts-shadow-overlay: 0 24px 56px oklch(0.208 0.040 var(--ts-neutral-h) / 0.18),
                         0 4px 8px oklch(0.208 0.040 var(--ts-neutral-h) / 0.05);

    color-scheme: light;
}
/*
 * Dark values.
 *
 * Applied two ways, and both are needed: the media query covers a viewer who never
 * touched a toggle, the attribute covers one who did. Each block is guarded so the other
 * cannot win by accident — `data-theme="light"` beats the system preference, and
 * `data-theme="dark"` beats a light system preference.
 *
 * Note the flip: in light mode a filled control carries white text, in dark mode the fill
 * is lighter than the surface, so `-fg` goes dark. Components never encode that — they
 * ask for `--color-brand-fg` and get whichever is right.
 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        --ts-color-surface: oklch(0.227 0.038 var(--ts-neutral-h));
        --ts-color-surface-muted: oklch(0.180 0.032 var(--ts-neutral-h));
        --ts-color-surface-raised: oklch(0.258 0.046 var(--ts-neutral-h));

        --ts-color-border: oklch(0.310 0.050 var(--ts-neutral-h));
        --ts-color-border-strong: oklch(0.375 0.050 var(--ts-neutral-h));

        --ts-color-fg: oklch(0.929 0.013 var(--ts-neutral-h));
        --ts-color-fg-muted: oklch(0.740 0.030 var(--ts-neutral-h));
        --ts-color-fg-subtle: oklch(0.620 0.030 var(--ts-neutral-h));

        --ts-color-brand: oklch(0.670 var(--ts-brand-c) var(--ts-brand-h));
        --ts-color-brand-hover: oklch(0.730 var(--ts-brand-c) var(--ts-brand-h));
        --ts-color-brand-fg: oklch(0.190 0.030 var(--ts-brand-h));
        --ts-color-brand-subtle: oklch(0.255 0.060 var(--ts-brand-h));

        --ts-color-danger: oklch(0.655 var(--ts-danger-c) var(--ts-danger-h));
        --ts-color-danger-fg: oklch(0.190 0.030 var(--ts-danger-h));
        --ts-color-danger-subtle: oklch(0.255 0.060 var(--ts-danger-h));

        --ts-color-success: oklch(0.620 var(--ts-success-c) var(--ts-success-h));
        --ts-color-success-fg: oklch(0.190 0.030 var(--ts-success-h));
        --ts-color-success-subtle: oklch(0.255 0.060 var(--ts-success-h));

        --ts-color-warning: oklch(0.640 var(--ts-warning-c) var(--ts-warning-h));
        --ts-color-warning-fg: oklch(0.190 0.030 var(--ts-warning-h));
        --ts-color-warning-subtle: oklch(0.255 0.060 var(--ts-warning-h));

        --ts-color-info: oklch(0.655 var(--ts-info-c) var(--ts-info-h));
        --ts-color-info-fg: oklch(0.190 0.030 var(--ts-info-h));
        --ts-color-info-subtle: oklch(0.255 0.050 var(--ts-info-h));

        --ts-shadow-card: 0 1px 3px oklch(0 0 0 / 0.45);
        --ts-shadow-raised: 0 4px 12px oklch(0 0 0 / 0.50);
        --ts-shadow-overlay: 0 24px 56px oklch(0 0 0 / 0.60);

        color-scheme: dark;
    }
}

:root[data-theme='dark'] {
    --ts-color-surface: oklch(0.227 0.038 var(--ts-neutral-h));
    --ts-color-surface-muted: oklch(0.180 0.032 var(--ts-neutral-h));
    --ts-color-surface-raised: oklch(0.258 0.046 var(--ts-neutral-h));

    --ts-color-border: oklch(0.310 0.050 var(--ts-neutral-h));
    --ts-color-border-strong: oklch(0.375 0.050 var(--ts-neutral-h));

    --ts-color-fg: oklch(0.929 0.013 var(--ts-neutral-h));
    --ts-color-fg-muted: oklch(0.740 0.030 var(--ts-neutral-h));
    --ts-color-fg-subtle: oklch(0.620 0.030 var(--ts-neutral-h));

    --ts-color-brand: oklch(0.670 var(--ts-brand-c) var(--ts-brand-h));
    --ts-color-brand-hover: oklch(0.730 var(--ts-brand-c) var(--ts-brand-h));
    --ts-color-brand-fg: oklch(0.190 0.030 var(--ts-brand-h));
    --ts-color-brand-subtle: oklch(0.255 0.060 var(--ts-brand-h));

    --ts-color-danger: oklch(0.655 var(--ts-danger-c) var(--ts-danger-h));
    --ts-color-danger-fg: oklch(0.190 0.030 var(--ts-danger-h));
    --ts-color-danger-subtle: oklch(0.255 0.060 var(--ts-danger-h));

    --ts-color-success: oklch(0.620 var(--ts-success-c) var(--ts-success-h));
    --ts-color-success-fg: oklch(0.190 0.030 var(--ts-success-h));
    --ts-color-success-subtle: oklch(0.255 0.060 var(--ts-success-h));

    --ts-color-warning: oklch(0.640 var(--ts-warning-c) var(--ts-warning-h));
    --ts-color-warning-fg: oklch(0.190 0.030 var(--ts-warning-h));
    --ts-color-warning-subtle: oklch(0.255 0.060 var(--ts-warning-h));

    --ts-color-info: oklch(0.655 var(--ts-info-c) var(--ts-info-h));
    --ts-color-info-fg: oklch(0.190 0.030 var(--ts-info-h));
    --ts-color-info-subtle: oklch(0.255 0.050 var(--ts-info-h));

    --ts-shadow-card: 0 1px 3px oklch(0 0 0 / 0.45);
    --ts-shadow-raised: 0 4px 12px oklch(0 0 0 / 0.50);
    --ts-shadow-overlay: 0 24px 56px oklch(0 0 0 / 0.60);

    color-scheme: dark;
}
