/*
 * it2do.ch GmbH – design tokens (single source for web, apps, Keycloak, tools).
 * Documentation: CORPORATE-DESIGN.md §6. Colour values checked against WCAG 2.1 (ratios in the doc).
 *
 * Theme selection: light/dark follows the browser (prefers-color-scheme). A manual choice sets
 * <html data-theme="light|dark"> and is stored in the cookie "it2do-theme" (domain .it2do.ch, 1 year),
 * so every it2do page shares it.
 */
:root {
    /* ---- brand (never changes) ---- */
    --brand-blue: #0069b4;
    --brand-red: #c02026;
    --bar-height: 6px;

    /* ---- typography ---- */
    --font-sans: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "Roboto Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
    --text-xs: 0.75rem;    /* 12 px: eyebrow, badges, hints */
    --text-sm: 0.875rem;   /* 14 px: labels, secondary text, footer 13 px = 0.8125rem */
    --text-md: 1rem;       /* 16 px: body, fields, buttons */
    --text-lg: 1.25rem;    /* 20 px: card titles (h3) */
    --text-xl: 1.5rem;     /* 24 px: section titles (h2) */
    --text-2xl: 1.875rem;  /* 30 px: page title (h1); phones 26 px */
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-bold: 700;
    --leading-tight: 1.2;
    --leading-normal: 1.5;
    --tracking-eyebrow: 0.08em;

    /* ---- shape, spacing, motion ---- */
    --radius-sm: 6px;      /* badges, checkboxes */
    --radius: 8px;         /* fields, buttons, dropdowns */
    --radius-lg: 12px;     /* cards, dialogs, alerts */
    --control-height: 3rem;     /* 48 px fields + buttons (touch target) */
    --control-height-sm: 2.25rem; /* 36 px compact controls (header, mouse) */
    --touch-target: 2.75rem;      /* 44 px: compact controls on touch screens (pointer: coarse) */
    --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
    --space-5: 1.5rem; --space-6: 2rem; --space-7: 3rem;
    --duration: 150ms;
    --easing: cubic-bezier(0.4, 0, 0.2, 1);

    /* ---- light theme (default) ---- */
    color-scheme: light;
    --bg: #ffffff;                 /* page */
    --surface: #ffffff;            /* cards, fields, dropdown menus */
    --surface-muted: #f2f2f2;      /* table heads, read-only fields, code */
    --surface-hover: #eef3f9;      /* hovered rows / menu items (visible against white: 1.1:1 -> clearly lighter blue-grey) */
    --text: #1a1a1a;               /* body, page title */
    --text-muted: #5a5a5a;         /* secondary text, hints, footer */
    --text-on-color: #ffffff;      /* on red / blue buttons */
    --heading: #1a1a1a;            /* h1/h2 */
    --eyebrow: #0069b4;            /* small uppercase overline + section labels */
    --line: #d9dee5;               /* dividers, card borders (decorative) */
    --line-control: #8a94a3;       /* borders of fields, dropdowns, checkboxes (≥ 3:1) */
    --line-control-hover: #5a6577;
    --link: #0069b4;
    --link-hover: #00487d;
    --text-on-hover: #0069b4;      /* link-coloured text on --surface-hover (selected nav item, menu entry under the mouse): 5.1:1 */
    --focus-ring: 0 0 0 3px rgba(0, 105, 180, 0.35);

    /* actions */
    --primary: #c02026;            /* main action of a page (log in, save, confirm) */
    --primary-hover: #8e161b;
    --primary-active: #73121a;
    --secondary: #0069b4;          /* alternative action: blue outline */
    --secondary-hover-bg: rgba(0, 105, 180, 0.08);
    --secondary-active-bg: rgba(0, 105, 180, 0.16);
    --danger: #c02026;             /* destructive (delete): red outline, filled only in the confirm dialog */
    --danger-hover-bg: rgba(192, 32, 38, 0.08);
    --disabled-bg: #e9ecf0;
    --disabled-text: #8a94a3;

    /* status (alerts, badges, field messages) */
    --success: #15803d;  --success-bg: #ecf8f0;  --success-line: #a7dcb9;
    --warning: #b45309;  --warning-bg: #fdf5e7;  --warning-line: #f1cf98;
    --error: #c02026;    --error-bg: #fcf0f0;    --error-line: #efb7b9;
    --info: #0069b4;     --info-bg: #eef5fb;     --info-line: #a9cbe6;

    --logo: url("../img/logo-color.svg?v=5dc7718098");
    --watermark: url("../img/signet-color.svg?v=12695e2fbb");
    --watermark-opacity: 0.06;
    --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px -12px rgba(16, 24, 40, 0.18);
    /* one neutral shadow for EVERY button (primary, secondary, delete, action link) – no coloured glow */
    --shadow-button: 0 1px 2px rgba(16, 24, 40, 0.1), 0 4px 10px -4px rgba(16, 24, 40, 0.22);
    --shadow-button-hover: 0 2px 4px rgba(16, 24, 40, 0.12), 0 10px 20px -8px rgba(16, 24, 40, 0.3);
}

/* dark theme: browser preference unless the user chose light (block 1), or the user chose dark (block 2).
   Both blocks must stay identical – scripts/keycloak-theme-sync.py stops if they differ. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0b1220; --surface: #121a2b; --surface-muted: #1a2438; --surface-hover: #24345a;
        --text: #e8edf4; --text-muted: #9aa7ba; --heading: #e8edf4; --eyebrow: #4f9be8;
        --line: #2a3650; --line-control: #56678a; --line-control-hover: #7586a6;
        --link: #4f9be8; --link-hover: #8fc0f2; --text-on-hover: #8fc0f2; --focus-ring: 0 0 0 3px rgba(79, 155, 232, 0.45);
        --primary: #c02026; --primary-hover: #8e161b; --primary-active: #73121a;
        --secondary: #4f9be8; --secondary-hover-bg: rgba(79, 155, 232, 0.2); --secondary-active-bg: rgba(79, 155, 232, 0.32);
        --danger: #f0767b; --danger-hover-bg: rgba(240, 118, 123, 0.2);
        --disabled-bg: #1a2438; --disabled-text: #6b7a93;
        --success: #4ade80; --success-bg: #0f2a1d; --success-line: #1f5a3a;
        --warning: #fbbf24; --warning-bg: #2b2210; --warning-line: #5c4615;
        --error: #f0767b;   --error-bg: #2d1518;   --error-line: #6b2a2f;
        --info: #4f9be8;    --info-bg: #10223a;    --info-line: #24456e;
        --logo: url("../img/logo-white.svg?v=424eb6c4a1"); --watermark: url("../img/signet-white.svg?v=b5acad4a5e"); --watermark-opacity: 0.04;
        --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
        --shadow-button: 0 1px 2px rgba(0, 0, 0, 0.45), 0 4px 10px -4px rgba(0, 0, 0, 0.6);
        --shadow-button-hover: 0 2px 4px rgba(0, 0, 0, 0.5), 0 10px 20px -8px rgba(0, 0, 0, 0.7);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1220; --surface: #121a2b; --surface-muted: #1a2438; --surface-hover: #24345a;
    --text: #e8edf4; --text-muted: #9aa7ba; --heading: #e8edf4; --eyebrow: #4f9be8;
    --line: #2a3650; --line-control: #56678a; --line-control-hover: #7586a6;
    --link: #4f9be8; --link-hover: #8fc0f2; --text-on-hover: #8fc0f2; --focus-ring: 0 0 0 3px rgba(79, 155, 232, 0.45);
    --primary: #c02026; --primary-hover: #8e161b; --primary-active: #73121a;
    --secondary: #4f9be8; --secondary-hover-bg: rgba(79, 155, 232, 0.2); --secondary-active-bg: rgba(79, 155, 232, 0.32);
    --danger: #f0767b; --danger-hover-bg: rgba(240, 118, 123, 0.2);
    --disabled-bg: #1a2438; --disabled-text: #6b7a93;
    --success: #4ade80; --success-bg: #0f2a1d; --success-line: #1f5a3a;
    --warning: #fbbf24; --warning-bg: #2b2210; --warning-line: #5c4615;
    --error: #f0767b;   --error-bg: #2d1518;   --error-line: #6b2a2f;
    --info: #4f9be8;    --info-bg: #10223a;    --info-line: #24456e;
    --logo: url("../img/logo-white.svg?v=424eb6c4a1"); --watermark: url("../img/signet-white.svg?v=b5acad4a5e"); --watermark-opacity: 0.04;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    --shadow-button: 0 1px 2px rgba(0, 0, 0, 0.45), 0 4px 10px -4px rgba(0, 0, 0, 0.6);
    --shadow-button-hover: 0 2px 4px rgba(0, 0, 0, 0.5), 0 10px 20px -8px rgba(0, 0, 0, 0.7);
}
