/* Shoji brand tokens — single source of truth for the font, the coral
   primary colour, and the light/dark surface palette that non-DaisyUI
   consumers (Adminer, plain pages) can paint against.

   Loaded by renderHead() for the admin chrome and by adminer.css —
   so one edit here propagates to every surface at once.

   Kept deliberately small: no element styles, just the tokens plus the
   Inter webfont import. Per-element styling lives in shoji.css (DaisyUI
   chrome) and adminer.css.

   The surface tokens follow light by default. A `data-theme="dark"` on
   the root — the value Shoji's theme-change toggle persists — switches
   to dark. prefers-color-scheme handles the case where no explicit
   theme is set (e.g. Adminer hit directly before the preflight runs). */

/* Zalando Sans — variable font, self-hosted from /assets/fonts/ so the
   panel never reaches out to fonts.googleapis.com (avoids a third-
   party request in our cookie-notice claim and works for air-gapped
   installs). Three @font-face blocks, one per Unicode subset; each
   covers the full 400–700 weight range we use (the underlying file
   is a variable font, so the browser interpolates weight in-file).
   Mirrors the slicing Google's own CSS used to hand out. */
@font-face {
    font-family: 'Zalando Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('fonts/zalando-sans/zalando-sans-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
        U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
        U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Zalando Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('fonts/zalando-sans/zalando-sans-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
        U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
        U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
        U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Zalando Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('fonts/zalando-sans/zalando-sans-vietnamese.woff2') format('woff2');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169,
        U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309,
        U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

:root {
    --shoji-font: 'Zalando Sans', system-ui, -apple-system, BlinkMacSystemFont,
        'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    /* Coral primary — referenced by DaisyUI theme vars in shoji.css,
       Adminer accents, and focus halos. */
    --shoji-primary:       oklch(0.74 0.165 25);
    --shoji-primary-light: oklch(0.7  0.165 25);
    --shoji-primary-halo:  oklch(0.74 0.165 25 / 0.25);
    --shoji-primary-tint:  oklch(0.74 0.165 25 / 0.14);
    --shoji-primary-wash:  oklch(0.74 0.165 25 / 0.05);

    /* --- Light surface palette (default) ------------------------------ */
    --shoji-bg:          oklch(98% 0.002 264);
    --shoji-surface:     oklch(100% 0 0);
    --shoji-surface-alt: oklch(95% 0.003 264);
    --shoji-fg:          oklch(20% 0.005 264);
    --shoji-fg-muted:    oklch(20% 0.005 264 / 0.62);
    --shoji-border:      oklch(20% 0.005 264 / 0.12);
    --shoji-border-soft: oklch(20% 0.005 264 / 0.06);
    --shoji-row-alt:     oklch(20% 0.005 264 / 0.025);

    /* Status colours — foreground / background pair each. */
    --shoji-error:    oklch(63% 0.21 25);
    --shoji-error-bg: oklch(63% 0.21 25 / 0.10);
    --shoji-success:    oklch(62% 0.14 145);
    --shoji-success-bg: oklch(62% 0.14 145 / 0.10);
    --shoji-warn:    oklch(79% 0.15 80);
    --shoji-warn-bg: oklch(79% 0.15 80 / 0.14);
}

/* Explicit dark theme — used by Shoji's theme-change toggle and the
   preflight scripts in view.php / adminer.php.
   Mirrors Shoji's DaisyUI convention: elevated surfaces (cards, the
   sidebar) sit DARKER than the page in dark mode. --shoji-bg is the
   page layer (b2), --shoji-surface is the elevated layer (b1). */
:root[data-theme="dark"] {
    --shoji-bg:          oklch(21% 0.004 264);
    --shoji-surface:     oklch(17% 0.004 264);
    --shoji-surface-alt: oklch(27% 0.004 264);
    --shoji-fg:          oklch(94% 0.003 264);
    --shoji-fg-muted:    oklch(94% 0.003 264 / 0.62);
    --shoji-border:      oklch(94% 0.003 264 / 0.12);
    --shoji-border-soft: oklch(94% 0.003 264 / 0.06);
    --shoji-row-alt:     oklch(94% 0.003 264 / 0.03);

    --shoji-error:    oklch(72% 0.18 25);
    --shoji-error-bg: oklch(72% 0.18 25 / 0.16);
    --shoji-success:    oklch(72% 0.13 145);
    --shoji-success-bg: oklch(72% 0.13 145 / 0.14);
    --shoji-warn:    oklch(82% 0.14 80);
    --shoji-warn-bg: oklch(82% 0.14 80 / 0.16);
}

/* System-preference fallback for consumers that load without running a
   preflight (rare). Scoped away from anything that *did* set a theme. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --shoji-bg:          oklch(21% 0.004 264);
        --shoji-surface:     oklch(17% 0.004 264);
        --shoji-surface-alt: oklch(27% 0.004 264);
        --shoji-fg:          oklch(94% 0.003 264);
        --shoji-fg-muted:    oklch(94% 0.003 264 / 0.62);
        --shoji-border:      oklch(94% 0.003 264 / 0.12);
        --shoji-border-soft: oklch(94% 0.003 264 / 0.06);
        --shoji-row-alt:     oklch(94% 0.003 264 / 0.03);

        --shoji-error:    oklch(72% 0.18 25);
        --shoji-error-bg: oklch(72% 0.18 25 / 0.16);
        --shoji-success:    oklch(72% 0.13 145);
        --shoji-success-bg: oklch(72% 0.13 145 / 0.14);
        --shoji-warn:    oklch(82% 0.14 80);
        --shoji-warn-bg: oklch(82% 0.14 80 / 0.16);
    }
}
