:root {
    /* === JUNE18 Light Theme (Default) === */
    --bg-color: #fdfdfc;
    --text-color: #003b4f;
    --accent-color: #00a99d;
    --subhead-color: #007f6e;
    --invert-bg: #003b4f;
    --invert-text: #fdfdfc;
    --shadow: rgba(0,59,79,0.15);
    --border-color: #003b4f;
    
    /* === Dark Theme Overrides (for toggle) === */
    --dark-bg-color: #000000;
    --dark-text-color: #00a99d;
    --dark-accent-color: #00ffcc;
    --dark-subhead-color: #06989a;
    --dark-invert-bg: #00a99d;
    --dark-invert-text: #000000;
    --dark-shadow: rgba(0,169,157,0.15);
    --dark-border-color: #00a99d;
    
    /* === Typography & Spacing === */
    --font-mono: 'Courier Prime', monospace;
    --font-headers: 'Courier Prime', monospace;
    --transition-speed: 0.3s;
    --black: #000000;
    --white: #ffffff;
    --font-size-desktop: 16px;
    --font-size-console: 18px;
    --font-size-client-logos: 19px;
    --font-size-menu-desktop: 18px;
    --font-size-menu-tablet: 16px;
    --font-size-menu-mobile: 14px;
    --vt323: 'VT323', sans-serif;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === Font Smoothing === */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body, .boot-loader-container, .boot-loader-text {
    height: 100vh;
    min-height: 100vh;
}

body {
    font-family: var(--font-mono);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
    line-height: 1.4; /* Updated to match JUNE18 spec */
    overflow: hidden;
    margin: 0;
    padding: 0;
    /* Safe area support for devices with notches */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Mobile full-screen support */
@supports (height: 100dvh) {
    html, body, .boot-loader-container, .boot-loader-text {
        height: 100dvh; /* Dynamic viewport height - accounts for mobile browser UI */
        min-height: 100dvh;
    }
}

/* Enhanced mobile experience using modern viewport units */
@media (max-width: 768px) {
    html, body {
        height: 100dvh; /* Dynamic viewport height - adapts to browser UI */
        min-height: 100dvh;
        overflow-x: hidden; /* Prevent horizontal scrolling */
    }
    
    /* Main sections use dynamic viewport */
    .section {
        min-height: 100dvh;
        height: auto;
    }
    
    /* Mobile terminal navigation adjustments */
    .terminal-navigation {
        bottom: calc(0.5rem + env(safe-area-inset-bottom)); /* Buffer + safe area */
        left: 0.5rem;
        right: 0.5rem;
        width: auto; /* Use left/right instead of calc width */
        border-left: 1px dashed var(--border-color); /* Restore side borders on mobile */
        border-right: 1px dashed var(--border-color);
        box-shadow: 2px 2px 0 0 rgba(0, 59, 79, 0.2); /* Restore full shadow on mobile */
        padding: 0.1875rem 1rem; /* Compress menu height while keeping horizontal spacing */
    }
}

/* === Dark Theme Toggle === */
body.dark-theme {
    --bg-color: var(--dark-bg-color);
    --text-color: var(--dark-text-color);
    --accent-color: var(--dark-accent-color);
    --subhead-color: var(--dark-subhead-color);
    --invert-bg: var(--dark-invert-bg);
    --invert-text: var(--dark-invert-text);
    --shadow: var(--dark-shadow);
    --border-color: var(--dark-border-color);
}

/* Boot Loader */
.boot-loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    min-height: 0;
    background-color: var(--bg-color);
    z-index: 900;
    display: flex;
    justify-content: center;
    align-items: stretch;
    margin: 0;
    padding: 0;
}
.boot-loader-text {
    font-family: var(--font-mono);
    font-size: 16px;
    color: var(--text-color);
    background: var(--bg-color);
    white-space: pre;
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    min-height: 0;
    text-align: left;
    line-height: inherit;
    box-sizing: border-box;
    display: block;
    overflow: hidden;
}

/* ASCII Logo Container */
.ascii-logo-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-color);
    z-index: 600 !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ascii-logo-display {
    width: auto;
    max-width: 100vw;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.xf-works-logo {
    margin: -2rem auto 0 auto !important;
    display: block !important;
    visibility: visible !important;
    position: relative !important;
    z-index: 1001 !important;
}

.ascii-art {
    font-family: var(--font-mono) !important;
    font-size: 14px !important;
    line-height: 1 !important;
    color: var(--accent-color) !important;
    background-color: var(--bg-color) !important;
    white-space: pre !important;
    margin-bottom: 1rem !important;
    font-weight: normal !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1000 !important;
    text-align: left !important;
    transform: translateX(18.5px); /* Desktop only: nudge right by half of 37px offset */
}

/* Client Logos */
#client-logos {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 700;
    background-color: var(--bg-color);
}

.client-logos-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-mono);
}

.client-logos-wrapper {
    width: 60vw;
    height: 60vh;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (max-width: 767px) {
    .ascii-logo-container {
        height: 100dvh; /* Use dynamic viewport height to account for browser UI */
    }
    
    #client-logos {
        height: 70dvh; /* Center in 70% of dynamic viewport, leaving 30% for menu bar */
        display: flex; /* Ensure flexbox is active when shown */
    }
    
    .client-logos-container {
        height: 100%; /* Use parent's adjusted height */
    }
    
    .client-logos-wrapper {
        width: 80vw;
        height: 80%; /* Use percentage of container instead of viewport */
    }
}

.client-logo-textoverlay {
    width: 100%;
    height: 100%;
    font-family: var(--font-mono);
    font-size: 17px;
    line-height: 12px;
    color: transparent;
    white-space: pre;
    overflow: hidden;
    background-image: url('../assets/logos/client-logos-desktop.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    -webkit-background-clip: text;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Content */
#main-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: none;
    z-index: 600;
    background-color: var(--bg-color);
    font-family: var(--font-mono);
}

/* Content Sections (June 4th styling) */
.content-container {
    padding: 0;
    min-height: 100vh;
    width: 100%;
    height: 100vh;
    max-width: 100%;
    display: block;
    position: relative;
    z-index: 500;
}

.content-section {
    min-height: calc(100vh - 80px); /* Subtract footer height */
    height: calc(100vh - 80px); /* Subtract footer height */
    display: flex;
    justify-content: center;
    align-items: center; /* Pure CSS vertical centering */
    padding: 5vh 2vw; /* Minimum spacing from edges */
    opacity: 0;
    width: 100%;
    max-width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    margin-bottom: 0;
    box-sizing: border-box;
}

/* Content text wrapper (matches live site structure) */
.terminal-frame {
    width: auto;
    max-width: 96%; /* 20% narrower than 120% (120% * 0.8 = 96%) */
    padding: 2rem;
    border: none;
    margin: 0 auto;
    position: relative; /* ADDED: For corner positioning */
    text-align: left;
    display: flex;
    flex-direction: column; /* Stack elements vertically within frame */
    justify-content: center;
    align-items: center;
    flex-shrink: 0; /* Prevent shrinking beyond content needs */
}

.terminal-content {
    padding: 0;
    font-size: 1rem;
    font-weight: normal;
    line-height: 1.2;
    width: 100%;
    max-width: 100%;
}

/* Inverted title for content box */
.content-title-invert {
    display: block !important;
    background-color: var(--text-color) !important;
    color: var(--bg-color) !important;
    font-weight: bold !important;
    padding: 0.75rem 1.5rem !important;
    margin: 0 !important;
    font-family: var(--font-mono) !important;
    font-size: 16px !important;
    line-height: 20px !important;
    width: 100% !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

/* This is a special class for inverted titles in dark mode */
body.dark-theme .content-title-invert {
    background: var(--accent-color) !important;
    color: #000 !important;
}

/* Content ASCII Box - JUNE18 spec with retro block shading */
.content-ascii-box {
    font-family: var(--font-mono);
    font-weight: normal;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 16px;
    line-height: 1.4;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    overflow: visible;
    text-align: left;
    display: block;
    border: 1px dashed var(--border-color);
    /* Retro block shading - 30% darker bars on right/bottom */
    box-shadow: 4px 0 0 0 rgba(0, 59, 79, 0.3), 0 4px 0 0 rgba(0, 59, 79, 0.3);
    width: 86ch;
    max-width: calc(100vw - 8vw); /* Ensure it never exceeds viewport with padding */
    min-width: 60ch;
    box-sizing: border-box;
}

/* Title bar styling */
.content-title {
    background-color: #f0f0f0 !important; /* Light gray background */
    color: #000 !important; /* Dark text */
    font-weight: bold !important;
    padding: 0.75rem 1.5rem !important;
    margin: 0 !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    font-family: var(--font-mono) !important;
    font-size: 16px !important;
    line-height: 20px !important;
    border-bottom: 1px solid #ddd !important; /* Add subtle border */
    text-align: center !important;
}

/* Content area styling */
.content-text {
    padding: 2rem 1.5rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: block;
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Content subheader styling - JUNE18 spec */
.content-subheader {
    display: block;
    color: var(--subhead-color);
    font-weight: bold;
    margin-top: 1.2em;
    font-family: var(--font-mono);
    font-size: 1em;
    text-align: center;
}

/* Text animation for typing effect */
.text-animation-hidden {
    visibility: visible;
}
.text-typing-active {
    visibility: visible;
}

.content-panels {
    width: 100%;
    height: 100%;
    position: relative;
    font-family: var(--font-mono);
}

/* Terminal Input */
.terminal-input-container {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    flex-grow: 1;
    border-top: 1px dashed var(--border-color);
    background-color: var(--bg-color);
    min-width: 0;
}

.prompt {
    margin-right: 0.5rem;
    color: var(--accent-color);
    font-weight: normal;
    font-size: inherit; /* Inherit from body: 14px desktop, 12px mobile */
}

.terminal-input {
    flex: 1;
    background-color: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: inherit;
    outline: none;
    font-weight: normal;
    min-width: 0;
}

/* Terminal input cursor animation - JUNE18 spec */
.terminal-input::after {
    content: '|';
    animation: blink 1s step-start infinite;
    color: var(--accent-color);
}

@keyframes blink {
    50% { opacity: 0; }
}

.terminal-input::placeholder {
    color: var(--text-color);
    opacity: 0.7;
}

/* Terminal Menu Popup - JUNE18 spec with retro block shading */
.unix-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 340px;
    max-width: 90vw;
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    z-index: 1300; /* Higher than GPT modal to appear on top */
    display: none;
    font-family: var(--font-mono);
    color: var(--text-color);
    /* Retro block shading - 30% darker bars on right/bottom */
    box-shadow: 4px 0 0 0 rgba(0, 59, 79, 0.3), 0 4px 0 0 rgba(0, 59, 79, 0.3);
    padding: 2rem 1.5rem;
}
.unix-menu.active {
    display: block;
}
.menu-header {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px dashed var(--border-color);
    border-top: none;
    font-size: 16px;
    line-height: 1.4;
    font-weight: normal;
    color: var(--text-color);
    font-family: var(--font-mono);
}
.menu-content {
    padding: 1rem;
}
.menu-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: normal;
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.4;
}
.menu-item:hover {
    background-color: rgba(0, 169, 157, 0.1);
    color: var(--accent-color);
}

/* Menu brackets styling to match bottom navigation */
.menu-bracket {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.menu-item:hover .menu-bracket {
    opacity: 1;
    color: var(--accent-color);
}

/* Content Links - Match menu-item styling */
.content-link {
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: normal;
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.4;
    text-decoration: none;
    display: inline-block;
}

.content-link:hover {
    background-color: rgba(0, 169, 157, 0.1);
    color: var(--accent-color);
}

/* Dark mode - more pronounced hover (matches light mode pattern with teal color) */
body.dark-terminal .menu-item:hover,
body.dark-terminal .content-link:hover,
body.dark-theme .menu-item:hover,
body.dark-theme .content-link:hover {
    background-color: rgba(0, 169, 157, 0.3) !important;
}

.menu-footer {
    padding: 1rem;
    border-top: 1px dashed var(--border-color);
    border-bottom: none;
    display: flex;
    justify-content: space-between;
}
.menu-help, .menu-exit, .menu-close {
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.4;
}
.menu-help:hover, .menu-exit:hover, .menu-close:hover {
    color: var(--accent-color);
}

@media (max-width: 1024px) {
    .content-section {
        min-height: calc(100vh - 100px); /* Adjust for larger footer on tablet */
        height: calc(100vh - 100px);
        padding: 4vh 3vw; /* Responsive padding for tablet */
    }
    
    .terminal-frame {
        justify-content: center;
        align-items: center;
        max-width: 95%; /* Slightly narrower on tablet */
    }
    
    /* TABLET WIDTH: 62 characters fixed */
    .content-ascii-box {
        width: 62ch !important; /* CHANGED: Fixed width instead of max-width */
        max-width: 62ch !important;
        min-width: 40ch !important;
    }
    
    /* Tablet title and content styling */
    .content-title {
        font-size: 16px !important;
        line-height: 20px !important;
        padding: 0.75rem 1.5rem !important;
    }
    
    .content-text {
        font-size: 16px !important;
        line-height: 20px !important;
        padding: 2rem 1.5rem !important;
    }
    
    /* Menu System: Tablet (≤1024px) - match content size (16px) */
    .nav-arrow, .nav-menu {
        font-size: 16px !important; /* Force override */
        line-height: 16px !important; /* Force override */
    }
    
    /* Keep prompt and terminal-input inheriting from body */
    
    .menu-header, .menu-item, .menu-help, .menu-exit, .menu-close {
        font-size: 16px;
        line-height: 1.4;
    }
    
    .unix-menu {
        max-width: 95vw;
    }
    
    .content-wrapper {
        width: 62ch !important;
        max-width: 62ch !important;
        min-width: 40ch !important;
    }

    .nav-arrow {
        display: none;
    }
}

@media (max-width: 768px) {
    /* Body/Base Typography: Large Mobile (≤768px) = 14px/16px */
    body {
        font-size: 14px;
        line-height: 16px; /* Increased proportionally from 16px */
    }
    
    /* Content should also scale down to match body/menu */
    .content-ascii-box {
        font-size: 16px !important;
        line-height: 18px !important; /* Increased proportionally */
        padding: 1.5rem 1rem !important; /* Smaller padding on mobile */
        width: 50ch !important; /* CHANGED: Fixed width instead of max-width */
        max-width: 50ch !important; /* LARGE MOBILE WIDTH: 50 characters max */
        min-width: 30ch !important;
    }
    
    .content-section {
        min-height: calc(100vh - 80px); /* Consistent footer height on mobile */
        height: calc(100vh - 80px);
        padding: 3vh 4vw; /* More horizontal padding on mobile, less vertical */
    }
    
    /* Mobile title and content styling */
    .content-title {
        font-size: 14px !important;
        line-height: 16px !important;
        padding: 0.75rem 1rem !important;
    }
    
    .content-text {
        font-size: 16px !important;
        line-height: 18px !important;
        padding: 1.5rem 1rem !important;
    }
    
    .boot-loader-text {
        font-size: 14px;
        /* line-height inherits from body = 16px */
    }
    
    .ascii-art {
        font-size: 14px !important;
        transform: translateX(0); /* Reset transform for mobile - mobile looks fine */
    }
    
    .client-logo-textoverlay {
        background-size: 100%;
    }
    
    .client-logos-wrapper {
        width: 80vw;
        height: 80vh;
    }
    
    /* Content sections maintain mobile sizing */
    .terminal-frame {
        padding: 1rem;
        max-width: 90%; /* Slightly wider on mobile */
        /* flex-direction: column already set in base styles */
    }
    
    /* Menu System: Large Mobile (≤768px) - match content size (14px) */
    .nav-arrow, .nav-menu {
        font-size: 14px !important; /* Force override to match mobile content size */
        line-height: 14px !important; /* Force override */
    }
    
    .navigation {
        padding: 0.2rem 1rem;
    }
    
    .terminal-input-container {
        padding: 0.3rem 0.5rem;
    }
    
    .unix-menu {
        width: 98vw;
        max-width: 98vw;
    }
    
    .menu-header, .menu-item, .menu-help, .menu-exit, .menu-close {
        font-size: 14px;
        line-height: 1.4;
    }
    
    .content-wrapper {
        width: 50ch !important;
        max-width: 50ch !important;
        min-width: 30ch !important;
    }
    
    .terminal-input-container {
        width: 100%;
    }
    
    .navigation {
        width: auto;
    }
}

@media (max-width: 480px) {
    .content-section {
        min-height: calc(100vh - 80px);
        height: calc(100vh - 80px);
        padding: 2vh 1rem; /* Use fixed padding instead of vw to prevent overflow */
    }
    
    .terminal-frame {
        padding: 0.5rem; /* Reduce frame padding on mobile */
        max-width: 100%; /* Allow full width within padding */
    }
    
    .content-ascii-box,
    .gpt-overlay-menu,
    .content-wrapper {
        width: calc(100vw - 3rem) !important; /* Full width minus margins and padding */
        max-width: calc(100vw - 3rem) !important;
        min-width: 280px !important; /* Minimum for readability */
        margin: 0 auto !important;
        display: block !important;
        padding: 1rem 0.75rem !important;
        background: var(--bg-color) !important;
        color: var(--text-color) !important;
        box-sizing: border-box !important;
        /* border: 2px solid red !important; */
    }
    .content-text {
        padding: 1rem 0.75rem !important;
        background: var(--bg-color) !important;
        color: var(--text-color) !important;
    }
}

@media (max-width: 320px) {
    .content-section {
        min-height: calc(100vh - 80px);
        height: calc(100vh - 80px);
        padding: 1vh 0.5rem; /* Use fixed padding to prevent overflow */
    }
    
    .content-ascii-box,
    .gpt-overlay-menu,
    .content-wrapper {
        width: calc(100vw - 2rem) !important; /* Even tighter on very small screens */
        max-width: calc(100vw - 2rem) !important;
        min-width: 250px !important; /* Smaller minimum for very small screens */
        margin: 0 auto !important;
        display: block !important;
        padding: 0.75rem 0.5rem !important;
        background: var(--bg-color) !important;
        color: var(--text-color) !important;
        box-sizing: border-box !important;
        /* border: 2px solid red !important; */
    }
    .content-text {
        padding: 0.75rem 0.5rem !important;
        background: var(--bg-color) !important;
        color: var(--text-color) !important;
    }
}

/* Terminal Command Navigation */
.terminal-navigation {
    position: fixed;
    bottom: 0.5rem; /* Small buffer from screen bottom */
    left: 0.5rem; /* Same side buffer as mobile */
    width: calc(100% - 1rem); /* Same side margins as mobile */
    z-index: 800;
    background: var(--bg-color);
    border: 1px dashed var(--border-color); /* Full border box on all sides */
    display: flex;
    justify-content: flex-start; /* Left-aligned for desktop */
    align-items: center;
    transition: opacity 0.3s ease; /* Smooth fade-in when shown */
    gap: 1.5rem; /* Space between menu items */
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    /* Add retro block shading like other terminal elements */
    box-shadow: 0 2px 0 0 rgba(0, 59, 79, 0.2), 0 -2px 0 0 rgba(0, 59, 79, 0.2);
    /* Initial hidden state - will be shown when content state is active */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.command-item {
    font-size: inherit; /* Use inherited font size for responsive scaling */
    line-height: inherit; /* Use inherited line-height for proper spacing */
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
}

.command-item:hover {
    background-color: rgba(0, 169, 157, 0.1);
    color: var(--accent-color);
}

.command-item:active {
    background-color: rgba(0, 169, 157, 0.2);
}

.command-bracket {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.command-item:hover .command-bracket {
    opacity: 1;
    color: var(--accent-color);
}

body.case-reveal-active .terminal-navigation {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

body.case-reveal-active.case-reveal-nav-visible .terminal-navigation {
    opacity: 1;
    pointer-events: auto;
}

#nav-ghost {
    position: fixed;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: rgba(0, 169, 157, 0.7);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 805;
}

body.case-reveal-active #nav-ghost {
    opacity: 0.35;
    pointer-events: auto;
}

body.case-reveal-active.case-reveal-nav-visible #nav-ghost {
    opacity: 0;
    pointer-events: none;
}

/* Terminal Navigation Responsive Design */
@media (max-width: 768px) {
    .terminal-navigation {
        padding: 0.1875rem 1rem; /* Match compressed spacing */
        justify-content: center; /* Centered for mobile */
        gap: 1rem; /* Space between menu items on mobile */
    }
    
    .command-item {
        font-size: inherit; /* Inherit responsive font size from body */
        line-height: inherit;
    }
}

@media (max-width: 480px) {
    .terminal-navigation {
        padding: 0.1875rem 0.5rem; /* Keep tight top/bottom spacing and smaller side margins */
        min-height: 44px; /* iOS minimum touch target guideline */
        justify-content: center; /* Centered for mobile */
        gap: 0.75rem; /* Tighter spacing on small mobile */
    }
    
    .command-item {
        font-size: inherit; /* Inherit responsive font size from body */
        line-height: inherit;
        padding: 0.4rem 0.6rem; /* Add padding to individual touch targets */
        min-height: 32px; /* Ensure adequate touch area */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile-specific button labels - hide all child content and replace */
    #agentic-brand-tool-btn .command-bracket,
    #xf-menu-btn .command-bracket,
    #ascii-ar-btn .command-bracket {
        display: none; /* Hide brackets */
    }
    
    #agentic-brand-tool-btn {
        font-size: 0; /* Hide original text */
    }
    
    #xf-menu-btn {
        font-size: 0; /* Hide original text */
    }
    
    #xf-menu-btn::after {
        content: "[menu]";
        font-size: 14px; /* Mobile font size */
        color: var(--text-color);
    }
    
    #agentic-brand-tool-btn::after {
        content: "[brand tool]";
        font-size: 14px; /* Mobile font size */
        color: var(--text-color);
    }
    
    #ascii-ar-btn {
        font-size: 0; /* Hide original text */
    }
    
    #ascii-ar-btn::after {
        content: "[ar viewer]";
        font-size: 14px; /* Mobile font size */
        color: var(--text-color);
    }
    
    /* Ensure hover states work on mobile replacement text */
    #agentic-brand-tool-btn:hover::after,
    #xf-menu-btn:hover::after,
    #ascii-ar-btn:hover::after {
        color: var(--accent-color);
    }
}

/* GPT Response specific styles - JUNE18 THEME */
.gpt-content {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
}

/* GPT Overlay Menu - Single container with unified border */
.gpt-overlay-menu {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1400; /* Higher than unix-menu (1300) to ensure it's always on top */
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    box-shadow: 4px 0 0 0 rgba(0, 59, 79, 0.3), 0 4px 0 0 rgba(0, 59, 79, 0.3);
    font-family: var(--font-mono);
    color: var(--text-color);
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

/* GPT content area - no border, just content */
.gpt-overlay-menu .content-ascii-box {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    flex: 1;
    overflow: auto;
    max-height: 60vh;
}

/* GPT footer with horizontal separator line */
.gpt-menu-footer {
    padding: 1rem 1.5rem;
    border-top: 1px dashed var(--border-color);
    background: transparent;
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* GPT Menu Close Button */
.gpt-menu-close {
    position: relative;
}

/* GPT Loading Popup - Match theme colors with retro shading */
.gpt-loading-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    max-width: 90vw;
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    z-index: 1300;
    padding: 2rem 1.5rem;
    text-align: center;
    font-family: var(--font-mono);
    color: var(--text-color);
    /* Retro block shading - 30% darker bars on right/bottom */
    box-shadow: 4px 0 0 0 rgba(0, 59, 79, 0.3), 0 4px 0 0 rgba(0, 59, 79, 0.3);
}

/* Subheader styling for ### headings - UPDATED FOR JUNE18 */
.content-subheader {
    display: block;
    color: var(--subhead-color);
    font-weight: bold;
    margin: 1.2em 0 0.5em 0;
    font-size: 1em;
    letter-spacing: 0.01em;
    font-family: var(--font-mono);
    text-align: center;
}

/* Outer wrapper (no border) - UPDATED FOR JUNE18 with retro shading */
.content-wrapper,
pre.content-wrapper,
pre {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    color: inherit !important;
    padding: 0 !important;
    margin: 0 auto !important;
    display: block !important;
}

/* Only .content-ascii-box gets the border and background */
.content-ascii-box {
    background: var(--bg-color) !important;
    color: var(--text-color) !important;
    border: 1px dashed var(--border-color) !important;
    margin: 0 auto !important;
    display: block !important;
    box-shadow: 4px 0 0 0 rgba(0, 59, 79, 0.3), 0 4px 0 0 rgba(0, 59, 79, 0.3) !important;
    padding: 2rem 1.5rem 2.5rem 1.5rem !important; /* Use fixed padding instead of vw */
    max-width: 100%;
    box-sizing: border-box !important;
}

/* Overlay for GPT/help modals */
.gpt-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(253,253,252,0.6); /* subtle light overlay */
  z-index: 1199; /* Below navigation menu (1300) but above content */
  display: none;
}

/* Force background and text color, centering for content boxes */
.content-ascii-box:not(.gpt-overlay-menu .content-ascii-box),
.content-wrapper {
    background: var(--bg-color) !important;
    color: var(--text-color) !important;
    margin: 0 auto !important;
    display: block !important;
    border: 1px dashed var(--border-color) !important;
}

/* GPT overlay menu container gets its own border styling */
.gpt-overlay-menu {
    background: var(--bg-color) !important;
    color: var(--text-color) !important;
}
.content-text {
    background: var(--bg-color) !important;
    color: var(--text-color) !important;
}

.ascii-button, .gpt-menu-close, .menu-close {
  display: inline-block;
  font-family: 'Courier Prime', monospace !important;
  font-size: 1em;
  color: var(--text-color);
  background: var(--bg-color);
  border: 1px dashed var(--border-color);
  border-radius: 3px;
  padding: 0.5em 1.5em;
  margin: 1.5em 0 0 0;
  box-shadow: 2px 2px 0 0 rgba(0,59,79,0.15);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  text-align: center;
}
.ascii-button:hover, .gpt-menu-close:hover, .menu-close:hover {
  background: var(--border-color);
  color: var(--bg-color);
  box-shadow: 4px 4px 0 0 rgba(0,59,79,0.18);
}

.ascii-button, .gpt-menu-close, .menu-close {
  font-family: 'Courier Prime', monospace !important;
}

.ascii-button, .gpt-menu-close, .menu-close {
  font-size: 1em;
}

/* Import Courier Prime from Google Fonts in your HTML: */
/* <link href="https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&display=swap" rel="stylesheet"> */

body, .content-ascii-box, .ascii-button, .gpt-menu-close, .menu-close {
  font-family: var(--font-mono) !important;
}

.ascii-button, .gpt-menu-close, .menu-close {
  font-size: 1em;
}

body.dark-terminal {
  --bg-color: #000000;
  --text-color: #00a99d;
  --border-color: #00a99d;
  background: var(--bg-color) !important;
  color: var(--text-color) !important;
}

body.dark-terminal .content-ascii-box {
  background: var(--bg-color) !important;
  color: var(--text-color) !important;
  border-color: var(--border-color) !important;
}

body.dark-terminal .content-title-invert {
  background: var(--accent-color) !important;
  color: #000 !important;
} 

/* === Media Overlay System === */

/* Case Study Action Buttons */
.case-study-actions {
  margin-top: 1em;
  text-align: center;
}

.view-media-btn {
  display: inline-block;
  font-family: var(--font-mono) !important;
  font-size: 1em;
  color: var(--text-color);
  background: var(--bg-color);
  border: 1px dashed var(--border-color);
  border-radius: 3px;
  padding: 0.5em 1.5em;
  margin: 1.5em auto 0 auto;
  box-shadow: 2px 2px 0 0 rgba(0,59,79,0.15);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  text-align: center;
}

.view-media-btn:hover {
  background: var(--border-color);
  color: var(--bg-color);
  box-shadow: 4px 4px 0 0 rgba(0,59,79,0.18);
}

.view-media-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 0 var(--shadow);
}

/* Media Overlay Container */
.media-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
}

.media-display {
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  background: #000;
  scroll-behavior: smooth;
}

/* Media Elements */
.current-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  transition: filter 0.8s ease;
}

.ascii-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  z-index: 5;
}

/* Media Controls */
.media-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
}

.media-close-btn:hover {
  background: var(--accent-color);
  color: #000;
}

.media-nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
  pointer-events: none;
  transform: translateY(-50%);
}

.media-nav button {
  background: rgba(0, 0, 0, 0.8);
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 20px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.3s ease;
}

.media-nav button:hover {
  background: var(--accent-color);
  color: #000;
}

.media-nav button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.media-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: var(--accent-color);
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--accent-color);
}

/* Responsive Media Overlay */
@media (max-width: 768px) {
  .media-close-btn {
    top: 10px;
    right: 10px;
    padding: 6px 10px;
    font-size: 16px;
  }
  
  .media-nav {
    padding: 0 10px;
  }
  
  .media-nav button {
    padding: 10px 14px;
    font-size: 18px;
  }
  
  .media-counter {
    bottom: 10px;
    padding: 6px 12px;
    font-size: 11px;
  }
  
  .view-media-btn {
    padding: 10px 20px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .media-close-btn {
    top: 5px;
    right: 5px;
    padding: 4px 8px;
    font-size: 12px;
  }
  
  .media-nav {
    padding: 0 5px;
  }
  
  .media-nav button {
    padding: 8px 12px;
    font-size: 16px;
  }
  
  .media-counter {
    bottom: 5px;
    padding: 4px 8px;
    font-size: 10px;
  }
  
  .view-media-btn {
    padding: 8px 16px;
    font-size: 12px;
  }
}

/* Dark Theme Support for Media Overlay */
body.dark-theme .view-media-btn {
  background: var(--bg-color);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

body.dark-theme .view-media-btn:hover {
  background: var(--accent-color);
  color: var(--bg-color);
}

body.dark-theme .media-close-btn,
body.dark-theme .media-nav button,
body.dark-theme .media-counter {
  color: var(--accent-color);
  border-color: var(--accent-color);
}

body.dark-theme .media-close-btn:hover,
body.dark-theme .media-nav button:hover {
  background: var(--accent-color);
  color: var(--bg-color);
}

/* Ensure media overlay works with existing menu system */
.media-overlay {
  /* Lower z-index than menu to keep menu visible */
  z-index: 1500;
}

/* Smooth transitions for media reveal */
.current-media {
  transition: filter 0.8s ease, opacity 0.3s ease;
}

/* Accessibility improvements */
.view-media-btn:focus,
.media-close-btn:focus,
.media-nav button:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Loading states */
.media-display.loading .current-media {
  opacity: 0.5;
}

.media-display.loading::after {
  content: 'Loading...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--accent-color);
  font-family: var(--font-mono);
  font-size: 14px;
  z-index: 20;
}




/* AR Modal Styles */
.ar-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.ar-modal {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    font-family: var(--font-mono);
}

.ar-modal h2 {
    color: var(--text-color);
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 700;
}

.ar-modal p {
    color: var(--text-color);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
}

.ar-modal-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.ar-modal-btn {
    padding: 12px 24px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    text-decoration: none;
    display: inline-block;
}

.ar-modal-btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
    border-color: var(--accent-color);
}

.ar-modal-btn.primary {
    background: var(--accent-color);
    color: var(--bg-color);
    border-color: var(--accent-color);
}

.ar-modal-btn.primary:hover {
    background: var(--bg-color);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* Responsive AR Modal */
@media (max-width: 768px) {
    .ar-modal {
        padding: 30px 20px;
    }
    
    .ar-modal h2 {
        font-size: 20px;
    }
    
    .ar-modal p {
        font-size: 14px;
    }
    
    .ar-modal-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .ar-modal-btn {
        width: 100%;
        max-width: 200px;
    }
}

/* === Modal System Styles === */

/* GPT/Chat Overlay Modal */
.gpt-overlay-menu {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1400; /* Above unix-menu (1300) to ensure it's always on top */
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    box-shadow: 4px 0 0 0 rgba(0, 59, 79, 0.3), 0 4px 0 0 rgba(0, 59, 79, 0.3);
    font-family: var(--font-mono);
    color: var(--text-color);
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    display: none; /* Hidden by default */
}

.gpt-overlay-menu.active {
    display: flex; /* Show when activated */
}

/* GPT overlay content area */
.gpt-overlay-menu .content-ascii-box {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    flex: 1;
    overflow: auto;
    max-height: 60vh;
}

/* GPT footer with horizontal separator line */
.gpt-menu-footer {
    padding: 1rem 1.5rem;
    border-top: 1px dashed var(--border-color);
    background: transparent;
    display: flex;
    justify-content: flex-end;
}

/* Unix-style Menu Modal */
.unix-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 340px;
    max-width: 90vw;
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    z-index: 1300; /* Below GPT modal but above content */
    display: none; /* Hidden by default */
    font-family: var(--font-mono);
    color: var(--text-color);
    box-shadow: 4px 0 0 0 rgba(0, 59, 79, 0.3), 0 4px 0 0 rgba(0, 59, 79, 0.3);
}

.unix-menu.active {
    display: block; /* Show when activated */
}

.menu-header {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px dashed var(--border-color);
    border-top: none;
    font-size: inherit;
    line-height: 1.4;
    font-weight: normal;
    color: var(--text-color);
    font-family: var(--font-mono);
}

.menu-content {
    padding: 1rem;
}

.menu-item {
    padding: 0.5rem 0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-mono);
    font-size: inherit;
    line-height: 1.4;
}

.menu-item:hover {
    background-color: rgba(0, 169, 157, 0.1);
    color: var(--accent-color);
}

.menu-footer {
    padding: 1rem;
    border-top: 1px dashed var(--border-color);
    text-align: center;
}

.menu-help, .menu-exit, .menu-close {
    cursor: pointer;
    transition: color 0.2s ease;
    font-family: var(--font-mono);
    font-size: inherit;
    line-height: 1.4;
}

.menu-help:hover, .menu-exit:hover, .menu-close:hover {
    color: var(--accent-color);
}

/* Loading Popup */
.gpt-loading-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    max-width: 90vw;
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    z-index: 1300;
    padding: 2rem 1.5rem;
    text-align: center;
    font-family: var(--font-mono);
    color: var(--text-color);
    box-shadow: 4px 0 0 0 rgba(0, 59, 79, 0.3), 0 4px 0 0 rgba(0, 59, 79, 0.3);
}

/* ASCII Button Styling */
.ascii-button, .gpt-menu-close, .menu-close {
    display: inline-block;
    font-family: var(--font-mono) !important;
    font-size: 1em;
    color: var(--text-color);
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.ascii-button:hover, .gpt-menu-close:hover, .menu-close:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}

/* Responsive Modal Adjustments */
@media (max-width: 768px) {
    .unix-menu {
        width: 95vw;
        max-width: 95vw;
    }
    
    .gpt-overlay-menu {
        max-width: 95vw;
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    .unix-menu {
        width: 98vw;
        max-width: 98vw;
    }
    
    .menu-header, .menu-item, .menu-help, .menu-exit, .menu-close {
        font-size: inherit;
        line-height: 1.4;
    }
    
    .gpt-overlay-menu {
        max-width: 98vw;
        max-height: 90vh;
    }
    
    .gpt-loading-popup {
        width: 95vw;
    }
}
