/* ---------------------------------------------------------------------------
 * DISIE — design tokens (Visual Identity v3 Saffron)
 *
 * Single source of truth for typography, colour, surfaces, shape.
 *
 * Decision history: ADR-0006. The tokens here come from the v3 Saffron
 * iteration of the Claude Design bundle (see
 * docs/identity/v3-saffron-source.html, retained as reference).
 *
 * Phase 3.2 stop-gap on fonts: stack falls back to system serif/sans/mono.
 * Phase 3.3 self-hosts Source Serif 4 / Inter / JetBrains Mono from
 * /theme/disie/fonts/ via @font-face here — tokens stay unchanged.
 * --------------------------------------------------------------------------- */

:root {
    /* --- Paper / surfaces ---------------------------------------------- */
    --disie-bg:               #f6f4ee;          /* warm paper */
    --disie-surface:          #ffffff;
    --disie-surface-2:        #fbfaf5;
    --disie-border:           #e5e1d6;
    --disie-border-strong:    #c8c2b2;

    /* --- Ink scale (text) ---------------------------------------------- */
    --disie-ink-1:            #15181b;          /* strongest, headlines */
    --disie-ink-2:            #2a2e33;          /* body */
    --disie-ink-3:            #5a5f66;          /* muted */
    --disie-ink-4:            #8a8f96;          /* hint */

    /* --- Saffron system: yellow as fill, Bistre for text/links --------- */
    /* Bistre = warm dark-brown, plays the "deep accent" role for text
       and links. 7.45:1 contrast on warm paper. */
    --disie-bistre:           #5e4400;
    --disie-bistre-deep:      #4a3500;          /* hover / pressed */
    --disie-bistre-soft:      #f9eecd;          /* tinted surfaces */
    /* Saffron = the brand fill colour: blocks, buttons, stripes, highlights.
       NEVER used for body text (won't reach 4.5:1 on white). */
    --disie-saffron:          #f2c115;
    --disie-saffron-deep:     #d9a900;          /* hover on saffron fills */
    --disie-saffron-ink:      #15181b;          /* text on saffron */

    /* --- Secondary palette (used sparingly) ---------------------------- */
    --disie-ochre:            #8b5a1f;          /* section tags, kickers */
    --disie-ochre-soft:       #f3ead8;
    --disie-forest:           #2d5e3e;          /* OA marks, status */
    --disie-forest-soft:      #e3ede4;
    --disie-crimson:          #9a2a2a;          /* errata, retractions */

    /* --- Backwards-compatibility aliases for our existing component
           selectors. These let phase-2 stylesheet refs (--disie-accent
           etc.) keep working until everything migrates. */
    --disie-accent:           var(--disie-bistre);
    --disie-accent-strong:    var(--disie-bistre-deep);
    --disie-accent-soft:      var(--disie-bistre-soft);
    --disie-bg-card:          var(--disie-surface-2);
    --disie-text:             var(--disie-ink-2);
    --disie-muted:            var(--disie-ink-3);
    --disie-link:             var(--disie-bistre);
    --disie-link-hover:       var(--disie-bistre-deep);
    --disie-ink:              var(--disie-ink-1);

    /* --- Typography ---------------------------------------------------- */
    --disie-font-body:  "Source Serif 4", "Iowan Old Style", "Cambria", Georgia, serif;
    --disie-font-ui:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --disie-font-mono:  "JetBrains Mono", "SFMono-Regular", "Menlo", Consolas, "DejaVu Sans Mono", monospace;

    --disie-font-size-base:    18px;            /* serif body, was 17px */
    --disie-line-height-body:  1.6;
    --disie-line-height-tight: 1.15;

    /* --- Shape / shadow ------------------------------------------------ */
    --disie-radius-sm: 4px;
    --disie-radius:    6px;
    --disie-radius-lg: 10px;

    --disie-shadow-1: 0 1px 0 rgba(21, 24, 27, 0.04);
    --disie-shadow-2: 0 1px 2px rgba(21, 24, 27, 0.06),
                      0 4px 16px -8px rgba(21, 24, 27, 0.08);
    /* alias */
    --disie-shadow-sm: var(--disie-shadow-1);
    --disie-shadow:    var(--disie-shadow-2);

    --disie-content-max: 72ch;

    /* --- Spacing scale ------------------------------------------------- */
    --disie-space-xs:  0.5rem;
    --disie-space-sm:  0.75rem;
    --disie-space-md:  1rem;
    --disie-space-lg:  1.5rem;
    --disie-space-xl:  2rem;
    --disie-space-2xl: 3rem;
}

/* --- Dark mode (preference-driven; OJS has no toggle yet) -------------- */
@media (prefers-color-scheme: dark) {
    :root {
        --disie-bg:            #14181c;
        --disie-surface:       #1b2026;
        --disie-surface-2:     #20262d;
        --disie-border:        #2a323b;
        --disie-border-strong: #3d4750;

        --disie-ink-1: #f0ece3;
        --disie-ink-2: #d4d0c7;
        --disie-ink-3: #9aa0a8;
        --disie-ink-4: #6c727a;

        /* Bistre lifts to a warm gold to keep AA on the dark surface */
        --disie-bistre:       #f5d76e;
        --disie-bistre-deep:  #ffe78a;
        --disie-bistre-soft:  #2a2415;

        /* Saffron stays the same (fills don't need contrast lifting) */
        --disie-saffron-deep: #ffd64d;

        --disie-ochre:        #d4a76a;
        --disie-ochre-soft:   #2c2418;
        --disie-forest:       #8bc09c;
        --disie-forest-soft:  #1a2620;
        --disie-crimson:      #d97a7a;

        --disie-shadow-1: 0 1px 0 rgba(0, 0, 0, 0.4);
        --disie-shadow-2: 0 1px 2px rgba(0, 0, 0, 0.4),
                          0 4px 16px -8px rgba(0, 0, 0, 0.5);
    }
}
