/* ==========================================================================
   AuraBily — Bilitis Studio Design System Tokens (Layer 01)
   Theme: Warm Obsidian Noir & Champagne Gold (#111110 / #c5a46d)
   Strict 4px/8px spatial grid, WCAG AA contrast, Dark & Light modes.
   Zero component rules, zero !important.
   ========================================================================== */

:root,
html.dark,
[data-theme="dark"] {
  /* Authoritative Surfaces */
  --surface-base: #111110;
  --surface-primary: #191817;
  --surface-elevated: #22211f;
  --surface-overlay: #292725;
  --surface-hover: #2f2c29;
  --surface-input: #141312;

  /* Text Hierarchy */
  --text-primary: #f1eee9;
  --text-secondary: #a6a29b;
  --text-muted: #77746e;
  --text-inverse: #111110;

  /* Brand Accent (Restrained Champagne Gold) */
  --accent: #c5a46d;
  --accent-hover: #d7b982;
  --accent-deep: #9c793b;
  --accent-soft: rgba(197, 164, 109, 0.14);
  --accent-border: rgba(197, 164, 109, 0.36);
  --accent-focus: rgba(197, 164, 109, 0.85);
  --accent-gradient: linear-gradient(135deg, #e2c792 0%, #c5a46d 52%, #9a773c 100%);

  /* Semantic Status */
  --success: #68bb91;
  --success-soft: rgba(104, 187, 145, 0.14);
  --warning: #e0ad64;
  --warning-soft: rgba(224, 173, 100, 0.14);
  --danger: #d76e6e;
  --danger-soft: rgba(215, 110, 110, 0.14);
  --info: #8bb4e8;
  --accent-purple: #b589f2;

  /* Borders */
  --border-subtle: rgba(241, 238, 233, 0.08);
  --border-structural: rgba(241, 238, 233, 0.14);
  --border-strong: rgba(241, 238, 233, 0.22);

  /* Spacing (4px base grid) */
  --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;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  /* Typography */
  --font-serif: 'Cinzel', Georgia, 'Times New Roman', serif;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --text-xs: 0.75rem;   /* 12px */
  --text-sm: 0.875rem;  /* 14px */
  --text-base: 16px;    /* mandatory anti-zoom floor on iOS inputs */
  --text-lg: 1.125rem;  /* 18px */
  --text-xl: 1.35rem;   /* 21.6px */

  /* Motion */
  --motion-fast: 150ms;
  --motion-normal: 200ms;
  --motion-slow: 280ms;
  --ease-standard: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Interaction & Safe Area */
  --touch-min: 48px;
  --ctrl-h-sm: 44px;
  --ctrl-h-md: 44px;
  --ctrl-h-lg: 50px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Layout */
  --header-height: 56px;
  --mobile-nav-height: 72px;
  --desktop-sidebar-width: 248px;
  --desktop-sidebar-collapsed: 68px;
  --creation-col-width: 480px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.42);
  --shadow-modal: 0 20px 56px rgba(0, 0, 0, 0.72);
  --shadow-gold: 0 0 0 1px var(--accent-border), 0 6px 20px rgba(197, 164, 109, 0.14);

  /* Z-Index Scale */
  --z-base: 1;
  --z-sticky: 40;
  --z-dock: 80;
  --z-header: 100;
  --z-nav: 140;
  --z-backdrop: 180;
  --z-drawer: 220;
  --z-modal: 300;
  --z-sheet-backdrop: 330;
  --z-sheet: 340;
  --z-palette: 360;
  --z-toast: 420;

  /* ── Legacy Variable Aliases (preserves compatibility with legacy widgets) ── */
  --bg-main: var(--surface-base);
  --bg-surface: var(--surface-primary);
  --bg-elevated: var(--surface-elevated);
  --bg-card: var(--surface-primary);
  --bg-card-hover: var(--surface-hover);
  --bg-input: var(--surface-input);
  --bg-glass: var(--surface-primary);
  --bg-glass-card: var(--surface-elevated);
  --border-titanium: var(--border-strong);
  --border-gold: var(--accent-border);
  --border-gold-focus: var(--accent-focus);
  --text-gold: var(--accent);
  --gold-primary: var(--accent);
  --gold-light: var(--accent-hover);
  --gold-dark: var(--accent-deep);
  --gold-glow: var(--accent-soft);
  --gold-gradient: var(--accent-gradient);
  --status-ok: var(--success);
  --status-warn: var(--warning);
  --status-danger: var(--danger);
  --header-h: var(--header-height);
  --mobile-nav-h: var(--mobile-nav-height);
  --z-sticky-cta: var(--z-dock);
  --z-mobile-nav: var(--z-nav);
}

/* Warm Alabaster & Burnished Bronze Light Theme */
html.light,
[data-theme="light"] {
  --surface-base: #f5f3ee;
  --surface-primary: #ffffff;
  --surface-elevated: #edeae2;
  --surface-overlay: #e4dfd4;
  --surface-hover: #f9f7f2;
  --surface-input: #ffffff;

  --text-primary: #1a1917;
  --text-secondary: #58544d;
  --text-muted: #7a756c;
  --text-inverse: #ffffff;

  --accent: #9a7432;
  --accent-hover: #7f5d22;
  --accent-deep: #5e4314;
  --accent-soft: rgba(154, 116, 50, 0.12);
  --accent-border: rgba(154, 116, 50, 0.36);
  --accent-focus: rgba(154, 116, 50, 0.85);
  --accent-gradient: linear-gradient(135deg, #c1974d 0%, #9a7432 52%, #6e4e18 100%);

  --success: #168052;
  --success-soft: rgba(22, 128, 82, 0.12);
  --warning: #b4690e;
  --warning-soft: rgba(180, 105, 14, 0.12);
  --danger: #c03232;
  --danger-soft: rgba(192, 50, 50, 0.12);
  --info: #2563eb;
  --accent-purple: #7c3aed;

  --border-subtle: rgba(26, 25, 23, 0.09);
  --border-structural: rgba(26, 25, 23, 0.16);
  --border-strong: rgba(26, 25, 23, 0.26);

  --shadow-sm: 0 1px 4px rgba(20, 18, 14, 0.06);
  --shadow-md: 0 6px 20px rgba(20, 18, 14, 0.10);
  --shadow-modal: 0 18px 48px rgba(20, 18, 14, 0.18);
  --shadow-gold: 0 0 0 1px var(--accent-border), 0 4px 16px rgba(154, 116, 50, 0.14);
}
