/**
 * BIBLIOTECA DIGITALE — design tokens.
 *
 * The suite's single palette, typography scale and shape scale. Every bd-*
 * front-end stylesheet declares this file's handle (`bd-tokens`) in its own
 * $deps, so it is always in the document first whatever enqueue strategy the
 * consumer uses.
 *
 * ── Where the values come from ───────────────────────────────────────────────
 *
 * Not a brand book — there is none. They were sampled pixel by pixel from the
 * mockups in Grafica/, and the reasoning, the WCAG measurements and the
 * per-token provenance live in BD-docs/sottosistemi/05-design-system.md and in
 * Grafica/design-tokens.css. That second file is the documentary source and
 * must stay aligned with this one; it is NOT to be pasted into Divi's Custom
 * CSS box or a child theme any more. Two copies of the same :root in the
 * cascade is the fastest way to stop knowing which one wins.
 *
 * ── Why this ships inside a plugin ───────────────────────────────────────────
 *
 * CSS pasted into "Divi -> Theme Options -> Custom CSS" or into a child theme
 * is text anyone in wp-admin can delete without noticing, and no release
 * restores it. Shipped here it is versioned, arrives with the zip, updates with
 * the plugin, and no configuration panel can reach it.
 *
 * ── What is inherited from Divi, and what is not ─────────────────────────────
 *
 * Divi 5 ships no design-token set: not one of its stylesheets defines a custom
 * property. What it does put on :root at runtime is site configuration, and
 * only two groups of it are stable enough to build on:
 *
 *   - Five global colors whose ids are hardcoded in every Divi installation
 *     (GlobalData::$customizer_colors). Every OTHER global color an admin
 *     creates gets a per-site UUID id, so it can never be named here.
 *   - Six typography variables (Fonts::enqueue_footer_fonts()).
 *
 * The five colors and the two font families are inherited below, so changing
 * them in Divi propagates to the whole suite. Each is written as
 * `var(--gcid-..., <our value>)`: when Divi has it we follow, and when Divi is
 * absent, inactive, or simply did not emit that variable for this page — which
 * happens, since with Dynamic Assets on Divi prints only the colors its own
 * modules reference — our sampled value stands. There is no state in which a
 * plugin is left without a colour.
 *
 * Three Divi variables are deliberately NOT inherited, because Divi emits them
 * whether or not anyone chose them, so inheriting would silently replace a
 * measured value with a factory default rather than follow a decision:
 *
 *   --et_global_heading_font_weight   always emitted, defaults to 500; the
 *                                     mockups' headings are 700
 *   --et_global_body_font_weight      same, defaults to 500
 *   --et_global_body_font_size        always emitted, defaults to 14px; the
 *                                     mockups' body text is 16px
 *
 * In the other direction, a Divi Global Color can point AT any name defined
 * here through its "var CSS" toggle (write `bd-success-soft`, lowercase, no
 * leading -- and no var()) — the mechanism bd-company-teams already uses for
 * --bd-team-color. That is how a hand-built Divi module uses the semantic and
 * shape tokens Divi has no counterpart for, without anyone retyping a hex.
 *
 * @package BD_Shared
 */

:root {

    /* ── 1. Giappichelli blue — the platform's colour, the same for everyone ──
       Two blues of equal luminosity and different hue live in the mockups and
       have distinct roles: --bd-blue (pure) for text, titles, links and icons,
       --bd-blue-navy for solid fills. */
    --bd-blue:         var(--gcid-primary-color, #00008A);
    --bd-blue-navy:    var(--gcid-secondary-color, #01298A);
    --bd-blue-dark:    #022A5E;   /* hover, deep blue surfaces               */
    --bd-blue-darkest: #00006B;   /* pressed                                 */
    --bd-blue-muted:   #B1C1E5;   /* disabled states                         */
    --bd-blue-tint:    #EAF1FC;   /* active menu item, icon circles          */
    --bd-blue-wash:    #F3F5FB;   /* bands, side column                      */

    /* ── 2. Surfaces and borders ─────────────────────────────────────────── */
    --bd-white:         #FFFFFF;
    --bd-surface:       #FAFAFD;              /* card background             */
    --bd-bg-page:       #F9FAFE;              /* content area                */
    --bd-bg-subtle:     #F3F5FB;              /* sidebar, alternating bands  */
    --bd-border:        #DDE2F1;              /* decorative separators only  */
    --bd-border-strong: #7B8EC9;              /* field and control borders,
                                                 3.20:1 — WCAG 1.4.11        */
    --bd-border-subtle: rgba(15, 23, 42, .08);

    /* ── 3. Text ─────────────────────────────────────────────────────────────
       In the August mockups even the hero's intro paragraph is full blue. The
       blue-greys below are for running text and metadata, where full blue
       would be tiring to read at length. */
    --bd-text:         var(--gcid-body-color, #022A61);
    --bd-text-heading: var(--gcid-heading-color, #00008A);
    --bd-link:         var(--gcid-link-color, #00008A);
    --bd-text-slate:   #1E3351;   /* metadata: author, subject               */
    --bd-text-muted:   #5A6989;   /* secondary, inactive nav                 */
    --bd-text-subtle:  #5F6B94;   /* counters, placeholders — darkened from
                                     the mockups' #9AA2BE, unreadable at
                                     2.53:1                                  */
    --bd-text-invert:  #FFFFFF;

    /* ── 4. Institution accent — the one colour that varies per viewer ───────
       Emitted by BD_CT_Branding_Styles on every page load and always defined:
       no team, no colour configured, or logged out all fall back on their own.
       This file never redefines --bd-team-color; it only reads it.

       Use it ONLY where the mockups use it — header user button, active tab
       underline, highlighted card number and its icon circle. Widening that is
       how you end up with a different platform per university instead of one
       platform that recognises who is using it. */
    --bd-accent: var(--bd-team-color, var(--bd-blue));

    /* Soft tint of the accent, for highlighted icon circles. The first line is
       the fallback for browsers without color-mix(). */
    --bd-accent-soft: var(--bd-blue-tint);
    --bd-accent-soft: color-mix(in srgb, var(--bd-accent) 10%, #FFFFFF);

    /* ── 5. Semantic colours — fixed, NEVER derived from the accent ──────────
       Not a preference: in the two dashboard mockups the "TERMINATO" badge
       stays neutral grey even where the institution's accent is a completely
       different hue. The label carries the state, not just the colour, which
       is what makes an accent landing near a status colour harmless.

       --bd-danger is the one chosen rather than measured value: no error state
       appears in any mockup. It is a red at 6.54:1 on white. */
    --bd-success:      #00B85C;   /* fill / icon with a label — decorative   */
    --bd-success-ink:  #007E3F;   /* text, and icons standing alone          */
    --bd-success-soft: #E9F6EE;
    --bd-warning:      #C68209;   /* fill / icon with a label — decorative   */
    --bd-warning-ink:  #966307;   /* "SCADENZA" badge text                   */
    --bd-warning-soft: #FDF1E1;
    --bd-danger:       #B3261E;
    --bd-danger-soft:  #FBEAE8;
    --bd-info:         #00008A;
    --bd-info-soft:    #EAF1FC;
    --bd-neutral:      #5B6387;   /* "TERMINATO" badge text — darkened from
                                     the mockups' #646C94 (4.00:1)           */
    --bd-neutral-soft: #E0E4EC;

    /* Three rules that follow from the measured ratios, and bind:
       1. NEVER white text on --bd-warning (3.18:1) or --bd-success (2.62:1).
          On --bd-danger it is fine: 6.54:1.
       2. An icon standing ALONE, with no label beside it, uses the -ink
          variant: --bd-success 2.62:1 and --bd-cat-formazione 2.80:1 miss the
          3:1 of WCAG 1.4.11. With a text label beside it the icon is
          redundant and exempt.
       3. --bd-border (1.29:1) is for a decorative separator, never for the
          border of a field or a control — that needs --bd-border-strong. */

    /* ── 6. Catalogue categories ─────────────────────────────────────────── */
    --bd-cat-libri:           #00008A;
    --bd-cat-riviste:         #00B85C;
    --bd-cat-formazione:      #F8741C;   /* decorative only                  */
    --bd-cat-formazione-ink:  #B94D06;   /* text, and icons standing alone   */
    --bd-cat-formazione-soft: #FEF2EA;
    --bd-cat-edu:             #808080;
    --bd-edu:                 #E85848;   /* "Giappichelli edu" logotype      */

    /* ── 7. Typography ───────────────────────────────────────────────────────
       Headings: a high-contrast, narrow, compact serif. giappichelli.it
       declares 'Tiempos Headline',Georgia,serif and the mockups match its
       proportions and contrast. It is commercial (Klim) and must be licensed;
       free stand-ins, in order of verified similarity: Noto Serif Display,
       Newsreader, Playfair Display, Source Serif 4.

       Body: a geometric-humanist sans — round bowls, obliquely cut terminals,
       double-storey "a". It is NOT Karla, the sans giappichelli.it declares.
       The closest Google Font is Mulish, then Figtree and Nunito Sans.

       Both families follow Divi's Customizer when it is set: choose the font
       once there and the whole suite follows. Weights and sizes do not — see
       the file header for why. */
    --bd-font-serif: var(--et_global_heading_font, "Tiempos Headline"), "Noto Serif Display", Georgia, "Times New Roman", serif;
    --bd-font-sans:  var(--et_global_body_font, "Mulish"), "Karla", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --bd-lh:         var(--et_global_body_font_height, 1.7);

    /* Scale measured on the mockups at 1535-1920px wide */
    --bd-fs-h1: 42px;   /* serif 600/700                                     */
    --bd-fs-h2: 26px;   /* serif 700                                         */
    --bd-fs-h3: 20px;   /* sans 700                                          */
    --bd-fs-lg: 18px;
    --bd-fs-md: 16px;   /* body                                              */
    --bd-fs-sm: 14px;   /* secondary, metadata                               */
    --bd-fs-xs: 11px;   /* badges: uppercase, letter-spacing ~.06em          */

    --bd-fw-heading: 700;
    --bd-fw-body:    400;
    --bd-fw-medium:  600;

    /* ── 8. Shape ────────────────────────────────────────────────────────── */
    --bd-radius-sm:    6px;
    --bd-radius:      10px;   /* menu items                                  */
    --bd-radius-lg:   12px;   /* cards                                       */
    --bd-radius-pill: 999px;

    /* ── 9. Spacing — the mockups' internal card rhythm ──────────────────── */
    --bd-space-xs:  4px;
    --bd-space-sm:  8px;
    --bd-space:    12px;
    --bd-space-md: 16px;
    --bd-space-lg: 24px;
    --bd-space-xl: 40px;
}
