/* Clash Royale Stats 3.0.0 - "Arena" design tokens (T-002 / R-002 / D-022).

   Reproduces the :root block of design/v3/parts/common.css verbatim, then adds a
   CHART TOKEN block: the 2.0.0 property names the Chart.js builders still read
   as `getComputedStyle(...).getPropertyValue("--x")` (web/charts.js,
   web/screens/habits.js), mapped onto Arena values so the charts stay correctly
   themed without a hard-coded palette. T-016 retired the 2.0.0 shim stylesheet
   and, with it, every alias nothing under web/ reads any more.

   Rules the mapping follows:
     - Data-series colors are UNCHANGED (--series-1/2, --diverge-pos/neg keep
       their 2.0.0 hex values - the validated dataviz palette, dark column).
     - Gold is selection / brand chrome only. It is never a data series.
     - Status colors move to the Arena good/bad/warn trio.

   Fonts are vendored (web/vendor/fonts, OFL) - no third-party origin at runtime.
   Every URL in this file carries ?v=<APP_VERSION> so a NAS redeploy can never
   serve a phone a stale asset against a fresh index.html. */

/* ---------- vendored fonts ---------------------------------------------------
   Both faces are variable fonts; the weight RANGE in each @font-face descriptor
   is the axis range the file actually carries (Bricolage Grotesque: opsz 12-96 x
   wght 500-800, Manrope: wght 400-800). `font-display: swap` plus the system
   fallback stacks in --display/--body mean a blocked, missing or still-loading
   font file degrades to a system face, never to invisible text. */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("/static/vendor/fonts/bricolage-grotesque-latin.woff2?v=4.0.0") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, 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: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("/static/vendor/fonts/bricolage-grotesque-latin-ext.woff2?v=4.0.0") 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: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/static/vendor/fonts/manrope-latin.woff2?v=4.0.0") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, 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: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/static/vendor/fonts/manrope-latin-ext.woff2?v=4.0.0") 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;
}

/* ---------- Arena tokens (design/v3/parts/common.css :root, verbatim) ------- */

:root {
  color-scheme: dark;

  --bg: #0b0e14;
  --s1: #131826;
  --s2: #1a2131;
  --s3: #232c40;
  --line: rgba(255,255,255,.08);
  --line-2: rgba(255,255,255,.14);
  --ink: #f5f2ea;
  --ink-2: #b6bccb;
  /* R-005 needs AA (4.5:1) for text >= 12px on EVERY Arena surface. The
     artboard's #7b8397 measures 5.09 on --bg and 4.67 on --s1 but only 4.24 on
     --s2 and 3.68 on --s3, so muted 12px text inside a .card-flat tile or a
     .tag failed AA; #8d95aa is the same hue three steps lighter and measures
     6.45 / 5.91 / 5.37 / 4.66 on bg/s1/s2/s3 (T-016). */
  --ink-3: #8d95aa;
  --gold: #f5b83d;
  --gold-ink: #1a1200;
  --gold-soft: rgba(245,184,61,.14);
  --blue: #3987e5;
  --orange: #d95926;
  --aqua: #199e70;
  --yellow: #c98500;
  --elixir: #b45af2;
  --good: #2fbf71;
  --bad: #e5484d;
  --warn: #fab219;
  --good-soft: rgba(47,191,113,.14);
  --bad-soft: rgba(229,72,77,.14);
  --warn-soft: rgba(250,178,25,.14);
  --blue-soft: rgba(57,135,229,.16);
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Shell metrics - read by shell.css and by the sheet primitive in app.js. */
  --appbar-h: 56px;
  --tabbar-h: 84px;
  --side-w: 240px;
  --content-max: 1440px;

  /* ---------- chart tokens (the surviving 2.0.0 alias names) ----------
     The 2.0.0 shim stylesheet these also served is gone (T-016), but the chart
     builders still read THESE names through css("--x"): web/charts.js's `T`
     map, web/screens/habits.js's local builders and web/screens/war.js's
     comment trail. Every alias that nothing under web/ reads any more went with
     the shim (--page, --surface-2, --border, --series-3, --series-4,
     --status-warn, --accent-gold, --radius); their Arena equivalents (--bg,
     --s2, --line, --aqua, --yellow, --warn, --gold) are right above.
     Data-series colours are unchanged from 2.0.0 by design (D-022). */
  --surface-1: var(--s1);
  --surface-3: var(--s3);
  --text-primary: var(--ink);
  --text-secondary: var(--ink-2);
  --text-muted: var(--ink-3);
  --grid: rgba(255,255,255,.08);        /* = --line, but Chart.js needs a value, not a var() chain */
  --baseline: rgba(255,255,255,.14);    /* = --line-2, same reason */
  --series-1: #3987e5;                  /* blue   - unchanged from 2.0.0 */
  --series-2: #d95926;                  /* orange - unchanged from 2.0.0 */
  --diverge-pos: #3987e5;               /* unchanged from 2.0.0 */
  --diverge-neg: #e66767;               /* unchanged from 2.0.0 */
  --status-good: #2fbf71;               /* = --good  (was #0ca30c) */
  --status-critical: #e5484d;           /* = --bad   (was #d03b3b) */
}

/* ---------- base ---------- */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }

body {
  font-family: var(--body);
  color: var(--ink);
  font-size: 15px;                      /* mobile base (R-002) */
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
@media (min-width: 1024px) {
  body { font-size: 14px; }             /* desktop base (R-002) */
}

img { display: block; max-width: 100%; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: #ffd070; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  background: var(--s2); padding: 1px 5px; border-radius: 4px;
}

/* Tabular numerals utility: every figure the UI aligns in a column carries it
   (the type ramp classes .num/.display switch it on by themselves). */
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- reduced motion (R-005 / PLAN amendment 8) ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .livedot.pulse { animation: none !important; }
  .skeleton { animation: none !important; background: var(--s2) !important; }
  .sheet-backdrop, .tabbar { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
