/* ─────────────────────────────────────────────────────────────────────────
   design-tokens.css — Skobka edition

   Ported from sko.asiegf.me. Sharp-cornered, dark-first, near-black ink with
   a single high-saturation accent (Skobka yellow #FFD100). All "soft" state
   colors are 12% alphas of the base hue — no separate tints needed.

   Typography is taken from the `wnr` branch: Space Grotesk across the board,
   the tightened 11/13/14/16/17/24 type scale, and the full tracking ladder
   (display / tight / normal / wide / micro). It pairs better with the flat
   rectangles than Barlow Condensed did, while keeping the Skobka color logic
   intact.

   Two-layer model preserved:
     1. PRIMITIVES — raw values (palettes, scales). Don't consume directly.
     2. SEMANTIC   — purpose aliases. Components consume only these.

   The dark theme (under [data-theme="dark"]) is canonical Skobka; the light
   defaults under :root are a coherent inversion in the same family — sharp,
   near-mono, yellow accent intact.
   ───────────────────────────────────────────────────────────────────────── */

/* Space Grotesk — self-hosted to satisfy CSP (style-src/font-src 'self').
   One woff2 per subset; the file is shared across weights 300–700. */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/space-grotesk-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: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/space-grotesk-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: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/space-grotesk-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;
}

:root {
  /* ─── PRIMITIVES ──────────────────────────────────────────────────────── */

  /* Skobka ink — near-black neutrals, no blue cast */
  --ink-black: #000000;
  --ink-950:   #0d0d0d;
  --ink-900:   #111111;
  --ink-800:   #1a1a1a;
  --ink-700:   #262626;
  --ink-600:   #333333;
  --ink-500:   #4d4d4d;
  --ink-400:   #737373;
  --ink-300:   #a3a3a3;
  --ink-200:   #d4d4d4;
  --ink-100:   #ededed;
  --ink-50:    #f5f5f5;
  --ink-white: #ffffff;

  /* Alpha whites — for borders / muted text on dark surfaces */
  --white-8:  rgba(255, 255, 255, 0.08);
  --white-12: rgba(255, 255, 255, 0.12);
  --white-20: rgba(255, 255, 255, 0.20);
  --white-35: rgba(255, 255, 255, 0.35);
  --white-55: rgba(255, 255, 255, 0.55);

  /* Alpha blacks — mirror set for use on light surfaces */
  --black-8:  rgba(0, 0, 0, 0.08);
  --black-12: rgba(0, 0, 0, 0.12);
  --black-20: rgba(0, 0, 0, 0.20);
  --black-45: rgba(0, 0, 0, 0.45);
  --black-65: rgba(0, 0, 0, 0.65);

  /* Skobka accent — a single high-saturation yellow */
  --yellow:     #FFD100;
  --yellow-dim: #e6bd00;
  --yellow-10:  rgba(255, 209, 0, 0.10);
  --yellow-20:  rgba(255, 209, 0, 0.20);

  /* State hues — flat, with 12% alpha companions for soft fills */
  --hue-green:    #16a34a;
  --hue-green-bg: rgba(22, 163, 74, 0.12);
  --hue-red:      #dc2626;
  --hue-red-bg:   rgba(220, 38, 38, 0.12);
  --hue-orange:   #d97706;
  --hue-orange-bg:rgba(217, 119, 6, 0.12);
  --hue-info:     #38c8f8;
  --hue-info-bg:  rgba(56, 200, 248, 0.12);

  /* Legacy palette names — kept so the existing showcase swatch grid still
     resolves. Each ramp is re-mapped to the new system. */
  --slate-50:  var(--ink-50);
  --slate-100: var(--ink-100);
  --slate-200: var(--ink-200);
  --slate-300: var(--ink-300);
  --slate-400: var(--ink-400);
  --slate-500: var(--ink-500);
  --slate-600: var(--ink-600);
  --slate-700: var(--ink-700);
  --slate-800: var(--ink-800);
  --slate-900: var(--ink-900);
  --slate-950: var(--ink-950);

  --blue-50:  #fff8cc; --blue-100: #fff0a3; --blue-200: #ffe770;
  --blue-300: #ffdd3d; --blue-400: #ffd61f; --blue-500: var(--yellow);
  --blue-600: var(--yellow-dim); --blue-700: #b39200; --blue-800: #806800; --blue-900: #4d3f00;

  --green-50:  #e8f8ee; --green-100: #c2ecd0; --green-200: #8ddca8;
  --green-300: #5bc880; --green-400: #34b262; --green-500: var(--hue-green);
  --green-600: #128a3f; --green-700: #0e6e32; --green-800: #0a5024; --green-900: #063317;

  --amber-50:  #fff4e0; --amber-100: #ffe0b0; --amber-200: #ffc878;
  --amber-300: #ffae42; --amber-400: #ec931a; --amber-500: var(--hue-orange);
  --amber-600: #b46105; --amber-700: #8a4a04; --amber-800: #5e3303; --amber-900: #381e01;

  --red-50:  #fdecec; --red-100: #fbcdcd; --red-200: #f59a9a;
  --red-300: #ee6868; --red-400: #e34141; --red-500: var(--hue-red);
  --red-600: #b81f1f; --red-700: #911818; --red-800: #661010; --red-900: #3d0909;

  --cyan-50:  #e6faff; --cyan-100: #c2f1ff; --cyan-200: #95e6ff;
  --cyan-300: #6cdaff; --cyan-400: #4ecffd; --cyan-500: var(--hue-info);
  --cyan-600: #1ba6d8; --cyan-700: #1380a6; --cyan-800: #0d5d78; --cyan-900: #08394a;

  --violet-50:  #f5ecff; --violet-100: #e8d5ff; --violet-200: #d2adff;
  --violet-300: #bb84ff; --violet-400: #b060ff; --violet-500: #9c45f0;
  --violet-600: #7e2cd1; --violet-700: #5e1f9c; --violet-800: #3f156a; --violet-900: #240a3d;

  /* ─── TYPOGRAPHY (kept from `wnr` branch) ─────────────────────────────── */

  --font-family-sans:  'Space Grotesk', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-family-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --font-family-mono:  ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Type scale — wnr's tightened 11/13/14/16/17/24 rhythm */
  --text-xs:   0.6875rem;  /* 11 */
  --text-sm:   0.8125rem;  /* 13 */
  --text-base: 0.875rem;   /* 14 */
  --text-lg:   1rem;       /* 16 */
  --text-xl:   1.0625rem;  /* 17 */
  --text-2xl:  1.5rem;     /* 24 */
  --text-3xl:  1.875rem;   /* 30 */
  --text-4xl:  2.25rem;    /* 36 */
  --text-5xl:  3rem;       /* 48 */

  /* Line heights */
  --leading-tight:   1.1;
  --leading-snug:    1.3;
  --leading-normal:  1.5;
  --leading-relaxed: 1.7;

  /* Weights — Space Grotesk shines at 500/600/700 */
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* Letter-spacing — tight on display, loose on micro-caps (wnr ladder) */
  --tracking-display: -0.04em;
  --tracking-tight:   -0.02em;
  --tracking-normal:  0.01em;
  --tracking-wide:    0.05em;
  --tracking-micro:   0.12em;

  /* ─── SPACING / RADII / SHADOWS / MOTION ─────────────────────────────── */

  /* Spacing — Skobka uses 4px base */
  --space-0:  0;
  --space-1:  0.25rem;  /*  4 */
  --space-2:  0.5rem;   /*  8 */
  --space-3:  0.75rem;  /* 12 */
  --space-4:  1rem;     /* 16 */
  --space-5:  1.25rem;  /* 20 */
  --space-6:  1.5rem;   /* 24 */
  --space-8:  2rem;     /* 32 */
  --space-10: 2.5rem;   /* 40 */
  --space-12: 3rem;     /* 48 */
  --space-16: 4rem;     /* 64 */

  /* Radii — Skobka is sharp by default. Tokens kept for opt-in deviation. */
  --radius-none: 0;
  --radius-sm:   0.125rem;  /*  2 */
  --radius-md:   0.25rem;   /*  4 */
  --radius-lg:   0.5rem;    /*  8 */
  --radius-xl:   0.75rem;   /* 12 */
  --radius-full: 9999px;

  /* Shadow primitives — soft drops for light, deep blacks for dark.
     The semantic layer picks the right flavor per theme. */
  --shadow-light-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 1px rgba(0, 0, 0, 0.04);
  --shadow-light-md: 0 4px 6px -1px rgba(0, 0, 0, 0.10), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-light-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.10), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-light-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.06);

  --shadow-dark-sm: 0 1px 3px rgba(0, 0, 0, 0.50);
  --shadow-dark-md: 0 4px 12px rgba(0, 0, 0, 0.60);
  --shadow-dark-lg: 0 8px 24px rgba(0, 0, 0, 0.70);
  --shadow-dark-xl: 0 16px 40px rgba(0, 0, 0, 0.75);

  /* Accent glow — Skobka's signature subtle yellow halo */
  --shadow-glow-accent: 0 0 24px rgba(255, 209, 0, 0.15);

  /* Motion — Skobka's snappy 100/200/300ms cadence */
  --duration-fast: 100ms;
  --duration-base: 200ms;
  --duration-slow: 300ms;
  --easing-standard: cubic-bezier(0.4, 0, 0.2, 1);

  /* z-index ladder */
  --z-base:    0;
  --z-sticky:  100;
  --z-overlay: 300;
  --z-modal:   400;
  --z-tooltip: 500;

  /* ─── SEMANTIC (light — coherent inversion, same family) ─────────────── */

  /* Surfaces */
  --color-bg:           var(--ink-50);
  --color-surface:      #ffffff;
  --color-surface-alt:  var(--ink-100);
  --color-surface-sunk: var(--ink-200);

  /* Text */
  --color-text:         var(--ink-900);
  --color-text-muted:   var(--black-65);
  --color-text-subtle:  var(--black-45);
  --color-text-inverse: #ffffff;

  /* Borders */
  --color-border:       var(--black-8);
  --color-border-strong:var(--black-20);
  --color-focus-ring:   var(--yellow-dim);

  /* Brand / primary — warm yellow on light, grounded enough to hold shape on
     white surfaces while keeping black foreground text highly legible. */
  --color-primary:        var(--yellow-dim);
  --color-primary-hover:  #d0aa00;
  --color-primary-active: #ad8d00;
  --color-primary-fg:     var(--ink-black);
  --color-primary-soft:   var(--yellow-20);

  /* Secondary — flat near-mono */
  --color-secondary:        var(--ink-100);
  --color-secondary-hover:  var(--ink-200);
  --color-secondary-active: var(--ink-300);
  --color-secondary-fg:     var(--ink-900);

  /* Status — flat hues + 12% alpha softs */
  --color-success:      var(--hue-green);
  --color-success-fg:   #ffffff;
  --color-success-soft: var(--hue-green-bg);
  --color-success-text: #0e6e32;

  --color-warning:      var(--hue-orange);
  --color-warning-fg:   #ffffff;
  --color-warning-soft: var(--hue-orange-bg);
  --color-warning-text: #8a4a04;

  --color-danger:       var(--hue-red);
  --color-danger-fg:    #ffffff;
  --color-danger-soft:  var(--hue-red-bg);
  --color-danger-text:  #911818;

  --color-info:         #1ba6d8;
  --color-info-fg:      #ffffff;
  --color-info-soft:    var(--hue-info-bg);
  --color-info-text:    #0d5d78;

  /* Accent — violet. Distinct from the yellow brand note and from every
     status hue (red / orange / green / cyan). Reads as "highlight",
     not "brand". */
  --color-accent:       #7e2cd1;
  --color-accent-fg:    #ffffff;
  --color-accent-soft:  rgba(126, 44, 209, 0.14);

  /* Code / mark */
  --color-code-bg:      var(--ink-100);
  --color-code-fg:      #5e1f9c;
  --color-mark-bg:      var(--yellow-20);

  /* Overlay / scrim */
  --color-overlay:      rgba(0, 0, 0, 0.45);

  /* Type aliases */
  --font-sans:  var(--font-family-sans);
  --font-serif: var(--font-family-serif);
  --font-mono:  var(--font-family-mono);

  /* Shadow aliases */
  --shadow-sm: var(--shadow-light-sm);
  --shadow-md: var(--shadow-light-md);
  --shadow-lg: var(--shadow-light-lg);
  --shadow-xl: var(--shadow-light-xl);
}

/* ─── SEMANTIC (dark — canonical Skobka) ────────────────────────────────── */

[data-theme="dark"] {
  /* Surfaces — direct from Skobka's --color-bg-* tokens */
  --color-bg:           var(--ink-950);   /* #0d0d0d */
  --color-surface:      var(--ink-900);   /* #111111 — bg-subtle */
  --color-surface-alt:  var(--ink-800);   /* #1a1a1a — bg-muted */
  --color-surface-sunk: var(--ink-700);   /* #262626 — bg-raised */

  /* Text — pure white + alpha whites for muted/subtle */
  --color-text:         var(--ink-white);
  --color-text-muted:   var(--white-55);
  --color-text-subtle:  var(--white-35);
  --color-text-inverse: var(--ink-black);

  /* Borders — alpha whites */
  --color-border:       var(--white-8);
  --color-border-strong:var(--white-20);
  --color-focus-ring:   var(--yellow);

  /* Primary — Skobka yellow, the lone high-saturation note */
  --color-primary:        var(--yellow);
  --color-primary-hover:  var(--yellow-dim);
  --color-primary-active: #b39200;
  --color-primary-fg:     var(--ink-black);
  --color-primary-soft:   var(--yellow-10);

  /* Secondary — flat dark surface */
  --color-secondary:        var(--ink-800);
  --color-secondary-hover:  var(--ink-700);
  --color-secondary-active: var(--ink-600);
  --color-secondary-fg:     var(--ink-white);

  /* Status — direct from Skobka's --color-*-bg pairings */
  --color-success:      var(--hue-green);
  --color-success-fg:   var(--ink-white);
  --color-success-soft: var(--hue-green-bg);
  --color-success-text: #5bc880;

  --color-warning:      var(--hue-orange);
  --color-warning-fg:   var(--ink-white);
  --color-warning-soft: var(--hue-orange-bg);
  --color-warning-text: #ffae42;

  --color-danger:       var(--hue-red);
  --color-danger-fg:    var(--ink-white);
  --color-danger-soft:  var(--hue-red-bg);
  --color-danger-text:  #ee6868;

  --color-info:         var(--hue-info);
  --color-info-fg:      var(--ink-black);
  --color-info-soft:    var(--hue-info-bg);
  --color-info-text:    #95e6ff;

  /* Accent — violet on dark too. Sits clearly apart from the yellow
     primary while staying inside the saturated-on-near-black palette. */
  --color-accent:       #b060ff;
  --color-accent-fg:    var(--ink-black);
  --color-accent-soft:  rgba(176, 96, 255, 0.18);

  /* Code / mark */
  --color-code-bg:      var(--ink-800);
  --color-code-fg:      #d2adff;
  --color-mark-bg:      var(--yellow-20);

  /* Overlay / scrim */
  --color-overlay:      rgba(0, 0, 0, 0.7);

  /* Shadows — heavy black drops, like Skobka's design-system.css */
  --shadow-sm: var(--shadow-dark-sm);
  --shadow-md: var(--shadow-dark-md);
  --shadow-lg: var(--shadow-dark-lg);
  --shadow-xl: var(--shadow-dark-xl);
}
