/* MÄHREN tenant theme (D-004, ADR-020) — loaded via Tenant:ThemeCssUrl,
   linked after app.css so overrides here win ties. Palette and fonts are
   derived from the tenant's public web presence until official CI assets
   arrive; replacing this file (and the assets next to it) rebrands the
   installation without a code change (D-003/D-004).

   Scoping: the palette primitives MUST live on :root — the base theme
   files define hundreds of DERIVED variables there (header/sidebar
   backgrounds, text roles, borders, …) and custom properties resolve
   var() references on the element they are declared on, so primitives
   overridden below :root would never reach them. Mode-correctness comes
   from the html scheme class (App.razor renders it from the theme cookie,
   vergixSetSchemeClass syncs it on runtime toggles): no class → the OS
   media query decides; .vx-scheme-dark/.vx-scheme-light pin the explicit
   choice, beating the media block on specificity. */

/* Brand fonts — self-hosted (SIL OFL; no Google CDN request at runtime,
   deliberate for GDPR). Latin subset covers German. Lato is the workhorse
   for everything incl. grids; Libre Caslon Text is display-only. */
@font-face {
    font-family: "Lato";
    src: url("fonts/Lato-Regular.woff2") format("woff2");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Lato";
    src: url("fonts/Lato-Bold.woff2") format("woff2");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: "Lato";
    src: url("fonts/Lato-Italic.woff2") format("woff2");
    font-style: italic;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Lato";
    src: url("fonts/Lato-BoldItalic.woff2") format("woff2");
    font-style: italic;
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: "Libre Caslon Text";
    src: url("fonts/LibreCaslonText-Regular.woff2") format("woff2");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Libre Caslon Text";
    src: url("fonts/LibreCaslonText-Bold.woff2") format("woff2");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: "Libre Caslon Text";
    src: url("fonts/LibreCaslonText-Italic.woff2") format("woff2");
    font-style: italic;
    font-weight: 400;
    font-display: swap;
}

/* Palette — raw --rz-* overrides on top of the zen stylesheets (ADR-020,
   revised 2026-10-31).

   The base shades matter as much as the accents: everything unset derives
   from them (page background = base-700 in dark, borders, grid headers,
   secondary and disabled text). Zen's stock neutrals are pure grays; left
   alone they clash with the warm brand surfaces.

   Light surface hierarchy: page (body) warm near-white, cards/panels the
   brand off-white — raised without hard borders.

   Dark keeps zen's lightness steps (base-800 is lighter than base-700 —
   zen's own order, not a typo) and only tints them to the brand's warm
   neutral, hue 30°, HSL saturation 8%. Zen's surfaces are translucent
   layers over the page (base-background-color and the card, dialog and
   grid backgrounds are rgba of near-black), so the page color is what
   reads through: never pin base-background-color to an opaque near-black
   again — that flattened zen's depth and crushed base-300…600 into four
   nearly identical shades (owner review, 2026-10-31). */
:root {
    --rz-primary: #13293E;
    --rz-on-primary: #F1ECE9;
    --rz-secondary: #837B72;
    --rz-on-secondary: #FFFFFF;

    --rz-base: #E5DED8;
    --rz-on-base: #201E1C;
    --rz-base-50: #FAF8F6;
    --rz-base-100: #F5F1ED;
    --rz-base-200: #EDE7E1;
    --rz-base-300: #E5DED8;
    --rz-base-400: #DED6CF;
    --rz-base-500: #D5CCC4;
    --rz-base-600: #C3B9B0;
    --rz-base-700: #7C766F;
    --rz-base-800: #4C4844;
    --rz-base-900: #201E1C;

    --rz-body-background-color: #FAF8F6;
    --rz-base-background-color: #F1ECE9;
    --rz-text-color: #2E2E2E;
    --rz-text-secondary-color: #4C4844;
    --rz-text-disabled-color: #B3ABA3;

    --rz-text-font-family: "Lato", "Roboto", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:not(.vx-scheme-light) {
        --rz-primary: #5B84AD;
        --rz-on-primary: #0B1826;
        --rz-secondary: #9C948B;
        --rz-on-secondary: #141210;

        --rz-base: #5F5851;
        --rz-on-base: #F1ECE9;
        --rz-base-50: #E9E4E0;
        --rz-base-100: #CFC8C2;
        --rz-base-200: #999288;
        --rz-base-300: #776E65;
        --rz-base-400: #5F5851;
        --rz-base-500: #49443F;
        --rz-base-600: #3A3632;
        --rz-base-700: #272421;
        --rz-base-800: #35312D;
        --rz-base-900: #1A1816;
        --rz-base-dark: #1A1816;
        --rz-on-base-light: #1A1816;
        --rz-on-base-lighter: #1A1816;

        --rz-body-background-color: var(--rz-base-700);
        --rz-base-background-color: rgba(26, 24, 22, 0.55);
        --rz-form-field-label-floating-background-color: #272421;
        --rz-text-color: #F1ECE9;
        --rz-text-secondary-color: #CFC8C2;
        --rz-text-disabled-color: #776E65;
    }
}

:root.vx-scheme-dark {
    --rz-primary: #5B84AD;
    --rz-on-primary: #0B1826;
    --rz-secondary: #9C948B;
    --rz-on-secondary: #141210;

    --rz-base: #5F5851;
    --rz-on-base: #F1ECE9;
    --rz-base-50: #E9E4E0;
    --rz-base-100: #CFC8C2;
    --rz-base-200: #999288;
    --rz-base-300: #776E65;
    --rz-base-400: #5F5851;
    --rz-base-500: #49443F;
    --rz-base-600: #3A3632;
    --rz-base-700: #272421;
    --rz-base-800: #35312D;
    --rz-base-900: #1A1816;
    --rz-base-dark: #1A1816;
    --rz-on-base-light: #1A1816;
    --rz-on-base-lighter: #1A1816;

    --rz-body-background-color: var(--rz-base-700);
    --rz-base-background-color: rgba(26, 24, 22, 0.55);
    --rz-form-field-label-floating-background-color: #272421;
    --rz-text-color: #F1ECE9;
    --rz-text-secondary-color: #CFC8C2;
    --rz-text-disabled-color: #776E65;
}

/* Typography: body font follows --rz-text-font-family above; display
   headings (page titles only) use the serif. .vx-page-header-h1 is listed
   separately because RadzenText's .rz-text-h5 class would otherwise
   out-rank the bare h1 selector. */
html, body {
    font-family: "Lato", "Segoe UI", system-ui, -apple-system, sans-serif;
}

h1, .vx-page-header-h1 {
    font-family: "Libre Caslon Text", Georgia, serif;
    font-weight: 400;
}

/* The wordmark asset is white (no dark variant exists publicly, D-004);
   header and auth screen are both light surfaces in light mode, so tint
   it to ink there and show it as-is on dark. */
.vx-brand-logo,
.vx-auth-brand-logo {
    filter: brightness(0) opacity(0.85);
}

:root.vx-scheme-dark .vx-brand-logo,
:root.vx-scheme-dark .vx-auth-brand-logo {
    filter: none;
}

@media (prefers-color-scheme: dark) {
    :root:not(.vx-scheme-light) .vx-brand-logo,
    :root:not(.vx-scheme-light) .vx-auth-brand-logo {
        filter: none;
    }
}
