/* ============================================
   THE CLIMATE LEDGER — DESIGN SYSTEM
   Premium Emerald Forest Theme
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Colors - Emerald Forest Dark */
    --bg-primary: #021a0a;
    --bg-secondary: #041f10;
    --bg-tertiary: #0a3019;
    --bg-card: rgba(6, 40, 20, 0.5);

    --accent-emerald: #10b981;
    --accent-emerald-light: #34d399;
    --accent-emerald-dark: #059669;
    --accent-teal: #14b8a6;
    --accent-cyan: #2dd4bf;
    --accent-blue: #22d3ee;
    --accent-violet: #a78bfa;
    --accent-violet-rgb: 167, 139, 250;
    --accent-purple: var(--accent-violet);
    --accent-pink: #ec4899;
    --accent-amber: #fbbf24;
    --accent-gold: #d4a017;

    /* Primary Accent — Emerald Green */
    --accent-main: #10b981;
    --accent-main-light: #34d399;
    --accent-main-rgb: 16, 185, 129;
    --accent-cyan-rgb: 45, 212, 191;

    --gradient-primary: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
    --gradient-hero: linear-gradient(135deg, #34d399 0%, #10b981 40%, #fbbf24 100%);
    --gradient-dark: linear-gradient(180deg, #021a0a 0%, #041f10 100%);
    --gradient-card: linear-gradient(135deg, rgba(253, 251, 247, 0.05) 0%, rgba(253, 251, 247, 0.01) 100%);
    --gradient-glow: radial-gradient(ellipse at center, rgba(16, 185, 129, 0.2) 0%, transparent 70%);

    /* Glass — Cream-tinted frost */
    --glass-bg: rgba(253, 251, 247, 0.03);
    --glass-bg-hover: rgba(253, 251, 247, 0.08);
    --glass-border: rgba(253, 251, 247, 0.1);
    --glass-border-hover: rgba(253, 251, 247, 0.25);
    --glass-blur: 24px;

    /* Text */
    --text-primary: #fdfbf7; /* Soft cream/off-white */
    --text-secondary: #86efac;
    --text-tertiary: #4ade80;
    --text-accent: #34d399;

    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;
    --space-5xl: 8rem;

    /* Borders */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows — green-tinted glow */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 30px rgba(16, 185, 129, 0.3);
    --shadow-glow-lg: 0 0 60px rgba(16, 185, 129, 0.25), 0 0 120px rgba(45, 212, 191, 0.1);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 0.2s;
    --duration-normal: 0.4s;
    --duration-slow: 0.8s;

    /* Z-indexes */
    --z-canvas: -1;
    --z-content: 1;
    --z-navbar: 150;
    --z-mobile-menu: 100;
    --z-modal: 200;
    --z-widget: 300;
    --z-transition: 999;

    /* Container */
    --container-max: 1280px;
    --container-padding: 1.5rem;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Three.js Canvas */
#three-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-canvas);
    pointer-events: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
}

h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
}

h3 {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: 600;
}

h4 {
    font-size: 1.125rem;
    font-weight: 600;
}

p {
    color: var(--text-secondary);
    max-width: 680px;
}

a {
    color: var(--accent-main);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--accent-main-light);
}

/* --- Focus visibility (keyboard navigation) --- */
:focus-visible {
    outline: 2px solid var(--accent-main-light);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Gradient text */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-hero {
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Layout --- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.main-content {
    position: relative;
    z-index: var(--z-content);
    min-height: 100vh;
}

.section {
    padding: var(--space-5xl) 0;
    position: relative;
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-4xl);
}

.section-header .section-label {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent-main);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: var(--space-md);
    padding: var(--space-xs) var(--space-lg);
    border: 1px solid rgba(var(--accent-main-rgb), 0.3);
    border-radius: var(--radius-full);
    background: rgba(var(--accent-main-rgb), 0.05);
}

.section-header h2 {
    margin-bottom: var(--space-lg);
}

.section-header p {
    margin: 0 auto;
    font-size: 1.1rem;
}

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-xl); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-xl); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-xl); }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    :root {
        --container-padding: 1rem;
        --space-5xl: 5rem;
        --space-4xl: 4rem;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Selection --- */
::selection {
    background: rgba(var(--accent-main-rgb), 0.3);
    color: var(--text-primary);
}

/* --- Page Transition Overlay --- */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: var(--z-transition);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s var(--ease-out);
}

.page-transition.active {
    opacity: 1;
    pointer-events: all;
}

/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-accent { color: var(--accent-main); }
.text-secondary { color: var(--text-secondary); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { gap: var(--space-md); }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* Reveal animation base */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
