/* Theme tokens — the single source of truth for both themes.
   The charte is sober by construction: neutral greys carry every surface, and a
   single blue is kept for the selected state and for the fill of a control that
   has to be found. There is no second hue and no brand gradient — a surface that
   needs to stand out takes a grey weight, not a colour.
   `:root` is the light theme and stays first; `html[data-theme="dark"]` below
   only redefines colours (never --radius or the three family tokens, which are
   shared) and is switched on by public/js/theme.js, before the first paint. */

:root {
    color-scheme: light;

    /* ---- neutral scale (light theme) ----
       The canvas and the blocks sitting on it share one value, as the charte has
       them: what separates a block from the page is its border, not a tint.
       --bg-secondary is the soft fill a control wears at rest (the composer's
       rounds, a select, a filter field): the charte's paper, 1.12:1 on white --
       enough to see a control's edge, light enough to leave the panels and the
       page one surface. */
    --bg-color: #ffffff;
    --panel-color: #ffffff;
    --input-bg: #ffffff;
    --bg-secondary: #eff3f4;

    /* ---- text ----
       Two levels carry the text, both from the charte's ink: --text-color for what
       is read, --text-dim for the counters, the muted metadata and the ornaments.
       The light theme reads 12.02:1 for the ink on white (10.76:1 on
       --bg-secondary) and 6.87:1 for the muted level (6.15:1 on --bg-secondary):
       both levels are read, so both are above AA. The muted one is a slate, a
       step from the ink and not a fade of it -- a level at 1.78:1 was decorative,
       and nowhere may a site that must be read take it. Where --text-dim sits on
       a filled control the pair is unchecked: those sites paint --on-accent
       instead. */
    --text-color: #26384a;
    --text-dim: #4a5c70;

    /* ---- the one blue ----
       The charte's petrol, used everywhere the interface turns blue: the fill of a
       control, a border that becomes active, the selected tab, the text that is
       blue (links, section headings, a selected label). It is the only blue of the
       charte that carries text -- 10.39:1 on white, 9.30:1 on --bg-secondary, and
       a white label on it reads 10.39:1 -- which is why the fill and the ink share
       it. --accent-dim is a lighter pass for a border that appears on hover,
       --accent-hover the shade a link takes when it is pointed at (the charte's
       link-hover, 2.00:1 against the petrol: a fill changing to it is seen). */
    --accent-color: #0a4174;
    --accent-dim: #7fb2e2;
    --accent-hover: #2a6fb6;
    --link-color: #0a4174;

    /* The light behind the voice call's panel: the accent, as it is -- the veil is a
       role of its own, so the name stays, and the value is the accent's in both themes. */
    --aura-color: var(--accent-color);

    /* ---- text drawn on a filled surface (light theme) ----
       --on-accent: on --accent-color; --on-veil: on the dark full-screen veils
       (media preview, loading spinner). */
    --on-accent: #ffffff;
    --on-veil: #ffffff;

    /* ---- borders ----
       Two weights: --border-color outlines a container, --panel-border-color
       draws the edge of a piece inside a container, inputs included -- a field
       is a piece, not a second kind of edge.

       The container's weight reads 1.46:1 on white: the stronger of the two,
       because with the canvas and the panels sharing one white it is what draws a
       block on the page. The piece's reads 1.18:1: a hairline for an edge inside a
       block that is already drawn by its contour. Neither is a
       control's boundary, so the 3:1 of WCAG 1.4.11 is not what these values are
       for, and each block reads by its fill as much as by its contour. */
    --border-color: #c7d8e5;
    --panel-border-color: #e8edf1;

    /* ---- list-row interaction tints ----
       The wash every clickable row of the left panels shares (session, memory,
       skills), and the hover of every quiet control: a pass of the charte's light
       blue, --accent-dim's family, so a row reads as pointed at or as selected
       without the panel gaining a second surface colour. Over a white panel the
       hover lands at 1.23:1 against the page (the ink still at 9.77:1) and the
       selected row one step further: two steps that stay told apart. */
    --row-hover-bg: rgba(189, 216, 233, 0.55);
    --row-selected-bg: rgba(189, 216, 233, 0.9);

    /* ---- state colours (light theme) ----
       Semantic, outside the neutral scale: a failure, a warning or a success
       keeps its own hue, because being told apart at a glance is the point. */
    --error-color: #b91c1c;
    --error-bright: #dc2626;
    /* The danger's fill under the pointer: one step further from the surface, the
       move --accent-hover makes for the blue. */
    --error-hover: #991b1b;
    --error-bg: #fdecea;
    --error-text: #b71c1c;
    --warn: #b45309;
    --danger-bg: #fef2f2;
    --danger-text: #b91c1c;
    --danger-border: #fecaca;
    --success-bg: #e8f5e9;
    --success-text: #1b5e20;

    /* ---- document format marks (light theme) ----
       The one place the charte's single-hue rule is deliberately departed from,
       and for one reason: a document's format is read before any word of it, and
       a reader looks for the colour of the format they know. These are OUR
       drawings, not Adobe's or Microsoft's icons -- those may not ship inside a
       third-party application without a licence -- so the sheet, the fold and the
       letters are ours, and the format is always also spelled out in text on the
       card: the colour is a second signal, never the only one. */
    --doc-mark-pdf: #b3261e;
    --doc-mark-docx: #2b579a;
    --doc-mark-xlsx: #1e7145;
    --doc-mark-pptx: #c2410c;
    --doc-mark-text: #5b626b;
    --doc-mark-audio: #6d4aa8;
    --doc-media-backdrop: #000;
    --doc-mark-video: #2f4a6d;
    /* The folded corner and the letter, drawn on the format's own colour. */
    --doc-mark-fold: rgba(255, 255, 255, 0.34);
    --doc-mark-glyph: #ffffff;

    /* ---- a provider's own mark (both themes) ----
       Meta is the one connector the panel draws as a GLYPH instead of a file:
       its logotype is a wide wordmark that a 48px square letterboxes into an
       unreadable sliver. The colour is the light end of the gradient in Meta's
       own asset (#0081FB -> #0064E0), and it keeps the SAME value in both themes
       instead of being re-tinted like the state colours: measured, it reads
       3.8:1 on the light panel and 4.45:1 on the dark one, above the 3:1 a
       non-text mark owes, and a brand colour nobody owns is a colour the reader
       no longer recognises. */
    --connector-mark-meta: #0081fb;

    /* ---- shadows, focus ring and veils (light theme) ----
       Calibrated for light surfaces: the dark theme re-tints them, because a
       shadow mixed for a light background is invisible on a dark one. */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.45);
    --shadow-float: 2px 2px 5px rgba(0, 0, 0, 0.2);
    --shadow-auth: 0 28px 80px rgba(0, 0, 0, 0.14);
    --focus-ring: 0 0 0 3px rgba(110, 165, 220, 0.40);
    --overlay-bg: rgba(20, 20, 20, 0.82);
    --spinner-veil: rgba(0, 0, 0, 0.5);

    /* ---- radii ----
       Two roles, two tokens. A CONTROL -- a button, a field, a menu's surface,
       a clickable row, a tooltip -- takes the smaller corner; a SURFACE -- a card,
       a bubble, a notice, a frame, and a block framed inside a card -- the
       larger one. A circle (50%) and a pill (999px) are shapes, not steps, and
       stay literal. */
    --radius-control: 10px;
    --radius-surface: 12px;

    /* ---- families ----
       Three roles, three faces, all served from public/fonts (see fonts.css).
       Lato carries the body. It ships two weights only, 400 and 700 -- plus a 400
       italic -- so every font-weight in the stylesheets is written in one of those
       two values: a 500 or a 600 has no face to land on and the browser would
       silently pick a neighbour. Montserrat dresses the titles -- a panel's head
       line, a card's, the tiles of the administration, the column's brand name --
       and a project's group header in the tree; Oleo Script the avatar's letter. A
       face nothing asks for is never downloaded, so a family left declared ahead of
       its zone costs nothing. */

    --lato: "Lato", sans-serif;
    --montserrat: "Montserrat", sans-serif;
    --oleo: "Oleo Script Swash Caps", cursive;
}

/* ---- dark theme ----
   Only colours: every token below is consumed by the same rules as its light
   counterpart, so no stylesheet has to know which theme is active.
   The scale is the light one inverted -- the same three greys, the same one
   blue -- and the borders are lifted, because a hairline that reads on white
   disappears on a near-black surface.
   Contrast (checked by tests/front/test_theme_tokens.py): 4.5:1 on the main
   text, links and accent; 3:1 on dimmer text, borders and meaningful icons; and
   never worse than the light-theme ratio for a given pair. */
html[data-theme="dark"] {
    color-scheme: dark;

    /* Neutral scale: the surfaces keep the blue-tinted greys the app already
       used at night -- they read cooler than a pure neutral, and they cost
       nothing in contrast, being darker than the light theme's counterparts.
       The canvas stays deeper than the panels, which is what the light theme
       cannot do (white is its floor). The soft fill sits one notch above the
       canvas so the composer bar and a hovered control still read as a band,
       and the field stays the lightest surface of the four. */
    --bg-color: #0f131b;
    --panel-color: #171d29;
    --input-bg: #1c232f;
    --bg-secondary: #12171f;

    /* Text */
    --text-color: #e6e6e6;
    --text-dim: #b4b4b4;

    /* The one blue, raised so it reads on a dark surface: --on-accent stays a
       near-black, which is what keeps a label legible on a light-blue fill. */
    --accent-color: #7fb0dd;
    --accent-dim: #6a9bc9;
    --accent-hover: #a8cff0;
    --link-color: #8dbde8;
    --on-accent: #10151b;
    --on-veil: #f4f6fa;

    /* The light behind the voice call's panel: the accent, as in the light theme. */
    --aura-color: var(--accent-color);

    /* Borders: the container's edge is the stronger one here too. */
    --border-color: rgba(255, 255, 255, 0.46);
    --panel-border-color: rgba(255, 255, 255, 0.38);

    /* List-row interaction tints */
    --row-hover-bg: rgba(127, 176, 221, 0.14);
    --row-selected-bg: rgba(127, 176, 221, 0.22);

    /* State colours: light-theme values are calibrated for light surfaces and
       would be unreadable here, so each one is re-tinted for dark surfaces. */
    --error-color: #ff8f8f;
    --error-bright: #ff6b6b;
    --error-hover: #ffadad;
    --error-bg: #3a1c22;
    --error-text: #ffb4b4;
    --warn: #f5b544;
    --danger-bg: #3a1c22;
    --danger-text: #ffb4b4;
    --danger-border: #8a3a44;
    --success-bg: #14301f;
    --success-text: #8ce9a8;
    /* Document format marks: the same five hues, lifted so the sheet still reads
       as a format on a dark surface instead of sinking into the panel. The fold
       and the letter keep their light values -- they are drawn on the mark. */
    --doc-mark-pdf: #e05252;
    --doc-mark-docx: #4a86d8;
    --doc-mark-xlsx: #2f9e6b;
    --doc-mark-pptx: #e2703a;
    --doc-mark-text: #8b93a1;
    --doc-mark-audio: #a98be0;
    --doc-media-backdrop: #0b0d10;
    --doc-mark-video: #7fa3d4;
    /* The fold and the letter are drawn ON the mark, so they stay the same in
       both themes; the pair is redeclared here because a colour token without a
       dark value is a token nobody checked on the other theme. */
    --doc-mark-fold: rgba(255, 255, 255, 0.28);
    --doc-mark-glyph: #ffffff;
    /* A provider's own mark: the SAME value as the light block, on purpose --
       Meta's blue reads 4.45:1 on this panel, and re-tinting a brand colour is
       how a mark stops being recognised. */
    --connector-mark-meta: #0081fb;
    /* Shadows, focus ring and veils */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.6);
    --shadow-float: 2px 2px 5px rgba(0, 0, 0, 0.5);
    --shadow-auth: 0 28px 80px rgba(0, 0, 0, 0.55);
    --focus-ring: 0 0 0 3px rgba(127, 176, 221, 0.35);
    --overlay-bg: rgba(0, 0, 0, 0.78);
    --spinner-veil: rgba(0, 0, 0, 0.6);
}
