/* ============================================================
   DESIGN TOKENS — the only place with colours and fonts (W-39, D-35)
   Token names come from Apply (PROVENANCE.md); values follow workset.eu
   (read 2026-10-02). Change a value here and every screen follows.
   Dark by default · the light block at the end is Apply's and unused
   (nothing sets data-theme); the theme configurator will revisit it.
   ============================================================ */

/* ── Fonts, served from /static/fonts (W-39 R5): never from a third party (CSP, privacy) ── */
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/jetbrains-mono/JetBrainsMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ── Surfaces ──────────────────────────────────────────── */
  --bg-deep:         #050D1A;          /* top bar, footer, alternate bands */
  --bg-base:         #0A1628;          /* page ground */
  --bg-elevated:     #0F2040;          /* cards */
  --bg-glass:        rgba(15, 32, 64, 0.72);
  --bg-glass-strong: #162A50;          /* a card inside a card */
  --bg-input:        rgba(5, 13, 26, 0.45);
  --bg-input-focus:  rgba(5, 13, 26, 0.60);

  /* ── Text scale ────────────────────────────────────────── */
  --text-primary:    #F0F4F8;
  --text-secondary:  #8BA3B8;
  --text-tertiary:   #8198AD;
  --text-disabled:   #4A6070;          /* disabled controls only: below 4.5:1 on purpose */
  --text-on-accent:  #02201D;          /* sits ON accent fills and the accent gradient */

  /* ── Borders ───────────────────────────────────────────── */
  --border-subtle:   rgba(255, 255, 255, 0.07);
  --border-default:  rgba(255, 255, 255, 0.10);
  --border-strong:   rgba(255, 255, 255, 0.18);

  /* ── Brand ─────────────────────────────────────────────── */
  --accent:          #2FE6A8;          /* mint */
  --accent-soft:     rgba(47, 230, 168, 0.12);
  --accent-glow:     rgba(47, 230, 168, 0.15);
  --accent-ring:     rgba(47, 230, 168, 0.35);
  --accent-pressed:  #22C493;
  --accent-2:        #00E5FF;          /* cyan */
  --accent-3:        #038F8F;          /* teal */
  --accent-gradient: linear-gradient(135deg, var(--accent-2) 0%, var(--accent) 100%);

  /* ── Semantic colors ───────────────────────────────────── */
  --success:         #34D399;
  --success-soft:    rgba(52, 211, 153, 0.12);
  --warning:         #FF8A3D;
  --warning-soft:    rgba(255, 138, 61, 0.12);
  --danger:          #F87171;
  --danger-soft:     rgba(248, 113, 113, 0.09);
  --danger-ring:     rgba(248, 113, 113, 0.35);
  --info:            #00E5FF;
  --info-soft:       rgba(0, 229, 255, 0.12);

  /* ── Score ramp (W-52): six steps from red to green, under the ink of an accent fill ──
     Steps 0, 2 and 5 are the danger, the warning and the success colour, letter by letter. Step 1 is half way
     from danger to warning. Steps 3 and 4 are one third and two thirds of the way from warning to success.
     The three mixed steps are mixed in OKLab and written by hand: when one of the three colours changes, they
     are worked out again. */
  --level-0:         #F87171;
  --level-1:         #FC7E5B;
  --level-2:         #FF8A3D;
  --level-3:         #D4A862;
  --level-4:         #9EC07F;
  --level-5:         #34D399;

  /* ── Typography ────────────────────────────────────────── */
  --font:            "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:       "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --fw-regular:      400;              /* the normal weight, for a rule that has to write it (monospaced marks) */
  --fw-medium:       450;              /* quiet buttons, field labels, names */
  --fw-strong:       500;              /* buttons, table headers, the labels of the report */
  --fw-heading:      600;              /* staff headings and the primary button: lighter than the browser bold */

  --t-label: 12px;                     /* monospaced capital labels and nothing else (W-55 R3) */
  --t-xs:    13px;                     /* the floor, equal to the next step on purpose (W-55 R2) */
  --t-sm:    13px;
  --t-base:  16px;
  --t-md:    17px;
  --t-lg:    20px;
  --t-xl:    24px;
  --t-2xl:   32px;
  --t-3xl:   44px;
  --t-4xl:   60px;
  --t-5xl:   84px;
  --ls-sm:   0.01em;                   /* letter-spacing of Inter text at 13 px (W-55 R10) */
  --lh-read: 1.65;                     /* line height of text read at length (W-55 R16) */
  --measure: 35em;                     /* its longest line, about 73 characters at any size (W-55 R16) */

  /* ── Spacing scale (4-based) ───────────────────────────── */
  --s-1:  4px;   --s-2:  8px;   --s-3:  12px;  --s-4:  16px;
  --s-5:  20px;  --s-6:  24px;  --s-8:  32px;  --s-10: 40px;
  --s-12: 48px;  --s-16: 64px;  --s-20: 80px;  --s-24: 96px;

  /* ── Radius scale ──────────────────────────────────────── */
  --r-xs:    6px;
  --r-sm:    10px;
  --r-md:    14px;
  --r-lg:    20px;
  --r-xl:    28px;
  --r-full:  9999px;

  /* ── Easing curves (iOS-like) ──────────────────────────── */
  --ease-out:    cubic-bezier(0.32, 0.72, 0, 1);
  --ease-in:     cubic-bezier(0.6, 0, 0.84, 0);
  --ease-io:     cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Duration ──────────────────────────────────────────── */
  --d-fast:   140ms;
  --d-base:   220ms;
  --d-slow:   420ms;

  /* ── Shadows ───────────────────────────────────────────── */
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:   0 4px 12px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg:   0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px var(--accent-glow);

  /* ── Layout ────────────────────────────────────────────── */
  --container:   min(92vw, 1200px);
  --container-narrow: min(92vw, 720px);

  /* ── Z-index ───────────────────────────────────────────── */
  --z-bg:    -1;
  --z-base:   0;
  --z-float: 10;
  --z-nav:   100;
  --z-modal: 1000;
}

/* ============================================================
   LIGHT MODE — WorkSet brand teal, more conservative
   Activated by html[data-theme="light"]
   ============================================================ */
[data-theme="light"] {
  --bg-base:         #f5f7fa;
  --bg-elevated:     #ffffff;
  --bg-glass:        rgba(255, 255, 255, 0.70);
  --bg-glass-strong: rgba(255, 255, 255, 0.88);
  --bg-input:        rgba(0, 0, 0, 0.02);
  --bg-input-focus:  rgba(2, 98, 98, 0.04);

  --text-primary:    #0a1628;
  --text-secondary:  #4a6070;
  --text-tertiary:   #5a7184;
  --text-disabled:   #c3d0db;
  --text-on-accent:  #ffffff;

  --border-subtle:   rgba(2, 98, 98, 0.08);
  --border-default:  rgba(2, 98, 98, 0.14);
  --border-strong:   rgba(2, 98, 98, 0.24);

  --accent:          #026262;          /* WorkSet teal */
  --accent-soft:     rgba(2, 98, 98, 0.10);
  --accent-glow:     rgba(2, 98, 98, 0.25);
  --accent-pressed:  #014545;

  --accent-2:        #4338ca;
  --accent-3:        #be185d;

  /* ── Semantic colors ───────────────────────────────────────
     D-137: a semantic token is "the color THIS theme uses to mean success",
     not a brand constant — so it gets redefined per theme, exactly like
     --text-* and --accent above. The :root values are calibrated for a dark
     surface (7.0-11.6:1 there) and were falling to 1.56-2.58:1 on white,
     which made every status badge and score pill effectively invisible in
     light mode. These hold the hue instead of muddying it the way darkening by
     multiplication does.
     Ratios measured in the browser against the REAL composited badge background, not a
     hand-computed one — the 700 tints landed at 4.33-4.37:1 there, just under the bar,
     so success and warning take the 800 step. The -soft fills stay as they are: they
     read as pale washes on a light surface, and darkening them would eat the very
     contrast these values buy. */
  --success:         #166534;           /* 4.66:1 measured on its badge · 6.07:1 on #fff */
  --warning:         #854d0e;           /* 4.71:1 · 6.15:1 */
  --danger:          #b91c1c;           /* 5.75:1 · 6.47:1 */
  --info:            #1d4ed8;           /* 6.04:1 · 6.70:1 */

  --shadow-sm:   0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg:   0 12px 32px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.05);
}
