/* --- CSS VARIABLES: ANTIGRAVITY DARK MODE --- */
:root {
    --bg-base: #10151D;           /* Deep Charcoal */
    --bg-surface: #1A212D;        /* Slightly lighter for Bento Cards */
    --text-primary: #F8FAFC;      /* Crisp White */
    --text-muted: #94A3B8;        /* Slate Gray */
    --accent-neon: #00FFCC;       /* Tactical Cyan/Green */
    --border-color: #2D3748;
    
    --transition-speed: 0.4s;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    /* background shorthand required — background-color won't transition gradients */
    transition: background 2s ease-in-out, color var(--transition-speed) ease;
}

/* --- ADA COMPLIANCE --- */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-neon);
    color: #000;
    padding: 8px;
    z-index: 100;
}
.skip-link:focus { top: 0; }
button:focus-visible { outline: 2px solid var(--accent-neon); outline-offset: 2px; }

/* --- HEADER & TOGGLE --- */
.tactical-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 2rem 1rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

/* Logo anchor — absolutely centred in the header row */
.logo {
    position: absolute;
    left: 50%;
    top: 30px;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    /* Prevent the logo from intercepting clicks on nav / toggle */
    pointer-events: auto;
    z-index: 1;
}

/* Logo image
   mix-blend-mode: screen — the near-black JPG background becomes invisible
   against the dark site surface; only the bright mark survives.
   drop-shadow in accent colour adds a subtle neon halo so the mark
   pops cleanly without needing a transparent PNG. */
.site-logo {
    height: 100px;
    width: auto;
    display: block;
    mix-blend-mode: screen;
    filter:
        brightness(1.3)
        contrast(1.1)
        drop-shadow(0 0 6px rgba(0, 255, 204, 0.25));
    transition: filter 0.25s ease;
}

.logo:hover .site-logo,
.logo:focus-visible .site-logo {
    filter:
        brightness(1.5)
        contrast(1.15)
        drop-shadow(0 0 12px rgba(0, 255, 204, 0.5));
}

.logo:focus-visible {
    outline: 2px solid var(--accent-neon);
    outline-offset: 6px;
    border-radius: 3px;
}
.mode-switch {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: monospace;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.mode-switch:hover { color: var(--accent-neon); border-color: var(--accent-neon); }
.status-indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }

/* --- EXECUTIVE VIEW (BENTO GRID) --- */
body[data-view="executive"] .dynamic-workspace {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 1200px;
    margin: 2rem auto;
    gap: 1.5rem;
    padding: 0 1rem;
}
body[data-view="executive"] .ide-sidebar { display: none; }
body[data-view="executive"] .content-canvas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Bare-metal register: pre tables are wide — lock to 2-column layout so
   the redteam and metrics cards each get ~50% width and never overflow. */
body[data-view="executive"][data-level="bare_metal"] .content-canvas {
    grid-template-columns: repeat(2, 1fr);
}
.bento-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 8px;
}

/* --- DEVELOPER VIEW (IDE LAYOUT) --- */
body[data-view="developer"] .dynamic-workspace {
    display: flex;
    height: calc(100vh - 70px);
    max-width: 100%;
    margin: 0;
}
body[data-view="developer"] .ide-sidebar {
    display: block;
    width: 250px;
    border-right: 1px solid var(--border-color);
    padding: 1rem;
    font-family: monospace;
    background: #0D1117;
}
body[data-view="developer"] .content-canvas {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}
body[data-view="developer"] .bento-card { display: none; } /* Hide marketing copy */

body[data-view="developer"] .mode-switch { color: var(--accent-neon); border-color: var(--accent-neon); }
body[data-view="developer"] .status-indicator { background: var(--accent-neon); box-shadow: 0 0 8px var(--accent-neon); }

/* ==========================================================================
   WASM TERMINAL SANDBOX
   Controller : wasm_terminal.js
   States     : default (inactive) | .is-active (focused, input live)
   ========================================================================== */

.terminal-container {
    background: #000;
    border: 1px solid var(--border-color);
    font-family: 'Courier New', Courier, monospace;
    border-radius: 4px;
    flex-grow: 1;
    cursor: text;
    /* Smooth glow transition on activation */
    transition:
        border-color 0.25s ease,
        box-shadow   0.25s ease;
    outline: none; /* Custom focus state below replaces native ring */
}

/* ── Active / focused state ─────────────────────────────────────────────── */
.terminal-container.is-active,
.terminal-container:focus {
    border-color: rgba(0, 255, 204, 0.55);
    box-shadow:
        0 0 0 1px rgba(0, 255, 204, 0.15),
        0 0 20px rgba(0, 255, 204, 0.08);
}

/* ── Header bar ─────────────────────────────────────────────────────────── */
.terminal-header {
    background: #0D1117;
    padding: 5px 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    border-radius: 4px 4px 0 0;
    -webkit-user-select: none;
    user-select: none;
}

.terminal-path {
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* Status badge: OFFLINE → WASM ACTIVE / JS FALLBACK */
.terminal-status {
    font-size: 0.68rem;
    letter-spacing: 1.5px;
    color: var(--border-color);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.terminal-container.is-active .terminal-status {
    color: var(--accent-neon);
    text-shadow: 0 0 6px rgba(0, 255, 204, 0.5);
}

/* ── Scrollable output body ─────────────────────────────────────────────── */
.terminal-body {
    padding: 1rem 1.25rem;
    color: var(--accent-neon);
    max-height: 320px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Neon scrollbar */
.terminal-body::-webkit-scrollbar       { width: 3px; }
.terminal-body::-webkit-scrollbar-track { background: #000; }
.terminal-body::-webkit-scrollbar-thumb { background: rgba(0, 255, 204, 0.3); border-radius: 2px; }

/* ── Individual output lines ────────────────────────────────────────────── */
.terminal-line {
    font-size: 0.8rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Live input echo line ────────────────────────────────────────────────── */
/* The █ block cursor is appended by JS; blink animation on .is-active only */
.terminal-input-line {
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-primary);
    min-height: 1.6em;
    white-space: pre-wrap;
    word-break: break-all;
}

@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* Scope the blink to the █ — last character of the input-line text.
   We animate the whole line's opacity would flicker text; instead we
   target the ::after pseudo-element as a synthetic overlay cursor.     */
.terminal-container.is-active .terminal-input-line::after {
    content: '';
    display: inline-block;
    width: 0.55ch;
    height: 1em;
    background: var(--accent-neon);
    vertical-align: text-bottom;
    margin-left: 1px;
    animation: blink-cursor 1s step-start infinite;
    opacity: 0.8;
}

body[data-view="executive"] .terminal-container { min-height: 240px; }

/* ==========================================================================
   TIME-OF-DAY ENVIRONMENTAL LIGHTING ENGINE
   Controller: timeController.js — evaluates new Date().getHours() on load
   and every 60s. Sets data-theme on <body>. CSS handles all visual state.
   ========================================================================== */

/* DAWN — 06:00–09:00 | Cold indigo bleeding into metallic steel-blue */
body[data-theme="dawn"] {
    background: linear-gradient(180deg, #1A2130 0%, #243B55 100%);
}

/* DAY — 09:00–17:00 | Standard charcoal tactical base */
body[data-theme="day"] {
    background: var(--bg-base);
}

/* DUSK — 17:00–20:00 | Burnt-orange + bruised-purple radial horizon bleed */
/* Anchor is at 50% 120% — below the fold — so the glow rises from the edge */
body[data-theme="dusk"] {
    background: radial-gradient(
        ellipse at 50% 120%,
        #5A2E1A 0%,       /* deep burnt-orange core */
        #3B2A3D 30%,      /* bruised-purple mid-bleed */
        #10151D 65%       /* charcoal tactical base */
    );
}

/* NIGHT — 20:00–06:00 | True obsidian for maximum contrast + reduced eye strain */
body[data-theme="night"] {
    background: #000000;
}

/* ==========================================================================
   MATRIX SCRAMBLE — TACTICAL NAV
   JS Engine: decipherEffect.js
   Character set: !<>-_\\/[]{}—=+*^?#_
   Lock-in: left-to-right at iterations += 1/3 per 30ms frame
   ========================================================================== */

.tactical-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.scramble-link {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--text-muted);
    position: relative;
    transition: color 0.2s ease;
    /* Deliberate no-clip — scramble glyphs must overflow cleanly */
    white-space: nowrap;
}

/* Keyboard ADA — visible focus ring matching accent */
.scramble-link:focus-visible {
    outline: 2px solid var(--accent-neon);
    outline-offset: 4px;
    border-radius: 2px;
}

/* STATE: active decipher — JS adds / removes this class */
.scramble-link.is-deciphering {
    color: var(--accent-neon);
    text-shadow:
        0 0 6px rgba(0, 255, 204, 0.55),
        0 0 18px rgba(0, 255, 204, 0.25);
}

/* STATE: fully resolved — hover keeps text-primary, not neon */
.scramble-link:hover {
    color: var(--text-primary);
}

/* Underline sweep — appears only after decipher resolves */
.scramble-link::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-neon);
    transition: width 0.25s ease;
}
.scramble-link:hover::after {
    width: 100%;
}

/* ==========================================================================
   COMPLEXITY TRANSLATION ENGINE
   Controller : translator.js
   Registers  : civilian | tactical | bare_metal
   DOM hook   : [data-content-key] — transition declared here, driven by JS
   ========================================================================== */

/* Fade contract — JS sets opacity:0, swaps innerHTML, restores opacity:1 */
[data-content-key] {
    transition: opacity 0.15s ease-in-out;
}

/* ── Control Bar Layout ─────────────────────────────────────────────────── */
.complexity-toggle {
    grid-column: 1 / -1;          /* spans full bento grid width */
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    padding: 0.75rem 1.25rem;
    background: rgba(0, 255, 204, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    letter-spacing: 1px;
    /* Push down to clear the 100px logo overhanging from the header */
    margin-top: 48px;
}

.complexity-toggle .prompt {
    color: var(--text-muted);
    margin-right: 0.5rem;
    user-select: none;
}

/* ── Toggle Buttons ─────────────────────────────────────────────────────── */
.level-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    letter-spacing: 1px;
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
    transition: color 0.2s ease, border-color 0.2s ease, text-shadow 0.2s ease;
}

.level-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* ADA: keyboard focus ring */
.level-btn:focus-visible {
    outline: 2px solid var(--accent-neon);
    outline-offset: 3px;
}

/* ACTIVE STATE — currently selected register */
.level-btn.active {
    color: var(--accent-neon);
    font-weight: bold;
    border-color: rgba(0, 255, 204, 0.35);
    text-shadow:
        0 0 5px rgba(0, 255, 204, 0.7),
        0 0 12px rgba(0, 255, 204, 0.3);
    background: rgba(0, 255, 204, 0.05);
}

/* ── Section 1 Content Card ─────────────────────────────────────────────── */
.section1-card {
    grid-column: 1 / -1;   /* stretch across auto-fit columns */
}

.section1-card h2 {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-neon);
    margin-bottom: 0.75rem;
}

.section1-card p {
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 0.9rem;
    max-width: 72ch;
}

/* ── Intro Card ─────────────────────────────────────────────────────────── */
.intro-card {
    grid-column: 1 / -1;
    border-left: 2px solid rgba(0, 180, 255, 0.4);
    background: linear-gradient(
        135deg,
        rgba(0, 140, 255, 0.04) 0%,
        var(--bg-surface) 55%
    );
    position: relative;
    overflow: hidden;
}

/* Subtle corner glow */
.intro-card::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(0, 180, 255, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.intro-card h2 {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #60b4ff;
    margin: 0 0 1rem 0;
    text-shadow: 0 0 8px rgba(0, 140, 255, 0.3);
}

.intro-body {
    color: var(--text-muted);
    line-height: 1.8;
    font-size: 0.9rem;
    /* Render \n\n as paragraph breaks from the JS strings */
    white-space: pre-line;
    transition: opacity 0.15s ease-in-out;
    max-width: 80ch;
}

/* ==========================================================================
   NARRATIVE CONTENT CARDS
   genesis-card  : full-width origin story log
   redteam-card  : attack surface / threat matrix
   metrics-card  : benchmark log
   ========================================================================== */

/* ── Card system tag — small dim label in card top-left ─────────────────── */
.card-sys-tag {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    opacity: 0.55;
    margin-bottom: 0.6rem;
    -webkit-user-select: none;
    user-select: none;
}

/* ── Shared heading style for new narrative cards ────────────────────────── */
.genesis-card h2,
.redteam-card h2,
.metrics-card h2 {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-neon);
    margin: 0 0 1rem 0;
}

/* ── Shared body div style ───────────────────────────────────────────────── */
.genesis-body,
.redteam-body,
.metrics-body {
    color: var(--text-muted);
    line-height: 1.75;
    font-size: 0.875rem;
    transition: opacity 0.15s ease-in-out;
}

/* ── Genesis Log — full-width, accent left border ────────────────────────── */
.genesis-card {
    grid-column: 1 / -1;
    border-left: 2px solid rgba(0, 255, 204, 0.35);
    background: linear-gradient(
        135deg,
        rgba(0, 255, 204, 0.03) 0%,
        var(--bg-surface) 60%
    );
    position: relative;
    overflow: hidden;
}

/* Subtle top-right corner glow */
.genesis-card::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(0, 255, 204, 0.07) 0%, transparent 70%);
    pointer-events: none;
}

/* ── Red Team + Metrics — auto side-by-side at wide viewports ────────────── */
/* They sit in the auto-fit grid naturally at ~half-width each on 1200px canvas */
.redteam-card {
    border-top: 2px solid rgba(255, 80, 80, 0.3);
    background: linear-gradient(
        180deg,
        rgba(255, 60, 60, 0.03) 0%,
        var(--bg-surface) 40%
    );
}

.redteam-card h2 {
    color: #ff6b6b;
    text-shadow: 0 0 8px rgba(255, 80, 80, 0.35);
}

.metrics-card {
    border-top: 2px solid rgba(0, 180, 255, 0.3);
    background: linear-gradient(
        180deg,
        rgba(0, 140, 255, 0.03) 0%,
        var(--bg-surface) 40%
    );
}

.metrics-card h2 {
    color: #60b4ff;
    text-shadow: 0 0 8px rgba(0, 140, 255, 0.35);
}

/* ── Pre-formatted metric table (bare-metal register) ────────────────────── */
pre.metric-table {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    line-height: 1.6;
    color: var(--text-muted);
    white-space: pre;
    overflow-x: auto;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
}

/* Scrollbar for long metric tables on small screens */
pre.metric-table::-webkit-scrollbar       { height: 3px; }
pre.metric-table::-webkit-scrollbar-track { background: transparent; }
pre.metric-table::-webkit-scrollbar-thumb { background: rgba(0, 255, 204, 0.2); border-radius: 2px; }



/* ==========================================================================
   COMPLIANCE FOOTER
   Controller: complianceModal.js
   ========================================================================== */

.compliance-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.9rem 2rem;
    border-top: 1px solid var(--border-color);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    letter-spacing: 1px;
    background: var(--bg-base);
    /* Sticks to the bottom of the viewport if content is short */
    margin-top: auto;
}

.sitemap-links,
.legal-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.footer-label {
    color: var(--accent-neon);
    margin-right: 0.5rem;
    font-weight: bold;
}

/* Shared reset for both anchor and button footer items */
.sitemap-links a,
.legal-links button {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    letter-spacing: 1px;
    padding: 0.2rem 0.5rem;
    border-radius: 2px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.sitemap-links a:hover,
.legal-links button:hover {
    color: var(--accent-neon);
    border-color: rgba(0, 255, 204, 0.3);
}

.sitemap-links a:focus-visible,
.legal-links button:focus-visible {
    outline: 2px solid var(--accent-neon);
    outline-offset: 3px;
}

/* Separator pipe between legal buttons */
.legal-links button + button::before {
    content: '|';
    color: var(--border-color);
    margin-right: 0.5rem;
    pointer-events: none;
}

/* ==========================================================================
   TERMINAL MODAL — Native <dialog>
   ========================================================================== */

.terminal-modal {
    background: rgba(5, 10, 15, 0.80);  /* 80% opaque */
    color: var(--accent-neon);
    border: 1px solid rgba(0, 255, 204, 0.6);
    border-radius: 4px;
    padding: 0;
    width: min(600px, 92vw);
    max-height: 78vh;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.82rem;

    /* Rectangular alpha-mask glow:
       Layer 1 — tight neon core  (white-hot center)
       Layer 2 — mid bloom        (primary neon spread)
       Layer 3 — outer fade       (atmospheric bleed)
       Layer 4 — surrounding dark (hard vignette, seals the alpha mask edge) */
    box-shadow:
        0 0 15px rgba(255, 255, 255, 0.55),
        0 0 30px rgba(0, 255, 204, 0.70),
        0 0 60px rgba(0, 255, 204, 0.30),
        0 0 90px rgba(0, 0, 0, 0.90);

    /* Bulletproof dialog centering — inset:0 + margin:auto distributes
       remaining viewport space equally on all four sides. Avoids the
       browser's native dialog margin stacking issue with top/transform. */
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(600px, 92vw);
    height: fit-content;

    /* Animate in from slightly above center */
    animation: modal-drop-in 0.2s ease-out;
}

@keyframes modal-drop-in {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Out-of-focus backdrop — blur only, no tint, no darkening */
.terminal-modal::backdrop {
    background: rgba(0, 0, 0, 0.05);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* ── Modal Header ───────────────────────────────────────────────────────── */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: rgba(0, 255, 204, 0.07);
    border-bottom: 1px solid rgba(0, 255, 204, 0.4);
}

.modal-title-text {
    font-size: 0.75rem;
    letter-spacing: 2px;
    font-weight: bold;
    color: var(--accent-neon);
    text-shadow: 0 0 6px rgba(0, 255, 204, 0.5);
}

#close-modal {
    background: none;
    border: 1px solid transparent;
    color: var(--accent-neon);
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
    border-radius: 2px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

#close-modal:hover {
    background: rgba(0, 255, 204, 0.1);
    border-color: rgba(0, 255, 204, 0.4);
}

#close-modal:focus-visible {
    outline: 2px solid var(--accent-neon);
    outline-offset: 3px;
}

/* ── Modal Body ─────────────────────────────────────────────────────────── */
.modal-body {
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
    max-height: calc(80vh - 3rem); /* header height buffer */
}

/* Scrollbar — styled to match the terminal aesthetic */
.modal-body::-webkit-scrollbar        { width: 4px; }
.modal-body::-webkit-scrollbar-track  { background: #050A0F; }
.modal-body::-webkit-scrollbar-thumb  { background: rgba(0, 255, 204, 0.35); border-radius: 2px; }

/* <pre> preserves the \n line breaks from our JS text strings */
.modal-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.75;
    color: rgba(0, 255, 204, 0.85);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
}

/* ── Modal Footer — dismissal instruction ────────────────────────────────── */
.modal-footer {
    padding: 0.55rem 1rem;
    border-top: 1px solid rgba(0, 255, 204, 0.15);
    background: rgba(0, 255, 204, 0.03);
    text-align: center;
}

.modal-dismiss-hint {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.68rem;
    letter-spacing: 1px;
    color: rgba(0, 255, 204, 0.35);
    -webkit-user-select: none;
    user-select: none;
}

/* ==========================================================================
   SECURE COMMS TRANSMISSION FORM
   Controller : commsForm.js
   Webhook    : Formspree / Cloudflare Worker (configure in index.html)
   ========================================================================== */

/* ── Utility: visually-hidden but present in DOM (honeypot, skip links) ─── */
.sr-trap {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* ── Card shell ─────────────────────────────────────────────────────────── */
.comms-card {
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    grid-column: 1 / -1; /* Full-width in the bento grid */
}

.comms-card h2[data-content-key="comms_header"] {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent-neon);
    margin-bottom: 0.5rem;
}

.comms-sub {
    font-family: 'Courier New', Courier, monospace;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.5;
}

.comms-sub-protocol {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: rgba(148, 163, 184, 0.5);
    letter-spacing: 0.5px;
}

/* ── Direct contact block ────────────────────────────────────────────────── */
.contact-direct {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 0.5rem;
}

.contact-email-link {
    display: inline-flex;
    align-items: center;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--accent-neon);
    text-decoration: none;
    border: 1px solid rgba(0, 255, 204, 0.3);
    padding: 1rem 1.5rem;
    border-radius: 3px;
    background: rgba(0, 255, 204, 0.03);
    transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    width: fit-content;
}

.contact-email-link:hover,
.contact-email-link:focus-visible {
    background: rgba(0, 255, 204, 0.08);
    border-color: var(--accent-neon);
    box-shadow: 0 0 24px rgba(0, 255, 204, 0.2);
    text-decoration: none;
}

.contact-email-link:focus-visible {
    outline: 2px solid var(--accent-neon);
    outline-offset: 4px;
}

.contact-email-prefix {
    color: rgba(0, 255, 204, 0.5);
    font-size: 0.9rem;
}

.contact-note {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.8;
    margin: 0;
}

/* ==========================================================================
   TACTICAL ASSET CARDS — Animated Background Image Cards
   Assets   : assets/leo_satellite_dithered.png | assets/uas_drone_dithered.png
   Layers   : z-index 0 (SVG ghost) → z-index 1 (text content)
   Animation: .orbital-drift 45s linear | .drone-loiter 30s ease-in-out
   ========================================================================== */

/* ── Card shell ─────────────────────────────────────────────────────────── */
.tactical-asset-card {
    position: relative;
    overflow: hidden;           /* Traps the oversized, panning SVG inside */
    background: #050A0F;
    border: 1px solid rgba(0, 255, 204, 0.45);
    padding: 2rem;
    min-height: 200px;
    /* Subtle neon ambient glow on the card border */
    box-shadow: 0 0 0 1px rgba(0, 255, 204, 0.08), inset 0 0 40px rgba(0, 255, 204, 0.03);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.tactical-asset-card:hover {
    border-color: rgba(0, 255, 204, 0.7);
    box-shadow: 0 0 0 1px rgba(0, 255, 204, 0.15), inset 0 0 40px rgba(0, 255, 204, 0.06);
}

/* Place the asset cards side-by-side in the bento grid */
body[data-view="executive"] .tactical-asset-card {
    /* Override grid-column: 1/-1 from section1/comms cards — these share the row */
    grid-column: unset;
}

/* ── SVG ghost layer ────────────────────────────────────────────────────── */
.svg-payload-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;   /* Never blocks text selection or clicks */
    opacity: 0.15;          /* Radar-ghost transparency */
}

/* ── Tactical image sizing & glow ──────────────────────────────────────── */
.tactical-svg {
    position: absolute;
    width: 160%;            /* Oversized so it has room to travel */
    height: auto;
    /* Neon bloom on the dithered pixels */
    filter:
        drop-shadow(0 0 6px rgba(0, 255, 204, 0.8))
        drop-shadow(0 0 18px rgba(0, 255, 204, 0.35));
}

/* ── Card text layer ────────────────────────────────────────────────────── */
.card-content {
    position: relative;
    z-index: 1;
    color: var(--text-primary);
}

.card-content h3 {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.78rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent-neon);
    margin: 0 0 0.75rem 0;
    text-shadow: 0 0 8px rgba(0, 255, 204, 0.4);
}

.card-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 36ch;
    margin: 0;
}

/* ── ANIMATION 1: ORBITAL DRIFT (Satellite) ────────────────────────────── */
/* Behavioral profile: rigid, constant velocity — simulates orbital mechanics */
.orbital-drift {
    top: -20%;
    left: -30%;
    animation: orbit-pan 45s linear infinite alternate;
    transform-origin: center center;
}

@keyframes orbit-pan {
    0%   { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(15%, 20%) rotate(3deg); }
}

/* ── ANIMATION 2: TACTICAL LOITER (UAS Drone) ──────────────────────────── */
/* Behavioral profile: ease-in-out — simulates wind resistance + thrust cycles */
.drone-loiter {
    top: 5%;
    left: -20%;
    animation: loiter-pan 30s ease-in-out infinite alternate;
    transform-origin: center center;
}

@keyframes loiter-pan {
    0%   { transform: translateX(0) translateY(0); }
    100% { transform: translateX(25%) translateY(8%); }
}

/* Respect prefers-reduced-motion — freeze animations for accessibility */
@media (prefers-reduced-motion: reduce) {
    .orbital-drift,
    .drone-loiter {
        animation: none;
    }
}

/* ==========================================================================
   ACCESSIBILITY WIDGET
   #a11y-widget: fixed bottom-right container
   #a11y-panel: dropdown panel (panel opens upward)
   ========================================================================== */

/* ── Font scale — applied to <html> so all rem values cascade ────────────── */
html.font-large  { font-size: 112.5%; }  /* 18px base */
html.font-xlarge { font-size: 125%;   }  /* 20px base */

/* ── Widget container ────────────────────────────────────────────────────── */
#a11y-widget {
    position: fixed;
    bottom: 3.5rem;       /* sits above the compliance footer bar */
    right: 1.5rem;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

/* ── Toggle button ───────────────────────────────────────────────────────── */
.a11y-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: var(--bg-surface);
    border: 1px solid var(--accent-neon);
    border-radius: 2rem;
    color: var(--accent-neon);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.15);
}

.a11y-toggle-btn:hover,
.a11y-toggle-btn:focus-visible {
    background: rgba(0, 255, 204, 0.08);
    box-shadow: 0 0 14px rgba(0, 255, 204, 0.3);
    outline: none;
}

.a11y-toggle-btn svg { flex-shrink: 0; }

/* ── Panel ───────────────────────────────────────────────────────────────── */
.a11y-panel {
    background: var(--bg-surface);
    border: 1px solid rgba(0, 255, 204, 0.25);
    border-radius: 6px;
    padding: 0;
    width: 220px;
    box-shadow:
        0 0 0 1px rgba(0, 255, 204, 0.05),
        0 8px 32px rgba(0, 0, 0, 0.55),
        0 0 18px rgba(0, 255, 204, 0.08);
    overflow: hidden;
    /* Animate open */
    animation: a11y-panel-in 0.18s ease-out both;
}

@keyframes a11y-panel-in {
    from { opacity: 0; transform: translateY(6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)  scale(1);    }
}

/* ── Panel header ────────────────────────────────────────────────────────── */
.a11y-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid rgba(0, 255, 204, 0.12);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--accent-neon);
}

.a11y-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    transition: color 0.15s ease;
    line-height: 1;
}

.a11y-close-btn:hover { color: var(--text-primary); }

/* ── Panel sections ──────────────────────────────────────────────────────── */
.a11y-section {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.a11y-section:last-child { border-bottom: none; }

.a11y-section-label {
    display: block;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    opacity: 0.6;
    margin-bottom: 0.55rem;
}

/* ── Font size buttons ───────────────────────────────────────────────────── */
.a11y-font-row {
    display: flex;
    gap: 0.4rem;
}

.a11y-font-btn {
    flex: 1;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.8rem;
}

.a11y-font-btn:nth-child(2) { font-size: 0.92rem; }
.a11y-font-btn:nth-child(3) { font-size: 1.05rem; }

.a11y-font-btn:hover {
    border-color: rgba(0, 255, 204, 0.35);
    color: var(--text-primary);
}

.a11y-font-btn.active {
    background: rgba(0, 255, 204, 0.1);
    border-color: var(--accent-neon);
    color: var(--accent-neon);
}

/* ── Mode toggle buttons ─────────────────────────────────────────────────── */
.a11y-mode-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.6rem;
    margin-bottom: 0.35rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.a11y-mode-btn:last-child { margin-bottom: 0; }

.a11y-mode-btn:hover {
    border-color: rgba(0, 255, 204, 0.35);
    color: var(--text-primary);
}

.a11y-mode-btn[aria-pressed="true"] {
    background: rgba(0, 255, 204, 0.1);
    border-color: var(--accent-neon);
    color: var(--accent-neon);
}


/* ==========================================================================
   LIGHT MODE
   Applied via: body.light-mode
   ========================================================================== */
body.light-mode {
    --bg-base:       #f0f4f8;
    --bg-surface:    #ffffff;
    --text-primary:  #0d1117;
    --text-muted:    #4a5568;
    --border-color:  #cbd5e0;
    --accent-neon:   #007a5e;
    background: var(--bg-base);
    color: var(--text-primary);
}

body.light-mode .tactical-header {
    background: rgba(240, 244, 248, 0.95);
    border-bottom-color: #cbd5e0;
}

body.light-mode pre.metric-table {
    color: var(--text-muted);
}

body.light-mode .a11y-toggle-btn {
    box-shadow: 0 0 8px rgba(0, 122, 94, 0.2);
}


/* ==========================================================================
   HIGH CONTRAST MODE
   Applied via: body.high-contrast
   WCAG 2.1 AA: minimum 4.5:1 ratio, enforced via pure black/white/yellow
   ========================================================================== */
body.high-contrast {
    --bg-base:       #000000;
    --bg-surface:    #0a0a0a;
    --text-primary:  #ffffff;
    --text-muted:    #eeeeee;
    --border-color:  #ffffff;
    --accent-neon:   #ffff00;
    background: #000;
    color: #fff;
}

body.high-contrast .bento-card {
    border: 2px solid #ffffff;
}

body.high-contrast .tactical-header {
    background: #000;
    border-bottom: 2px solid #ffffff;
}

body.high-contrast .level-btn {
    border-color: #ffffff;
}

body.high-contrast .level-btn.active {
    background: #ffff00;
    color: #000000;
    border-color: #ffff00;
}

body.high-contrast a,
body.high-contrast .scramble-link {
    color: #ffff00;
}

body.high-contrast .compliance-footer {
    border-top: 2px solid #ffffff;
}

body.high-contrast pre.metric-table {
    color: #eeeeee;
}

body.high-contrast .a11y-toggle-btn {
    border-color: #ffff00;
    color: #ffff00;
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.3);
}

body.high-contrast .a11y-panel {
    border-color: #ffffff;
    background: #0a0a0a;
}

body.high-contrast .a11y-font-btn.active,
body.high-contrast .a11y-mode-btn[aria-pressed="true"] {
    background: #ffff00;
    border-color: #ffff00;
    color: #000000;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS
   Breakpoints: 768px (tablet) | 640px (mobile) | 400px (small mobile)
   Strategy   : keep all content & functions intact; rearrange layout only.
   ========================================================================== */

/* Hamburger button (desktop: hidden) */
#nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 0.45rem 0.55rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    order: 2;
}
#nav-hamburger:hover { border-color: var(--accent-neon); }
#nav-hamburger:focus-visible { outline: 2px solid var(--accent-neon); outline-offset: 2px; }

.hamburger-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: background 0.2s ease, transform 0.25s ease, opacity 0.2s ease;
}
#nav-hamburger:hover .hamburger-bar,
#nav-hamburger[aria-expanded="true"] .hamburger-bar { background: var(--accent-neon); }

#nav-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
#nav-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
#nav-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Tablet (768px) */
@media (max-width: 768px) {
    .tactical-header {
        padding: 0.75rem 1.25rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .tactical-nav { gap: 1rem; }
    body[data-view="executive"] .dynamic-workspace {
        margin: 1.25rem auto;
        padding: 0 0.85rem;
        gap: 1rem;
    }
    .bento-card { padding: 1.5rem; }
    .compliance-footer { padding: 0.75rem 1.25rem; flex-wrap: wrap; }
}

/* Mobile (640px) */
@media (max-width: 640px) {
    .tactical-header {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 0.65rem 0.9rem;
        gap: 0.4rem;
    }
    /* On mobile logo re-enters normal flex flow (no absolute centering) */
    .logo {
        position: static;
        transform: none;
        flex: 1;
        order: 1;
        justify-content: flex-start;
    }
    .site-logo { height: 60px; }
    #nav-hamburger { display: flex; order: 2; }
    .mode-switch { order: 3; padding: 0.4rem 0.65rem; font-size: 0.65rem; letter-spacing: 0.5px; }
    #toggle-text { display: none; }

    .tactical-nav {
        order: 4;
        width: 100%;
        flex-direction: column;
        gap: 0;
        border-top: 1px solid var(--border-color);
        padding: 0.4rem 0 0.2rem;
        margin-top: 0.3rem;
        display: none;
    }
    .tactical-nav.nav-open { display: flex; }

    .scramble-link {
        padding: 0.65rem 0.25rem;
        font-size: 0.72rem;
        letter-spacing: 2px;
        border-bottom: 1px solid rgba(45, 55, 72, 0.45);
        width: 100%;
        display: block;
    }
    .scramble-link:last-child { border-bottom: none; }

    body[data-view="executive"] .dynamic-workspace {
        margin: 0.85rem auto;
        padding: 0 0.65rem;
        gap: 0.8rem;
    }
    body[data-view="executive"] .content-canvas {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    body[data-view="executive"][data-level="bare_metal"] .content-canvas {
        grid-template-columns: 1fr;
    }

    .bento-card { padding: 1.1rem; }
    .hero-card h1 { font-size: 1.2rem; line-height: 1.4; margin-bottom: 0.75rem; }
    .hero-card p { font-size: 0.875rem; }

    .complexity-toggle {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.65rem 0.9rem;
    }
    .complexity-toggle .prompt { margin-right: 0; }
    .level-btn { font-size: 0.68rem; padding: 0.4rem 0.55rem; letter-spacing: 0.5px; }

    .terminal-body { max-height: 200px; }
    body[data-view="executive"] .terminal-container { min-height: 170px; }

    .tactical-asset-card { min-height: 140px; padding: 1.1rem; }

    .compliance-footer {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.75rem 0.9rem;
        gap: 0.65rem;
    }
    .sitemap-links, .legal-links { flex-wrap: wrap; gap: 0.1rem; }

    #a11y-widget { bottom: 5rem; right: 0.75rem; }

    .section1-card p,
    .genesis-body,
    .redteam-body,
    .metrics-body { font-size: 0.85rem; }
}

/* Small mobile (400px) */
@media (max-width: 400px) {
    .bento-card { padding: 0.9rem; }
    .level-btn { font-size: 0.62rem; padding: 0.3rem 0.4rem; letter-spacing: 0.3px; }
    .compliance-footer { font-size: 0.65rem; }
    .hero-card h1 { font-size: 1.05rem; }
}

/* Safe area insets for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .compliance-footer {
        padding-bottom: calc(0.9rem + env(safe-area-inset-bottom));
    }
}
