/* ============================================================
   DE Toolkit — Shared Theme System
   Single source of truth for all pages and tools.
   Link this file BEFORE any page-specific stylesheet.
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Cascadia Code (blue theme body font) ── */
@font-face {
    font-family: 'Cascadia Code';
    src: url('https://cdn.jsdelivr.net/npm/@fontsource/cascadia-code@4.2.1/files/cascadia-code-latin-400-normal.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Cascadia Code';
    src: url('https://cdn.jsdelivr.net/npm/@fontsource/cascadia-code@4.2.1/files/cascadia-code-latin-600-normal.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: 'Cascadia Code';
    src: url('https://cdn.jsdelivr.net/npm/@fontsource/cascadia-code@4.2.1/files/cascadia-code-latin-700-normal.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

/* ── Base Variables (Dark — fallback when no data-theme is set) ── */
:root {
    /* Backgrounds */
    --bg-body:       #0a0c10;
    --bg-sidebar:    #0d1017;
    --bg-main:       #0f1218;
    --bg-card:       #151a23;
    --bg-card-hover: #1a2030;
    --bg-input:      #0c0f15;
    --bg-elevated:   #1c2333;

    /* Borders */
    --border:        #1e2736;
    --border-light:  #283347;

    /* Accent */
    --accent:             #4f8ff7;
    --accent-light:       #6ba3ff;
    --accent-glow:        rgba(79, 143, 247, 0.15);
    --accent-glow-strong: rgba(79, 143, 247, 0.3);

    /* Semantic colours */
    --green:      #3fb950;
    --green-glow: rgba(63, 185, 80, 0.15);
    --orange:     #d29922;
    --red:        #f85149;
    --yellow:     #d29922;
    --purple:     #a371f7;

    /* Text */
    --text-1: #e6edf3;
    --text-2: #8b949e;
    --text-3: #484f58;
    --text-4: #30363d;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transition */
    --transition: 0.2s ease;

    /* Layout (main site) */
    --sidebar-width:  260px;
    --topbar-height:  56px;
    --menubar-height: 48px;

    /* ── Tool variable aliases ─────────────────────────────────────
       Map legacy per-tool variable names to canonical vars so each
       tool's component CSS continues to work without changes.
       ────────────────────────────────────────────────────────────── */

    /* Background aliases */
    --bg:    var(--bg-body);
    --bg1:   var(--bg-body);
    --bg2:   var(--bg-main);
    --bg3:   var(--bg-card);
    --bg4:   var(--bg-elevated);
    --panel: var(--bg-sidebar);

    /* Border aliases */
    --border2:   var(--border);
    --border-h:  var(--border-light);

    /* Text aliases */
    --text:       var(--text-1);
    --text2:      var(--text-2);
    --text3:      var(--text-3);
    --text4:      var(--text-4);
    --text-dim:   var(--text-2);
    --text-muted: var(--text-3);

    /* Accent aliases */
    --accent2: var(--accent-light);

    /* Typography aliases */
    --font: var(--font-sans);
    --mono: var(--font-mono);

    /* Shadow / transition aliases */
    --shadow: var(--shadow-lg);
    --tr:     var(--transition);

    /* Type & Comprehend cursor */
    --cursor-bg:   var(--accent);
    --cursor-text: var(--bg-body);
}

/* ── Blue Theme (default on the main site) ── */
:root[data-theme="blue"] {
    --bg-body:       #010f22;
    --bg-sidebar:    #011530;
    --bg-main:       #011838;
    --bg-card:       #042250;
    --bg-card-hover: #062e68;
    --bg-input:      #010f22;
    --bg-elevated:   #083272;
    --border:        #0f4285;
    --border-light:  #1a55aa;

    --accent:             #4da6ff;
    --accent-light:       #74bbff;
    --accent-glow:        rgba(77, 166, 255, 0.15);
    --accent-glow-strong: rgba(77, 166, 255, 0.3);

    --green:      #3fb950;
    --green-glow: rgba(63, 185, 80, 0.15);
    --orange:     #d29922;
    --red:        #f85149;
    --yellow:     #d29922;
    --purple:     #a371f7;

    --text-1: #ddeeff;
    --text-2: #7898be;
    --text-3: #3a5575;
    --text-4: #1e3350;

    --font-sans: 'Cascadia Code', 'JetBrains Mono', 'Consolas', monospace;
    --font-mono: 'Cascadia Code', 'JetBrains Mono', monospace;
}

/* ── Dark Theme ── */
:root[data-theme="dark"] {
    --bg-body:       #0a0c10;
    --bg-sidebar:    #0d1017;
    --bg-main:       #0f1218;
    --bg-card:       #151a23;
    --bg-card-hover: #1a2030;
    --bg-input:      #0c0f15;
    --bg-elevated:   #1c2333;
    --border:        #1e2736;
    --border-light:  #283347;

    --accent:             #4f8ff7;
    --accent-light:       #6ba3ff;
    --accent-glow:        rgba(79, 143, 247, 0.15);
    --accent-glow-strong: rgba(79, 143, 247, 0.3);

    --green:      #3fb950;
    --green-glow: rgba(63, 185, 80, 0.15);
    --orange:     #d29922;
    --red:        #f85149;
    --yellow:     #d29922;
    --purple:     #a371f7;

    --text-1: #e6edf3;
    --text-2: #8b949e;
    --text-3: #484f58;
    --text-4: #30363d;
}

/* ── Light Theme ── */
:root[data-theme="light"] {
    --bg-body:       #f0f4f8;
    --bg-sidebar:    #ffffff;
    --bg-main:       #f8fafb;
    --bg-card:       #ffffff;
    --bg-card-hover: #eef2f7;
    --bg-input:      #f0f4f8;
    --bg-elevated:   #e4eaf2;
    --border:        #d0dbe8;
    --border-light:  #b8c8da;

    --accent:             #1a6cf5;
    --accent-light:       #3880ff;
    --accent-glow:        rgba(26, 108, 245, 0.1);
    --accent-glow-strong: rgba(26, 108, 245, 0.2);

    --green:      #1a7f37;
    --green-glow: rgba(26, 127, 55, 0.12);
    --orange:     #b45309;
    --red:        #dc2626;
    --yellow:     #92400e;
    --purple:     #7c3aed;

    --text-1: #1a2332;
    --text-2: #4a5a70;
    --text-3: #7a8a9a;
    --text-4: #a0aab4;

    --font-sans: 'Times New Roman', Times, serif;
}
