/* ═══════════════════════════════════════════════
   BASE — Reset, Design Tokens, Utilities
   Shared across ALL pages
   ═══════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

:root {
    /* Colors — Core */
    --navy: #051C2C;
    --navy-light: #0A2E44;
    --navy-dark: #031017;
    --navy-2: #0d3a5c;
    --teal: #00BFB3;
    --teal-dark: #009E94;
    --teal-soft: rgba(0, 191, 179, 0.10);
    --warm: #F7F6F2;
    --warm-soft: #FAFAF8;
    --warm-2: #EDECE7;
    --white: #FFFFFF;
    --ink: #1A1A1A;
    --ink-2: #4A4A4A;
    --ink-3: #7A7A7A;
    --ink-4: #737373;
    --teal-text: #008F86;
    --border: #E8E7E3;

    /* Colors — Semantic */
    --red: #DC2626;
    --red-soft: rgba(220, 38, 38, 0.08);
    --green: #059669;
    --green-soft: rgba(5, 150, 105, 0.08);
    --blue: #6366F1;
    --blue-soft: rgba(99, 102, 241, 0.08);
    --amber: #D97706;
    --amber-soft: rgba(245, 158, 11, 0.08);
    --gold: #C9A96E;

    /* Colors — Tag accents (lighter variants for labels) */
    --indigo-light: #818CF8;
    --amber-light: #FBBF24;
    --emerald-light: #34D399;

    /* Colors — Extended palette */
    --ink-1: #111111;
    --warm-3: #DEDAD2;
    --msci: #B8C4CE;
    --dark-hero: #041828;

    /* Chart colors */
    --chart-primary: #00BFB3;
    --chart-primary-rgb: 0, 191, 179;
    --chart-secondary: #C9A96E;
    --chart-tertiary: #6366F1;
    --chart-danger: #DC2626;
    --chart-danger-rgb: 220, 38, 38;
    --chart-success: #00BF63;
    --chart-success-rgb: 0, 191, 99;
    --chart-muted: rgba(0, 0, 0, 0.15);
    --chart-grid: rgba(0, 0, 0, 0.05);
    --chart-grid-bold: rgba(0, 0, 0, 0.12);
    --chart-tick: rgba(0, 0, 0, 0.35);
    --chart-tooltip-bg: rgba(10, 46, 68, 0.95);

    /* Layout tokens */
    --content-max-w: 1120px;
    --section-px: 56px;

    /* Typography */
    --serif: 'Playfair Display', Georgia, serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Motion */
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-transform: cubic-bezier(0.32, 0.72, 0, 1);

    /* Z-index scale */
    --z-base: 1;
    --z-empty: 150;
    --z-progress: 180;
    --z-tabbar: 190;
    --z-topbar: 200;
    --z-dropdown: 300;
    --z-loading: 500;
    --z-overlay: 999;
    --z-modal: 1000;

    /* Shadows — Multi-layer, depth-aware */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 0 0 1px rgba(0,0,0,0.03), 0 2px 4px rgba(0,0,0,0.03), 0 8px 24px rgba(0,0,0,0.06);
    --shadow-lg: 0 0 0 1px rgba(0,0,0,0.03), 0 4px 8px rgba(0,0,0,0.03), 0 12px 32px rgba(0,0,0,0.06), 0 24px 48px rgba(0,0,0,0.04);
    --shadow-xl: 0 0 0 1px rgba(0,0,0,0.02), 0 8px 16px rgba(0,0,0,0.04), 0 24px 56px rgba(0,0,0,0.08), 0 40px 80px rgba(0,0,0,0.06);
}

html { overflow-x: hidden; }
body {
    font-family: var(--sans);
    color: var(--ink);
    background: var(--white);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.num { font-variant-numeric: tabular-nums; }

/* ═══ Section Labels ═══ */
.sec-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--teal);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}
.sec-title {
    font-family: var(--serif);
    font-size: 48px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--navy);
    margin-bottom: 16px;
}
.sec-title em { font-style: italic; color: var(--ink-3); font-weight: 500; }
.sec-text {
    font-size: 17px;
    line-height: 1.75;
    color: var(--ink-3);
    max-width: 580px;
    margin: 0 auto;
}

/* ═══ Scroll Reveal Animations ═══ */
.rv {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.rv.vis { opacity: 1; transform: translateY(0); }
.rd1 { transition-delay: 0.06s; }
.rd2 { transition-delay: 0.12s; }
.rd3 { transition-delay: 0.18s; }
.rd4 { transition-delay: 0.24s; }
.rd5 { transition-delay: 0.30s; }
.rd6 { transition-delay: 0.36s; }
.rd7 { transition-delay: 0.42s; }

/* ═══ Utility Classes ═══ */
.is-hidden { display: none !important; }
.is-invisible { visibility: hidden !important; }

/* ── Typography utilities ── */
.overline { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--teal); }
.heading-display { font-family: var(--serif); font-weight: 700; line-height: 1.12; letter-spacing: -0.02em; color: var(--navy); }
.heading-display em { font-style: italic; color: var(--ink-3); font-weight: 500; }
.heading-display--xl { font-size: 48px; }
.heading-display--lg { font-size: 40px; }
.heading-display--md { font-size: 32px; }
.subtitle { font-size: 16px; line-height: 1.7; color: var(--ink-3); max-width: 540px; }
.subtitle--light { color: rgba(255,255,255,0.55); }

/* ── Dark hero section pattern ── */
.dark-hero-section {
    background: linear-gradient(170deg, var(--dark-hero) 0%, var(--navy) 40%, var(--navy-light) 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden;
    min-height: 100vh;
    padding: calc(var(--header-h) + 40px) var(--section-px) 60px;
}
.dark-hero-tag {
    display: inline-flex; align-items: center; gap: 12px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.14em; color: var(--teal); margin-bottom: 20px;
}
.dark-hero-tag-line {
    display: inline-block; width: 28px; height: 2px;
    background: var(--teal); opacity: 0.4;
}
.dark-hero-inner {
    position: relative; z-index: 1; max-width: 880px; width: 100%;
    display: flex; flex-direction: column; align-items: center;
}
.dark-hero-title {
    font-family: var(--serif); font-size: 48px; font-weight: 700;
    line-height: 1.12; letter-spacing: -0.02em; color: var(--white);
    margin-bottom: 16px;
}
.dark-hero-title em {
    color: rgba(255,255,255,0.55); font-weight: 500;
}
.dark-hero-sub {
    font-size: 16px; line-height: 1.7; color: rgba(255,255,255,0.40);
    max-width: 540px; margin: 0 auto 40px;
}
.ambient-glow { position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; }

/* ── Color utilities ── */
.text-ink-4 { color: var(--ink-4); }

/* Inherit font-family on form elements */
button, input, select, textarea { font-family: inherit; }

/* ═══ Accessibility ═══ */
:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
    outline: none;
}

/* ═══ Section title variant ═══ */
.section-title--sm { font-size: 32px; }

/* ═══ Body loading state ═══ */
.body-loading { opacity: 0; transition: opacity 0.2s; }

/* ═══ Skip navigation ═══ */
.skip-nav {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 10000;
    padding: 12px 24px;
    background: var(--navy);
    color: var(--white);
    border-radius: 0 0 8px 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s ease;
}
.skip-nav:focus {
    top: 0;
}

/* ═══ Error states ═══ */
.error-banner {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-overlay);
    max-width: 600px;
    width: calc(100% - 32px);
    padding: 14px 24px;
    background: var(--red-soft);
    border: 1px solid var(--red);
    border-radius: 10px;
    color: var(--red);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    box-shadow: var(--shadow-md);
}
.chart-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 24px;
    color: var(--ink-3);
    font-size: 14px;
    text-align: center;
    background: var(--warm);
    border-radius: 12px;
}

/* ═══ Print styles ═══ */
@media print {
    .topbar, .tabbar, .progress-strip, .metricsFab, .premium-lock-overlay { display: none !important; }
    .tab-pane { display: block !important; opacity: 1 !important; }
    body { opacity: 1 !important; }
    * { animation: none !important; transition: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
