/* ==========================================================================
   DESIGN TOKENS — The Ai Toolz
   All CSS custom properties. Override with [data-theme="dark"].
   ========================================================================== */

:root {
  /* ── Colors: Light ─────────────────────────────────────────────────────── */
  --color-bg:          #FFFFFF;
  --color-surface:     #F8FAFC;
  --color-surface-2:   #F1F5F9;
  --color-border:      #E2E8F0;
  --color-text:        #0F172A;
  --color-text-muted:  #475569;
  --color-primary:     #4F46E5;
  --color-primary-600: #4338CA;
  --color-secondary:   #7C3AED;
  --color-accent:      #F43F5E;
  --color-success:     #16A34A;
  --color-warning:     #D97706;
  --color-danger:      #DC2626;
  --color-info:        #0284C7;

  /* Semantic aliases */
  --color-primary-fg:  #FFFFFF;
  --color-danger-fg:   #FFFFFF;
  --color-success-fg:  #FFFFFF;
  --color-warning-fg:  #FFFFFF;

  /* ── Gradient ────────────────────────────────────────────────────────────── */
  --gradient-primary: linear-gradient(135deg, #4F46E5, #7C3AED);
  --gradient-accent:  linear-gradient(135deg, #F43F5E, #7C3AED);

  /* ── Category Accents ────────────────────────────────────────────────────── */
  /* Format: --cat-{slug}-fg / --cat-{slug}-bg */
  --cat-organize-fg:        #2563EB; --cat-organize-bg:        #EFF6FF;
  --cat-optimize-fg:        #16A34A; --cat-optimize-bg:        #F0FDF4;
  --cat-convert-to-pdf-fg:  #F59E0B; --cat-convert-to-pdf-bg:  #FFFBEB;
  --cat-convert-from-pdf-fg:#EA580C; --cat-convert-from-pdf-bg:#FFF7ED;
  --cat-edit-fg:            #7C3AED; --cat-edit-bg:            #F5F3FF;
  --cat-sign-fg:            #DB2777; --cat-sign-bg:            #FDF2F8;
  --cat-security-fg:        #0D9488; --cat-security-bg:        #F0FDFA;
  --cat-text-fg:            #4F46E5; --cat-text-bg:            #EEF2FF;
  --cat-string-fg:          #0891B2; --cat-string-bg:          #ECFEFF;
  --cat-list-fg:            #65A30D; --cat-list-bg:            #F7FEE7;
  --cat-random-fg:          #C026D3; --cat-random-bg:          #FDF4FF;
  --cat-number-fg:          #0284C7; --cat-number-bg:          #F0F9FF;
  --cat-integer-fg:         #7C3AED; --cat-integer-bg:         #F5F3FF;
  --cat-unicode-fg:         #DC2626; --cat-unicode-bg:         #FEF2F2;
  --cat-utf8-fg:            #B45309; --cat-utf8-bg:            #FFFBEB;
  --cat-ascii-fg:           #475569; --cat-ascii-bg:           #F8FAFC;
  --cat-hex-fg:             #0F766E; --cat-hex-bg:             #F0FDFA;
  --cat-binary-fg:          #1D4ED8; --cat-binary-bg:          #EFF6FF;
  --cat-csv-fg:             #15803D; --cat-csv-bg:             #F0FDF4;
  --cat-tsv-fg:             #166534; --cat-tsv-bg:             #DCFCE7;
  --cat-json-fg:            #CA8A04; --cat-json-bg:            #FEFCE8;
  --cat-yaml-fg:            #9333EA; --cat-yaml-bg:            #FAF5FF;
  --cat-xml-fg:             #BE123C; --cat-xml-bg:             #FFF1F2;
  --cat-time-fg:            #0EA5E9; --cat-time-bg:            #F0F9FF;
  --cat-math-fg:            #6D28D9; --cat-math-bg:            #EDE9FE;
  --cat-fractal-fg:         #E11D48; --cat-fractal-bg:         #FFF1F2;
  --cat-png-fg:             #2563EB; --cat-png-bg:             #EFF6FF;
  --cat-jpg-fg:             #EA580C; --cat-jpg-bg:             #FFF7ED;
  --cat-webp-fg:            #059669; --cat-webp-bg:            #ECFDF5;
  --cat-gif-fg:             #D946EF; --cat-gif-bg:             #FDF4FF;
  --cat-bitmap-fg:          #64748B; --cat-bitmap-bg:          #F1F5F9;
  --cat-image-fg:           #0891B2; --cat-image-bg:           #ECFEFF;

  /* ── Typography ──────────────────────────────────────────────────────────── */
  --font-sans:  'Inter var', 'Inter', system-ui, -apple-system, BlinkMacSystemFont,
                'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', ui-monospace, 'Cascadia Code',
                'Source Code Pro', Menlo, Monaco, Consolas, monospace;

  /* Fluid type scale — clamp(min, preferred, max) */
  --text-h1:    clamp(2.25rem, 4vw + 1rem, 3.75rem);
  --text-h2:    clamp(1.75rem, 3vw + 0.5rem, 2.5rem);
  --text-h3:    clamp(1.25rem, 1.5vw + 0.5rem, 1.5rem);
  --text-body:  1rem;
  --text-sm:    0.875rem;
  --text-xs:    0.75rem;

  --line-body:  1.65;
  --line-tight: 1.25;
  --line-snug:  1.4;

  --prose-width: 70ch;

  /* ── Spacing ─────────────────────────────────────────────────────────────── */
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-6:   24px;
  --space-8:   32px;
  --space-12:  48px;
  --space-16:  64px;
  --space-24:  96px;
  --space-32:  128px;

  /* ── Border Radius ────────────────────────────────────────────────────────── */
  --radius-input:   8px;
  --radius-btn:     12px;
  --radius-card:    16px;
  --radius-hero:    24px;
  --radius-pill:    999px;

  /* ── Shadows (light: soft colored; dark: border-based) ───────────────────── */
  --shadow-1: 0 1px 3px 0 rgb(15 23 42 / .07), 0 1px 2px -1px rgb(15 23 42 / .07);
  --shadow-2: 0 4px 6px -1px rgb(15 23 42 / .08), 0 2px 4px -2px rgb(15 23 42 / .08);
  --shadow-3: 0 10px 15px -3px rgb(15 23 42 / .1), 0 4px 6px -4px rgb(15 23 42 / .1);
  --shadow-4: 0 25px 50px -12px rgb(15 23 42 / .18);
  --shadow-focus: 0 0 0 3px rgb(79 70 229 / .35);
  --shadow-focus-danger: 0 0 0 3px rgb(220 38 38 / .35);

  /* ── Motion ──────────────────────────────────────────────────────────────── */
  --duration-fast:   150ms;
  --duration-normal: 220ms;
  --duration-slow:   320ms;
  --ease-out:        cubic-bezier(.2, .8, .2, 1);

  /* ── Z-index scale ────────────────────────────────────────────────────────── */
  --z-below:     -1;
  --z-base:       0;
  --z-raised:    10;
  --z-dropdown:  100;
  --z-sticky:    200;
  --z-overlay:   300;
  --z-modal:     400;
  --z-toast:     500;
  --z-tooltip:   600;

  /* ── Layout ──────────────────────────────────────────────────────────────── */
  --container-max:    1240px;
  --header-height:    72px;
  --header-height-sm: 60px;
  --side-padding-sm:  16px;
  --side-padding-md:  24px;
  --side-padding-lg:  32px;

  /* ── Component internals ─────────────────────────────────────────────────── */
  --input-height-sm: 32px;
  --input-height-md: 40px;
  --input-height-lg: 48px;
  --btn-height-sm:   32px;
  --btn-height-md:   44px;
  --btn-height-lg:   52px;
}

/* ── Dark theme overrides ─────────────────────────────────────────────────── */
[data-theme="dark"] {
  --color-bg:          #0B1020;
  --color-surface:     #111832;
  --color-surface-2:   #18213F;
  --color-border:      #26304F;
  --color-text:        #E6EAF5;
  --color-text-muted:  #9AA6C4;
  --color-primary:     #818CF8;
  --color-primary-600: #6366F1;
  --color-secondary:   #A78BFA;
  --color-accent:      #FB7185;
  --color-success:     #4ADE80;
  --color-warning:     #FCD34D;
  --color-danger:      #F87171;
  --color-info:        #38BDF8;

  --color-primary-fg:  #0B1020;
  --color-danger-fg:   #0B1020;
  --color-success-fg:  #0B1020;
  --color-warning-fg:  #0B1020;

  /* Category accents — dark tinted backgrounds */
  --cat-organize-bg:        #1e2d47; --cat-optimize-bg:        #14291e;
  --cat-convert-to-pdf-bg:  #2a2010; --cat-convert-from-pdf-bg:#2a1e10;
  --cat-edit-bg:            #221a35; --cat-sign-bg:            #2d1a28;
  --cat-security-bg:        #0d2423; --cat-text-bg:            #1a1d3a;
  --cat-string-bg:          #0e2028; --cat-list-bg:            #1a2610;
  --cat-random-bg:          #2a1030; --cat-number-bg:          #0d2030;
  --cat-integer-bg:         #221a35; --cat-unicode-bg:         #2d1010;
  --cat-utf8-bg:            #2a2010; --cat-ascii-bg:           #1a2030;
  --cat-hex-bg:             #0d2423; --cat-binary-bg:          #1a2040;
  --cat-csv-bg:             #10281a; --cat-tsv-bg:             #102818;
  --cat-json-bg:            #2a2408; --cat-yaml-bg:            #221535;
  --cat-xml-bg:             #2d101a; --cat-time-bg:            #0d2030;
  --cat-math-bg:            #1a1530; --cat-fractal-bg:         #2d1020;
  --cat-png-bg:             #1e2d47; --cat-jpg-bg:             #2a1e10;
  --cat-webp-bg:            #0e2820; --cat-gif-bg:             #2a1030;
  --cat-bitmap-bg:          #1a2030; --cat-image-bg:           #0e2028;

  --shadow-1: 0 1px 3px 0 rgb(0 0 0 / .3), 0 0 0 1px var(--color-border);
  --shadow-2: 0 4px 6px -1px rgb(0 0 0 / .4), 0 0 0 1px var(--color-border);
  --shadow-3: 0 10px 15px -3px rgb(0 0 0 / .5), 0 0 0 1px var(--color-border);
  --shadow-4: 0 25px 50px -12px rgb(0 0 0 / .6), 0 0 0 1px var(--color-border);
  --shadow-focus: 0 0 0 3px rgb(129 140 248 / .4);
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast:   0ms;
    --duration-normal: 0ms;
    --duration-slow:   0ms;
  }
}
