/* ============================================================
   DESIGN TOKENS
   Single source of truth for colors, typography, spacing,
   radii, shadows, motion. All values are intentional.
   ============================================================ */

:root {
  /* ----- Color: Light mode (default) ----- */
  --color-bg: #FAFAF7;            /* warm off-white */
  --color-bg-elevated: #FFFFFF;   /* cards, navbar */
  --color-bg-subtle: #F4F3EF;     /* subtle section bg */
  --color-bg-inset: #EFEDE8;      /* code blocks, hover */

  --color-text: #18181B;          /* near-black */
  --color-text-secondary: #3F3F46;
  --color-text-muted: #71717A;    /* zinc-500 */
  --color-text-faint: #A1A1AA;

  --color-border: #E4E4E7;
  --color-border-strong: #D4D4D8;

  --color-accent: #FF5C28;        /* warm orange */
  --color-accent-hover: #E64A1A;
  --color-accent-soft: rgba(255, 92, 40, 0.10);
  --color-accent-text: #FFFFFF;

  --color-success: #16A34A;
  --color-surface-glow: rgba(255, 92, 40, 0.08);

  /* ----- Typography ----- */
  --font-sans: "Inter", "Vazirmatn", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", "Vazirmatn", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Vazirmatn", ui-monospace, monospace;

  /* Persian uses Vazirmatn for everything for proper shaping */
  --font-sans-fa: "Vazirmatn", "Inter", system-ui, sans-serif;
  --font-display-fa: "Vazirmatn", "Space Grotesk", system-ui, sans-serif;

  /* Type scale (1.250 — major third) */
  --text-xs: 0.75rem;    /* 12 */
  --text-sm: 0.875rem;   /* 14 */
  --text-base: 1rem;     /* 16 */
  --text-md: 1.125rem;   /* 18 */
  --text-lg: 1.25rem;    /* 20 */
  --text-xl: 1.5rem;     /* 24 */
  --text-2xl: 1.875rem;  /* 30 */
  --text-3xl: 2.25rem;   /* 36 */
  --text-4xl: 3rem;      /* 48 */
  --text-5xl: 3.75rem;   /* 60 */
  --text-6xl: 4.5rem;    /* 72 */

  --leading-tight: 1.1;
  --leading-snug: 1.3;
  --leading-normal: 1.55;
  --leading-relaxed: 1.75;

  --tracking-tight: -0.02em;
  --tracking-tighter: -0.035em;
  --tracking-wide: 0.04em;
  --tracking-wider: 0.08em;

  /* ----- Spacing scale (4px base) ----- */
  --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 */
  --space-20: 5rem;     /* 80 */
  --space-24: 6rem;     /* 96 */
  --space-32: 8rem;     /* 128 */

  /* ----- Radius (subtle, consistent) ----- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  /* ----- Shadows (restrained) ----- */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
  --shadow-accent: 0 8px 24px rgba(255, 92, 40, 0.18);

  /* ----- Layout ----- */
  --container-max: 1200px;
  --container-narrow: 760px;
  --navbar-height: 72px;
  --navbar-height-mobile: 64px;

  /* ----- Motion ----- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 150ms;
  --dur-base: 250ms;
  --dur-slow: 450ms;

  /* ----- Z-index scale ----- */
  --z-base: 1;
  --z-sticky: 50;
  --z-mobile-menu: 150;
  --z-navbar: 200;
  --z-overlay: 300;

  /* Accessible accent for text on background (AA on small text) */
  --color-accent-strong: #D94A1A;
}

/* ----- Dark mode (intentionally designed, not inverted) ----- */
[data-theme="dark"] {
  --color-bg: #0A0A0B;
  --color-bg-elevated: #131316;
  --color-bg-subtle: #0F0F12;
  --color-bg-inset: #1A1A1F;

  --color-text: #FAFAFA;
  --color-text-secondary: #E4E4E7;
  --color-text-muted: #A1A1AA;
  --color-text-faint: #71717A;

  --color-border: #27272A;
  --color-border-strong: #3F3F46;

  --color-accent: #FF6B3D;
  --color-accent-hover: #FF8A5C;
  --color-accent-soft: rgba(255, 107, 61, 0.12);
  --color-accent-text: #0A0A0B;
  --color-accent-strong: #FF8A5C;

  --color-surface-glow: rgba(255, 107, 61, 0.10);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45), 0 4px 8px rgba(0, 0, 0, 0.25);
  --shadow-accent: 0 8px 24px rgba(255, 107, 61, 0.25);
}

/* ----- RTL: swap font stacks ----- */
[dir="rtl"] {
  --font-sans: var(--font-sans-fa);
  --font-display: var(--font-display-fa);
  --font-mono: "Vazirmatn", ui-monospace, monospace;
}
