/* ============================================================
   GLOBAL ARCHITECTURE
   ============================================================ */

html {
    scroll-behavior: smooth; /* Fix 2: smooth jump to anchor links */
}

:root {
    /* Fluid typography */
    --font-hero:    clamp(3.5rem, 7vw, 9rem);
    --font-sub:     clamp(1rem, 1.8vw, 1.25rem);
    --font-section: clamp(2.5rem, 5vw, 5rem);

    /* Spacing */
    --space-xs:  0.5rem;
    --space-sm:  1rem;
    --space-md:  2rem;
    --space-lg:  4rem;
    --space-xl:  6rem;

    /* Palette */
    --bg-dark:    #0a0a0a;
    --bg-section: #0a0a0a; /* Fix 1: sections use solid background to cover 3D canvas */
    --text-light: #ffffff;
    --text-muted: #a1a1aa;
    --border:     #333;

    /* Z-index hierarchy */
    --z-canvas:   -1;
    --z-content:   10;
    --z-nav:      999;
    --z-loader:  9999;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}
html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}
html, body {
    background-color: #0a0a0a; /* Locks the exposed canvas to black */
    overflow-x: hidden;
    width: 100%;
    color: var(--text-light);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
section {
    margin: 0 !important; /* Force override any layout gaps */
    width: 100vw;
}
.section-title, p, h1, h2, h3 {
    margin-bottom: clamp(1rem, 2vw, 2rem);
}

/* ============================================================
   FIX 2: ALWAYS-VISIBLE NAVIGATION HEADER
   Replaces the hidden takeover menu for zero friction.
   ============================================================ */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: var(--z-nav);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 5vw;
    /* subtle top bar separation */
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.brand {
    font-size: 1.4rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    color: var(--text-light);
    text-decoration: none;
}

.site-nav {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.nav-link {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--text-light);
}

/* Collapse nav on small screens */
@media (max-width: 600px) {
    .site-nav { gap: var(--space-sm); }
    .nav-link  { font-size: 0.75rem; }
}

/* ============================================================
   WEBGL CANVAS
   Strictly fixed behind everything else.
   ============================================================ */
#webgl-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: var(--z-canvas);
}

/* ============================================================
   HERO SECTION
   Transparent — intentionally shows 3D canvas behind it.
   ============================================================ */
.ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: var(--z-content);
    pointer-events: none;
    display: flex;
    align-items: center;
    padding: 0 5vw;
    /* padding-top: 80px; clear fixed header */
}

.content {
    max-width: 700px;
}

.hero-title {
    font-size: var(--font-hero);
    font-weight: 900;
    line-height: 0.92;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: var(--space-md);
}

.hero-sub {
    font-size: var(--font-sub);
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 460px;
    margin-bottom: var(--space-lg);
}

.cta-button {
    pointer-events: auto;
    display: inline-block;
    border: 1px solid var(--text-light);
    background: transparent;
    color: var(--text-light);
    padding: var(--space-sm) var(--space-md);
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.cta-button:hover {
    background: var(--text-light);
    color: var(--bg-dark);
}

/* Hero scroll space: invisible scroll track for GSAP ScrollTrigger */
.scroll-space {
    height: 300vh;
    pointer-events: none;
}

/* ============================================================
   FIX 1: SECTION BACKGROUNDS
   Every section below the hero MUST have a solid background
   so it physically covers the 3D canvas as the user scrolls.
   No more bleed-through / overlap bugs.
   ============================================================ */
#skills,
#snap-deck,
#conversion {
    position: relative;
    z-index: var(--z-content);
    background-color: var(--bg-section);
}

/* ============================================================
   SECTION: CORE COMPETENCIES (#skills)
   ============================================================ */

.skill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem 4vw;
    border-bottom: 1px solid #333;
    cursor: crosshair;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    background: #0a0a0a;
    color: #555;
    overflow: hidden;
    height: 15vh;
}

.skill-label {
    font-size: clamp(2rem, 5vw, 5rem);
    font-weight: 900;
    text-transform: uppercase;
    transition: color 0.3s;
}

.skill-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    max-width: 50%;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    line-height: 1.5;
    color: #fff;
}

/* The Kinetic Snap (Hover) */
.skill-row:hover {
    background: #ffffff;
    color: #000;
    height: 30vh;
}

.skill-row:hover .skill-label {
    color: #000;
}

.skill-row:hover .skill-reveal {
    opacity: 1;
    transform: translateY(0);
    color: #000;
}

/* ============================================================
   SECTION: EXPERIENCE (#authority)
   ============================================================ */
.timeline-block {
    opacity: 0;
    transform: translateY(30px);
}

.timeline-node {
    transition: all 0.3s ease;
}

.timeline-block:hover .timeline-node { 
    background: #fff !important; 
    transform: scale(1.3); 
}

@media (max-width: 968px) { 
    .timeline-visual { 
        display: none !important; 
    } 
    .timeline-track > div { 
        grid-template-columns: 1fr; 
    } 
}

/* ============================================================
   SECTION: CASE STUDIES (SNAP DECK)
   ============================================================ */

#snap-deck { 
    border-top: 1px solid #333; 
}

.deck-left { 
    width: 50vw; 
    height: 100vh; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border-right: 1px solid #333; 
    overflow: hidden; 
    background: #0a0a0a; 
}

#dynamic-title { 
    font-size: clamp(2rem, 5vw, 6rem); /* Reduced slightly to fit long words */
    font-weight: 900; 
    color: #fff; 
    line-height: 1; 
    text-transform: uppercase; 
    transition: opacity 0.15s ease-out; 
    text-align: center; 
    white-space: nowrap; /* Forces text to stay on one line */
    padding: 1rem; 
    width: 100%;
}

.deck-right { 
    width: 50vw; 
}

.snap-panel { 
    height: 100vh; 
    scroll-snap-align: start; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    padding: clamp(2rem, 5vw, 6rem); 
    border-bottom: 1px solid #333; 
    background: #0a0a0a; 
}

.monolith-content-block {
    z-index: 2;
    border: 1px solid #fff;
    padding: 3rem;
    background: #0a0a0a;
    max-width: 600px;
}

.card-title {
    font-size: 2.5rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: var(--space-xs);
    line-height: 1.2;
}

.card-meta {
    font-family: monospace;
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed #333;
}

.card-specs {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    #snap-deck { flex-direction: column; }
    .deck-left { display: none; }
    .deck-right { width: 100vw; }
    .snap-panel { width: 100vw; }
}

/* ============================================================
   FIX 3: CONTACT FORM (#conversion)
   Strictly styled inputs — no more unstyled HTML.
   ============================================================ */
#conversion {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(4rem, 10vw, 8rem) clamp(1rem, 5vw, 4rem);
}

.terminal-ui {
    width: 100%;
    max-width: 780px;
    border: 1px solid var(--text-light);
    padding: var(--space-md);
    background-color: #0a0a0a; /* solid, not translucent — the canvas is off at this point */
}

.terminal-header {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 900;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-sm);
}

/* ============================================================
   COMMAND MATRIX LINKS
   ============================================================ */
.brutal-link {
    display: inline-block;
    text-align: center;
    text-decoration: none;
    font-family: monospace;
    transition: all 0.2s ease-out;
    cursor: crosshair;
}

.primary-link {
    border: 1px solid #fff;
    color: #fff;
    padding: 1.5rem;
    font-size: 1.2rem;
    font-weight: bold;
    background: transparent;
}

.primary-link:hover {
    background: #fff;
    color: #000;
    transform: translateY(-4px);
    box-shadow: 4px 4px 0px #333;
}

.secondary-link {
    border: 1px solid #333;
    color: #888;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    background: transparent;
    flex-grow: 1;
}

.secondary-link:hover {
    border-color: #fff;
    color: #fff;
    background: #111;
}

/* ============================================================
   PRE-LOADER
   ============================================================ */
#loader {
    position: fixed;
    inset: 0;
    background: #0a0a0a;
    z-index: var(--z-loader);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    color: var(--text-light);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

@keyframes brutalBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}
.blinking-cursor {
    animation: brutalBlink 1s step-end infinite;
}

/* ============================================================
   HERO SPLIT GRID PORTRAIT
   ============================================================ */
/* Brutalist Image Filter */
.hero-brutal-photo {
    filter: grayscale(100%) contrast(140%) brightness(90%);
    transition: filter 0.3s ease;
}

.hero-portrait-wrapper:hover .hero-brutal-photo {
    filter: grayscale(100%) contrast(160%) brightness(110%);
}

/* Button Hover State */
.brutal-btn:hover {
    background: #fff !important;
    color: #000 !important;
}

/* Mobile Responsiveness */
@media (max-width: 968px) {
    .hero-split-grid {
        grid-template-columns: 1fr !important;
        padding-top: 120px !important; /* Account for fixed header */
    }
    
    .hero-col-visual {
        justify-content: flex-start !important;
        margin-top: 2rem !important;
    }
}

/* Nav Link Hover States */
.nav-link {
    color: #888;
    font-family: monospace;
    font-size: 1rem;
    text-decoration: none;
    transition: color 0.2s;
}
.nav-link:hover {
    color: #fff;
}
.mobile-nav-link:hover {
    color: #666;
}

/* Responsive Breakpoint - 768px */
@media (max-width: 768px) {
    .desktop-links {
        display: none !important; /* Kill the desktop row on small screens */
    }
    .mobile-toggle {
        display: block !important; /* Reveal the menu button */
    }
}

/* Overlay Active Class */
.overlay-active {
    transform: translateY(0) !important;
}

/* =========================================
   UNIVERSAL MOBILE OVERRIDE (MAX 968PX)
   ========================================= */

/* 1. Global Overflow Lock */
html, body {
    max-width: 100%;
    overflow-x: hidden !important; 
}

@media (max-width: 968px) {
    /* 1. Global Box Sizing */
    *, *::before, *::after {
        box-sizing: border-box !important;
    }

    /* 2. Force All Grids to Stack Vertically */
    .hero-split-grid, 
    .command-matrix {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        gap: 1.5rem !important;
    }

    /* 3. Hero Section Clearance & Compaction */
    .hero-col-text {
        margin-top: 0 !important;
    }
    .hero-split-grid {
        padding-top: 0px !important;
        padding-bottom: 1rem !important;
    }
    .hero-title {
        margin-bottom: 1rem !important;
    }
    .hero-sub {
        margin-bottom: 1.5rem !important;
    }
    .hero-col-visual {
        justify-content: center !important;
        width: 100% !important;
        margin-top: 0 !important;
    }
    .hero-portrait-wrapper {
        max-width: 250px !important;
        margin: 0 auto !important;
    }

    /* 4. Timeline (Phase 3) Padding Fix */
    .timeline-track {
        padding-left: 1.5rem !important;
        margin-left: 0.5rem !important;
    }
    .timeline-node {
        left: -1.9rem !important; 
    }

    /* 5. Snap Deck Container Bleed Fix */
    #snap-deck {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }
    .deck-left, .deck-right {
        width: 100% !important;
        height: auto !important;
        position: relative !important; 
    }
    .deck-left {
        padding: 3rem 1rem 1rem 1rem !important;
        border-right: none !important;
        border-bottom: 1px solid #333 !important;
        height: auto !important;
        min-height: unset !important;
    }
    .snap-panel {
        width: 100% !important;
        padding: 2rem 1rem !important;
        height: auto !important;
        min-height: auto !important;
        scroll-snap-align: none !important; 
    }
    .snap-panel h3 {
        overflow-wrap: normal !important;
        word-break: normal !important;
        font-size: 1.5rem !important;
    }

    /* 6. Massive Typography Containment */
    h1, h2, #dynamic-title, .hero-col-text h1, .section-title {
        overflow-wrap: normal !important;
        white-space: normal !important;
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
        line-height: 1.2 !important;
        width: 100% !important;
    }

    /* 7. Core Competencies Scaling */
    .skill-label {
        font-size: clamp(1.1rem, 4vw, 1.3rem) !important;
    }
    
    /* 8. Terminal Text & Button Wrapping */
    #typewriter-text {
        font-size: 1.1rem !important;
        word-break: break-all !important;
    }
    .brutal-link {
        padding: 0.8rem 0.5rem !important;
        font-size: 0.9rem !important;
    }

    /* 9. Vertical Padding Reduction & Min-Height Kills */
    section {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    #skills, .hero-split-grid {
        min-height: auto !important;
    }
    
    .timeline-block {
        margin-bottom: 2rem !important;
    }


    .skill-row {
        padding: 1rem 4vw;
    height: 8vh;
    }


    #conversion {
    min-height: 60vh;
    /* padding: clamp(4rem, 10vw, 8rem) clamp(1rem, 5vw, 4rem); */
}
}

/* =========================================
   SHORT SCREEN OPTIMIZATION (MAX-HEIGHT: 800px)
   ========================================= */

@media (max-height: 800px) and (min-width: 969px) {
    /* Target: Desktop and Tablet Landscape screens that lack vertical space.
       Action: Remove the 100vh lock and stop vertically centering to prevent navbar overlap. 
    */
    .hero-split-grid {
        min-height: auto !important;
        padding-top: 140px !important; /* Force clearance for the fixed navbar */
        padding-bottom: 4rem !important;
        align-items: flex-start !important; 
    }

    /* Shrink the massive typography slightly to respect the vertical limit */
    .hero-col-text h1 {
        font-size: clamp(3rem, 6vw, 6rem) !important;
        margin-bottom: 1rem !important;
    }

    .hero-col-text p {
        margin-bottom: 2rem !important;
    }

    /* Constrain the portrait so it doesn't blow out the bottom of the screen */
    .hero-portrait-wrapper {
        max-width: 350px !important;
        margin-top: 2rem !important;
    }
}
