/*
 * MOBILE LAYOUT (≤576px) - KEY ARCHITECTURE NOTES
 * 
 * Grid Issue: .content-grid uses display:grid with 2 columns on desktop.
 *   → MUST override to display:block on mobile to prevent empty right column.
 * 
 * Yellow Box Structure: .content-container.in-view (yellow bg) wraps .featured-content (white box).
 *   → Spacing controlled by .content-container.in-view margins/padding.
 *   → Keep .featured-content padding minimal to avoid double-padding.
 * 
 * READY Text: Desktop uses complex transforms/pseudo-elements. Mobile version at line ~443
 *   uses 'all: unset' to strip desktop styles, then rebuilds from scratch (25vw font, nowrap).
 * 
 * White Space: .featured-title.enhanced-title padding directly affects bottom whitespace in yellow box.
 *   Reduce this padding (currently 4px) to tighten layout.
 */

@media (max-width: 576px) {
    :root {
        --font-size-xs: 10px;
        --font-size-sm: 12px;
        --font-size-md: 15px;
        --font-size-lg: 18px;
        --font-size-xl: 24px;
        --font-size-xxl: 32px;
        --letter-spacing-tight: -0.03em;
        --letter-spacing-normal: 0;
        --letter-spacing-wide: 0.05em;
    }


    /* Apply consistent full width to profile and terminal sections on mobile */
        .profile-section {
            width: 100%;
            max-width: 100%;
            margin-left: 0 !important; /* Ensure no negative margin */
            margin-right: 0;
            /*padding-left: var(--spacing-md); /* Apply standard mobile padding */
            /*padding-right: var(--spacing-md); /* Apply standard mobile padding */
            box-sizing: border-box;
            overflow-x: hidden;
        }
        .terminal-container { /* Target terminal specifically */
            width: 100%;
            max-width: 100%;
            margin-left: 0; /* Reset margins */
            margin-right: 0;
            box-sizing: border-box;
            overflow-x: hidden;
        }
    .terminal-container { /* Ensure terminal takes full width of its column */
        width: 100%;
    }

    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
        position: relative;
        font-size: var(--font-size-md);
        line-height: 1.6; /* Improved readability */
        font-weight: 400; /* Match desktop */
        -webkit-text-size-adjust: 100%;
    }

}

@media (max-width: 576px) {}

@media (max-width: 576px) {
    .highlight {
        color: #FF472E;
        /* Original brand color */
        text-shadow: none;
        font-weight: 700;
        position: relative;
        padding: 0 1px;
        display: inline-block;
        transition: all var(--transition-fast);
        font-size: 1.05em;
        text-transform: lowercase;
        letter-spacing: -0.01em;
    }

    .highlight:after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 2px;
        background-color: rgba(255, 71, 46, 0.4);
        transform: scaleX(0.9);
        transition: transform var(--transition-fast), background-color var(--transition-fast);
    }
    
    .highlight:hover:after {
        transform: scaleX(1.05);
        background-color: rgba(255, 71, 46, 0.6);
    }
}

@media (max-width: 576px) {
    .journalism-section {
        padding: var(--spacing-md) 0; /* Balanced padding */
        margin-top: 0;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /*.blended-message {
        padding: 0 var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }*/ 
}

@media (max-width: 576px) {
    .label, .journalism-label {
        font-size: 0.75rem;
        letter-spacing: 0.25em;
        margin-bottom: var(--spacing-sm);
        font-weight: 900;
        color: var(--orange-red);
        padding-bottom: 5px;
        border-bottom: 1px solid var(--orange-red);
        display: inline-block;
    }
    .journalism-title {
        font-size: 2.2rem;
        line-height: 1.1;
        letter-spacing: -0.06em;
        max-width: 100%;
        color: var(--orange-red);
        transform: translateX(-2%);
        padding-left: 2%;
    }
    
    .title-container {
        margin-bottom: 0; /* Remove margin - controlled by featured-content */
        padding: 0; /* Remove padding */
    }
}

@media (max-width: 576px) {
    /* CRITICAL: Force single column layout on mobile to prevent empty grid columns */
    .content-grid,
    .profile-grid {
        display: block !important; /* Override grid completely */
        grid-template-columns: none;
        gap: 0;
        width: 100%;
    }
    
    .dotted-square {
        display: none; /* Hide on mobile - becomes orphaned in vertical layout */
    }
    
    /* Eliminate right side empty space */
    .text-column {
        width: 100%;
        padding-right: 0; /* Remove right padding on mobile */
        padding-left: 0; /* Remove left padding on mobile */
        margin: 0;
        max-width: none;
    }
    
    .profile-section {
        padding: 0; /* Remove padding to control spacing better */
        margin-top: 0; /* Remove top margin */
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .white-section {
        width: 100%;
        max-width: 100vw;
        padding: 32px 0 0 0;
        margin: 0;
        background-color: var(--off-white) !important; /* Override yellow background */
    }
    
    .featured-content {
        width: 100%;
        max-width: none;
        padding: var(--spacing-xs);
        margin: 0;
        margin-bottom: 0;
        background-color: var(--off-white) !important;
        box-sizing: border-box;
        overflow: hidden; /* Prevent any overflow creating extra space */
    }

    .meta {
        margin-top: var(--spacing-md);
        margin-bottom: var(--spacing-md);
        position: relative;
        z-index: 2;
        width: 100%;
        letter-spacing: 0.02em;
        font-feature-settings: 'kern' 1;
    }

    .category {
        font-weight: 900;
        letter-spacing: 0.2em;
        text-transform: uppercase;
        font-size: 0.75rem;
        position: relative;
        display: inline-block;
    }

    .date {
        opacity: 0.8;
        font-size: 0.75rem;
        letter-spacing: 0.05em;
        font-weight: 300;
        font-style: italic;
        margin-left: var(--spacing-sm);
    }

    /*.profile-heading {
        font-size: 9.5vw;
        line-height: 1.05;
        margin-bottom: var(--spacing-md);
        letter-spacing: -0.06em;
        font-weight: 900;
        max-width: 100%;
        word-break: normal;
        white-space: normal;
        overflow-wrap: break-word;
        transform: translateX(-2%);
        padding-right: 5%;
        hyphens: auto;
        color: var(--text-black);
        margin-top: 0;
        padding-top: 0;
    }*/

    .profile-bio {
        font-size: 1.2rem;
        line-height: 1.5;
        margin-bottom: var(--spacing-xl);
        color: rgba(30, 30, 30, 0.85);
        letter-spacing: 0.01em;
        padding-right: 0;
        max-width: 100%;
        font-weight: 300;
        padding-left: 5%;
        margin-top: var(--spacing-md);
        font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Style for the DCVC link in the bio */
    .profile-bio a {
        color: #FF472E;
        font-weight: 700;
        text-decoration: none;
        position: relative;
        display: inline-block;
        padding: 0 2px;
        transition: all 0.3s ease;
    }
    
    .profile-bio a:after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 0;
        background-color: rgba(255, 71, 46, 0.1);
        z-index: -1;
        transition: height 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .profile-bio a:hover, .profile-bio a:focus {
        color: #FF472E;
    }
    
    .profile-bio a:hover:after, .profile-bio a:focus:after {
        height: 100%;
    }

    /* Profile section container styling */
    .profile-container {
        padding: var(--spacing-md) 0;
        position: relative;
        background-color: rgba(255, 255, 255, 0.8);
        border-radius: 2px;
        overflow: hidden;
        margin-top: var(--spacing-sm);
    }

    /* Add subtle decoration to profile section */
    .profile-container:before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 5px;
        height: 60px;
        background-color: #FF472E;
        opacity: 0.9;
    }
    
    /* Add visual separation between heading and content */
    .profile-heading:after {
        content: '';
        display: block;
        width: 30px;
        height: 2px;
        background-color: rgba(255, 71, 46, 0.4);
        margin-top: var(--spacing-xs);
    }

    /* Footer improvements for mobile */
    .social-links {
        /*margin-top: var(--spacing-sm);*/
        margin-left: 0;
        justify-content: flex-start;
    }

    .footer-left,
    .footer-right {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .footer-links {
        display: flex;
        flex-wrap: wrap;
        /*margin-top: var(--spacing-sm);*/
        justify-content: flex-start;
    }

    .footer-link {
        /*margin: 0 var(--spacing-sm) var(--spacing-xs) 0;*/
        padding: var(--spacing-xs) 0;
        font-weight: 500;
        letter-spacing: 0.01em;
        font-size: 0.9rem;
    }

    .footer-content {
        padding: var(--spacing-xs) 0 0 0; /* Reduced from 24px to 16px */
    }
    
    .footer-logo {
        font-size: 1.6rem;
        font-weight: 900;
        letter-spacing: -0.02em;
        margin-bottom: 0; /* Remove bottom margin */
        /*margin-top: var(--spacing-xs);*/ /* Small top margin for spacing from READY */
    }

    /* Hide cursor on touch devices */
    @media (hover: none) {
        .cursor-container {
            display: none;
        }

        body {
            cursor: auto;
        }

        a,
        button {
            cursor: pointer;
        }
    }
    /* Mobile Typography & Spacing Refinements */
    .featured-title.enhanced-title {
        line-height: 1.2;
        letter-spacing: -0.02em;
        padding: 4px;
        margin: 0; /* Reset all margins */
        width: 100%;
        box-sizing: border-box;
        display: block; /* Ensure block display */
    }

    .profile-heading.enhanced-profile-heading {
        font-size: 1.35rem;
        line-height: 1.45; /* Slightly more breathing room between lines */
        /*margin-top: var(--spacing-sm);*/
        margin-bottom: var(--spacing-md); /* More space before black box */
        padding: 0 var(--spacing-xs);
        font-weight: 700;
        letter-spacing: 0.01em;
        max-width: 100%; /* Ensure full width utilization */
    }

    .text-highlight {
        padding: 0.1em 0.3em; /* Increase horizontal padding slightly */
        /* Apply a background similar to the screenshot */
        background-color: rgba(40, 10, 5, 0.8); /* Dark red background for contrast */
        color: var(--off-white); /* Lighter text on dark background */
        border-radius: 3px; /* Slightly rounded corners */
        display: inline; /* Ensure it doesn't break flow */
        box-decoration-break: clone; /* Apply styles across line breaks */
        -webkit-box-decoration-break: clone; /* Apply styles across line breaks */
        text-shadow: none; /* Remove any inherited text shadow */
    }

    /* Specific override for highlights outside the dark section - make more dramatic */
    .blended-message .text-highlight {
         background-color: rgba(255, 71, 46, 0.1); /* Subtle orange background */
         color: var(--orange-red); /* Original highlight color */
         padding: 0.1em 0.3em; /* Add padding */
         border-radius: 3px; /* Match other highlights */
         font-weight: 700; /* Make highlight bolder */
         box-decoration-break: clone; /* Apply styles across line breaks */
        -webkit-box-decoration-break: clone;
    }
    /* Remove the underline style */
    .blended-message .text-highlight:after {
        content: none; /* Remove the underline */
    }
     .blended-message .text-highlight:hover:after {
       content: none; /* Ensure no underline on hover */
    }


    .bio-story p {
        margin-bottom: var(--spacing-sm, 16px); /* Reduce space after paragraphs */
        line-height: 1.7; /* Improved readability */
    }

    :root {
        --spacing-xs: 8px;    /* 1 unit - maintain baseline */
        --spacing-sm: 16px;   /* 2 units */
        --spacing-md: 24px;   /* 3 units */
        --spacing-lg: 32px;   /* 4 units - reduced for mobile */
        --spacing-xl: 48px;   /* 6 units - reduced for mobile */
        --spacing-xxl: 56px;  /* 7 units - reduced for mobile */
    }

    .top-section {
        height: auto;
        min-height: 80px;
        padding: var(--spacing-sm) 0 0 0; /* Minimal top padding */
        display: flex;
        align-items: flex-end;
        overflow: visible; /* Allow text to extend beyond */
        position: relative;
    }
    
    /* Oversized dramatic READY text like desktop */
    .top-section .large-text {
        all: unset;
        display: block;
        font-family: Inter, sans-serif;
        font-size: 25vw; /* Extremely large like desktop (desktop uses 45vw) */
        font-weight: 900;
        color: rgba(0, 0, 0, 0.9);
        line-height: 0.75;
        letter-spacing: -0.03em;
        margin: 0;
        margin-bottom: -8vw; /* Negative margin to overlap yellow box */
        padding: 0;
        position: relative;
        z-index: 5;
        text-align: left;
        white-space: nowrap;
        -webkit-text-stroke: 1px rgba(0, 0, 0, 0.3);
        text-shadow: 0.03em 0.03em 0 rgba(0, 0, 0, 0.2);
        transform-origin: left center;
    }
    
    /* Remove pseudo-elements on mobile */
    .top-section .large-text::before,
    .top-section .large-text::after {
        display: none;
    }
    
    .bottom-section {
        /*height: auto;*/
        height: 8vh;
        min-height: auto;
        /*padding: var(--spacing-xxl) 0 0 0;*/ /* 56px top, 0 bottom - push READY text down */
        /*padding: 24px 0 0px 0;*/
        display: flex;
        flex-direction: column;
        /*justify-content: flex-start;*/
    }

    .blended-message {
        font-size: 1.05rem;
        line-height: 1.65;
        padding: var(--spacing-xs);
        /*margin-bottom: var(--spacing-lg);*/ /* Space before bottom section */
        font-weight: 400;
        text-shadow: none;
        letter-spacing: 0.005em;
    }

    .enhanced-title .highlight {
        font-size: 7.5vw; /* Reduce font size on mobile to prevent awkward breaks */
        /* Apply exciting styles by default */
        color: var(--orange-red); /* Ensure base color */
        -webkit-text-stroke: 0.5px var(--text-black); /* Thinner stroke for mobile */
        text-shadow: 2px 2px 0 var(--text-black); /* Simpler shadow for mobile */
        display: inline-block; /* Needed for stroke/shadow */
        transform: rotate(-1deg); /* Subtle rotation */
        margin: 0; /* Reset desktop margin */
    }

    /* Apply exciting styles to hero by default on mobile */
    .enhanced-title {
        transform: skewX(-6deg); /* Apply base skew */
        padding-left: 2%; /* Adjust padding slightly for mobile */
    }

    .enhanced-title .line1,
    .enhanced-title .line3 {
        text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1); /* Subtle shadow for mobile */
    }

    /* Reduce black box size on mobile */
    .profile-section .profile-text-column .bio-container {
        padding: var(--spacing-sm);
        margin-top: 0;
        margin-bottom: var(--spacing-lg); /* More space after black box */
    }

    .bio-story {
        margin-bottom: var(--spacing-lg); /* Using baseline grid */
    }
    
    .bio-story:last-child {
        margin-bottom: 0; /* No margin after last story */
    }

    /* Terminal adjustments for mobile */
    .terminal-container {
        padding: var(--spacing-md);
        font-size: var(--font-size-sm);
        min-height: 280px;
        transition: box-shadow var(--transition-fast), transform var(--transition-fast);
        cursor: pointer;
        margin-top: 0;
        /*margin-bottom: var(--spacing-md);*/ /* Space before next section */
    }

    /* Adjust active state slightly for mobile if needed */
    .terminal-container:active {
         transform: scale(0.99);
         box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .terminal-output {
        line-height: 1.5; /* Increased line height for readability */
        font-size: 14px; /* Explicit font size */
    }

    .terminal-prompt {
        padding-top: var(--spacing-xs);
        font-size: 14px; /* Match output size */
    }

    .terminal-input {
        font-size: 14px; /* Match output size */
    }

    .terminal-cursor {
        width: 8px; /* Wider cursor for visibility */
        height: 16px; /* Taller cursor */
    }

    /* Styles for interactive state on mobile */
    .terminal-container.terminal-interactive {
        outline: 2px solid rgba(255, 71, 46, 0.5); /* Stronger outline */
        outline-offset: 1px;
        box-shadow: 0 0 12px rgba(255, 71, 46, 0.25), 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .terminal-interactive .terminal-cursor.cursor-interactive {
         animation: blink-fast 0.6s step-end infinite;
         background-color: var(--orange-red);
    }

   /* Style for highlighted terms within terminal output on mobile */
    .terminal-output .term-highlight {
        color: #facc15; /* Brighter yellow for better visibility */
        font-weight: 700; /* Bolder for emphasis */
        font-size: 15px; /* Slightly larger than regular text */
        text-shadow: 0 0 1px rgba(0, 0, 0, 0.3); /* Subtle text shadow for depth */
    }
    
    /* Command styling */
    .terminal-output .command {
        color: #ffffff; /* White for commands */
        font-weight: 600;
        margin-top: 4px;
    }
    
    /* Success message styling */
    .terminal-output .success {
        color: var(--off-white); /* Default color for the text */
        font-weight: normal; /* Normal weight for the text */
        text-shadow: none;
    }
    
    /* Style only the [SUCCESS] part */
    .terminal-output .success::first-line {
        color: var(--off-white); /* Ensure consistent color */
    }
    
    .terminal-output .success::before {
        content: '[SUCCESS] ';
        color: #4ade80; /* Brighter green for success tag */
        font-weight: 600; /* Bolder for emphasis */
        text-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
    }
    
    /* Info message styling */
    .terminal-output .info {
        color: #3b82f6; /* Brighter blue for info */
        font-weight: 600;
        text-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
    }
   /* End Mobile Refinements */
}

@media (max-width: 576px) {
    /* Improved title layout for mobile */
    .enhanced-title {
        display: flex;
        flex-direction: column;
        gap: 0.2em;
        margin-bottom: var(--spacing-md); /* Ensure proportionate spacing below title */
    }
    
    .enhanced-title .line1 {
        font-size: 8vw;
    }
    
    .enhanced-title .line2 {
        margin: 0.1em 0;
    }
    
    .enhanced-title .line3 {
        font-size: 7vw;
    }
    
    /* Make Agentic Intelligence more dramatic */
    .enhanced-title .highlight {
        font-size: 8vw; /* Slightly larger */
        color: var(--orange-red);
        -webkit-text-stroke: 0.7px var(--text-black); /* Slightly thicker stroke */
        text-shadow: 2px 2px 0 var(--text-black), 4px 4px 8px rgba(255, 71, 46, 0.3); /* Enhanced shadow */
        transform: rotate(-1deg) translateY(-1px); /* Subtle shift */
        letter-spacing: -0.02em; /* Tighter letter spacing */
        font-weight: 800; /* Bolder weight */
    }
    
    /* Adjust content container spacing and add yellow background */
    .content-container.in-view {
        padding: 8px;
        background-color: #F5D547;
        border-radius: 4px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
        margin-top: -8px; /* Overlap with red section slightly */
        margin-bottom: 8px;
    }
    
    /* Ensure text remains readable on yellow background */
    .content-container.in-view .enhanced-title {
        color: #000000;
    }
    
    /* Only apply yellow background to the first content container (Bring Agentic Intelligence section) */
    .profile-section .content-container.in-view {
        background-color: transparent !important; /* Remove any background */
        box-shadow: none;
        padding: 0; /* Remove padding in profile section */
    }
}

@media (max-width: 576px) {
    .nav-brand {
        font-size: 0.9rem;
        letter-spacing: 0.03em;
        display: flex;
        flex-direction: column;
        line-height: 1.2;
        position: relative;
        z-index: 105;
    }
}

@media (max-width: 576px) {
    /* Improved title layout for mobile */
    .enhanced-title {
        display: flex;
        flex-direction: column;
        gap: 0.2em;
    }
    
    .enhanced-title .line1 {
        font-size: 8vw;
    }
    
    .enhanced-title .line2 {
        margin: 0.1em 0;
    }
    
    .enhanced-title .line3 {
        font-size: 7vw;
    }
}