/*
 * 2videos design tokens: colour, typography, spacing, radii, elevation, motion.
 * Load this FIRST on every page (before the page's own stylesheet).
 *
 * Fonts are self-hosted (shared/fonts/, SIL Open Font License; no Google Fonts or
 * other third-party requests):
 *   Inter        interface text, numbers (tabular figures for balances/timers)
 *   Sora         display: headings, the wordmark, big numbers
 *   JetBrains Mono  codes (leak codes, IDs)
 *
 * Type scale: base 14px, ratio ~1.2. Use the variables, not raw px, in new CSS.
 * The admin UI keeps a copy of this file and fonts/ (backend/admin-ui/), like icons.js.
 */

/* ---- faces (variable weight; latin + latin-ext subsets) ---- */
@font-face {
  font-family: 'Inter';
  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';
  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: 'Sora';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url(./fonts/sora-latin-wght-normal.woff2) format('woff2-variations'), url(./fonts/sora-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: 'Sora';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url(./fonts/sora-latin-ext-wght-normal.woff2) format('woff2-variations'), url(./fonts/sora-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: 'JetBrains Mono';
  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');
}

:root {
  /* families (system fonts only as a fallback while the web font loads) */
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Sora', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* scale */
  --text-2xs: 0.6875rem;  /* 11 */
  --text-xs: 0.75rem;     /* 12  labels, meta */
  --text-sm: 0.8125rem;   /* 13  secondary text */
  --text-base: 0.875rem;  /* 14  body */
  --text-md: 1rem;        /* 16  emphasis, inputs on touch */
  --text-lg: 1.125rem;    /* 18  panel titles */
  --text-xl: 1.375rem;    /* 22  section titles */
  --text-2xl: 1.75rem;    /* 28  page titles */
  --text-3xl: 2.25rem;    /* 36  hero numbers */
  --text-4xl: 3rem;       /* 48  splash */

  /* weights */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-black: 800;

  /* line heights + tracking */
  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.5;
  --tracking-tight: -0.02em;
  --tracking-display: -0.03em;
  --tracking-caps: 0.06em;

  /* brand */
  --brand-pink: #ff3d7f;
  --brand-coral: #ff7a59;
  --brand-gradient: linear-gradient(135deg, #ff3d7f 0%, #ff7a59 100%);

  /* ---- colour: one palette for every page (dark UI) ---- */
  color-scheme: dark;
  --color-bg: #0f0f14;            /* page */
  --color-surface: #1a1a22;       /* cards, panels */
  --color-surface-2: #22222c;     /* inputs, chips, raised rows */
  --color-surface-sunken: #111118;/* text fields */
  --color-line: #2c2c38;          /* borders, dividers */
  --color-line-strong: #3d3d4c;   /* hover borders */
  --color-text: #f1f1f5;
  --color-text-2: #c4c4d0;        /* secondary text on surfaces */
  --color-muted: #9a9aab;         /* meta, captions */
  --color-accent: #ff3d7f;
  --color-accent-hover: #ff5c93;
  --color-on-accent: #ffffff;
  --color-live: #ff3b3b;
  --color-gold: #fbbf24;          /* tokens, tips, goals */
  --color-good: #4ade80;
  --color-warn: #fbbf24;
  --color-bad: #f87171;
  --color-info: #60a5fa;

  /* Short aliases used by the page stylesheets (keep, so old CSS reads the same palette) */
  --bg: var(--color-bg);
  --panel: var(--color-surface);   --surface: var(--color-surface);
  --panel-2: var(--color-surface-2); --surface-2: var(--color-surface-2);
  --line: var(--color-line);
  --text: var(--color-text);
  --text-2: var(--color-text-2);
  --muted: var(--color-muted);
  --accent: var(--color-accent);
  --live: var(--color-live);
  --gold: var(--color-gold);
  --good: var(--color-good);  --ok: var(--color-good);
  --warn: var(--color-warn);
  --bad: var(--color-bad);    --error: var(--color-bad);
  --info: var(--color-info);

  /* ---- spacing: 4 px grid ---- */
  --space-0: 2px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* ---- radii ---- */
  --radius-xs: 4px;   /* tiny tags */
  --radius-sm: 6px;   /* chips inside inputs, small buttons */
  --radius-md: 8px;   /* buttons, inputs */
  --radius-lg: 12px;  /* cards, panels */
  --radius-xl: 16px;  /* dialogs, hero tiles */
  --radius-full: 999px;
  --radius: var(--radius-lg);

  /* ---- controls: one height per size so rows line up ---- */
  --control-sm: 28px;
  --control-md: 36px;
  --control-lg: 44px;

  /* ---- elevation ---- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.6);
  --focus-ring: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-accent);

  /* ---- motion ---- */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --duration-fast: 120ms;
  --duration: 200ms;

  /* ---- layers ---- */
  --z-sticky: 10;
  --z-dropdown: 50;
  --z-overlay: 100;
  --z-toast: 200;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

html {
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  /* Inter: lowercase l with a tail, capital I with serifs — usernames like "Il1lI" stay readable */
  font-feature-settings: 'cv05', 'cv08';
}
button, input, select, textarea { font-family: inherit; }

h1, h2, .display {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
}
h1 { font-weight: var(--weight-bold); }
h2 { font-weight: var(--weight-semibold); }

/* The 2videos wordmark: always the display face */
.wordmark { font-family: var(--font-display) !important; font-weight: var(--weight-black); letter-spacing: var(--tracking-display); }

/* Numbers that change (balances, timers, viewer counts) shouldn't jiggle */
.tnum, time, [data-tnum] { font-variant-numeric: tabular-nums; }
code, kbd, samp, .mono { font-family: var(--font-mono); font-feature-settings: normal; }
