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

html { 
    scroll-behavior: smooth; 
    font-size: 16px; 
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--border-accent); color: var(--text-primary); }

a { text-decoration: none; color: inherit; transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* Prevent any element from causing horizontal overflow */
main, section, header, footer, article, aside, div, nav {
    max-width: 100vw;
}

/* Layout Utilities */
.container { 
    max-width: var(--container-width); 
    margin: 0 auto; 
    padding: 0 clamp(1.5rem, 5vw, 4.5rem); 
}

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

/* Background Patterns */
.bg-grid {
    background-image: 
        linear-gradient(var(--border-light) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-light) 1px, transparent 1px);
    background-size: 50px 50px;
    background-position: center top;
}

/* Capital: Tech Grid with Accent Dots */
.bg-tech-grid {
    position: relative;
    overflow: hidden;
}
.bg-tech-grid::before {
    content: '';
    position: absolute; inset: 0; opacity: 0.05;
    background-image:
        linear-gradient(var(--accent) 1px, transparent 1px),
        linear-gradient(90deg, var(--accent) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}
.bg-tech-grid::after {
    content: '';
    position: absolute; width: 100%; height: 100%; top: 0; left: 0;
    background: radial-gradient(circle at 70% 30%, rgba(var(--accent-rgb), 0.08) 0%, transparent 50%);
    pointer-events: none;
}

/* Aviation: Flowing Lines */
.bg-flow-lines {
    position: relative;
    overflow: hidden;
}
.bg-flow-lines::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 20px,
        rgba(var(--accent-rgb), 0.03) 20px,
        rgba(var(--accent-rgb), 0.03) 21px
    );
    pointer-events: none;
    transform: rotate(15deg);
}

/* International: Solid Lux Lines */
.bg-lux-lines {
    position: relative;
    overflow: hidden;
}
.bg-lux-lines::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.01) 10px,
        rgba(255, 255, 255, 0.01) 11px
    );
    pointer-events: none;
}

/* Graphic Separators */
.separator-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-light), transparent);
    margin: 4rem 0;
}

.separator-diamond {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4rem 0;
    color: var(--accent);
    opacity: 0.3;
}
.separator-diamond::before, .separator-diamond::after {
    content: '';
    height: 1px;
    width: 100px;
    background: var(--border-light);
    margin: 0 1rem;
}
.separator-diamond span {
    width: 8px; height: 8px;
    border: 1px solid currentColor;
    transform: rotate(45deg);
}

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

p { margin-bottom: 1.5rem; color: var(--text-secondary); }

.mb-4 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border: 1px solid var(--accent);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-align: center;
    background: transparent;
}

.btn:hover {
    background: var(--accent) !important;
    color: var(--bg-deep) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.08);
}

.hero-title {
    font-size: clamp(3rem, 6vw, 5rem);
    font-weight: 300;
    line-height: 1.1;
    margin-bottom: 2rem;
    color: var(--text-primary);
}
.hero-title strong, .hero-title em {
    font-weight: 600;
    font-style: italic;
    color: var(--accent);
}

.hero-subtitle {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--accent);
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto 3rem;
}

/* Page Header / Hero */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: var(--nav-height);
    position: relative;
    overflow: hidden;
}

.page-header {
    padding: 12rem 0 6rem;
    background: var(--bg-deep);
    text-align: center;
    border-bottom: 1px solid var(--border-light);
}

.page-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.page-subtitle {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--accent);
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto;
    font-style: italic;
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.section-divider {
    width: 60px;
    height: 1px;
    background: var(--accent);
    margin: 0 auto 1.5rem auto;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--nav-height);
    background: rgba(5, 5, 5, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
}

.nav-container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 5vw, 4.5rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-logo-mark {
    width: 32px;
    height: 32px;
    border: 1px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    color: var(--accent);
    font-size: 1.2rem;
}

.nav-logo-text {
    font-family: var(--font-body);
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-primary);
}

.nav-logo-text span {
    font-weight: 300;
    opacity: 0.7;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    position: relative;
    padding-bottom: 5px;
    transition: color 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--accent);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 10;
}
.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 1.5px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}
.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}
.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Footer structure */
footer {
    border-top: 1px solid var(--border-light);
    padding: 4rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-surface);
}

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

@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 2rem; }
}

@media (max-width: 768px) {
    .mobile-menu-toggle { display: flex; }
    
    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: rgba(5, 5, 5, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 2rem clamp(1.5rem, 5vw, 4.5rem);
        gap: 1.5rem;
        border-bottom: 1px solid var(--border-light);
    }
    
    .nav-links.open { display: flex; }
    .nav-links a { font-size: 0.9rem; }
    
    .nav-container > .btn { display: none; }
    
    .page-header { padding: 8rem 0 3rem; }
    
    .section { padding: 3.5rem 0; }
    .section-header { margin-bottom: 2.5rem; }
    .section-title { font-size: clamp(1.5rem, 5vw, 2.5rem); }
    
    .hero { min-height: 85vh; }
    .hero-subtitle { font-size: 1rem; margin-bottom: 2rem; }
    
    .separator-line, .separator-diamond { margin: 2rem 0; }

    /* Force inline grids to single column on mobile */
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Reduce heavy inline gaps on mobile */
    [style*="gap: 4rem"] {
        gap: 2rem !important;
    }

    /* Wrap footer flex bars on mobile */
    footer div[style*="display: flex"] {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.75rem !important;
        text-align: center !important;
    }

    /* Prevent any overflow on mobile */
    .container {
        max-width: 100% !important;
        overflow-x: hidden;
    }

    /* Constrain wide elements */
    .terminal-window,
    .metrics-bar,
    .stats-grid,
    .stats,
    .equity-grid,
    .benefits-grid,
    .philosophy-grid,
    .leadership-grid,
    .cards-grid,
    .ai-grid {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Clamp text that could overflow */
    .hero-title {
        word-break: break-word;
    }

    /* Ensure buttons don't overflow */
    .btn {
        max-width: 100%;
        word-break: break-word;
    }
}