/*
Theme Name: KYLOE Pixel Theme - Mobile Optimized
Mobile Responsive & Touch-Friendly Additions
Version: 1.0.1
*/

/* ============================================
   RESPONSIVE DESIGN - Enhanced Mobile First
   ============================================ */

/* Large Tablets and Small Desktops */
@media (max-width: 1024px) {
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    .section-title {
        font-size: 28px;
    }
    
    .about-content {
        gap: 40px;
    }
}

/* Tablets */
@media (max-width: 768px) {
    /* Mobile Header with Hamburger Menu */
    .site-header {
        padding: 15px 0;
    }
    
    .header-container {
        flex-direction: row;
        justify-content: space-between;
        position: relative;
    }
    
    .site-logo {
        flex: 1;
        min-width: 0;
    }
    
    .pixel-logo {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .site-title {
        font-size: 18px;
        letter-spacing: 1px;
    }
    
    /* Hamburger Menu Button */
    .hamburger-menu {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 48px;
        height: 48px;
        background: var(--bg-secondary);
        border: 3px solid var(--mario-red);
        cursor: pointer;
        z-index: 1001;
        gap: 6px;
        padding: 8px;
    }
    
    .hamburger-menu span {
        display: block;
        width: 24px;
        height: 4px;
        background: var(--mario-yellow);
        transition: all 0.3s ease;
    }
    
    .hamburger-menu.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .hamburger-menu.active span:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger-menu.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    /* Mobile Navigation */
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: var(--bg-tertiary);
        border-left: 4px solid var(--mario-red);
        padding: 80px 30px 30px;
        transition: right 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }
    
    .main-nav.active {
        right: 0;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }
    
    .main-nav li {
        border-bottom: 2px solid var(--bg-secondary);
    }
    
    .main-nav a {
        display: block;
        padding: 18px 15px;
        font-size: 14px;
        min-height: 56px;
        display: flex;
        align-items: center;
        border: none;
    }
    
    .main-nav a:hover {
        background: rgba(229, 37, 33, 0.1);
        border: none;
        color: var(--mario-yellow);
    }
    
    /* Mobile Menu Overlay */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 999;
    }
    
    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Theme Toggle - Mobile */
    .theme-toggle {
        min-width: 48px;
        min-height: 44px;
        font-size: 18px;
    }
    
    /* Hero Section - Mobile */
    .hero-section {
        min-height: auto;
        padding: 120px 20px 80px;
    }
    
    .hero-content {
        padding: 30px 20px;
    }
    
    .hero-title {
        font-size: 28px;
        margin-bottom: 15px;
    }
    
    .hero-subtitle {
        font-size: 12px;
        margin-bottom: 30px;
        line-height: 2.2;
    }
    
    /* Mobile Pixel Button - Touch Optimized */
    .pixel-button {
        padding: 18px 36px;
        font-size: 14px;
        min-height: 56px;
        min-width: 200px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Services Section - Mobile */
    .services-section {
        padding: 60px 20px;
    }
    
    .section-title {
        font-size: 22px;
        margin-bottom: 40px;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .service-card {
        padding: 30px 20px;
    }
    
    .service-icon {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
    
    .service-title {
        font-size: 16px;
    }
    
    .service-desc {
        font-size: 11px;
    }
    
    /* About Section - Mobile */
    .about-section {
        padding: 60px 20px;
    }
    
    .about-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .about-text h2 {
        font-size: 22px;
    }
    
    .about-text p {
        font-size: 11px;
    }
    
    .pixel-art-display {
        padding: 30px;
    }
    
    .pixel-character {
        font-size: 60px;
    }
    
    /* Footer - Mobile */
    .site-footer {
        padding: 40px 20px 20px;
    }
    
    .footer-logo {
        font-size: 24px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 20px;
    }
    
    .footer-links a {
        padding: 15px 0;
        display: block;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .icp-info {
        font-size: 9px;
        padding: 15px;
    }
}

/* Mobile Phones - Extra Small Screens */
@media (max-width: 480px) {
    .site-title {
        font-size: 14px;
    }
    
    .pixel-logo {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .hero-title {
        font-size: 22px;
    }
    
    .hero-subtitle {
        font-size: 10px;
    }
    
    .hero-content {
        padding: 20px 10px;
    }
    
    .pixel-button {
        width: 100%;
        max-width: 280px;
    }
    
    .section-title {
        font-size: 18px;
    }
    
    .service-card {
        padding: 25px 15px;
    }
    
    .about-text h2 {
        font-size: 18px;
    }
    
    /* Smaller pixel borders for small screens */
    :root {
        --pixel-size: 3px;
    }
    
    .pixel-border {
        border-width: 3px;
    }
    
    .pixel-box {
        border-width: 3px;
    }
}

/* ============================================
   TOUCH OPTIMIZATION
   ============================================ */

/* Minimum Touch Target Size - 44x44px */
.pixel-button,
.theme-toggle,
.hamburger-menu,
.main-nav a,
.footer-links a,
.pixel-logo {
    min-width: 44px;
    min-height: 44px;
}

/* Touch-friendly spacing */
button,
a,
[role="button"] {
    -webkit-tap-highlight-color: rgba(229, 37, 33, 0.2);
}

/* Disable text selection on interactive elements */
.pixel-button,
.hamburger-menu,
.theme-toggle {
    -webkit-user-select: none;
    user-select: none;
}

/* Active state for touch */
.pixel-button:active,
.theme-toggle:active,
.hamburger-menu:active {
    transform: scale(0.97);
    filter: brightness(0.9);
}

/* ============================================
   PERFORMANCE OPTIMIZATION - Mobile
   ============================================ */

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

/* Disable animations for mobile performance */
@media (max-width: 768px) {
    /* Disable heavy animations */
    .pixel-logo,
    .hero-section::before,
    .pixel-character,
    .animate-bounce,
    .animate-shake {
        animation: none !important;
    }
    
    /* Disable hover transforms on touch */
    .service-card:hover {
        transform: none;
    }
    
    .service-card:hover::before {
        opacity: 0;
    }
    
    /* Simplify shadows */
    .pixel-button:hover {
        box-shadow: 
            4px 4px 0 0 var(--mario-blue),
            8px 8px 0 0 var(--mario-green);
        transform: none;
    }
    
    /* Disable title bounce animation */
    .hero-title {
        animation: none;
    }
    
    /* Disable pixel pulse */
    @keyframes pixel-pulse {
        0%, 100% { transform: none; }
        50% { transform: none; }
    }
    
    /* Disable twinkling stars */
    .hero-section::before {
        animation: none;
        opacity: 0.3;
    }
    
    /* Disable scroll animations */
    .pixel-visible {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ============================================
   IMAGE OPTIMIZATION - Mobile
   ============================================ */

img {
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
}

/* Lazy loading styles */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded,
img[loading="lazy"]:not([loading]) {
    opacity: 1;
}

/* ============================================
   PIXEL STYLE PRESERVATION - Mobile
   ============================================ */

@media (max-width: 768px) {
    /* Maintain pixel aesthetic */
    .pixel-border {
        border-style: solid;
        image-rendering: pixelated;
    }
    
    .pixel-box {
        box-shadow: 
            inset -3px -3px 0 0 rgba(0,0,0,0.3),
            inset 3px 3px 0 0 rgba(255,255,255,0.1);
    }
    
    .pixel-button {
        box-shadow: 
            3px 3px 0 0 var(--mario-blue),
            6px 6px 0 0 var(--mario-green);
        border-width: 3px;
    }
    
    /* Pixel text rendering */
    .hero-title,
    .section-title,
    .service-title {
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        font-smooth: never;
        -webkit-text-size-adjust: 100%;
    }
}

/* ============================================
   FONT LOADING OPTIMIZATION - Mobile
   ============================================ */

/* Font Display Swap for faster text display */
@font-face {
    font-family: 'Press Start 2P';
    src: url('https://fonts.gstatic.com/s/pressstart2p/v15/e3t4euO8St-6X6Nq8x2qK3dmDg.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Fallback font while loading */
@media (max-width: 768px) {
    body {
        font-family: 'Courier New', monospace;
        font-size: 13px;
    }
}

/* ============================================
   UTILITY CLASSES - Mobile
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .mb-20 {
        margin-bottom: 15px;
    }
    
    .mb-40 {
        margin-bottom: 30px;
    }
    
    .mt-40 {
        margin-top: 30px;
    }
    
    /* Hide non-essential elements on mobile */
    .pixel-art-display .pixel-character {
        font-size: 48px;
    }
}

/* ============================================
   SCROLLBAR - Mobile Optimized
   ============================================ */

@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 8px;
    }
    
    ::-webkit-scrollbar-track {
        background: var(--bg-secondary);
    }
    
    ::-webkit-scrollbar-thumb {
        background: var(--mario-red);
        border-radius: 0;
    }
}

/* ============================================
   PRINT STYLES - Simplified
   ============================================ */

@media print {
    .site-header,
    .hamburger-menu,
    .theme-toggle,
    .nav-overlay {
        display: none !important;
    }
    
    .main-nav {
        position: static;
        width: auto;
        height: auto;
    }
}
