:root {
    --navy: #001f3f;
    --alert-red: #D0021B;
    --gold: #F5A623;
    --font-main: 'Courier New', Courier, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #000;
    color: var(--gold);
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* --- LAYERS --- */
#starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

#bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 5;
    opacity: 0;
    transition: opacity 2s ease-in;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    grid-template-rows: auto 1fr 70px;
    pointer-events: none;
    /* Let clicks pass through where empty */
    padding: 20px;
    opacity: 0;
    /* Starts hidden, fades in with video */
    transition: opacity 1s ease-in;
}

/* --- HUD CORNERS --- */
.hud-panel {
    border: 1px solid rgba(245, 166, 35, 0.3);
    background: rgba(0, 31, 63, 0.6);
    backdrop-filter: blur(4px);
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: auto;
    clip-path: polygon(0 0,
            100% 0,
            100% calc(100% - 20px),
            calc(100% - 20px) 100%,
            0 100%);
}

.hud-top-left {
    grid-column: 1;
    grid-row: 1;
    border-top: 3px solid var(--gold);
}

.hud-top-right {
    grid-column: 3;
    grid-row: 1;
    text-align: right;
    border-top: 3px solid var(--gold);
    clip-path: polygon(0 0,
            100% 0,
            100% 100%,
            20px 100%,
            0 calc(100% - 20px));
}

.hud-label {
    font-size: 1rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hud-value {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--alert-red);
    text-shadow: 0 0 8px var(--alert-red);
}

/* --- CENTER AREA --- */
.center-stage {
    grid-column: 2;
    grid-row: 1 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
}

.logo-hud-small {
    width: 100%;
    max-width: 150px;
    height: auto;
    margin-top: 20px;
    filter: drop-shadow(0 0 5px rgba(0, 31, 63, 0.8));
    opacity: 1;
    display: block;
}

#intro-logo-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    /* Above stars (10), below UI (20) */
    display: flex;
    align-items: flex-start;
    /* Top Align */
    justify-content: center;
    /* Center Horizontal */
    padding-top: 10vh;
    /* Way above */
    transition: opacity 1s ease-out;
    pointer-events: none;
}

#intro-logo {
    width: 60%;
    max-width: 800px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(0, 31, 63, 1));
    opacity: 0.9;
}

.tagline {
    font-size: 1.5rem;
    background-color: var(--gold);
    color: var(--navy);
    padding: 8px 20px;
    font-weight: bold;
    letter-spacing: 4px;
    text-transform: uppercase;
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0% 100%);
}

h1 {
    font-size: 4rem;
    letter-spacing: 10px;
    text-transform: uppercase;
    text-shadow: 0 0 10px var(--navy);
    margin-bottom: 0px;
    opacity: 0.9;
}

/* --- BOTTOM NAV (STRATEGO RACK) --- */
.nav-rack {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 20px;
    gap: 20px;
    pointer-events: auto;
    z-index: 60;
}

.nav-piece {
    width: 120px;
    height: 50px;
    /* Reduced Height */
    background: rgba(0, 31, 63, 0.6);
    backdrop-filter: blur(4px);
    border: 2px solid var(--gold);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transform: translateY(10px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    box-shadow: 0 0 0px rgba(245, 166, 35, 0);
    text-decoration: none;
    /* For link wrapper */
    color: inherit;
    /* For link wrapper */
}

.nav-piece:hover {
    transform: translateY(-5px) scale(1.05);
    /* Adjusted hover float */
    box-shadow: 0 0 15px rgba(245, 166, 35, 0.6);
    background: var(--gold);
    border-color: var(--gold);
    z-index: 50;
}

.nav-piece:hover span {
    color: var(--navy);
    border-color: var(--navy);
}

/* --- DROPDOWN MENU --- */
.dropdown-menu {
    position: absolute;
    bottom: calc(100% + 15px);
    /* Appears above the tab with a gap */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(0, 31, 63, 0.95);
    border: 1px solid var(--gold);
    padding: 10px;
    width: 250px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 15px rgba(245, 166, 35, 0.3);
    text-align: center;
}

.nav-piece:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.menu-item {
    color: var(--gold);
    padding: 8px 0;
    border-bottom: 1px solid rgba(245, 166, 35, 0.3);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    /* for links */
    display: block;
    /* for links */
}

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

.menu-item:hover {
    background: rgba(245, 166, 35, 0.2);
    color: #fff;
}

/* =========================================
   TABLET OPTIMIZATION (1024px and below)
   ========================================= */
@media (max-width: 1024px) {
    #ui-layer {
        grid-template-columns: 200px 1fr 200px;
    }
    
    .hud-value {
        font-size: 1.6rem;
    }
    
    .hud-logo {
        width: 180px;
        bottom: 90px;
    }
    
    h1 {
        font-size: 3rem;
    }
    
    /* USABILITY: Ensure all touch targets are at least 44x44px */
    .social-icon {
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
    }
    
    .nav-piece, .action-btn-red {
        min-height: 44px;
    }
}

/* =========================================
   MOBILE OPTIMIZATION (768px and below)
   ========================================= */
@media (max-width: 768px) {
    /* Switch parent container from grid to a scrolling flex column */
    #ui-layer {
        display: flex !important;
        flex-direction: column;
        padding: 70px 15px 15px 15px;
        overflow-y: auto;
        pointer-events: auto; /* Re-enable scrolling on mobile */
    }

    /* Redesign HUD Corners into clean, wrap-friendly dashboards */
    .hud-panel {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        clip-path: none !important; /* Remove complex clipping for clean boxes */
        border: 1px solid rgba(245, 166, 35, 0.4) !important;
        border-radius: 5px;
        margin-bottom: 10px;
        padding: 10px;
    }
    
    .hud-panel > div {
        flex: 1 1 30%; 
        text-align: center;
    }

    .hud-label {
        margin-top: 0 !important;
        font-size: 0.75rem;
    }

    .hud-value {
        font-size: 1.1rem;
    }

    /* Center Content Container */
    .center-stage {
        flex: 1;
        padding-top: 20px;
        padding-bottom: 120px; /* Buffer to prevent overlap with logo/socials */
        opacity: 1 !important; 
        z-index: 10;
        justify-content: flex-start;
    }
    
    /* Subpage specific tweaks to avoid feeling cramped */
    .page-content {
        padding: 20px !important;
        margin-top: 5vh !important;
    }

    h1 {
        font-size: 2.2rem;
        letter-spacing: 5px;
    }
    
    .tagline {
        font-size: 1rem;
        padding: 6px 15px;
    }

    /* Activate Mobile Menu Button */
    .mobile-menu-btn {
        display: flex !important;
        position: fixed;
        top: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
        background: rgba(0, 31, 63, 0.95);
        border: 2px solid var(--gold);
        color: var(--gold);
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        z-index: 200;
        cursor: pointer;
        border-radius: 4px;
        pointer-events: auto;
    }

    /* Collapse Desktop Nav Rack into Off-Canvas Mobile Menu */
    .nav-rack {
        position: fixed;
        top: 0;
        right: -100%; /* Hidden off-screen by default */
        width: 250px;
        height: 100vh;
        background: rgba(0, 31, 63, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: 80px;
        transition: right 0.3s ease-in-out;
        z-index: 150;
        border-left: 2px solid var(--gold);
        flex-wrap: nowrap !important;
    }

    .nav-rack.active {
        right: 0; /* Slide in trigger */
    }

    .nav-piece {
        width: 80% !important;
        margin-bottom: 15px;
        transform: none !important; /* Disables desktop offset */
        border: 2px solid var(--gold) !important; /* Restores full borders */
        border-radius: 5px;
        height: 50px;
    }
    
    .nav-piece:hover {
        transform: scale(1.02) !important; 
    }

    /* Re-position Socials cleanly horizontally */
    .social-links {
        position: fixed !important;
        bottom: 20px;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 100%;
        justify-content: center;
        z-index: 90;
    }

    /* Re-position and scale down logo */
    .hud-logo {
        width: 140px;
        bottom: 80px;
        left: 50% !important;
        transform: translateX(-50%) !important;
        opacity: 1 !important;
    }
    
    .social-icon {
        background: rgba(0, 31, 63, 1) !important;
    }
    
    .page-title {
        font-size: 1.8rem !important;
    }
    
    #intro-logo {
        width: 80%;
    }
    
    .hide-mobile {
        display: none !important;
    }

    .mobile-brand-badge {
        display: flex !important;
        position: fixed;
        top: 15px;
        left: 15px;
        height: 44px;
        align-items: center;
        justify-content: center;
        background-color: var(--alert-red);
        color: var(--gold);
        font-family: var(--font-main);
        font-size: 1.2rem;
        font-weight: bold;
        letter-spacing: 2px;
        padding: 0 15px;
        z-index: 200;
        border-radius: 4px;
        border: 2px solid var(--gold);
    }

    body.subpage .social-links {
        position: static !important;
        transform: none !important;
        order: -1;
        margin-bottom: 15px;
    }

    body.subpage .center-stage {
        padding-bottom: 20px;
    }
}

.scan-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 15px;
    background-color: rgba(208, 2, 27, 0.3);
    opacity: 0.3;
    animation: scan 4s linear infinite;
    pointer-events: none;
    z-index: 100;
}

@keyframes scan {
    0% {
        top: 0%;
    }

    100% {
        top: 100%;
    }
}

/* New CSS from Refinement */
.social-links {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 15px;
    pointer-events: auto;
    z-index: 80;
}

.hud-logo {
    position: absolute;
    bottom: 70px;
    left: 5px;
    width: 240px;
    opacity: 0.8;
    z-index: 80;
    pointer-events: auto;
    filter: drop-shadow(0 0 5px rgba(0, 31, 63, 0.8));
}

.action-btn-red {
    display: inline-block;
    background: transparent;
    border: 2px solid var(--alert-red);
    color: var(--alert-red);
    padding: 10px 20px;
    font-family: var(--font-main);
    font-size: 1.1rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s;
    font-weight: bold;
}

.action-btn-red:hover {
    background: var(--alert-red);
    color: #fff;
    box-shadow: 0 0 15px var(--alert-red);
}

.filter-multispectral {
    filter: hue-rotate(270deg) saturate(3) contrast(1.5) brightness(1.2) !important;
}

.social-icon {
    width: 30px;
    height: 30px;
    background: rgba(0, 31, 63, 0.8);
    border: 1px solid var(--gold);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    text-decoration: none;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.social-icon:hover {
    background: var(--gold);
    color: var(--navy);
    transform: scale(1.1);
}