/* ========================================
   BASE STYLES
   Reset, Variables, Typography, Utilities
   ======================================== */

/* Note: Fonts (Outfit + JetBrains Mono) are loaded via <link> in HTML for reliability */

/* CSS Variables - Clean Theme (default) */
:root {
    --bg: #0a0e14;
    --bg-elevated: #0f1419;
    --bg-card: #151b23;
    --bg-code: #1a2028;
    --cyan: #00d9ff;
    --cyan-dim: #00b8d4;
    --teal: #14b8a6;
    --blue: #0ea5e9;
    --green: #22c55e;
    --yellow: #eab308;
    --red: #ef4444;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --border: #1e293b;
    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --scanline-opacity: 0;
    --glow-intensity: 0;
    --crt-curve: 0px;
}

/* CLI Theme Variables */
[data-theme="cli"] {
    --bg: #0d0d0d;
    --bg-elevated: #111111;
    --bg-card: #0a0a0a;
    --bg-code: #080808;
    --cyan: #00ff9f;
    --cyan-dim: #00cc7f;
    --teal: #00ff9f;
    --green: #00ff9f;
    --yellow: #ffff00;
    --red: #ff0000;
    --text: #00ff9f;
    --text-muted: #00cc7f;
    --text-dim: #009966;
    --border: #00ff9f33;
    --font-display: 'JetBrains Mono', 'Fira Code', monospace;
    --radius: 0px;
    --radius-sm: 0px;
    --scanline-opacity: 0.03;
    --glow-intensity: 1;
    --crt-curve: 2px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-display);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Clean Theme - Subtle grain texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    z-index: 0;
}

[data-theme="cli"] body::before {
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    opacity: var(--scanline-opacity);
    z-index: 10000;
}

/* CLI Theme - CRT Glow Effect */
[data-theme="cli"] body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
    z-index: 9999;
}

a {
    color: var(--cyan);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--cyan-dim);
}

img {
    max-width: 100%;
    height: auto;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
}

h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.text-gradient {
    background: linear-gradient(135deg, var(--cyan) 0%, var(--teal) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* CLI Theme - Text Glow */
[data-theme="cli"] h1,
[data-theme="cli"] h2,
[data-theme="cli"] h3,
[data-theme="cli"] .logo,
[data-theme="cli"] .text-gradient {
    text-shadow: 0 0 10px var(--cyan), 0 0 20px var(--cyan), 0 0 30px var(--cyan);
}

[data-theme="cli"] .text-gradient {
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: var(--cyan);
    background-clip: unset;
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

section {
    padding: 6rem 0;
    position: relative;
}

/* Text Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }

/* Smooth theme transition */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Override for elements that shouldn't transition */
.terminal-dot, .copy-btn svg, .toast {
    transition: none;
}

/* Responsive */
@media (max-width: 768px) {
    section {
        padding: 4rem 0;
    }
}
