/* ============================================================================
 * MYSTRIX TOKENS — the one canonical source of the product's design tokens.
 *
 * IMP-1840. The `--st-*` values and the self-hosted font faces were authored in
 * the creator app's studio.css under IMP-0626 from
 * docs/design/MYSTRIX_DESIGN_LANGUAGE.md; the palette, type roles and radius
 * values are that brief's decisions, not new ones. This file is now the single
 * editable source: scripts/frontend/sync_shared_js.py publishes a
 * byte-identical copy into the creator and admin apps (the same way the shared
 * JS utilities are published), and neither app defines its own copy of the
 * values any more. Edit the tokens HERE, then run the publisher.
 *
 * The @font-face src URLs are relative (`../fonts/`), so every service that
 * serves this stylesheet also serves the fonts from its own
 * `<service>/app/static/fonts/` directory — the publisher ships those binaries
 * from shared_frontend/static/fonts alongside this file.
 *
 * SECTIONS
 *   1. Fonts (self-hosted, script-subsetted)
 *   2. Tokens
 * ==========================================================================*/


/* ---------------------------------------------------------------------------
 * 1. FONTS — self-hosted variable woff2, script-subsetted.
 *
 * Per the brief these are self-hosted rather than pulled from a third-party
 * CDN, following the precedent BUG-1627 set for CDN-delivered assets. Each
 * face is split by unicode-range so a Latin-locale user downloads only
 * the Latin subset. Scripts these faces do not cover (Arabic, Bengali, Hindi,
 * Marathi, Urdu, Chinese, Japanese) fall through to the system stack, which
 * is the correct behaviour — no glyph is faked.
 *
 * Inter is the UI/utility face — everything dense and functional. Fraunces is
 * the display face — titles only, used with restraint.
 * ------------------------------------------------------------------------ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-var-latin.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';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-var-latin-ext.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';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-var-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-var-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F,
    U+FE2E-FE2F;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-var-greek.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1,
    U+03A3-03FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-var-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/fraunces-var-latin.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: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/fraunces-var-latin-ext.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: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/fraunces-var-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}


/* ---------------------------------------------------------------------------
 * 2. TOKENS
 * ------------------------------------------------------------------------ */

:root {
  /* --- Palette: exactly the seven from the design brief. ---------------- */
  --st-ink: #0b0a10;
  --st-parchment: #f3ede1;
  --st-amethyst: #9b7ef5;
  --st-amethyst-deep: #5b3fb0;
  --st-ember: #e8935f;
  --st-verdigris: #4fae94;
  --st-error: #e2565a;
  color-scheme: dark;
  --st-primary: var(--st-amethyst);
  --st-secondary: var(--st-ember);
  --st-positive: var(--st-verdigris);
  --st-danger: var(--st-error);
  --st-canvas: var(--st-ink);
  --st-on-accent: var(--st-ink);
  --st-chrome-sidebar: rgba(0, 0, 0, 0.55);
  --st-chrome-header: rgba(0, 0, 0, 0.35);

  /* Derived surfaces. Every step is a violet-cast lift off --st-ink, never a
     neutral gray — the brief calls for "near-black with a violet cast". The
     "well" is DARKER than the panel: inputs are recessed into the page like a
     ruled blank on a form, not raised chips sitting on top of it. */
  --st-surface-1: #131019;   /* panels, cards */
  --st-surface-2: #181420;   /* nested panels, hovered rows, panel headers */
  --st-surface-3: #1f1a2b;   /* pressed / selected row */
  --st-well: #0e0c14;        /* input + code interiors */

  /* Rules (borders). Named for the manuscript metaphor: a rule is a ruled
     line, and the panel's inline-start rule is the studio's signature. */
  --st-rule: #2a2338;
  --st-rule-soft: #1e1928;
  --st-rule-strong: #3a3050;
  --st-rule-active: var(--st-primary);

  /* Text */
  --st-text: #f1eafe;        /* 15.5:1 on surface-1 */
  --st-text-muted: #947cac;  /*  7.6:1 */
  --st-text-dim: #9784a6;    /*  5.0:1 on surface-2, the lightest panel */
  --st-text-faint: #837b9b;  /*  4.6:1 — AA floor; hints and dim glyphs */

  /* Accent tints. Two alphas per accent: a wash for surfaces, a line for
     borders. Nothing else — this is what stops the grab-bag reappearing. */
  --st-amethyst-wash: rgba(155, 126, 245, 0.10);
  --st-amethyst-wash-strong: rgba(155, 126, 245, 0.18);
  --st-amethyst-line: rgba(155, 126, 245, 0.32);
  --st-amethyst-glow: rgba(155, 126, 245, 0.22);
  --st-ember-wash: rgba(232, 147, 95, 0.10);
  --st-ember-line: rgba(232, 147, 95, 0.30);
  --st-verdigris-wash: rgba(79, 174, 148, 0.10);
  --st-verdigris-line: rgba(79, 174, 148, 0.30);
  --st-error-wash: rgba(226, 86, 90, 0.10);
  --st-error-line: rgba(226, 86, 90, 0.32);

  /* --- Type ------------------------------------------------------------- */
  --st-font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --st-font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', sans-serif;
  /* Reader prose previewed inside the studio. The reading-serif role is the
     reader product's, not the studio's; the studio only borrows it for a
     preview pane, so it is a fallback stack rather than a hosted face here. */
  --st-font-reading: 'Source Serif 4', 'Iowan Old Style', Georgia, serif;
  --st-font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
    monospace;

  /* Type scale. Twelve pixels is the governed readable floor, including dense
     metadata and badges. The base stays 13px so the authoring workspace keeps
     the compact density established by IMP-0626 without returning to 10/11px. */
  --st-text-2xs: 12px;
  --st-text-xs: 12px;
  --st-text-sm: 12px;
  --st-text-base: 13px;   /* the studio's workhorse size */
  --st-text-md: 14px;
  --st-text-lg: 16px;
  --st-display-sm: 15px;  /* Fraunces: empty-state + panel-group titles */
  --st-display-md: 18px;  /* Fraunces: section headings */
  --st-display-lg: 22px;  /* Fraunces: page title */

  --st-leading-tight: 1.25;
  --st-leading-ui: 1.45;
  --st-leading-prose: 1.65;
  --st-leading-icon: 1;
  --st-tracking-display: -0.015em;
  --st-tracking-ui: -0.005em;

  --st-weight-normal: 400;
  --st-weight-medium: 500;
  --st-weight-semi: 600;
  --st-weight-bold: 700;

  /* One Font Awesome 6 vocabulary, weight and optical box. Functional SVGs
     such as maps/charts remain SVG; production interface glyphs use these. */
  --st-icon-size-sm: 12px;
  --st-icon-size: 14px;
  --st-icon-size-lg: 16px;
  --st-icon-box: 18px;

  /* --- Space. 4px grid, tightened at the low end for dense controls. ---- */
  --st-space-0: 0;
  --st-space-1: 2px;
  --st-space-2: 4px;
  --st-space-3: 6px;
  --st-space-4: 8px;
  --st-space-5: 12px;
  --st-space-6: 16px;
  --st-space-7: 20px;
  --st-space-8: 24px;
  --st-space-9: 32px;
  --st-space-10: 48px;

  /* --- Controls. One height scale is the real density lever. ------------ */
  --st-control-h-sm: 26px;
  --st-control-h: 32px;      /* canonical field + button height */
  --st-control-h-lg: 38px;
  --st-control-pad-x: var(--st-space-5);
  --st-control-pad-x-sm: var(--st-space-4);

  /* --- Radius. The brief keeps the product's existing 12/16 and says not to
     relitigate them; the smaller steps are for controls nested inside. --- */
  --st-radius-xs: 4px;
  --st-radius-sm: 8px;
  --st-radius: 12px;
  --st-radius-lg: 16px;
  --st-radius-pill: 999px;

  /* --- The margin rule: the studio's signature dimension. --------------- */
  --st-rule-width: 2px;

  /* --- Motion ----------------------------------------------------------- */
  --st-ease: cubic-bezier(0.2, 0, 0, 1);
  --st-dur-fast: 120ms;
  --st-dur: 180ms;
  --st-dur-slow: 320ms;

  /* --- Elevation. Low light: shadows are deep and soft, never gray. ----- */
  --st-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --st-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  --st-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  --st-focus-ring: 0 0 0 3px var(--st-amethyst-glow);

  /* --- Workspace geometry (brief: "wide-screen, multi-pane workspace"). - */
  --st-pane-rail: 260px;     /* secondary/inspector pane */
  --st-measure: 68ch;        /* max line length for authoring text */
}


