/* =========================================================================
   xeberauto design tokens
   Defined once. Nothing downstream may hardcode a colour, size or spacing
   value; everything derives from here so a change lands everywhere at once.
   ========================================================================= */

/* ---------- Fonts, self hosted. No CDN at runtime. ---------------------- */

@font-face {
    font-family: 'Source Sans 3';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/sans-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Azerbaijani lives here: ə is U+0259, inside U+0100-02BA. */
@font-face {
    font-family: 'Source Sans 3';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/sans-400-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: 'Source Sans 3';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/sans-600-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Source Sans 3';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/sans-600-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: 'Source Serif 4';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/serif-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Source Serif 4';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/serif-700-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;
}

/* ---------- Light, the default ----------------------------------------- */

:root {
    color-scheme: light;

    /* Roughly 60% white and neutral, 30% surface grey, 10% accent.
       The accent belongs to interactive and category signals only; every
       decorative use of red weakens the ones that carry meaning. */
    --bg: #FFFFFF;
    --surface: #F7F8FA;
    --surface-2: #EEF1F5;
    --border: #E2E6EC;
    --text: #10151C;
    --text-muted: #5B6674;
    --accent: #C8102E;
    --accent-dark: #9E0C24;
    --accent-soft: #FDECEF;
    /* Text drawn on top of --accent. White clears 4.5:1 on the deep red but
       only reaches 3.0:1 on the lighter red dark mode needs, so the ink flips
       with the theme instead of being hardcoded at each call site. */
    --accent-ink: #FFFFFF;

    /* Admin only. Never used on the public site. */
    --ok: #1B7F4C;
    --warn: #B8860B;
    --danger: #C0392B;

    /* Type. Display carries headlines, body carries everything read at
       length, ui carries chrome. */
    --font-display: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-ui: var(--font-body);
    --font-mono: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;

    /* Ratio 1.25. Line height tightens as size grows. */
    --fs-xs: 0.75rem;    /* 12 */
    --fs-sm: 0.875rem;   /* 14 */
    --fs-base: 1rem;     /* 16 */
    --fs-md: 1.25rem;    /* 20 */
    --fs-lg: 1.5625rem;  /* 25 */
    --fs-xl: 1.9375rem;  /* 31 */
    --fs-2xl: 2.4375rem; /* 39 */

    --lh-tight: 1.15;
    --lh-snug: 1.3;
    --lh-normal: 1.5;
    --lh-relaxed: 1.7;

    /* 8px base. Multiples only, 4px permitted inside dense admin tables.
       Spacing encodes grouping: inside a card < between cards < between
       page blocks. Equal gaps everywhere is the failure to avoid. */
    --space-1: 0.25rem;  /* 4  admin only */
    --space-2: 0.5rem;   /* 8  */
    --space-3: 1rem;     /* 16 */
    --space-4: 1.5rem;   /* 24 */
    --space-5: 2rem;     /* 32 */
    --space-6: 3rem;     /* 48 */
    --space-7: 4rem;     /* 64 */
    --space-8: 6rem;     /* 96 */

    --radius-sm: 4px;
    --radius: 8px;

    /* Layered, one light source, subtle. Hairline borders are preferred to
       shadows on most cards. */
    --shadow-sm: 0 1px 2px rgba(16, 21, 28, 0.05);
    --shadow: 0 1px 3px rgba(16, 21, 28, 0.07), 0 4px 12px rgba(16, 21, 28, 0.05);
    --shadow-lg: 0 2px 6px rgba(16, 21, 28, 0.08), 0 12px 32px rgba(16, 21, 28, 0.10);

    --container: 1280px;
    --measure: 720px;   /* article reading column, 65-72 characters */

    --header-h: 116px;
    --header-h-condensed: 60px;

    --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);

    --z-header: 100;
    --z-drawer: 200;
    --z-overlay: 300;
    --z-toast: 400;
}

/* On a 1920 screen a 1280 container leaves a third of the display empty on
   either side, which reads as the page having failed to load rather than as
   restraint. The article reading column is capped separately by --measure,
   so widening the shell does not lengthen a line of body text. */
@media (min-width: 1560px) {
    :root {
        --container: 1440px;
    }
}

@media (min-width: 1800px) {
    :root {
        --container: 1560px;
    }
}

/* ---------- Dark: the same variable names, redefined -------------------- */

/* System preference, unless the reader has explicitly chosen light. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        color-scheme: dark;

        --bg: #0E1116;
        --surface: #161A21;
        --surface-2: #1E242C;
        --border: #29313B;
        --text: #E8EBEF;
        --text-muted: #98A2B0;

        /* Lifted off the light red: #C8102E on a dark ground fails contrast
           for text. This holds AA against --bg while staying the same hue. */
        --accent: #FF5A6E;
        --accent-dark: #FF8494;
        --accent-soft: #2A1419;
        --accent-ink: #10151C;

        --ok: #35C47A;
        --warn: #E0A340;
        --danger: #EF6B6F;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.45);
    }
}

/* Manual choice wins over the system in both directions. */
:root[data-theme='dark'] {
    color-scheme: dark;

    --bg: #0E1116;
    --surface: #161A21;
    --surface-2: #1E242C;
    --border: #29313B;
    --text: #E8EBEF;
    --text-muted: #98A2B0;
    --accent: #FF5A6E;
    --accent-dark: #FF8494;
    --accent-soft: #2A1419;
    --accent-ink: #10151C;

    --ok: #35C47A;
    --warn: #E0A340;
    --danger: #EF6B6F;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.45);
}
