/* ==========================================================================
   Fantascript design system "Fanta Navy" - tokens
   public/css/fs/tokens.css  (load first, then components.css)

   - Custom properties + @font-face only. No selectors other than :root and
     the media queries that retune the same properties. Safe on every page,
     including the key-system pages that host third-party ad DOM.
   - Every token is namespaced --fs-* so an injected stylesheet (ad creative,
     widget) can never collide with it.
   - Dark only. Text/surface pairs are WCAG 2 AA (ratios in the comments and
     in design/final/styleguide.html).
   - Fonts are self-hosted (SIL OFL 1.1, licences in /fonts/). Paths are
     relative to this file, so they work from /css/fs/ and from file://.
   ========================================================================== */

/* ---- Fonts -------------------------------------------------------------- */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../../fonts/inter-latin-wght-normal.woff2") format("woff2-variations"),
       url("../../fonts/inter-latin-wght-normal.woff2") 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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations"),
       url("../../fonts/inter-latin-ext-wght-normal.woff2") 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: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../../fonts/inter-cyrillic-wght-normal.woff2") format("woff2-variations"),
       url("../../fonts/inter-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url("../../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations"),
       url("../../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ---- Surfaces: deep navy, lighter = closer to the viewer -------------- */
  --fs-bg: #141c28;            /* page                                      */
  --fs-well: #0f1620;          /* code wells, key box, chart inset          */
  --fs-field: #121a26;         /* inputs sitting on a surface (inset)       */
  --fs-surface: #1b2433;       /* cards, table containers, sidebar tiles    */
  --fs-surface-2: #1f2a3a;     /* card head strips, nested panels           */
  --fs-raised: #223044;        /* menus, dialogs, popovers, toasts          */
  --fs-raised-2: #283851;      /* hover/selected on raised; segmented "on"  */
  --fs-field-raised: #1b2433;  /* inputs inside raised panels (in-game look)*/
  --fs-side-top: #1d283a;      /* sidebar gradient, lit from the top-left   */
  --fs-side-mid: #18212f;
  --fs-side-bottom: #141c28;
  --fs-scrim: rgba(7, 11, 18, 0.66);

  /* ---- Lines (blue-tinted alpha, sit on any navy) ----------------------- */
  --fs-line-subtle: rgba(148, 178, 230, 0.075);
  --fs-line: rgba(148, 178, 230, 0.12);
  --fs-line-strong: rgba(148, 178, 230, 0.2);
  --fs-line-field: #394a64;        /* input border                          */
  --fs-line-field-hover: #4d6286;
  --fs-hover: rgba(148, 178, 230, 0.06);   /* row / item hover wash          */
  --fs-hover-strong: rgba(148, 178, 230, 0.1);

  /* ---- Text ------------------------------------------------------------- */
  --fs-text: #eef3fa;          /* 13.99:1 surface · 10.61:1 raised-2        */
  --fs-text-2: #a6b3c7;        /*  7.35:1 surface ·  5.58:1 raised-2        */
  --fs-text-3: #8d9ab0;        /*  5.48:1 surface ·  4.69:1 raised. Never on
                                   raised-2 (4.16:1): use text-2 there       */
  --fs-text-placeholder: #8592a8; /* 5.56:1 on field, 4.96:1 on surface     */
  --fs-text-disabled: #5f6c80; /* disabled ink only (WCAG exempt)           */
  --fs-ink: #0a1424;           /* text on accent / bright fills (6.71:1)    */

  /* ---- Brand accent: soft blue of the in-game Fanta menus --------------- */
  --fs-accent: #5b9cff;        /* marks, rings, fills (5.68:1 on surface).
                                   Accent-coloured TEXT uses --fs-accent-text */
  --fs-accent-hi: #74acff;     /* hover                                     */
  --fs-accent-lo: #4b8cf2;     /* pressed                                   */
  --fs-accent-text: #8dbbff;   /* links / small accent text (7.93:1)        */
  --fs-accent-soft: rgba(91, 156, 255, 0.14);
  --fs-accent-soft-2: rgba(91, 156, 255, 0.22);
  --fs-accent-line: rgba(91, 156, 255, 0.45);
  --fs-focus: #8fbcff;         /* focus ring (8.8:1 on page)                */

  /* ---- Status (always paired with an icon or a word) -------------------- */
  --fs-success: #3ddc97;
  --fs-success-text: #7ee8b9;
  --fs-success-soft: rgba(61, 220, 151, 0.13);
  --fs-success-line: rgba(61, 220, 151, 0.32);
  --fs-warning: #ffb547;
  --fs-warning-text: #ffcf87;
  --fs-warning-soft: rgba(255, 181, 71, 0.13);
  --fs-warning-line: rgba(255, 181, 71, 0.34);
  --fs-danger: #ff6b7a;
  --fs-danger-text: #ff9ea8;
  --fs-danger-soft: rgba(255, 107, 122, 0.13);
  --fs-danger-line: rgba(255, 107, 122, 0.36);
  --fs-danger-solid: #cf3a4d;  /* white text 4.81:1                         */
  --fs-danger-solid-hi: #b93244;  /* hover: darker, white 5.9:1           */
  --fs-neutral: #8796ad;
  --fs-neutral-text: #b4c0d1;
  --fs-neutral-soft: rgba(148, 163, 184, 0.12);
  --fs-neutral-line: rgba(148, 163, 184, 0.26);

  /* ---- Product identity hues ---------------------------------------------
     Icon tiles, active nav rail, product chips and empty-state art ONLY.
     Buttons, links, focus and selection are always brand blue, so a product
     hue never competes with an action. Keys = the shared key system.      */
  --fs-hue-keysystem: #5b9cff;
  --fs-hue-keysystem-soft: rgba(91, 156, 255, 0.16);
  --fs-hue-keysystem-text: #8dbbff;
  --fs-hue-roblox: #a78bfa;    /* violet                                    */
  --fs-hue-roblox-soft: rgba(167, 139, 250, 0.16);
  --fs-hue-roblox-text: #c9b8ff;
  --fs-hue-cr: #f2c94c;        /* Clash Royale: gold                        */
  --fs-hue-cr-soft: rgba(242, 201, 76, 0.15);
  --fs-hue-cr-text: #f7dc8a;
  --fs-hue-onestate: #2dd4bf;  /* OneState: teal                            */
  --fs-hue-onestate-soft: rgba(45, 212, 191, 0.15);
  --fs-hue-onestate-text: #7eeadb;
  --fs-hue-system: #94a3b8;    /* System group: slate                       */
  --fs-hue-system-soft: rgba(148, 163, 184, 0.14);
  --fs-hue-system-text: #c4cfdd;

  /* ---- Data viz (dataviz validator, dark, on #1b2433: lightness band,
     chroma, CVD dE 12.8, normal dE 27.4, contrast >= 3:1 - all PASS).
     Fixed order, never cycled: 1 launches, 2 script loads, 3 key/verify.  */
  --fs-viz-1: #5b9cff;
  --fs-viz-2: #e76624;
  --fs-viz-3: #00a888;
  --fs-viz-muted: #46556d;     /* sparkline history / de-emphasis           */
  --fs-viz-grid: rgba(148, 178, 230, 0.08);
  --fs-viz-axis: rgba(148, 178, 230, 0.22);
  --fs-viz-track: rgba(148, 178, 230, 0.08);

  /* ---- Discord (quiet outlined CTA; solid only in the library band) ----- */
  --fs-discord: #5865f2;       /* white text 4.61:1                         */
  --fs-discord-hi: #6873f4;
  --fs-discord-soft: rgba(88, 101, 242, 0.12);
  --fs-discord-line: rgba(88, 101, 242, 0.48);
  --fs-discord-text: #c7cbff;  /* 9.6:1 on surface                          */

  /* ---- Typography ------------------------------------------------------- */
  --fs-font-sans: "Inter Variable", "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --fs-font-mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, "SFMono-Regular",
    "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  --fs-size-11: 0.6875rem;  /* 11px  kbd hints, overlines                   */
  --fs-size-12: 0.75rem;    /* 12px  captions, table headers, meta          */
  --fs-size-13: 0.8125rem;  /* 13px  tables, dense UI                       */
  --fs-size-14: 0.875rem;   /* 14px  admin body                             */
  --fs-size-15: 0.9375rem;  /* 15px  card titles, public body               */
  --fs-size-16: 1rem;       /* 16px  inputs on touch, lead                    */
  --fs-size-18: 1.125rem;   /* 18px  dialog / empty-state titles            */
  --fs-size-20: 1.25rem;    /* 20px  mobile page title                      */
  --fs-size-24: 1.5rem;     /* 24px  page title                             */
  --fs-size-28: 1.75rem;    /* 28px  KPI value, key-page title              */
  --fs-size-32: 2rem;       /* 32px  public section title                   */
  --fs-size-40: 2.5rem;     /* 40px  public hero (tablet)                   */
  --fs-size-56: 3.5rem;     /* 56px  public hero                            */

  --fs-lh-tight: 1.15;
  --fs-lh-snug: 1.3;
  --fs-lh-normal: 1.5;
  --fs-lh-relaxed: 1.6;

  --fs-w-regular: 400;
  --fs-w-medium: 500;
  --fs-w-semibold: 600;
  --fs-w-bold: 700;
  --fs-w-heavy: 750;

  --fs-tracking-tight: -0.02em;
  --fs-tracking-snug: -0.01em;
  --fs-tracking-caps: 0.08em;

  /* ---- Spacing (4 px grid) ---------------------------------------------- */
  --fs-sp-0-5: 2px;
  --fs-sp-1: 4px;
  --fs-sp-1-5: 6px;
  --fs-sp-2: 8px;
  --fs-sp-2-5: 10px;
  --fs-sp-3: 12px;
  --fs-sp-4: 16px;
  --fs-sp-5: 20px;
  --fs-sp-6: 24px;
  --fs-sp-7: 28px;
  --fs-sp-8: 32px;
  --fs-sp-10: 40px;
  --fs-sp-12: 48px;
  --fs-sp-16: 64px;
  --fs-sp-20: 80px;

  /* ---- Radii (generous, like the in-game panels) ------------------------ */
  --fs-r-xs: 6px;    /* chips, kbd                                        */
  --fs-r-sm: 8px;    /* small buttons, tiles                              */
  --fs-r-md: 10px;   /* buttons, inputs                                   */
  --fs-r-lg: 12px;   /* nested panels, menus, alerts                      */
  --fs-r-xl: 14px;   /* cards                                             */
  --fs-r-2xl: 18px;  /* dialogs, key-page card                            */
  --fs-r-3xl: 24px;  /* public feature panels                             */
  --fs-r-full: 999px;

  /* ---- Elevation: navy-tinted black + a 1 px top sheen ------------------ */
  --fs-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  --fs-shadow-xs: 0 1px 2px rgba(3, 7, 14, 0.35);
  --fs-shadow-sm: 0 2px 8px -2px rgba(3, 7, 14, 0.5);
  --fs-shadow-md: 0 12px 32px -12px rgba(3, 7, 14, 0.75), 0 2px 6px rgba(3, 7, 14, 0.35);
  --fs-shadow-lg: 0 28px 64px -18px rgba(3, 7, 14, 0.85), 0 8px 20px rgba(3, 7, 14, 0.45);
  --fs-glow-accent: 0 0 0 1px rgba(91, 156, 255, 0.55), 0 8px 22px -8px rgba(91, 156, 255, 0.7);
  --fs-ring: 0 0 0 3px rgba(91, 156, 255, 0.35);

  /* ---- Controls ---------------------------------------------------------
     Retuned below for touch: every control >= 44 px, inputs 16 px text.  */
  --fs-h-xs: 28px;
  --fs-h-sm: 32px;
  --fs-h-md: 38px;
  --fs-h-lg: 44px;
  --fs-h-xl: 52px;
  --fs-input-size: var(--fs-size-14);    /* text in inputs / selects     */
  --fs-input-size-sm: var(--fs-size-13); /* small + mono inputs          */
  --fs-code-size: 12.5px;                /* code textareas               */
  --fs-hit-pad: 0px;          /* invisible hit-area extension (touch)      */

  /* ---- Layout ----------------------------------------------------------- */
  --fs-sidebar-w: 272px;
  --fs-topbar-h: 60px;
  --fs-content-max: 1360px;
  --fs-gutter: 32px;

  /* ---- Motion (0 ms under prefers-reduced-motion) ----------------------- */
  --fs-ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --fs-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --fs-dur-1: 120ms;
  --fs-dur-2: 180ms;
  --fs-dur-3: 260ms;

  /* ---- Layers ----------------------------------------------------------- */
  --fs-z-topbar: 30;
  --fs-z-sidebar: 40;
  --fs-z-menu: 50;
  --fs-z-drawer: 60;
  --fs-z-savebar: 25;
  --fs-z-toast: 90;
}

/* Narrow or touch: every interactive control >= 44 px, form text 16 px
   (iOS never zooms on focus), gutters tighten. */
@media (max-width: 1023.98px), (pointer: coarse) {
  :root {
    --fs-h-xs: 36px;
    --fs-h-sm: 44px;
    --fs-h-md: 44px;
    --fs-h-lg: 48px;
    --fs-h-xl: 56px;
    --fs-input-size: var(--fs-size-16);
    --fs-input-size-sm: var(--fs-size-16);
    --fs-code-size: var(--fs-size-16);
    --fs-hit-pad: 4px;
  }
}
@media (max-width: 1023.98px) {
  :root { --fs-gutter: 20px; }
}
@media (max-width: 479.98px) {
  :root { --fs-gutter: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --fs-dur-1: 0ms;
    --fs-dur-2: 0ms;
    --fs-dur-3: 0ms;
  }
}
