/* Mobile-Specific Styles - Loaded only on mobile for performance */
/* This file contains optimized styles specifically for mobile devices */

/* ============================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Reduce animations on mobile for performance */
@media (max-width: 768px) {
    *, *::before, *::after {
        animation-duration: 0.3s !important;
        transition-duration: 0.2s !important;
    }
    
    /* Disable parallax on mobile */
    .hero-content {
        transform: none !important;
    }
    
    /* Disable backdrop-filter on low-end devices */
    @supports not (backdrop-filter: blur(10px)) {
        header.scrolled {
            background: rgba(15, 15, 26, 0.98);
        }
        .hero-content {
            background: rgba(0, 0, 0, 0.85);
        }
    }
}

/* ============================================
   MOBILE HEADER & NAVIGATION
   ============================================ */

@media (max-width: 768px) {
    header {
        padding: 12px 16px;
        background: rgba(15, 15, 26, 0.98) !important;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    
    header.scrolled {
        background: rgba(15, 15, 26, 0.99) !important;
    }
    
    .logo {
        gap: 8px;
    }
    
    .logo-icon {
        width: 36px;
        height: 36px;
    }
    
    .logo-text {
        font-size: 14px;
        letter-spacing: 1px;
    }
    
    .header-center {
        display: none;
    }
    
    .header-right {
        gap: 10px;
    }
    
    /* Mobile Menu Button */
    .mobile-menu-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 40px;
        height: 40px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 8px;
        gap: 5px;
        z-index: 1002;
    }
    
    .mobile-menu-btn span {
        display: block;
        width: 22px;
        height: 2px;
        background: var(--text-white);
        border-radius: 2px;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
    
    /* Mobile Navigation Overlay */
    .mobile-nav {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: var(--primary-darker);
        z-index: 1001;
        display: none !important;
        flex-direction: column;
        padding: 80px 24px 40px;
        overflow-y: auto;
    }
    
    .mobile-nav.active {
        display: flex !important;
    }
    
    .mobile-nav-links {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 32px;
    }
    
    .mobile-nav-links a {
        display: flex;
        flex-direction: column;
        padding: 16px 20px;
        text-decoration: none;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.05);
        transition: all 0.2s ease;
    }
    
    .mobile-nav-links a:active {
        background: rgba(0, 212, 255, 0.1);
        border-color: rgba(0, 212, 255, 0.3);
    }
    
    .mobile-nav-links a .en {
        font-family: 'Montserrat', sans-serif;
        font-size: 12px;
        font-weight: 600;
        color: var(--accent-cyan);
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-bottom: 4px;
    }
    
    .mobile-nav-links a .label {
        font-size: 16px;
        color: var(--text-white);
        font-weight: 500;
    }
    
    /* Mobile Search */
    .mobile-search {
        margin-bottom: 32px;
    }
    
    .mobile-search-btn {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px 20px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 12px;
        color: rgba(255, 255, 255, 0.6);
        font-size: 15px;
        font-family: 'Montserrat', sans-serif;
        cursor: pointer;
    }
    
    .mobile-search-btn svg {
        width: 20px;
        height: 20px;
        stroke: currentColor;
        fill: none;
        stroke-width: 2;
        flex-shrink: 0;
    }
    
    .mobile-search-btn svg circle,
    .mobile-search-btn svg path {
        stroke: currentColor;
        fill: none;
    }
    
    /* Mobile Social Links */
    .mobile-social {
        margin-top: auto;
        padding-top: 24px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-social-title {
        font-size: 12px;
        color: var(--text-gray);
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-bottom: 16px;
        font-family: 'Montserrat', sans-serif;
    }
    
    .mobile-social-links {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 12px;
    }
    
    .mobile-social-links a {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center;
        gap: 6px;
        padding: 12px 8px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 10px;
        text-decoration: none;
        color: var(--text-gray);
        font-size: 11px;
        transition: all 0.2s ease;
        min-height: 70px;
    }
    
    .mobile-social-links a span:first-child {
        font-size: 20px;
    }
    
    .mobile-social-links a span:last-child {
        font-size: 10px;
        text-align: center;
    }
    
    .mobile-social-links a:active {
        background: rgba(0, 212, 255, 0.1);
        color: var(--accent-cyan);
        border-color: rgba(0, 212, 255, 0.3);
    }
}

/* Hide mobile elements on desktop */
@media (min-width: 769px) {
    .mobile-menu-btn,
    .mobile-nav {
        display: none !important;
    }
}

/* CRITICAL: Ensure mobile nav is always hidden until activated */
.mobile-nav {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1001 !important;
}

.mobile-nav.active {
    display: flex !important;
}

/* ============================================
   MOBILE HERO SECTION
   ============================================ */

@media (max-width: 768px) {
    .hero {
        min-height: 85vh;
        min-height: calc(var(--vh, 1vh) * 85); /* iOS fix */
        padding: 60px 16px;
    }
    
    /* Use gradient fallback on mobile to avoid loading 4MB banner */
    .hero-bg {
        background: linear-gradient(135deg, 
            #1a1a2e 0%, 
            #2a3a5a 25%, 
            #1a2540 50%, 
            #0f0f1a 100%) !important;
        background-size: cover;
        background-position: center;
    }
    
    /* If mobile banner exists, use it instead */
    .hero-bg.has-mobile-banner {
        background: url('../banner-mobile.webp') no-repeat center center !important;
        background-size: cover !important;
    }
    
    /* Stronger overlay for readability */
    .hero-bg::after {
        background: linear-gradient(180deg, 
            rgba(15, 15, 26, 0.5) 0%, 
            rgba(15, 15, 26, 0.7) 50%,
            rgba(15, 15, 26, 0.98) 100%);
    }
    
    .hero-content {
        padding: 24px 20px;
        border-radius: 12px;
        max-width: 100%;
    }
    
    .hero-subtitle {
        font-size: 18px;
        letter-spacing: 2px;
        margin-bottom: 16px;
    }
    
    .hero-quote {
        font-size: 14px;
        line-height: 1.8;
    }
    
    .scroll-indicator {
        bottom: 24px;
        font-size: 10px;
    }
    
    .scroll-indicator::after {
        height: 30px;
    }
}

/* ============================================
   MOBILE ABOUT SECTION
   ============================================ */

@media (max-width: 768px) {
    .about-section {
        padding: 60px 16px;
    }
    
    .about-container {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .about-visual {
        height: auto;
        order: -1;
    }
    
    .about-image-wrapper {
        width: 200px;
        height: 220px;
        margin: 0 auto;
    }
    
    .about-content {
        padding: 0;
        text-align: center;
    }
    
    .section-header {
        margin-bottom: 24px;
    }
    
    .section-label {
        font-size: 12px;
        letter-spacing: 2px;
    }
    
    .section-title-sub {
        font-size: 12px;
    }
    
    .about-highlight {
        font-size: 16px;
        margin-bottom: 20px;
        line-height: 1.8;
    }
    
    .about-main-title {
        font-size: 24px;
        margin-bottom: 24px;
        line-height: 1.5;
    }
    
    .about-text {
        font-size: 14px;
        line-height: 1.9;
        margin-bottom: 24px;
    }
    
    .section-link {
        font-size: 13px;
        justify-content: center;
    }
}

/* ============================================
   MOBILE GAMES SECTION
   ============================================ */

@media (max-width: 768px) {
    .games-section {
        padding: 60px 16px;
    }
    
    .games-container {
        max-width: 100%;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-top: 32px;
    }
    
    .game-card {
        border-radius: 12px;
    }
    
    /* Optimize touch targets */
    .game-card:active {
        transform: scale(0.98);
        background: rgba(255, 255, 255, 0.06);
    }
    
    /* Disable hover effects on touch */
    .game-card:hover {
        transform: none;
    }
    
    .game-image {
        aspect-ratio: 16/9;
    }
    
    .game-info {
        padding: 16px;
    }
    
    .game-name {
        font-size: 16px;
        margin-bottom: 4px;
    }
    
    .game-desc {
        font-size: 12px;
        line-height: 1.5;
    }
}

/* ============================================
   MOBILE FOOTER
   ============================================ */

@media (max-width: 768px) {
    footer {
        padding: 48px 16px 32px;
    }
    
    .footer-container {
        flex-direction: column;
        align-items: center;
        gap: 24px;
    }
    
    .footer-logo {
        justify-content: center;
    }
    
    .footer-bottom {
        margin-top: 32px;
        padding-top: 24px;
        gap: 16px;
    }
    
    .footer-legal {
        gap: 16px;
        justify-content: center;
    }
    
    .footer-legal a {
        font-size: 12px;
    }
    
    .footer-social-wrapper {
        width: 100%;
        position: relative;
    }
    
    .footer-social-btn {
        width: 100%;
        padding: 14px 24px;
        font-size: 14px;
    }
    
    .footer-social-popup {
        position: absolute;
        width: 100%;
        left: 0;
        right: 0;
        transform: translateY(10px);
        bottom: 100%;
        margin-bottom: 10px;
        background: var(--primary-darker);
        border: 1px solid rgba(0, 212, 255, 0.3);
        border-radius: 12px;
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .footer-social-popup a {
        display: flex !important;
        align-items: center;
        padding: 12px 16px;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 8px;
        text-decoration: none;
        color: var(--text-light);
        font-size: 14px;
    }
    
    .footer-social-popup a:active {
        background: rgba(0, 212, 255, 0.1);
    }
    
    .footer-social-popup .social-label {
        font-family: 'Montserrat', sans-serif;
        font-weight: 500;
    }
    
    .footer-social-wrapper:hover .footer-social-popup {
        transform: translateY(0);
    }
    
    .footer-copyright {
        font-size: 11px;
    }
}

/* ============================================
   MOBILE IMAGES - LAZY LOADING SUPPORT
   ============================================ */

@media (max-width: 768px) {
    /* Placeholder for lazy-loaded images */
    img[data-src] {
        background: linear-gradient(135deg, #2a3a5a 0%, #1a2540 100%);
        min-height: 100px;
    }
    
    img.lazy-loaded {
        animation: fadeIn 0.3s ease;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    /* Optimize image rendering */
    img {
        content-visibility: auto;
    }
}

/* ============================================
   MOBILE COOKIE CONSENT
   ============================================ */

@media (max-width: 768px) {
    .cookie-consent {
        padding: 16px;
    }
    
    .cookie-consent-container {
        flex-direction: column;
        gap: 16px;
    }
    
    .cookie-consent-text h4 {
        font-size: 14px;
    }
    
    .cookie-consent-text p {
        font-size: 12px;
    }
    
    .cookie-consent-buttons {
        width: 100%;
        display: flex;
        gap: 12px;
    }
    
    .cookie-btn {
        flex: 1;
        padding: 12px 16px;
        font-size: 13px;
    }
}

/* ============================================
   MOBILE SEARCH MODAL
   ============================================ */

@media (max-width: 768px) {
    .search-modal {
        padding-top: 0;
        align-items: flex-start;
    }
    
    .search-modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        min-height: 100vh;
    }
    
    #search-input {
        padding: 20px 16px;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .search-results {
        max-height: calc(100vh - 80px);
    }
    
    .search-result-item {
        padding: 16px;
    }
    
    .search-result-title {
        font-size: 15px;
    }
}

/* ============================================
   MOBILE BACK TO TOP
   ============================================ */

@media (max-width: 768px) {
    .back-to-top {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

/* ============================================
   MOBILE THEME TOGGLE
   ============================================ */

@media (max-width: 768px) {
    .theme-toggle {
        padding: 8px 10px;
        font-size: 16px;
    }
}

/* ============================================
   MOBILE CAROUSEL
   ============================================ */

@media (max-width: 768px) {
    .carousel-wrapper {
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    .carousel-track {
        gap: 12px;
        padding: 16px 0;
        /* Disable auto-scroll on mobile for better UX */
        animation: none;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    
    .carousel-card {
        width: 260px;
        min-width: 260px;
        scroll-snap-align: start;
    }
    
    .carousel-info {
        padding: 12px;
    }
    
    .carousel-title {
        font-size: 13px;
    }
    
    .carousel-date {
        font-size: 11px;
    }
}

/* ============================================
   MOBILE LIGHT THEME ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    body.light-theme header {
        background: rgba(255, 255, 255, 0.95);
    }
    
    body.light-theme .mobile-nav {
        background: #f5f5f8;
    }
    
    body.light-theme .mobile-nav-links a {
        background: #fff;
        border-color: rgba(0, 0, 0, 0.1);
    }
    
    body.light-theme .mobile-nav-links a .label {
        color: #1a1a1a;
    }
    
    body.light-theme .mobile-search-btn {
        background: #fff;
        border-color: rgba(0, 0, 0, 0.15);
        color: #666;
    }
    
    body.light-theme .mobile-menu-btn span {
        background: #1a1a1a;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .game-card:hover,
    .video-card:hover,
    .carousel-card:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.03);
    }
    
    /* Increase touch targets */
    a, button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Active states for touch feedback */
    .game-card:active,
    .video-card:active,
    .carousel-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* ============================================
   REDUCED MOTION PREFERENCES
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .carousel-track {
        animation: none;
    }
    
    .scroll-indicator {
        animation: none;
    }
}
