:root {
    /* --- THE SYSTEM PALETTE : VOID (Dark Mode) --- */
    --color-void: #050505;
    --color-obsidian: #0A0A0A;
    --color-carbon: #141414;

    --color-glass: rgba(255, 255, 255, 0.03);
    --color-glass-hover: rgba(255, 255, 255, 0.06);
    --color-glass-border: rgba(255, 255, 255, 0.08);

    --color-text-primary: #F2F2F2;
    --color-text-secondary: #888888;
    --color-text-mono: #555555;

    --color-accent: #FFFFFF;
    --color-signal: #00FF41;
    /* Status Green */

    /* --- THE DOCUMENT PALETTE : PAPER (Light Mode) --- */
    --paper-bg: #F4F4F0;
    /* Off-White / Bone */
    --paper-surface: #EAEAE4;
    --paper-text-primary: #111111;
    /* Near Black */
    --paper-text-secondary: #555555;
    --paper-border: rgba(0, 0, 0, 0.08);
    --paper-accent: #000000;

    /* --- FLUID TYPOGRAPHY (Editorial / Swiss Style) --- */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* More dramatic scale - REDUCED for readability */
    --h1-size: clamp(2rem, 3vw + 0.5rem, 4rem);
    --h2-size: clamp(2rem, 2vw + 0.5rem, 3rem);
    --h3-size: clamp(1rem, 1vw, 1.5rem);
    --body-size: clamp(0.9rem, 1vw, 1.1rem);

    /* --- SPACING & LAYOUT --- */
    --spacing-xs: clamp(0.5rem, 1vw, 1rem);
    --spacing-sm: clamp(1rem, 2vw, 2rem);
    --spacing-md: clamp(2rem, 4vw, 4rem);
    --spacing-lg: clamp(4rem, 6vw, 8rem);

    --header-height: 100px;
    --container-max: 1920px;
    --border-radius: 0px;
    /* Sharp corners for Brutalist feel */
}

/* --- LIGHT THEME OVERRIDES --- */
.light-theme {
    --color-void: var(--paper-bg);
    --color-obsidian: var(--paper-surface);
    --color-carbon: var(--paper-surface);

    /* Invert Glass for Light Mode clarity */
    --color-glass: rgba(0, 0, 0, 0.05);
    --color-glass-hover: rgba(0, 0, 0, 0.08);
    --color-glass-border: rgba(0, 0, 0, 0.1);

    --color-text-primary: var(--paper-text-primary);
    --color-text-secondary: var(--paper-text-secondary);
    --color-text-mono: #666666;

    --color-accent: var(--paper-accent);
    /* Signal Green stays same or gets darker? Keep same for consistency or darken: */
    --color-signal: #00AA2D;
}

/* --- DATA RAIL LAYOUT (Sub-pages) --- */
.data-rail-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    /* Fixed Sidebar + Fluid Content */
    min-height: 100vh;
}

.data-rail-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: calc(var(--header-height) + 2rem) 2rem 2rem 4vw;
    border-right: 1px solid var(--color-glass-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.data-rail-content {
    padding: calc(var(--header-height) + 4rem) 4vw 4rem 4rem;
    max-width: 1400px;
    /* Readability cap on wide screens */
}

@media (max-width: 1024px) {
    .data-rail-layout {
        grid-template-columns: 1fr;
    }

    .data-rail-sidebar {
        display: none;
    }

    .data-rail-content {
        padding: calc(var(--header-height) + 2rem) 4vw 2rem;
    }
}

/* --- RESET & BASICS --- */
html.lenis {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    cursor: crosshair;
    /* Technical cursor */
}

body {
    background-color: var(--color-void);
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* FILM GRAIN OVERLAY REMOVED FOR PERFORMANCE */
/* body::after { ... } */

/* --- TYPOGRAPHY --- */
h1,
h2,
h3,
h4 {
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 0.95;
    text-transform: uppercase;
}

h1 {
    font-size: var(--h1-size);
}

h2 {
    font-size: var(--h2-size);
}

h3 {
    font-size: var(--h3-size);
    margin-bottom: 1.5rem;
}

p {
    font-size: var(--body-size);
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
    font-weight: 300;
}

strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

a {
    color: inherit;
    text-decoration: none;
    transition: 0.3s;
}

/* --- LAYOUT UTILITIES --- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 4vw;
}

.corp-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem;
    position: relative;
}

.col-span-12 {
    grid-column: span 12;
}

.col-span-8 {
    grid-column: span 8;
}

.col-span-6 {
    grid-column: span 6;
}

.col-span-4 {
    grid-column: span 4;
}

.col-span-3 {
    grid-column: span 3;
}

.col-span-2 {
    grid-column: span 2;
}

/* --- COMPONENTS --- */

/* 1. HUD Button */
.btn,
.btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    /* Standard padding */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-glass-border);
    color: var(--color-text-primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.btn:hover,
.btn-small:hover {
    background: var(--color-text-primary);
    color: var(--color-void);
    border-color: var(--color-text-primary);
}

/* 2. Compliance/Tech Badge */
.compliance-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    border: 1px solid var(--color-glass-border);
    padding: 0.3rem 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(0, 0, 0, 0.3);
}

/* 3. Glass Panel / Stat Block */
.stat-block {
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    padding: 2rem;
    backdrop-filter: blur(10px);
}

/* 4. Data Rail (The Sidebar) */
.data-rail {
    border-left: 1px solid var(--color-glass-border);
    padding-left: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.rail-item h4 {
    font-family: var(--font-mono);
    color: var(--color-text-mono);
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

/* --- HEADER HUD --- */
header {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4vw;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(3, 3, 3, 0.0);
    /* Transparent initially */
    transition: background 0.5s, border-color 0.5s, backdrop-filter 0.5s;
}

header.scrolled {
    background: rgba(3, 3, 3, 0.3);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-glass-border);
}

.logo {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    display: flex;
    flex-direction: column;
    line-height: 0.9;
}

.desktop-nav ul {
    display: flex;
    gap: 3rem;
    list-style: none;
}

.desktop-nav a {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    position: relative;
}

.desktop-nav a:hover {
    opacity: 1;
}

.desktop-nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0%;
    height: 1px;
    background: var(--color-accent);
    transition: 0.3s;
}

.desktop-nav a:hover::after {
    width: 100%;
}

/* Light Mode Nav Override */
.light-mode-nav a {
    color: var(--color-text-primary);
    /* Should be dark in light mode via variables */
    font-weight: 500;
}

.light-mode-nav a::after {
    background: var(--color-text-primary);
}

/* --- HERO --- */
.hero-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    /* Ensure left alignment */
    position: relative;
    z-index: 10;
    padding: 0 4vw;
}

.hero-content h1 {
    /* Solid text, no blend mode */
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    /* Boost contrast against particles */
}

#hero-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    opacity: 0.6;
}

/* --- SECTIONS --- */
.section-light {
    /* In 2030 design, we don't do 'light' sections. We do Glass sections. */
    background: transparent;
    border-top: 1px solid var(--color-glass-border);
}

/* --- UTILITIES --- */
.sticky-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 2rem);
    align-self: start;
}

.scroll-item {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--color-glass-border);
}

.scroll-item:last-child {
    border-bottom: none;
}

.border-top {
    border-top: 1px solid var(--color-glass-border);
}

.border-bottom {
    border-bottom: 1px solid var(--color-glass-border);
}

.text-mono {
    font-family: var(--font-mono);
}

.text-accent {
    color: var(--color-text-primary);
}

.mt-xs {
    margin-top: var(--spacing-xs);
}

.mt-sm {
    margin-top: var(--spacing-sm);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mb-sm {
    margin-top: 80px;
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

.pt-sm {
    padding-top: var(--spacing-sm);
}

.pt-md {
    padding-top: var(--spacing-md);
}

.pt-lg {
    padding-top: var(--spacing-lg);
}

.pb-sm {
    padding-bottom: var(--spacing-sm);
}

.pb-md {
    padding-bottom: var(--spacing-md);
}

.pb-lg {
    padding-bottom: var(--spacing-lg);
}

/* --- RESPONSIVE --- */
/* --- MOBILE MENU (Default Hidden) --- */
.mobile-nav,
.hamburger {
    display: none;
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    .corp-grid {
        grid-template-columns: 1fr;
    }

    .col-span-12,
    .col-span-6,
    .col-span-4,
    .col-span-3,
    .col-span-2 {
        grid-column: span 1;
    }

    .desktop-nav,
    .btn-small {
        display: none;
    }

    /* Hamburger Button */
    .hamburger {
        display: flex;
        flex-direction: column;
        gap: 6px;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 200;
    }

    .hamburger span {
        display: block;
        width: 30px;
        height: 2px;
        background-color: var(--color-text-primary);
        transition: 0.3s;
    }

    .hamburger.active span {
        background-color: #F2F2F2;
    }

    /* Hamburger Animation */
    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }

    .hamburger.active span:nth-child(2) {
        transform: rotate(-45deg) translate(5px, -6px);
    }

    /* Mobile Nav Overlay */
    .mobile-nav {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(5, 5, 5, 0.9);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        z-index: 150;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        padding: 2rem;
    }

    /* Active State (toggled by JS) */
    .mobile-nav.active {
        opacity: 1;
        pointer-events: all;
    }

    .mobile-nav ul {
        list-style: none;
        text-align: center;
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .mobile-nav li {
        opacity: 0;
        transform: translateY(20px);
        transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .mobile-nav.active li {
        opacity: 1;
        transform: translateY(0);
    }

    /* Stagger Loop */
    .mobile-nav.active li:nth-child(1) {
        transition-delay: 0.1s;
    }

    .mobile-nav.active li:nth-child(2) {
        transition-delay: 0.15s;
    }

    .mobile-nav.active li:nth-child(3) {
        transition-delay: 0.2s;
    }

    .mobile-nav.active li:nth-child(4) {
        transition-delay: 0.25s;
    }

    .mobile-nav.active li:nth-child(5) {
        transition-delay: 0.3s;
    }

    .mobile-nav.active li:nth-child(6) {
        transition-delay: 0.35s;
    }

    .mobile-nav.active li:nth-child(7) {
        transition-delay: 0.4s;
    }

    .mobile-nav.active li:nth-child(8) {
        transition-delay: 0.45s;
    }

    .mobile-nav a {
        font-size: clamp(1.5rem, 5vw, 2.5rem);
        font-weight: 800;
        text-transform: uppercase;
        color: #F2F2F2;
        letter-spacing: -0.02em;
        position: relative;
        display: inline-block;
    }

    .mobile-nav a::after {
        content: '';
        position: absolute;
        bottom: 5px;
        left: 0;
        width: 0%;
        height: 2px;
        background: var(--color-signal);
        transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .mobile-nav a:hover::after {
        width: 100%;
    }

    .sticky-sidebar {
        position: relative;
        top: 0;
        margin-bottom: 3rem;
    }

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

    .data-rail {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--color-glass-border);
        padding-top: 2rem;
        margin-top: 3rem;
    }
}

/* --- PRINT STYLES --- */
@media print {
    @page {
        margin: 2cm;
        size: auto;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 11pt !important;
        line-height: 1.4 !important;
    }

    /* Hide UI Elements */
    .data-rail-sidebar,
    header,
    /* The fixed header */
    .btn,
    .btn-small,
    footer,
    .mobile-nav,
    .hamburger,
    #hero-canvas,
    .compliance-badge,
    a[href^="javascript:"] {
        display: none !important;
    }

    /* Layout Resets */
    .data-rail-layout {
        display: block !important;
    }

    .data-rail-content {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .container {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Typography Overrides */
    h1,
    h2,
    h3,
    h4 {
        color: #000000 !important;
        page-break-after: avoid;
    }

    h1 {
        font-size: 24pt !important;
        margin-bottom: 0.5cm !important;
    }

    h2 {
        font-size: 16pt !important;
        margin-bottom: 1cm !important;
        opacity: 1 !important;
    }

    h3 {
        font-size: 14pt !important;
        border-bottom: 1px solid #000;
        padding-bottom: 5px;
        margin-top: 1cm !important;
    }

    h4 {
        font-size: 11pt !important;
        opacity: 1 !important;
        color: #333 !important;
    }

    p,
    li {
        color: #000 !important;
        opacity: 1 !important;
        orphans: 3;
        widows: 3;
    }

    /* Spacing Overrides */
    .mt-md,
    .mb-md,
    .mt-lg,
    .mb-lg,
    .pt-md,
    .pb-md {
        margin-top: 0.5cm !important;
        margin-bottom: 0.5cm !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .border-top,
    .border-bottom {
        border: none !important;
    }

    /* Grid Reset */
    .corp-grid {
        display: block !important;
    }

    .col-span-6,
    .col-span-4,
    .col-span-3 {
        width: 100% !important;
        margin-bottom: 1cm !important;
    }

    /* Links */
    a {
        text-decoration: none !important;
        color: #000 !important;
    }

    a::after {
        content: " (" attr(href) ")";
        font-size: 0.8rem;
        opacity: 0.7;
    }

    /* Don't show link HREF for internal anchor links or javascript */
    a[href^="#"]::after,
    a[href^="javascript"]::after {
        content: "";
    }

    /* Specific tweaks for whitepaper header */
    header.mb-md {
        display: block !important;
        /* Ensure the content header shows, while nav header is hidden */
        position: static !important;
        background: transparent !important;
        border: none !important;
        height: auto !important;
        padding: 0 !important;
    }
}

/* --- WHITEPAPER / DOCUMENT STYLES --- */
/* Ensure lists and other text-heavy elements share the same max-width as paragraphs */
.data-rail-content ul,
.data-rail-content ol {
    margin-bottom: 2rem;
    line-height: 1.6;
}

.data-rail-content li {
    margin-bottom: 0.5rem;
    color: var(--color-text-secondary);
}

/* Ensure corp-grid items in whitepaper don't stretch too wide if used for text */
.data-rail-content .corp-grid p {
    max-width: 100%;
    /* Let grid control width */
}

/* Force wrapping for long words if needed */
.data-rail-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
}