/* ============================================================
   BARBAROS BX — Design Tokens (single source of truth)
   ------------------------------------------------------------
   Dark-first design language; runtime follows the platform theme
   attribute html[data-buld-theme] so BX components always match
   the active theme with zero extra wiring.

   RULES (mandatory — see bx/README.md):
   · Every color/space/radius/shadow/duration in the UI comes from
     these tokens. No hex, no px magic numbers in components/screens.
   · New UI consumes .bx-* primitives only. No custom styles outside
     the BX library. Reuse → extend → (last resort) create.
   ============================================================ */

:root {
    /* ---------- LIGHT ramp (warm paper — platform default theme) ---------- */
    --bx-bg:         #FAF9F5;   /* Anthropic Light */
    --bx-surface-1:  #FFFFFF;
    --bx-surface-2:  #F0EEE6;   /* Claude cream */
    --bx-surface-3:  #E8E6DC;   /* Anthropic Light Gray */
    --bx-ink-1:      #1F1E1B;
    --bx-ink-2:      #4A4844;
    --bx-ink-3:      #75736C;
    --bx-ink-4:      #A19F97;
    --bx-border:        rgba(30,28,24,.09);
    --bx-border-strong: rgba(30,28,24,.17);

    /* Actions & accent — LOCKED to the live BARBAROS identity (Apple-blue
       #0071E3, token `--buld-cta`). Founder decision 2026-07-10: keep the
       current blue; terracotta remains a pending proposal only. Do not change
       these without founder approval. */
    --bx-action-bg:   #0071E3;
    --bx-action-ink:  #FFFFFF;
    --bx-action-hover:#0066CC;

    --bx-accent:      #0071E3;
    --bx-accent-soft: rgba(0,113,227,.10);
    --bx-info:        #5B88B5;
    --bx-info-soft:   rgba(106,155,204,.14);
    --bx-success:     #6E8455;
    --bx-success-soft:rgba(120,140,93,.15);
    --bx-warning:     #B98A2F;
    --bx-warning-soft:rgba(185,138,47,.14);
    --bx-danger:      #C24C42;
    --bx-danger-soft: rgba(194,76,66,.12);

    --bx-scrim: rgba(10,10,12,.45);

    /* ---------- Elevation (light: faint, warm-neutral) ---------- */
    --bx-shadow-1: 0 1px 2px rgba(17,17,20,.06);
    --bx-shadow-2: 0 4px 12px rgba(17,17,20,.08);
    --bx-shadow-3: 0 16px 40px rgba(17,17,20,.14);

    /* ---------- Typography ---------- */
    --bx-font-text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
    --bx-font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
    --bx-font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;

    --bx-text-11: 11px; --bx-text-12: 12px; --bx-text-13: 13px; --bx-text-14: 14px;
    --bx-text-16: 16px; --bx-text-18: 18px; --bx-text-22: 22px; --bx-text-28: 28px;
    --bx-weight-regular: 400; --bx-weight-medium: 500; --bx-weight-semibold: 600;
    --bx-tracking-text: -0.011em;
    --bx-tracking-display: -0.021em;
    --bx-leading-text: 1.45;
    --bx-leading-tight: 1.2;

    /* ---------- Spacing (4px base — sanctioned steps only) ---------- */
    --bx-s-1: 4px;  --bx-s-2: 8px;  --bx-s-3: 12px; --bx-s-4: 16px;
    --bx-s-5: 20px; --bx-s-6: 24px; --bx-s-8: 32px; --bx-s-10: 40px; --bx-s-14: 56px;

    /* ---------- Radius ---------- */
    --bx-r-control: 6px;   /* buttons, inputs, chips */
    --bx-r-card:    10px;
    --bx-r-modal:   14px;
    --bx-r-pill:    999px;

    /* ---------- Layout ---------- */
    --bx-content-max: 1440px;
    --bx-control-h:   36px;
    --bx-control-h-sm:28px;
    --bx-control-h-lg:44px;

    /* ---------- Motion (single easing, three durations) ---------- */
    --bx-ease: cubic-bezier(.2,.6,.2,1);
    --bx-dur-hover: 120ms;
    --bx-dur-overlay: 180ms;
    --bx-dur-layout: 240ms;

    /* ---------- Z scale ---------- */
    --bx-z-sticky: 40; --bx-z-drawer: 90; --bx-z-modal: 100;
    --bx-z-toast: 120; --bx-z-tooltip: 130;
}

/* ---------- DARK ramp — the canonical BX look ----------
   WARM charcoal (approved reference): deep graphite with a warm
   brown-tinted cast, cream ink — never pure black, never cold blue-grey. */
html[data-buld-theme="dark"], html[data-bx-theme="dark"] {
    --bx-bg:         #1B1A18;   /* Anthropic Dark family (#141413), lifted for UI depth */
    --bx-surface-1:  #232220;
    --bx-surface-2:  #2B2A27;
    --bx-surface-3:  #34332F;
    --bx-ink-1:      #F5F4EF;
    --bx-ink-2:      #C6C4BC;
    --bx-ink-3:      #929087;
    --bx-ink-4:      #6A6862;
    --bx-border:        rgba(245,244,239,.08);
    --bx-border-strong: rgba(245,244,239,.16);

    /* Actions & accent — live identity on dark is Apple-blue #2997FF
       (token `--buld-cta` dark). Founder decision 2026-07-10: keep blue. */
    --bx-action-bg:   #2997FF;
    --bx-action-ink:  #FFFFFF;
    --bx-action-hover:#1E86EF;

    --bx-accent:      #2997FF;
    --bx-accent-soft: rgba(41,151,255,.16);
    --bx-info:        #6A9BCC;
    --bx-info-soft:   rgba(106,155,204,.16);
    --bx-success:     #93AC77;
    --bx-success-soft:rgba(120,140,93,.20);
    --bx-warning:     #D4A257;
    --bx-warning-soft:rgba(212,162,87,.16);
    --bx-danger:      #E06A5E;
    --bx-danger-soft: rgba(224,106,94,.15);

    --bx-scrim: rgba(0,0,0,.6);

    --bx-shadow-1: 0 1px 2px rgba(0,0,0,.4);
    --bx-shadow-2: 0 4px 12px rgba(0,0,0,.35);
    --bx-shadow-3: 0 16px 40px rgba(0,0,0,.45);
}

/* ---------- Reduced motion: kill non-essential animation globally ---------- */
@media (prefers-reduced-motion: reduce) {
    :root { --bx-dur-hover: 0ms; --bx-dur-overlay: 0ms; --bx-dur-layout: 0ms; }
}
