/* ============================================================
 * AICentra — Design Tokens (canonical, v2 redesign)
 * Phase: UI Redesign v2 — Calm Ops direction
 * ============================================================
 * Single source of truth for every color, radius, spacing,
 * shadow, font, motion, and z-index value in the product.
 *
 * Load ORDER (in shell_head.html):
 *   1. tokens.css   ← this file
 *   2. base.css     ← reset + typography + focus + motion
 *   3. layout.css   ← shell grid + z-index + spacing utils
 *   4. shell.css    ← header/sidebar/footer chrome
 *   5. components.css
 *   6. legacy-bridge.css  ← smoothes over untouched Bootstrap/local classes
 *
 * Rule: no component may hardcode a colour, radius, shadow, or
 * spacing value. If a value is missing, add a token here.
 *
 * Naming is SEMANTIC, not literal (no --white, no --gray-100).
 * That way dark mode later == flipping values in one file.
 * ============================================================ */

:root {
  /* =============================================================
   * SURFACE ROLES — the paper the UI sits on
   * ============================================================= */
  --aic-color-canvas:         #FCFCFD; /* body background */
  --aic-color-surface:        #FFFFFF; /* cards, primary panels */
  --aic-color-surface-raised: #F7F9FC; /* wells inside cards */
  --aic-color-surface-sunk:   #F1F4F9; /* pressed / disabled fills */
  --aic-color-surface-hover:  #EEF2F9; /* list-item hover */
  --aic-color-surface-inverse:#0F172A; /* tooltips, code, dark chips */

  /* =============================================================
   * TEXT ROLES
   * ============================================================= */
  --aic-color-text:           #0F172A;
  --aic-color-text-muted:     #475569;
  --aic-color-text-subtle:    #94A3B8;
  --aic-color-text-inverse:   #FFFFFF;
  --aic-color-text-link:      #1E3A8A;
  --aic-color-text-link-hover:#0E7490;

  /* =============================================================
   * BORDER ROLES
   * ============================================================= */
  --aic-color-border:         #E2E8F0;
  --aic-color-border-strong:  #CBD5E1;
  --aic-color-border-focus:   #0E7490;

  /* =============================================================
   * BRAND — Shivaa-Borzo hues, semantically re-cast
   * ============================================================= */
  --aic-color-brand:          #1E3A8A;    /* Persian lapis */
  --aic-color-brand-strong:   #152B66;    /* pressed / hover-deeper */
  --aic-color-brand-soft:     #DDE3F2;    /* tint fill */
  --aic-color-brand-tint:     #F0F4FA;    /* wash */
  --aic-color-brand-fg-on:    #FFFFFF;    /* fg on brand */

  --aic-color-accent:         #0E7490;    /* Persian turquoise — AI marker */
  --aic-color-accent-strong:  #0A5566;
  --aic-color-accent-soft:    #DCEEF1;
  --aic-color-accent-tint:    #F0F9FA;

  --aic-color-gold:           #D4AF37;    /* filigree ONLY */
  --aic-color-gold-strong:    #A88A2C;
  --aic-color-gold-soft:      #F5EBD1;
  --aic-color-gold-fg:        #6B5A18;    /* text on gold-soft */

  /* Backward-compat aliases (kept identical to Phase 2 so existing .aic-* rules keep rendering) */
  --aic-color-primary:        var(--aic-color-brand);
  --aic-color-primary-strong: var(--aic-color-brand-strong);
  --aic-color-primary-soft:   var(--aic-color-brand-soft);

  /* =============================================================
   * SEMANTIC — status colors
   * ============================================================= */
  --aic-color-success:        #059669;
  --aic-color-success-strong: #047857;
  --aic-color-success-soft:   #D1FAE5;

  --aic-color-warn:           #B45309;    /* NOT gold — gold is brand */
  --aic-color-warn-strong:    #92400E;
  --aic-color-warn-soft:      #FEF3C7;

  --aic-color-danger:         #B91C1C;
  --aic-color-danger-strong:  #991B1B;
  --aic-color-danger-soft:    #FEE2E2;

  --aic-color-info:           #0E7490;
  --aic-color-info-soft:      #DCEEF1;

  --aic-color-neutral:        #64748B;
  --aic-color-neutral-soft:   #E2E8F0;

  /* =============================================================
   * BRAND GRADIENTS — reserved for logo mark and hero surfaces
   * NEVER used on interactive body/card surfaces
   * ============================================================= */
  --aic-grad-brand:      linear-gradient(135deg, #1E3A8A 0%, #0E7490 100%);
  --aic-grad-brand-deep: linear-gradient(180deg, #152B66 0%, #0A5566 100%);
  --aic-grad-gold:       linear-gradient(120deg, #D4AF37 0%, #F0DEA0 50%, #D4AF37 100%);
  --aic-grad-hero:
    radial-gradient(ellipse at 25% 0%, rgba(212,175,55,0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 75% 100%, rgba(14,116,144,0.10) 0%, transparent 50%),
    linear-gradient(180deg, #FCFCFD 0%, #F1F4F9 100%);

  /* =============================================================
   * TYPOGRAPHY
   * ============================================================= */
  --aic-font-persian: "Vazirmatn", "Vazir", "Estedad", "Tahoma", sans-serif;
  --aic-font-latin:   "Poppins", "Inter", ui-sans-serif, system-ui, sans-serif;
  --aic-font-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  /* Size ramp — steps of ~1.2 */
  --aic-font-xs:      12px;
  --aic-font-sm:      13px;
  --aic-font-base:    15px;   /* Persian at 15px is the sweet spot */
  --aic-font-md:      16px;
  --aic-font-lg:      18px;
  --aic-font-xl:      20px;
  --aic-font-2xl:     24px;
  --aic-font-3xl:     30px;
  --aic-font-4xl:     36px;
  --aic-font-5xl:     44px;
  --aic-font-6xl:     56px;

  --aic-weight-regular:  400;
  --aic-weight-medium:   500;
  --aic-weight-semibold: 600;
  --aic-weight-bold:     700;
  --aic-weight-black:    800;

  --aic-lh-tight:   1.15;
  --aic-lh-snug:    1.35;
  --aic-lh-normal:  1.55;
  --aic-lh-relaxed: 1.7;

  --aic-tracking-tight: -0.02em;
  --aic-tracking-normal: 0;
  --aic-tracking-wide:  0.05em;
  --aic-tracking-widest:0.08em;

  /* =============================================================
   * SPACING — 4-based scale
   * ============================================================= */
  --aic-space-0:  0;
  --aic-space-1:  4px;
  --aic-space-2:  8px;
  --aic-space-3:  12px;
  --aic-space-4:  16px;
  --aic-space-5:  20px;
  --aic-space-6:  24px;
  --aic-space-7:  28px;
  --aic-space-8:  32px;
  --aic-space-10: 40px;
  --aic-space-12: 48px;
  --aic-space-14: 56px;
  --aic-space-16: 64px;
  --aic-space-20: 80px;
  --aic-space-24: 96px;

  /* =============================================================
   * RADII
   * ============================================================= */
  --aic-radius-xs:   4px;
  --aic-radius-sm:   6px;
  --aic-radius-md:   10px;
  --aic-radius-lg:   14px;
  --aic-radius-xl:   20px;
  --aic-radius-2xl:  28px;
  --aic-radius-pill: 999px;

  /* =============================================================
   * ELEVATION
   * ============================================================= */
  --aic-shadow-xs:   0 1px 2px rgba(15, 23, 42, 0.05);
  --aic-shadow-sm:   0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --aic-shadow-md:   0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --aic-shadow-lg:   0 12px 24px -8px rgba(15, 23, 42, 0.12), 0 6px 12px -8px rgba(15, 23, 42, 0.06);
  --aic-shadow-xl:   0 24px 48px -12px rgba(30, 58, 138, 0.18), 0 12px 24px -12px rgba(15, 23, 42, 0.08);
  --aic-shadow-focus: 0 0 0 3px rgba(14, 116, 144, 0.35);
  --aic-shadow-focus-danger: 0 0 0 3px rgba(185, 28, 28, 0.35);
  --aic-shadow-gold: 0 0 24px rgba(212, 175, 55, 0.35);

  --aic-focus-ring: var(--aic-shadow-focus);

  /* =============================================================
   * MOTION — 2026 tight durations
   * ============================================================= */
  --aic-dur-instant: 0ms;
  --aic-dur-fast:    150ms;
  --aic-dur-base:    220ms;
  --aic-dur-slow:    380ms;
  --aic-dur-page:    500ms;
  --aic-transition-fast: var(--aic-dur-fast); /* alias */
  --aic-transition-base: var(--aic-dur-base);
  --aic-ease:          cubic-bezier(.2, .7, .2, 1);
  --aic-ease-standard: cubic-bezier(.2, .7, .2, 1);
  --aic-ease-emphasis: cubic-bezier(.16, 1, .3, 1);
  --aic-ease-in:       cubic-bezier(.4, 0, 1, 1);
  --aic-ease-out:      cubic-bezier(0, 0, .2, 1);

  /* =============================================================
   * LAYOUT
   * ============================================================= */
  --aic-header-height:    64px;
  --aic-sidebar-width:    264px;
  --aic-sidebar-collapsed:72px;
  --aic-page-max:         1440px;
  --aic-content-max:      1200px;
  --aic-reading-max:      72ch;

  /* =============================================================
   * Z-INDEX SCALE
   * ============================================================= */
  --aic-z-base:     0;
  --aic-z-raised:   10;
  --aic-z-sticky:   100;
  --aic-z-header:   200;
  --aic-z-drawer:   400;
  --aic-z-overlay:  900;
  --aic-z-modal:    1000;
  --aic-z-toast:    1100;
  --aic-z-tooltip:  1200;
  --aic-z-palette:  1300;
}

/* =============================================================
 * DENSITY MODES
 * <body data-density="compact"> shrinks all rhythm-affecting tokens
 * ============================================================= */
[data-density="compact"] {
  --aic-header-height:    52px;
  --aic-space-4:  12px;
  --aic-space-5:  16px;
  --aic-space-6:  20px;
  --aic-space-8:  24px;
  --aic-font-base: 14px;
}

/* =============================================================
 * HIGH-CONTRAST MODE
 * ============================================================= */
[data-theme="hc"] {
  --aic-color-text:         #000000;
  --aic-color-text-muted:   #1F2937;
  --aic-color-border:       #64748B;
  --aic-color-border-strong:#334155;
}
