/* --- ATLAS SOVEREIGN 3.3: HIGH-CONTRAST ARCHITECTURE --- */
:root {
    --atlas-blue: #004990;
    --atlas-gold: #D59F0F;
}

/* --- THE 3D GLASS ORB (State Machine Base) --- */
#atlasTrigger {
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    transition: background 1s ease, border-color 1s ease, box-shadow 1s ease; /* Smooth state transitions */
    /* Base structural styles */
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: inset -4px -4px 10px rgba(0,0,0,0.6), inset 4px 4px 10px rgba(255,255,255,0.2), 0 10px 25px rgba(0,0,0,0.4);
}

/* STATE 1: NORMAL (Corporate Blue) */
#atlasTrigger.state-normal {
    background: radial-gradient(circle at 30% 30%, #2a5298, var(--atlas-blue)) !important;
}

/* STATE 2: ALARMED (Emergency Red) */
#atlasTrigger.state-alarmed {
    background: radial-gradient(circle at 30% 30%, #e74c3c, #900000) !important;
    border-color: #ffcccc !important;
    box-shadow: 0 0 30px rgba(231, 76, 60, 0.8) !important;
}

/* STATE 3: SECURED (Blue/Gold Mix) */
#atlasTrigger.state-secured {
    background: linear-gradient(135deg, var(--atlas-gold), var(--atlas-blue)) !important;
}

/* STATE 4: ENLIGHTENED/THINKING (Glowing Gold) */
#atlasTrigger.state-thinking {
    background: radial-gradient(circle at 30% 30%, #f4c430, var(--atlas-gold)) !important;
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.8), inset -4px -4px 10px rgba(0,0,0,0.6) !important;
}

#atlasTrigger::after {
    content: ''; position: absolute; top: -100%; left: -100%; width: 300%; height: 300%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.15), transparent);
    transform: rotate(45deg); animation: atlasGlint 10s infinite linear;
}
@keyframes atlasGlint {
    0% { transform: translate(-80%, -80%) rotate(45deg); }
    100% { transform: translate(80%, 80%) rotate(45deg); }
}

/* AI & USER MESSAGE STABILITY (Night Mode Optimized) */
.atlas-message.ai {
    background: #1e1e4a !important; /* Lighter than background for depth in Night mode */
    border-left: 4px solid var(--atlas-gold) !important;
    color: #f0ede8 !important;
    border-radius: 4px 16px 16px 16px !important;
    font-style: italic;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.atlas-message.user {
    background: var(--atlas-blue) !important;
    color: #FFFFFF !important;
    border-radius: 16px 16px 4px 16px !important;
}

/* STABILIZE PANEL DIMENSIONS & DARKNESS */
.atlas-panel {
    width: 380px !important; height: 500px !important;
    background: #141430 !important; /* Solid dark blue prevents background bleeding */
    border: 1px solid rgba(255,255,255,0.1) !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5) !important;
}
/* ============================================================
   ENCOMPASS GROUP — SOVEREIGN DESIGN SYSTEM
   Premium Aesthetic Minimalism - 2026 UI/UX
   ============================================================ */

   :root {
    /* DEFAULT (DARK MODE) COLORS */
    --bg-primary: #0a0a1a;
    --bg-secondary: #0f0f28;
    --bg-surface: #1a1a3e;
    
    --text-main: #f0ede8;
    --text-muted: rgba(240, 237, 232, 0.7);
    --text-ghost: rgba(240, 237, 232, 0.4);
    
    --accent-gold: #d4af37;
    --accent-gold-dim: rgba(212, 175, 55, 0.12);
    --accent-gold-border: rgba(212, 175, 55, 0.3);
    
    --accent-blue: #1a3a6e;
    --accent-blue-bright: #2a5298;
    
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(20px);
    
    /* TYPOGRAPHY */
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-sans: 'Inter', system-ui, sans-serif;
    
    /* SPACING */
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 8rem;
    --space-2xl: 12rem;
    
    /* MOTION */
    --ease-luxury: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 0.3s var(--ease-luxury);
    --transition-slow: 0.8s var(--ease-luxury);
}

/* --- SOVEREIGN THEME ENGINE & CONTRAST FIX --- */
body { 
    background-color: var(--bg-primary); 
    color: var(--text-main); 
    transition: background-color 0.3s ease;
}

/* ============================================================
   AUTHORITATIVE LIGHT MODE (DAY MODE) OVERRIDES
   Client Branding: Deep Blue (#004990) & Gold (#D59F0F)
   ============================================================ */

[data-theme="light"] {
    /* Backgrounds: Crisp white and a 3% Deep Blue tint for section depth */
    --bg-primary: #ffffff;
    --bg-secondary: #f3f6fa; 
    --bg-surface: #ffffff;

    /* Typography: Deep Blue replaces black for high-end corporate branding */
    --text-main: #004990 !important;
    --text-muted: #3b5a7a !important; /* Softened blue-slate for paragraphs */
    --text-ghost: #7992ab !important;

    /* Accents: Client's Corporate Colors */
    --accent-gold: #D59F0F;
    --accent-gold-dim: rgba(213, 159, 15, 0.12);
    --accent-gold-border: rgba(213, 159, 15, 0.3);
    --accent-blue: #004990;
    --accent-blue-bright: #005bb5;

    /* Glassmorphism: Tinted with Deep Blue instead of standard grey/black */
    --glass-bg: rgba(0, 73, 144, 0.03);
    --glass-border: rgba(0, 73, 144, 0.15);
}

/* --- LIGHT MODE SPECIFIC UI COMPONENT OVERRIDES --- */

/* 1. Navigation Visibility & Branding (Desktop & Mobile) */
[data-theme="light"] .nav-link { color: #3b5a7a !important; font-weight: 500; }
[data-theme="light"] .nav-link:hover { color: #D59F0F !important; }
[data-theme="light"] .logo-main { color: #004990 !important; }
[data-theme="light"] .hamburger span { background-color: #004990; }

/* 2. Button High-Contrast Restructuring */
[data-theme="light"] .btn-primary {
    background-color: #004990 !important;
    color: #ffffff !important;
}
[data-theme="light"] .btn-primary:hover {
    background-color: #D59F0F !important;
    color: #004990 !important;
}
[data-theme="light"] .btn-outline {
    border-color: #004990 !important;
    color: #004990 !important;
}
[data-theme="light"] .btn-outline:hover {
    background-color: rgba(0, 73, 144, 0.05) !important;
    color: #D59F0F !important;
    border-color: #D59F0F !important;
}

/* 3. Atlas AI Chatbot - Light Mode Polish */
[data-theme="light"] .atlas-panel { 
    background: #ffffff !important; 
    border-color: rgba(0, 73, 144, 0.15) !important; 
}
[data-theme="light"] .atlas-header { 
    background: #f3f6fa !important; 
    border-color: rgba(0, 73, 144, 0.15) !important; 
}
.atlas-messages { background: inherit !important; padding: 20px; z-index: 5; }
[data-theme="light"] .atlas-messages { 
    background: #ffffff !important; 
}
[data-theme="light"] .atlas-message.ai { 
    background: #f3f6fa !important; 
    color: #004990 !important; 
    border-left: 4px solid #D59F0F !important; 
    border: 1px solid rgba(0, 73, 144, 0.1) !important;
}
[data-theme="light"] .atlas-message.user { 
    background: #004990 !important; 
    color: #ffffff !important; 
}
[data-theme="light"] .atlas-input-area { 
    background: #f3f6fa !important; 
    border-top: 1px solid rgba(0, 73, 144, 0.15) !important; 
}
[data-theme="light"] .atlas-input-area input { 
    background: #ffffff !important; 
    color: #004990 !important; 
    border-color: rgba(0, 73, 144, 0.2) !important; 
}

/* 4. Insight Hub, Modals & Mobile Overlays */
[data-theme="light"] .search-overlay {
    background: rgba(255, 255, 255, 0.95);
}
[data-theme="light"] #searchInput {
    color: #004990;
}
[data-theme="light"] .mobile-menu-overlay {
    background: #f3f6fa;
}
[data-theme="light"] .mobile-nav-link {
    color: #004990;
}
[data-theme="light"] .social-cluster a {
    color: #004990 !important;
    background: #ffffff;
    border-color: rgba(0, 73, 144, 0.15) !important;
}
[data-theme="light"] .social-cluster a:hover {
    color: #D59F0F !important;
    border-color: #D59F0F !important;
}

/* --- THE LIQUID MERCURY EFFECT --- */
.liquid-orb {
    filter: url(#atlas-gooey); /* Applies the turbulence filter */
    transition: all 0.5s ease;
}

@keyframes liquid-drift {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}
/* GRAIN TEXTURE (PREMIUM FEEL) */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    z-index: 9999;
}

/* TYPOGRAPHY PRESETS */
h1, h2, h3, h4, h5 {
    font-family: var(--font-serif);
    color: var(--text-main);
    font-weight: 300;
}

.title-hero {
    font-size: clamp(2.2rem, 7vw, 6.5rem); /* Lowered minimum for mobile */
    line-height: 1.05;
    letter-spacing: -0.02em;
    word-wrap: break-word; /* Prevents long words from overflowing */
}

.title-section {
    font-size: clamp(1.8rem, 4vw, 4rem); /* Lowered minimum for mobile */
    line-height: 1.1;
    margin-bottom: var(--space-md);
    word-wrap: break-word; /* Prevents long words from overflowing */
}

.display-text {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.eyebrow {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: var(--space-sm);
}
.eyebrow::before {
    content: '';
    display: inline-block;
    width: 30px;
    height: 1px;
    background-color: var(--accent-gold);
}

/* LAYOUT UTILS */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 4vw;
}

.section-spacing {
    padding: var(--space-2xl) 0;
}

/* GLASSMORPHISM HEADER */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    padding: 1.5rem 0;
    transition: background var(--transition-fast), padding var(--transition-fast);
}

.site-header.scrolled {
    background: var(--glass-bg); /* rgba(255, 255, 255, 0.04) */
    backdrop-filter: blur(20px); /* Forces the glass look */
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 0;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3); /* Adds depth to the glass */
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
}

.logo-main {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
}
.logo-main span {
    color: var(--accent-gold);
}
.logo-sub {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.55rem;
    letter-spacing: 0.3em;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 0.1rem;
}

/* DESKTOP NAV & ACTIONS */
/* --- ORGANIZED NAV GROUPS --- */
/* --- SOVEREIGN GROUPED NAVIGATION --- */
.desktop-nav {
    display: flex;
    justify-content: space-between; /* Spreads your Narrative, Engine, and Utility groups */
    align-items: center;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    gap: clamp(1rem, 1.5vw, 2rem); /* Dynamic spacing to prevent link collisions */
}
/* FIXES CROWDING: Spaces the links INSIDE the groups */
.nav-group {
    display: flex;
    align-items: center;
    gap: clamp(1.2rem, 2.5vw, 3rem); /* Dynamic spacing that scales with screen size */
}

/* Adds the separation line for the Contact/Utility group */
.utility-group {
    padding-left: 2.5rem;
    border-left: 1px solid var(--glass-border);
}

.mobile-actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.brand-logo {
    height: 60px;
    width: auto;
    display: block;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transition: color var(--transition-fast);
    position: relative;
    white-space: nowrap !important; /* PREVENTS TEXT OVERLAP */
    display: flex;
    align-items: center;
    padding: 10px 0; /* Creates a taller hover area for better stability */
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0%;
    height: 1px;
    background-color: var(--accent-gold);
    transition: width var(--transition-fast);
}
.nav-link:hover {
    color: var(--text-main);
}
.nav-link:hover::after {
    width: 100%;
}

/* SMART SEARCH BAR ICON */
.search-trigger {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color var(--transition-fast);
}
.search-trigger:hover {
    color: var(--accent-gold);
}

/* HAMBURGER BTN (MOBILE) */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: transparent;
    border: none;
    z-index: 1001; /* Above modal */
}
.hamburger span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--text-main);
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

/* BUTTONS */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    background-color: var(--accent-gold);
    color: var(--bg-primary);
    padding: 1rem 2.5rem;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    text-decoration: none;
    position: relative;
    overflow: hidden; /* Vital for the glint effect */
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
    transition: transform 0.3s var(--ease-luxury), background-color 0.3s var(--ease-luxury);
}

/* THE LIQUID GLINT */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: 0.6s var(--ease-luxury);
}

.btn-primary:hover::after {
    left: 100%;
}
.btn-primary:hover {
    transform: translateY(-2px);
    background-color: var(--text-main);
}
.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--accent-gold-border);
    padding: 1rem 2.5rem;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    text-decoration: none;
    transition: all var(--transition-fast);
}
.btn-outline:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

/* GLOBAL SLIDER STYLES */
.global-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--glass-border);
    border-radius: 3px;
    outline: none;
}
.global-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-gold);
    border: 2px solid var(--bg-primary);
    cursor: pointer;
    transition: transform var(--transition-fast);
}
.global-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ATLAS AI CHATBOT UI */
.atlas-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 10001; /* Now higher than the 9999 modal */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.atlas-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-gold);
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    transition: transform var(--transition-fast);
    position: relative;
    z-index: 2;
}
.atlas-trigger:hover { transform: scale(1.05); }

.atlas-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    max-height: 80vh;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    overflow: hidden;
    z-index: 1;
}
.atlas-panel.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

.atlas-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex; justify-content: space-between; align-items: center;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
}
.close-atlas {
    background: none; border: none; color: var(--text-muted); cursor: pointer; transition: color 0.2s;
}
.close-atlas:hover { color: var(--accent-gold); }

.atlas-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    background: var(--bg-primary); /* Prevents text bleeding */
}
.atlas-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    animation: fadeIn 0.3s ease;
}
.atlas-message.ai {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.atlas-message.user {
    background: var(--accent-blue-bright);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.atlas-input-area {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
    display: flex; gap: 12px;
    background: var(--bg-surface);
}
.atlas-input-area input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 24px;
    outline: none;
    font-family: var(--font-sans);
}
.atlas-input-area input:focus { border-color: var(--accent-gold); }
.atlas-input-area button {
    background: var(--accent-gold);
    color: var(--bg-primary);
    border: none;
    width: 44px; height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s;
}
.atlas-input-area button:hover { transform: scale(1.05); }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* TYPING INDICATOR */
.typing-indicator p {
    display: flex;
    gap: 5px;
    align-items: center;
    height: 18px;
    margin: 0;
}
.typing-indicator .dot {
    width: 6px;
    height: 6px;
    background: var(--text-main);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
    opacity: 0.6;
}
.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* ============================================================
   RESPONSIVE & MOBILE ARMOR (Fixes all horizontal scrolling)
   ============================================================ */
    @media (max-width: 1024px) {
    .desktop-nav {
        display: none;
    }
    .hamburger {
        display: flex;
    }
    #hero .container {
        grid-template-columns: 1fr !important;
        padding-top: 4rem;
    }
    #heroGlassBox {
        aspect-ratio: 16/9 !important;
    }

    /* --- NEW: HEADER & ATLAS COMPRESSION FOR SMALL ANDROIDS --- */
    /* This stops the logo and name from overlapping the hamburger menu */
    .brand-logo { height: 40px !important; }
    .logo-main { font-size: 1.1rem !important; }
    .logo-wrapper { gap: 0.4rem !important; }
    .mobile-actions { gap: 0.8rem !important; }
    .search-trigger { font-size: 1rem !important; }
    
    /* Pulls Atlas closer to the edge and shrinks it slightly for mobile */
    .atlas-widget {
        bottom: 1rem !important;
        right: 1rem !important;
    }
    .atlas-trigger {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.2rem !important;
    }
    /* -------------------------------------------------------- */
    
   /* 1. SURGICAL GRID OVERRIDE (Fixes Android 400px Blowout Safely) */
    div[style*="grid-template-columns"], 
    section[style*="grid-template-columns"], 
    footer > div > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important; /* Forces 1 column */
        min-width: 0 !important; /* The magic rule: Stops Android from forcing 400px widths */
        width: 100% !important;
        gap: 2rem !important;
    }

    /* 2. SAFE HORIZONTAL LOCK (Does not break animations) */
    html, body {
        overflow-x: hidden !important;
        width: 100%;
        position: relative;
    }

    /* Ensure specific large elements shrink safely */
    .container {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    img, canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    /* 2. FIX HARDCODED MINIMUM WIDTHS CAUSING OVERFLOW */
    .ecosystem-card, .tool-card, .bento-tile, .killer-item {
        min-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* 3. FIX FOOTER OVERFLOWS */
    footer > .container > div:last-child {
        grid-template-columns: 1fr !important; /* Stacks logo, socials, and terms */
        text-align: center;
        gap: 2rem;
    }
    footer .social-cluster {
        justify-content: center;
    }
    footer div[style*="align-items: flex-end"] {
        align-items: center !important;
    }

    /* 4. ATLAS CHATBOT MOBILE FIX (Prevents it from pushing off screen) */
    .atlas-panel {
        width: calc(100vw - 2rem) !important; /* Adapts exactly to phone screen */
        right: 1rem !important;
        bottom: 80px !important;
        height: 65vh !important; /* Prevents keyboard from blocking chat */
    }
    
    /* 5. STRICT HORIZONTAL SCROLL LOCK */
    .section-spacing {
        padding: 4rem 0 !important;
        overflow-x: hidden;
    }
    .container {
        padding: 0 1.5rem !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    body, html {
        overflow-x: hidden !important;
        width: 100vw;
        max-width: 100vw;
    }
}

/* --- SOVEREIGN MOBILE MENU SYSTEM --- */
/* --- STABILIZED MOBILE OVERLAY --- */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Changed from center to prevent jumping */
    align-items: center;
    transform: translateY(-100%);
    transition: transform 0.6s var(--ease-luxury);
    visibility: hidden;
    padding: 8rem 2rem 4rem 2rem; /* Added top padding for the header space */
    overflow-y: auto; /* Allows scrolling if the accordion is long */
}

.mobile-menu-overlay.active {
    transform: translateY(0); /* Slides it down on click */
    visibility: visible;
}

.close-menu {
    position: absolute; top: 2rem; right: 2rem;
    background: transparent; border: none;
    color: var(--text-main); cursor: pointer; font-size: 1.5rem;
}

.mobile-nav-links { display: flex; flex-direction: column; gap: 2.5rem; text-align: center; }

.mobile-nav-link {
    font-family: var(--font-serif); font-size: 2.2rem;
    color: var(--text-main); text-decoration: none;
    transition: color 0.3s ease;
}
.mobile-nav-link:hover { color: var(--accent-gold); }

/* --- SOVEREIGN SOCIAL SYSTEM --- */
/* --- SOVEREIGN GOLD FILIGREE SOCIALS --- */
.social-cluster {
    display: flex;
    gap: 1.8rem;
    align-items: center;
}

/* --- SOVEREIGN SPECIAL LOOK SOCIALS --- */
.social-cluster a {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #004990 !important; /* Corporate Deep Blue for High-Visibility */
    background: #ffffff;
    border: 1px solid rgba(0, 73, 144, 0.15);
    border-radius: 50%;
    transition: all 0.5s var(--ease-luxury);
    overflow: hidden; /* Stops the glint from bleeding out */
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.social-cluster a::after {
    content: '';
    position: absolute;
    top: -50%; left: -150%;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent, rgba(212, 175, 55, 0.4), transparent);
    transform: rotate(45deg);
    transition: all 0.7s ease;
}

.social-cluster a:hover {
    color: var(--accent-gold) !important;
    border-color: var(--accent-gold);
    transform: translateY(-8px) scale(1.15);
    box-shadow: 0 15px 30px rgba(212, 175, 55, 0.25);
}

.social-cluster a:hover::after {
    left: 100%; /* Sweeping glint effect */
}

.social-cluster a i {
    width: 20px !important;
    height: 20px !important;
    z-index: 2;
}
/* --- SOVEREIGN ECOSYSTEM CARDS --- */
.ecosystem-card {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: all 0.5s var(--ease-luxury);
    position: relative;
    overflow: hidden; /* Locks the reflection inside the card */
}

/* THE SOVEREIGN REFLECTION */
.ecosystem-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(212, 175, 55, 0.05),
        transparent
    );
    transition: 0.8s var(--ease-luxury);
}

.ecosystem-card:hover::before {
    left: 150%;
}

.ecosystem-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-gold);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.ecosystem-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-gold);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

/* THE LOGO PROTECTOR: Works for both Day & Night */
.eco-logo-box {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.05); /* Frosted tint */
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    margin-bottom: 1rem;
}

.eco-logo-box img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.2));
}

.eco-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1rem;
}

.eco-tags span {
    font-size: 0.7rem;
    padding: 0.4rem 0.8rem;
    background: var(--accent-gold-dim);
    color: var(--accent-gold);
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.eco-tags.azure span {
    background: rgba(42, 82, 152, 0.1);
    color: #2a5298;
}

/* --- THE FIRM CONSOLIDATION DROPDOWN --- */
.firm-dropdown { 
    position: relative; 
    display: flex; 
    align-items: center; 
    padding-bottom: 15px; 
    margin-bottom: -15px; 
}
.firm-menu { 
    position: absolute; 
    top: 100%; 
    left: 0; 
    width: 180px; 
    background: var(--bg-surface); 
    backdrop-filter: blur(20px); 
    border: 1px solid var(--glass-border); 
    border-radius: 8px; 
    padding: 1rem; 
    opacity: 0; 
    visibility: hidden; 
    pointer-events: none; 
    transition: opacity 0.2s ease, visibility 0.2s; 
    z-index: 2000; 
    display: flex; 
    flex-direction: column; 
    gap: 0.8rem; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
/* The invisible bridge so the mouse doesn't fall off */
.firm-menu::before { 
    content: ''; position: absolute; top: -15px; left: 0; width: 100%; height: 15px; background: transparent; 
}
.firm-dropdown:hover .firm-menu { 
    opacity: 1; visibility: visible; pointer-events: all; 
}

.ecosystem-dropdown { 
    position: relative; 
    display: flex; 
    align-items: center;
    /* This creates a physical bridge between the link and the menu */
    padding-bottom: 15px; 
    margin-bottom: -15px; 
}

.mega-menu-overlay {
    position: absolute; 
    top: 100%; /* Sits exactly where the padding-bottom ends */
    left: 50%;
    transform: translateX(-50%); 
    width: 600px; 
    background: var(--bg-surface);
    backdrop-filter: blur(20px); 
    border: 1px solid var(--glass-border);
    border-radius: 12px; 
    padding: 1.5rem; 
    opacity: 0; 
    visibility: hidden;
    /* Short, simple transition to prevent lag */
    transition: opacity 0.2s ease, visibility 0.2s; 
    z-index: 2000; /* Ensures it stays above all hero content */
    pointer-events: none;
}

/* THE SAFETY BRIDGE */
.mega-menu-overlay::before {
    content: '';
    position: absolute;
    top: -30px; 
    left: 0;
    width: 100%;
    height: 35px;
    background: transparent;
}

.ecosystem-dropdown:hover .mega-menu-overlay {
    opacity: 1 !important; 
    visibility: visible !important; 
    pointer-events: all !important;
}

.mega-menu-content { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.mega-item { display: flex; gap: 1rem; padding: 1rem; text-decoration: none; border-radius: 8px; transition: background 0.3s ease; }
.mega-item:hover { background: var(--glass-bg); }

.mega-icon-wrapper {
    width: 60px; height: 60px; min-width: 60px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.08); border: 1px solid var(--glass-border);
}
.mega-icon-wrapper img { width: 80%; height: auto; }
.mega-text h4 { margin: 0; color: var(--text-main); font-size: 1rem; }
.mega-text p { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; margin: 0.2rem 0 0 0; }

/* --- MOBILE ECOSYSTEM ACCORDION --- */
.mobile-accordion { width: 100%; border-bottom: 1px solid var(--glass-border); }

.accordion-trigger {
    background: none; border: none; width: 100%; text-align: left;
    display: flex; justify-content: center; align-items: center; gap: 10px;
    padding: 1.5rem 0; cursor: pointer;
}

.mobile-accordion-content {
    max-height: 0; overflow: hidden;
    transition: max-height 0.5s var(--ease-luxury);
    background: rgba(255,255,255,0.03);
    display: flex; flex-direction: column; gap: 1rem;
}

.mobile-accordion-content.active { max-height: 300px; padding: 1.5rem 0; }

.mobile-eco-item {
    display: flex; align-items: center; gap: 1.2rem;
    text-decoration: none; padding: 0.8rem 1rem;
}

.mobile-eco-item img {
    width: 50px; height: 50px; border-radius: 50%;
    background: rgba(255,255,255,0.08); padding: 5px;
    border: 1px solid var(--glass-border);
}

.mobile-eco-item .text strong { display: block; color: var(--text-main); font-size: 1.1rem; }
.mobile-eco-item .text span { color: var(--accent-gold); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; }

/* --- SOVEREIGN VAULT MODAL --- */
.vault-modal { position: fixed; inset: 0; background: rgba(10, 10, 26, 0.85); backdrop-filter: blur(10px); z-index: 3000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.4s var(--ease-luxury); }
.vault-modal.active { opacity: 1; pointer-events: all; }
.vault-modal-content { background: var(--bg-surface); border: 1px solid var(--accent-gold); padding: 3rem; border-radius: 12px; width: 90%; max-width: 500px; transform: translateY(20px); transition: transform 0.4s var(--ease-luxury); box-shadow: 0 20px 50px rgba(0,0,0,0.5); position: relative; }
.vault-modal.active .vault-modal-content { transform: translateY(0); }
.close-vault { position: absolute; top: 1.5rem; right: 1.5rem; background: transparent; border: none; color: var(--text-muted); cursor: pointer; transition: color 0.3s ease; }
.close-vault:hover { color: var(--accent-gold); }

/* --- BREAKPOINT OPTIMIZATION (1350px Squeeze for Overcrowded Header) --- */
@media (max-width: 1350px) and (min-width: 1025px) {
    .desktop-nav { gap: 0.5rem !important; max-width: 800px; }
    .nav-group { gap: 0.8rem !important; }
    .nav-link { font-size: 0.65rem !important; letter-spacing: 0.05em; }
    .btn-primary { padding: 0.7rem 1.2rem !important; font-size: 0.6rem !important; }
    .logo-main { font-size: 1.1rem !important; }
    .mobile-actions { gap: 0.8rem; }
    .utility-group { padding-left: 1rem; }
}

/* --- THE SOVEREIGN READING LINE --- */
#reading-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%; /* Initial state */
    height: 2px;
    background: var(--accent-gold);
    z-index: 9999; /* Stays above the header */
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    transition: width 0.1s ease-out;
}

/* --- SOVEREIGN SEARCH UI --- */
/* We use a dynamic rgba calculation based on theme to handle the blur overlay */
.search-overlay { position: fixed; inset: 0; background: var(--bg-primary); backdrop-filter: blur(20px); z-index: 5000; display: none; padding: 10vh 5vw; opacity: 0.98; overflow-y: auto; }
.search-overlay.active { display: block; animation: fadeIn 0.3s ease; }
.search-container { max-width: 900px; margin: 0 auto; }
.search-header { display: flex; align-items: center; border-bottom: 2px solid var(--accent-gold); padding-bottom: 1rem; margin-bottom: 2rem; }
#searchInput { background: transparent; border: none; color: var(--text-main); font-family: var(--font-serif); font-size: 2.5rem; width: 100%; outline: none; }
/* Placeholder text color needs to adapt to theme */
#searchInput::placeholder { color: var(--text-ghost); }
.close-search { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 2rem; transition: color 0.3s ease; }
.close-search:hover { color: var(--accent-gold); }
.search-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.2em; color: var(--accent-gold); margin-bottom: 1rem; font-family: var(--font-sans); }
.suggestion-chips { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 3rem; }
.suggestion-chips span { padding: 0.5rem 1.2rem; border: 1px solid var(--glass-border); border-radius: 20px; font-size: 0.8rem; color: var(--text-muted); cursor: pointer; transition: all 0.3s ease; font-family: var(--font-sans); background: transparent; }
.suggestion-chips span:hover { border-color: var(--accent-gold); color: var(--accent-gold); background: var(--accent-gold-dim); }
.search-result-item { padding: 1.5rem; border-bottom: 1px solid var(--glass-border); transition: background 0.3s ease; cursor: pointer; text-decoration: none; display: block; background: transparent; }
.search-result-item:hover { background: var(--glass-bg); border-color: var(--accent-gold); }
.search-result-item h4 { color: var(--accent-gold); margin-bottom: 0.5rem; font-family: var(--font-serif); font-size: 1.3rem; }
.search-result-item p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; font-family: var(--font-sans); margin: 0; }

/* --- SEARCH CATEGORY HEADERS --- */
.search-category-header {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent-gold);
    padding: 2rem 1.5rem 0.5rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 0.5rem;
}

/* --- THE TERMINAL CASCADE & GLOW --- */
@keyframes dataCascade {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Base result item setup for the cascade */
.search-result-item {
    /* FIX 1: Removed hardcoded opacity: 0. 'backwards' keeps it hidden ONLY during the JS delay! */
    animation: dataCascade 0.4s var(--ease-luxury) backwards;
    border-left: 4px solid transparent; /* Stabilizes the UI layout */
    position: relative;
    transition: all 0.2s ease; /* Smooth, safe transition instead of overriding animations */
}

/* --- KEYBOARD NAVIGATION FOCUS (High-Contrast Glow) --- */
.search-result-item.kb-focus { 
    background: var(--accent-gold-dim) !important; /* Forces contrast in Light Mode */
    border-color: var(--accent-gold) !important; 
    border-left: 4px solid var(--accent-gold) !important;
    /* FIX 2: Intense static glow. Much safer than infinite keyframes overlapping with JS */
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.5), inset 0 0 15px rgba(212, 175, 55, 0.1) !important;
    outline: none; 
    z-index: 2; 
}

/* --- QUANT-TERMINAL TYPING CURSOR --- */
.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background-color: #D59F0F;
    margin-left: 4px;
    vertical-align: middle;
    animation: blinkCursor 0.8s infinite;
}

@keyframes blinkCursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
@keyframes pulseGold {
    from { box-shadow: 0 0 0px rgba(212, 175, 55, 0); }
    to { box-shadow: 0 0 15px rgba(212, 175, 55, 0.8); }
}

.chip {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--accent-gold);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.chip:hover {
    background: var(--accent-gold-dim);
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}