/* --- MISSION BRIEFING: ELITE TACTICAL HUD (v2.0) --- */

:root {
    --hud-bg: #030305;
    --hud-border: rgba(255, 255, 255, 0.08);
    --hud-glass: rgba(10, 10, 12, 0.7);
    --hud-scan-line: rgba(0, 255, 128, 0.03);

    /* Colors */
    --c-sitrep: #ef4444;
    /* Red */
    --c-protocol: #10b981;
    /* Emerald */
    --c-exec: #f59e0b;
    /* Amber */
}

#mission-briefing {
    padding: 8rem 0;
    background: #000;
    position: relative;
    overflow: hidden;
    perspective: 1000px;
}

/* Dynamic tactical grid background */
.mission-grid-bg {
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(rgba(20, 20, 30, 0.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20, 20, 30, 0.5) 1px, transparent 1px);
    background-size: 60px 60px;
    transform: rotateX(45deg) translateY(-10%);
    animation: grid-scroll 20s linear infinite;
    opacity: 0.3;
    pointer-events: none;
    mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}

@keyframes grid-scroll {
    0% {
        transform: rotateX(45deg) translateY(0);
    }

    100% {
        transform: rotateX(45deg) translateY(-60px);
    }
}

/* --- THE TERMINAL CONTAINER --- */
.mission-terminal {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--hud-bg);
    border: 1px solid var(--hud-border);
    border-radius: 4px;
    /* Tactical squared corners */
    position: relative;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 1),
        0 20px 50px -10px rgba(0, 0, 0, 0.8);
    clip-path: polygon(0 0,
            100% 0,
            100% calc(100% - 20px),
            calc(100% - 20px) 100%,
            0 100%);
}

/* Decorative "Machined" borders */
.mission-terminal::before,
.mission-terminal::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    pointer-events: none;
}

.mission-terminal::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.mission-terminal::after {
    top: -1px;
    right: -1px;
    border-left: none;
    border-bottom: none;
}

/* Scanline Overlay */
.mission-terminal .scan-overlay {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.2) 4px);
    pointer-events: none;
    z-index: 50;
    opacity: 0.4;
}

/* --- TABS: PHYSICAL SWITCHES --- */
.terminal-tabs {
    display: flex;
    background: #08080a;
    border-bottom: 1px solid var(--hud-border);
    padding: 0.5rem;
    gap: 0.5rem;
}

.mission-tab-btn {
    flex: 1;
    position: relative;
    padding: 1.25rem;
    background: transparent;
    border: 1px solid transparent;
    color: #4b5563;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.mission-tab-btn span {
    position: relative;
    z-index: 10;
}

/* Hover State */
.mission-tab-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #9ca3af;
    border-color: rgba(255, 255, 255, 0.05);
}

/* Active State Styles */
.mission-tab-btn.active {
    background: #0e0e12;
    border-color: currentColor;
    color: white;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    text-shadow: 0 0 10px currentColor;
}

.mission-tab-btn.tab-sitrep.active {
    color: var(--c-sitrep);
    border-color: rgba(239, 68, 68, 0.3);
}

.mission-tab-btn.tab-protocol.active {
    color: var(--c-protocol);
    border-color: rgba(16, 185, 129, 0.3);
}

.mission-tab-btn.tab-execution.active {
    color: var(--c-exec);
    border-color: rgba(245, 158, 11, 0.3);
}

/* Glitch/Scan Effect on Tab Click */
.mission-tab-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: skewX(-20deg);
    transition: none;
}

.mission-tab-btn.active::after {
    animation: shine-sweep 2s ease-in-out infinite;
    /* Slower, pulsing sweep */
}

@keyframes shine-sweep {
    0% {
        left: -100%;
    }

    20% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

/* --- SCREEN CONTENT AREA --- */
.terminal-screen {
    position: relative;
    padding: 4rem;
    min-height: 500px;
    background: radial-gradient(circle at top center, rgba(30, 30, 40, 0.4), transparent 70%);
}

.mission-view {
    display: none;
    /* Hard Hide */
    grid-template-columns: 350px 1fr;
    /* Sidebar Layout */
    gap: 4rem;
    align-items: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.mission-view.active {
    display: grid;
    opacity: 1;
    transform: translateY(0);
}

/* Header / Sidebar Area */
.mv-header {
    text-align: left;
    position: relative;
}

.mv-header::after {
    content: '';
    position: absolute;
    right: -2rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.mv-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.mv-title {
    font-size: 3rem;
    line-height: 1.1;
    font-weight: 800;
    color: white;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    /* Cleaner sans for heavy titles */
    letter-spacing: -0.02em;
}

.mv-title span {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    /* Contrast font */
    font-style: italic;
    font-weight: 700;
}

/* The Grid Cards */
.mv-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.mv-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2rem 1.5rem;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
}

.mv-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -10px black;
}

/* Card Decor */
.mv-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
    opacity: 0.5;
}

.mv-card:hover::before {
    transform: scaleX(1);
}

.mv-icon {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    opacity: 0.8;
}

.mv-stat {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.75rem;
}

.mv-desc {
    font-size: 0.85rem;
    color: #8899a6;
    line-height: 1.6;
}

/* Coloring Logic */
#view-sitrep {
    --accent: var(--c-sitrep);
}

#view-protocol {
    --accent: var(--c-protocol);
}

#view-execution {
    --accent: var(--c-exec);
}

.mission-view .mv-badge {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.3);
}

.mission-view .mv-title span {
    color: var(--accent);
}

.mission-view .mv-card {
    color: var(--accent);
}

/* Sets currentColor for border top */

/* --- ULTRA POLISH (v3.0) --- */

/* Scramble Text Duds */
.dud {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 100;
}

/* Active Scanline Laser */
.mission-terminal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    /* Removed expensive box-shadow on animation */
    /* box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); */
    opacity: 0.2;
    animation: scanline-sweep 4s linear infinite;
    pointer-events: none;
    z-index: 60;
}

@keyframes scanline-sweep {
    0% {
        top: 0%;
        opacity: 0;
    }

    10% {
        opacity: 0.5;
    }

    90% {
        opacity: 0.5;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

/* Breathing Glow on Active Elements - OPTIMIZED */
.mission-view.active .mv-header {
    animation: header-breath 4s ease-in-out infinite;
    /* Enhance performance with will-change */
    will-change: text-shadow;
}

@keyframes header-breath {

    0%,
    100% {
        text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    }

    50% {
        text-shadow: 0 0 15px currentColor;
    }
}

/* Enhanced Tab Interactions */
.mission-tab-btn:active {
    transform: scale(0.98);
}

/* Mobile */
@media (max-width: 1024px) {
    .mission-view {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .mv-header::after {
        display: none;
    }

    .mv-header {
        text-align: center;
        margin-bottom: 2rem;
    }

    .mv-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }

    .terminal-screen {
        padding: 2rem;
    }
}