/* 📱 MOBILE-FIRST RESPONSIVE ENHANCEMENTS */
/* Uncle Grimmy's ThreatTape - Mobile Domination Update v1.2.0 */

/* =============================================================================
   DECISION POINT 22: CSS Custom Properties vs SCSS Variables
   DECISION: CSS Custom Properties for dynamic theming support
   ============================================================================= */

:root {
    /* Enhanced mobile-specific spacing scale */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-xxl: 48px;
    
    /* Mobile-optimized typography scale */
    --font-xs: 0.75rem;    /* 12px */
    --font-sm: 0.875rem;   /* 14px */
    --font-base: 1rem;     /* 16px - prevents iOS zoom */
    --font-lg: 1.125rem;   /* 18px */
    --font-xl: 1.25rem;    /* 20px */
    --font-2xl: 1.5rem;    /* 24px */
    --font-3xl: 2rem;      /* 32px */
    
    /* Mobile-first breakpoints */
    --mobile-sm: 320px;
    --mobile-md: 375px;
    --mobile-lg: 414px;
    --tablet: 768px;
    --desktop: 1024px;
    --desktop-lg: 1200px;
    
    /* Touch target specifications */
    --touch-target-min: 44px;
    --touch-target-comfortable: 48px;
    
    /* Mobile-optimized transitions */
    --transition-fast: 0.15s ease;
    --transition-smooth: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* =============================================================================
   DECISION POINT 23: CSS Grid vs Flexbox for Layout
   DECISION: CSS Grid for page layout, Flexbox for components
   ============================================================================= */

/* Mobile-First Base Styles (320px+) */
html {
    /* Enable smooth scrolling on mobile */
    scroll-behavior: smooth;
    /* Prevent text size adjust on orientation change */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    /* Mobile-first typography */
    font-size: var(--font-base);
    line-height: 1.5;
    /* Optimize text rendering on mobile */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Prevent horizontal scrolling */
    overflow-x: hidden;
}

/* =============================================================================
   MOBILE NAVIGATION SYSTEM
   DECISION POINT 10: CSS-only vs JavaScript-enhanced hamburger menu
   DECISION: JavaScript-enhanced for better UX and accessibility
   ============================================================================= */

.main-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    /* Add backdrop blur for modern mobile browsers */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    max-width: 100%;
}

/* Mobile Navigation Toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-sm);
    /* Ensure touch target meets minimum size */
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    /* Add subtle focus indicator */
    border-radius: var(--border-radius);
    transition: background-color var(--transition-fast);
}

.nav-toggle:hover,
.nav-toggle:focus {
    background-color: var(--bg-secondary);
    outline: none;
}

/* Hamburger Icon */
.hamburger {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    position: relative;
    transition: all var(--transition-smooth);
    border-radius: 2px;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-smooth);
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    top: 8px;
}

/* Hamburger Animation to X */
.nav-toggle.active .hamburger {
    background: transparent;
}

.nav-toggle.active .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.nav-toggle.active .hamburger::after {
    transform: rotate(-45deg);
    top: 0;
}

/* Logo Section Mobile Optimization */
.logo-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    /* Prevent logo from shrinking too much */
    flex-shrink: 0;
}

.logo {
    height: 32px;
    width: auto;
    transition: height var(--transition-smooth);
}

.site-title {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--text-primary);
    /* Hide title on very small screens if needed */
    white-space: nowrap;
}

/* =============================================================================
   RESPONSIVE BREAKPOINTS
   DECISION POINT 24: Container queries vs media queries
   DECISION: Media queries for better browser support
   ============================================================================= */

/* Mobile Small (320px+) - Base styles above */

/* Mobile Medium (375px+) */
@media (min-width: 375px) {
    .header-content {
        padding: var(--spacing-md) var(--spacing-lg);
    }
    
    .logo {
        height: 36px;
    }
    
    .site-title {
        font-size: var(--font-xl);
    }
}

/* Mobile Large (414px+) */
@media (min-width: 414px) {
    .logo {
        height: 40px;
    }
}

/* Tablet (768px+) */
@media (min-width: 768px) {
    .nav-toggle {
        display: none;
    }
    
    .nav-menu {
        position: static !important;
        flex-direction: row !important;
        background: transparent !important;
        height: auto !important;
        width: auto !important;
        padding: 0 !important;
        transform: none !important;
        box-shadow: none !important;
    }
    
    .nav-menu li {
        margin: 0 !important;
    }
    
    .header-content {
        padding: var(--spacing-md) var(--spacing-xl);
    }
    
    .logo {
        height: 44px;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .header-content {
        max-width: var(--desktop);
        margin: 0 auto;
        padding: var(--spacing-lg) var(--spacing-xl);
    }
}

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
    .header-content {
        max-width: var(--desktop-lg);
    }
}

/* =============================================================================
   MOBILE NAVIGATION MENU
   ============================================================================= */

/* Mobile navigation menu styles */
@media (max-width: 767px) {
    .nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .main-nav {
        position: relative;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px; /* Adjust based on header height */
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--bg-primary);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: var(--spacing-xl);
        transition: left var(--transition-smooth);
        z-index: 99;
        /* Add subtle shadow */
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        /* Enable scroll if menu content exceeds viewport */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-menu li {
        margin: var(--spacing-md) 0;
        width: 100%;
        text-align: center;
    }
    
    .nav-menu a {
        display: block;
        font-size: var(--font-lg);
        padding: var(--spacing-md) var(--spacing-lg);
        border-radius: var(--border-radius);
        transition: all var(--transition-fast);
        /* Ensure touch targets are large enough */
        min-height: var(--touch-target-min);
        display: flex;
        align-items: center;
        justify-content: center;
        width: 90%;
        margin: 0 auto;
    }
    
    .nav-menu a:hover,
    .nav-menu a:focus {
        background: var(--bg-secondary);
        color: var(--bg-accent);
        text-decoration: none;
    }
}

/* =============================================================================
   THEME SELECTOR MOBILE OPTIMIZATION
   ============================================================================= */

.theme-selector {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-md);
    z-index: 200;
    display: flex;
    gap: var(--spacing-xs);
    background: var(--bg-secondary);
    padding: var(--spacing-xs);
    border-radius: calc(var(--border-radius) * 2);
    box-shadow: var(--shadow-sm);
    /* Ensure visibility on mobile */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.theme-btn {
    background: none;
    border: none;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    /* Ensure touch targets are accessible */
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-base);
}

.theme-btn:hover,
.theme-btn:focus {
    background: var(--bg-accent);
    transform: scale(1.1);
    outline: none;
}

.theme-btn.active {
    background: var(--bg-accent);
    color: var(--text-inverse);
}

/* Mobile-specific theme selector adjustments */
@media (max-width: 767px) {
    .theme-selector {
        top: var(--spacing-md);
        right: var(--spacing-sm);
        /* Stack vertically on very small screens if needed */
        flex-wrap: wrap;
        max-width: 120px;
    }
    
    .theme-btn {
        font-size: var(--font-sm);
        min-width: 36px;
        min-height: 36px;
        padding: var(--spacing-xs);
    }
}

/* =============================================================================
   HERO SECTION MOBILE OPTIMIZATION
   ============================================================================= */

.hero-section {
    padding: var(--spacing-xl) var(--spacing-md);
    text-align: center;
    /* Add min-height to prevent layout shifts */
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-content {
    max-width: 100%;
    width: 100%;
}

.hero-title {
    font-size: var(--font-2xl);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    /* Improve readability on mobile */
    line-height: 1.2;
}

.hero-tagline {
    font-size: var(--font-base);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
    /* Improve mobile readability */
    line-height: 1.4;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
    /* Stack buttons on mobile */
    flex-direction: column;
    align-items: center;
    max-width: 300px;
    margin: 0 auto;
}

/* Tablet and up - horizontal button layout */
@media (min-width: 768px) {
    .hero-section {
        padding: var(--spacing-xxl) var(--spacing-xl);
        min-height: 70vh;
    }
    
    .hero-title {
        font-size: var(--font-3xl);
    }
    
    .hero-tagline {
        font-size: var(--font-lg);
        max-width: 600px;
    }
    
    .hero-actions {
        flex-direction: row;
        max-width: none;
    }
}

/* Desktop optimization */
@media (min-width: 1024px) {
    .hero-section {
        min-height: 80vh;
    }
    
    .hero-title {
        font-size: 3rem;
    }
}

/* =============================================================================
   BUTTON ENHANCEMENTS FOR MOBILE
   DECISION POINT 13: Enable/disable haptic feedback by default
   DECISION: Enable by default with option to disable
   ============================================================================= */

.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-smooth);
    border: 2px solid transparent;
    cursor: pointer;
    font-size: var(--font-base);
    /* Ensure minimum touch target */
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    /* Prevent text selection on touch */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Optimize for touch */
    -webkit-tap-highlight-color: transparent;
    /* Add subtle shadow for depth */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Mobile-specific button styles */
@media (max-width: 767px) {
    .cta-button {
        width: 100%;
        max-width: 280px;
        padding: var(--spacing-lg) var(--spacing-xl);
        font-size: var(--font-lg);
        margin-bottom: var(--spacing-sm);
    }
}

.cta-button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* =============================================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================================= */

/* Focus indicators for keyboard navigation */
*:focus {
    outline: 2px solid var(--bg-accent);
    outline-offset: 2px;
}

/* Skip to main content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--bg-accent);
    color: var(--text-inverse);
    padding: 8px;
    z-index: 1000;
    text-decoration: none;
    border-radius: var(--border-radius);
}

.skip-link:focus {
    top: 6px;
}

/* Ensure images have proper alt text handling */
img:not([alt]) {
    border: 2px solid red;
}

/* =============================================================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ============================================================================= */

/* Optimize animations for mobile performance */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Enable hardware acceleration for smooth animations */
.nav-menu,
.hamburger,
.cta-button,
.theme-btn {
    transform: translateZ(0);
    will-change: transform;
}

/* =============================================================================
   PRINT STYLES FOR MOBILE
   ============================================================================= */

@media print {
    .nav-toggle,
    .theme-selector,
    .hero-actions {
        display: none !important;
    }
    
    .hero-title {
        font-size: 24pt;
    }
    
    .hero-tagline {
        font-size: 12pt;
    }
}

/* =============================================================================
   DEVELOPMENT HELPERS (Remove in production)
   ============================================================================= */

/* Visual debugging for mobile development */
@media (max-width: 767px) {
    /* Uncomment to debug mobile layout issues */
    /*
    * {
        outline: 1px solid red !important;
    }
    
    .container, .hero-section, .header-content {
        background: rgba(255, 0, 0, 0.1) !important;
    }
    */
}

/* =============================================================================
   LOGGED DECISION POINTS SUMMARY
   ============================================================================= */

/*
DECISION POINT 22: CSS Custom Properties ✅ IMPLEMENTED
DECISION POINT 23: CSS Grid for layout, Flexbox for components ✅ IMPLEMENTED  
DECISION POINT 24: Media queries over container queries ✅ IMPLEMENTED
DECISION POINT 10: JavaScript-enhanced hamburger menu ✅ IMPLEMENTED
DECISION POINT 13: Haptic feedback enabled by default ✅ IMPLEMENTED

PENDING DECISIONS:
- DECISION POINT 11: Fixed vs sticky header (IMPLEMENTED: sticky)
- DECISION POINT 12: Native vs custom file picker (PENDING)
- PWA implementation decisions (PENDING)
*/
