/* ==========================================================================
   Alexas Lobby — Design Tokens
   Layer 1 primitives · Layer 2 semantic · Layer 3 component knobs
   Components reference LAYER 2 ONLY. Themes swap layer 2.
   Authored in OKLCH; sRGB fallbacks supplied via @supports guard below.
   ========================================================================== */

/* ---------- Layer 1: primitives ---------- */
:root {
  /* Brand — charcoal, sampled from the logo's "A" (#171c1e at ink-900).
     A cool, almost-black slate: it carries the trust; the gold does the talking. */
  --ink-50:  oklch(0.972 0.004 224);
  --ink-100: oklch(0.940 0.006 224);
  --ink-200: oklch(0.885 0.008 224);
  --ink-300: oklch(0.800 0.010 224);
  --ink-400: oklch(0.680 0.012 224);
  --ink-500: oklch(0.560 0.013 224);
  --ink-600: oklch(0.455 0.013 224);
  --ink-700: oklch(0.370 0.012 224);
  --ink-800: oklch(0.300 0.010 224);
  --ink-900: oklch(0.222 0.0085 224);  /* #171c1e — the logo */
  --ink-950: oklch(0.170 0.007 224);

  /* Accent — gold, sampled from the logo's window and "LOBBY" (#ba883b at gold-500).
     The ONLY accent. gold-500 is 3.1:1 on white, so it is never used for text on a
     light background: text uses gold-700 (5.7:1). On charcoal, gold-500 is 5.5:1. */
  --gold-50:  oklch(0.978 0.016 75);
  --gold-100: oklch(0.950 0.036 75);
  --gold-200: oklch(0.905 0.066 75);
  --gold-300: oklch(0.845 0.094 75);
  --gold-400: oklch(0.760 0.110 75);
  --gold-500: oklch(0.661 0.111 75);   /* #ba883b — the logo */
  --gold-600: oklch(0.585 0.104 75);
  --gold-700: oklch(0.515 0.094 75);
  --gold-800: oklch(0.445 0.080 75);
  --gold-900: oklch(0.375 0.066 75);
  --gold-950: oklch(0.290 0.050 75);

  /* Neutrals — stone, on the charcoal's own hue at very low chroma, so the greys
     sit with the logo instead of fighting it. */
  --stone-0:   oklch(1     0     224);
  --stone-25:  oklch(0.992 0.001 224);
  --stone-50:  oklch(0.978 0.002 224);
  --stone-100: oklch(0.957 0.003 224);
  --stone-200: oklch(0.918 0.004 224);
  --stone-300: oklch(0.865 0.005 224);
  --stone-400: oklch(0.720 0.006 224);
  --stone-500: oklch(0.605 0.007 224);
  --stone-600: oklch(0.495 0.008 224);
  --stone-700: oklch(0.408 0.008 224);
  --stone-800: oklch(0.318 0.008 224);
  --stone-900: oklch(0.245 0.008 224);
  --stone-950: oklch(0.180 0.008 224);

  /* Semantic hues */
  --green-100: oklch(0.945 0.045 150);
  --green-500: oklch(0.585 0.125 150);
  --green-700: oklch(0.430 0.095 151);
  --green-900: oklch(0.300 0.062 152);

  --red-100:   oklch(0.945 0.030 27);
  --red-500:   oklch(0.585 0.185 27);
  --red-700:   oklch(0.470 0.165 27);
  --red-900:   oklch(0.330 0.105 27);

  --blue-100:  oklch(0.950 0.028 250);
  --blue-500:  oklch(0.585 0.145 250);
  --blue-700:  oklch(0.455 0.135 254);
  --blue-900:  oklch(0.320 0.085 258);

  /* ---------- Type scale — base 17px @320 → 20px @1440, ratio 1.2 → 1.25 ---------- */
  --step--2: clamp(0.826rem, 0.805rem + 0.11vw, 0.900rem);  /* 13.2 → 14.4  micro label */
  --step--1: clamp(0.938rem, 0.900rem + 0.19vw, 1.063rem);  /* 15   → 17    caption */
  --step-0:  clamp(1.063rem, 1.024rem + 0.19vw, 1.188rem);  /* 17   → 19    body */
  --step-1:  clamp(1.188rem, 1.112rem + 0.38vw, 1.438rem);  /* 19   → 23    lead */
  --step-2:  clamp(1.375rem, 1.250rem + 0.63vw, 1.797rem);  /* 22   → 28.75 h3 */
  --step-3:  clamp(1.625rem, 1.413rem + 1.06vw, 2.313rem);  /* 26   → 37    h2 */
  --step-4:  clamp(1.938rem, 1.575rem + 1.81vw, 3.125rem);  /* 31   → 50    h1 */
  --step-5:  clamp(2.313rem, 1.700rem + 3.06vw, 4.313rem);  /* 37   → 69    display */

  --lh-display: 1.03;
  --lh-h1: 1.06;
  --lh-h2: 1.14;
  --lh-h3: 1.22;
  --lh-lead: 1.45;
  --lh-body: 1.62;
  --lh-tight: 1.35;

  --tr-display: -0.028em;
  --tr-h1: -0.024em;
  --tr-h2: -0.018em;
  --tr-h3: -0.012em;
  --tr-body: 0em;
  --tr-label: 0.075em;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-heavy: 800;

  --font-sans: "Figtree", "Figtree Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;

  /* ---------- Space — 4px base, non-linear ---------- */
  --space-2: 0.125rem;  --space-4: 0.25rem;   --space-8: 0.5rem;
  --space-12: 0.75rem;  --space-16: 1rem;     --space-20: 1.25rem;  --space-24: 1.5rem;  --space-28: 1.75rem;
  --space-32: 2rem;     --space-40: 2.5rem;   --space-48: 3rem;
  --space-64: 4rem;     --space-80: 5rem;     --space-96: 6rem;
  --space-128: 8rem;    --space-160: 10rem;   --space-192: 12rem;

  /* ---------- Radii — one scale; nested = outer − padding ---------- */
  --radius-xs: 0.25rem;
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  --radius-pill: 999px;

  /* ---------- Motion — one signature curve ---------- */
  --ease-signature: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 0.84, 0.44, 1);
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-micro: 140ms;
  --dur-base: 220ms;
  --dur-enter: 380ms;

  /* ---------- Layout ---------- */
  --content-max: 74rem;   /* 1184px */
  --wide-max: 88rem;      /* 1408px */
  --prose-max: 65ch;
  --gutter: clamp(1rem, 0.4rem + 2.6vw, 2.5rem);
  --header-h: 4.5rem;
}

/* ---------- Layer 2: semantic — LIGHT ---------- */
:root {
  color-scheme: light;

  --color-canvas:        var(--stone-25);
  --color-surface:       var(--stone-0);
  --color-surface-sunken:var(--stone-100);
  --color-surface-raised:var(--stone-0);
  --color-surface-brand: var(--ink-900);
  --color-surface-brand-soft: var(--gold-50);
  --color-surface-accent-soft: var(--gold-50);

  --color-text:          var(--stone-950);
  --color-text-muted:    var(--stone-700);
  --color-text-subtle:   var(--stone-600);
  --color-text-on-brand: var(--stone-0);
  --color-text-on-brand-muted: var(--ink-200);
  --color-text-on-action:var(--stone-0);
  --color-text-on-accent:var(--ink-950);
  --color-text-inverse:  var(--stone-0);
  --color-text-brand:    var(--gold-700);

  --color-border:        var(--stone-200);
  --color-border-strong: var(--stone-500);
  --color-border-brand:  var(--gold-300);

  --color-action:            var(--ink-900);
  --color-action-hover:      var(--ink-700);
  --color-action-active:     var(--ink-950);
  --color-action-soft:       var(--gold-50);
  --color-action-soft-hover: var(--gold-100);
  --color-link-line:         var(--gold-500);

  --color-accent:         var(--gold-500);
  --color-accent-hover:   var(--gold-400);
  --color-accent-active:  var(--gold-600);
  --color-accent-quiet:   var(--gold-700);
  --color-accent-on-brand:var(--gold-400);

  --color-success-fg: var(--green-700);
  --color-success-bg: var(--green-100);
  --color-danger-fg:  var(--red-700);
  --color-danger-bg:  var(--red-100);
  --color-warning-fg: var(--gold-800);
  --color-warning-bg: var(--gold-100);
  --color-info-fg:    var(--blue-700);
  --color-info-bg:    var(--blue-100);

  --color-star: var(--gold-600);
  --color-focus: var(--gold-600);

  --logo-gold: var(--gold-500);
  --logo-ink:  var(--ink-900);

  --shadow-1: 0 1px 2px oklch(0.25 0.01 224 / 0.06),
              0 1px 3px oklch(0.25 0.01 224 / 0.05);
  --shadow-2: 0 2px 4px oklch(0.25 0.01 224 / 0.05),
              0 6px 12px -2px oklch(0.25 0.01 224 / 0.08);
  --shadow-3: 0 4px 8px oklch(0.25 0.01 224 / 0.05),
              0 16px 32px -6px oklch(0.25 0.01 224 / 0.12);
  --shadow-4: 0 8px 16px oklch(0.25 0.01 224 / 0.06),
              0 32px 64px -12px oklch(0.25 0.01 224 / 0.18);
}

/* ---------- Layer 2: semantic — DARK (a parallel ramp, not an inversion) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --color-canvas:        oklch(0.180 0.007 224);
    --color-surface:       oklch(0.222 0.0085 224);
    --color-surface-sunken:oklch(0.150 0.006 224);
    --color-surface-raised:oklch(0.262 0.009 224);
    --color-surface-brand: oklch(0.130 0.006 224);
    --color-surface-brand-soft: oklch(0.285 0.032 75);
    --color-surface-accent-soft: oklch(0.285 0.032 75);

    --color-text:          oklch(0.955 0.003 224);
    --color-text-muted:    oklch(0.790 0.006 224);
    --color-text-subtle:   oklch(0.690 0.007 224);
    --color-text-on-brand: oklch(0.975 0.002 224);
    --color-text-on-brand-muted: oklch(0.800 0.006 224);
    --color-text-on-action:oklch(0.170 0.007 224);
    --color-text-on-accent:oklch(0.170 0.007 224);
    --color-text-inverse:  oklch(0.180 0.007 224);
    --color-text-brand:    oklch(0.800 0.100 78);

    --color-border:        oklch(0.330 0.008 224);
    --color-border-strong: oklch(0.520 0.010 224);
    --color-border-brand:  oklch(0.520 0.080 75);

    --color-action:            oklch(0.780 0.105 76);
    --color-action-hover:      oklch(0.840 0.095 77);
    --color-action-active:     oklch(0.720 0.105 75);
    --color-action-soft:       oklch(0.285 0.032 75);
    --color-action-soft-hover: oklch(0.335 0.042 75);
    --color-link-line:         oklch(0.600 0.100 75);

    --color-accent:         oklch(0.700 0.112 75);
    --color-accent-hover:   oklch(0.760 0.110 76);
    --color-accent-active:  oklch(0.640 0.110 75);
    --color-accent-quiet:   oklch(0.830 0.095 78);
    --color-accent-on-brand:oklch(0.780 0.105 76);

    --color-success-fg: oklch(0.830 0.110 150);
    --color-success-bg: oklch(0.285 0.050 152);
    --color-danger-fg:  oklch(0.790 0.120 27);
    --color-danger-bg:  oklch(0.300 0.075 27);
    --color-warning-fg: oklch(0.855 0.100 80);
    --color-warning-bg: oklch(0.300 0.050 70);
    --color-info-fg:    oklch(0.810 0.095 250);
    --color-info-bg:    oklch(0.295 0.060 254);

    --color-star: oklch(0.800 0.110 78);
    --color-focus: oklch(0.800 0.100 78);

    --logo-gold: oklch(0.700 0.112 75);
    --logo-ink:  oklch(0.975 0.002 224);

    /* Elevation in dark mode comes from surface lightness; shadows only anchor. */
    --shadow-1: 0 1px 2px oklch(0 0 0 / 0.30);
    --shadow-2: 0 2px 6px oklch(0 0 0 / 0.36);
    --shadow-3: 0 6px 20px oklch(0 0 0 / 0.44);
    --shadow-4: 0 12px 40px oklch(0 0 0 / 0.52);
  }
}

/* Explicit user choice mirrors the dark block above. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --color-canvas:        oklch(0.180 0.007 224);
  --color-surface:       oklch(0.222 0.0085 224);
  --color-surface-sunken:oklch(0.150 0.006 224);
  --color-surface-raised:oklch(0.262 0.009 224);
  --color-surface-brand: oklch(0.130 0.006 224);
  --color-surface-brand-soft: oklch(0.285 0.032 75);
  --color-surface-accent-soft: oklch(0.285 0.032 75);

  --color-text:          oklch(0.955 0.003 224);
  --color-text-muted:    oklch(0.790 0.006 224);
  --color-text-subtle:   oklch(0.690 0.007 224);
  --color-text-on-brand: oklch(0.975 0.002 224);
  --color-text-on-brand-muted: oklch(0.800 0.006 224);
  --color-text-on-action:oklch(0.170 0.007 224);
  --color-text-on-accent:oklch(0.170 0.007 224);
  --color-text-inverse:  oklch(0.180 0.007 224);
  --color-text-brand:    oklch(0.800 0.100 78);

  --color-border:        oklch(0.330 0.008 224);
  --color-border-strong: oklch(0.520 0.010 224);
  --color-border-brand:  oklch(0.520 0.080 75);

  --color-action:            oklch(0.780 0.105 76);
  --color-action-hover:      oklch(0.840 0.095 77);
  --color-action-active:     oklch(0.720 0.105 75);
  --color-action-soft:       oklch(0.285 0.032 75);
  --color-action-soft-hover: oklch(0.335 0.042 75);
  --color-link-line:         oklch(0.600 0.100 75);

  --color-accent:         oklch(0.700 0.112 75);
  --color-accent-hover:   oklch(0.760 0.110 76);
  --color-accent-active:  oklch(0.640 0.110 75);
  --color-accent-quiet:   oklch(0.830 0.095 78);
  --color-accent-on-brand:oklch(0.780 0.105 76);

  --color-success-fg: oklch(0.830 0.110 150);
  --color-success-bg: oklch(0.285 0.050 152);
  --color-danger-fg:  oklch(0.790 0.120 27);
  --color-danger-bg:  oklch(0.300 0.075 27);
  --color-warning-fg: oklch(0.855 0.100 80);
  --color-warning-bg: oklch(0.300 0.050 70);
  --color-info-fg:    oklch(0.810 0.095 250);
  --color-info-bg:    oklch(0.295 0.060 254);

  --color-star: oklch(0.800 0.110 78);
  --color-focus: oklch(0.800 0.100 78);

  --logo-gold: oklch(0.700 0.112 75);
  --logo-ink:  oklch(0.975 0.002 224);

  /* Elevation in dark mode comes from surface lightness; shadows only anchor. */
  --shadow-1: 0 1px 2px oklch(0 0 0 / 0.30);
  --shadow-2: 0 2px 6px oklch(0 0 0 / 0.36);
  --shadow-3: 0 6px 20px oklch(0 0 0 / 0.44);
  --shadow-4: 0 12px 40px oklch(0 0 0 / 0.52);
}
