/* Hudson Vortex - Mobile-Specific Styles */

/* Prevent horizontal scroll on mobile */
html, body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* iOS Safe Area Support */
@supports (padding-top: env(safe-area-inset-top)) {
    .portal-nav {
        padding-top: env(safe-area-inset-top);
    }
    
    .portal-footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Touch-friendly tap targets */
@media (max-width: 768px) {
    /* Increase all clickable areas to 44px minimum */
    a, button, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better spacing for touch */
    .nav-menu a {
        padding: 1rem 0;
        display: block;
    }
    
    /* Larger form elements */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }
}

/* Performance-based styles */
.perf-low {
    /* Disable complex animations */
    * {
        animation-duration: 0s !important;
        transition-duration: 0.1s !important;
    }
    
    /* Hide decorative elements */
    .electromagnetic-wave,
    .portal-background::before,
    .portal-background::after {
        display: none;
    }
    
    /* Simplify shadows */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Mobile-specific component styles */
@media (max-width: 768px) {
    /* Simplify portal hero */
    .portal-hero {
        min-height: 100vh;
        background: radial-gradient(circle at center, 
            var(--portal-primary) 0%, 
            var(--magnetic-purple) 25%, 
            var(--portal-dark) 100%);
    }
    
    /* Stack features vertically */
    .portal-features,
    .science-grid,
    .experience-cards {
        grid-template-columns: 1fr !important;
    }
    
    /* Full-width buttons */
    .btn-primary,
    .btn-secondary {
        width: 100%;
        display: block;
        text-align: center;
    }
    
    /* Responsive tables */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    /* Card adjustments */
    .feature,
    .science-card,
    .exp-card,
    .research-card {
        margin-bottom: 1rem;
    }
}

/* Touch-specific interactions */
.touch-device {
    /* Remove hover effects on touch devices */
    .btn-primary:hover,
    .btn-secondary:hover,
    .nav-menu a:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* Add active states for touch feedback */
    .btn-primary:active,
    .btn-secondary:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .portal-hero {
        min-height: auto;
        padding: 3rem 0;
    }
    
    .portal-title {
        font-size: 2rem;
    }
    
    .hero-content {
        max-height: 100vh;
        overflow-y: auto;
    }
}

/* Mobile map optimizations */
@media (max-width: 768px) {
    #map,
    .mapboxgl-map {
        height: 60vh !important;
    }
    
    /* Touch-friendly map controls */
    .mapboxgl-ctrl-group button {
        width: 44px;
        height: 44px;
    }
    
    /* Larger popup close button */
    .mapboxgl-popup-close-button {
        font-size: 24px;
        padding: 10px;
    }
}

/* Mobile-optimized frequency generator */
@media (max-width: 768px) {
    .frequency-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .frequency-slider {
        width: 100%;
    }
    
    .frequency-display {
        font-size: 2rem;
        text-align: center;
        display: block;
        margin: 1rem 0;
    }
}

/* Mobile loading states */
.mobile-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 3px solid var(--portal-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Optimized image loading */
img {
    loading: lazy;
    decoding: async;
}

/* Mobile-specific scroll behavior */
@media (max-width: 768px) {
    /* Momentum scrolling for iOS */
    .scrollable {
        -webkit-overflow-scrolling: touch;
        overflow-y: scroll;
    }
    
    /* Hide scrollbars on mobile */
    ::-webkit-scrollbar {
        display: none;
    }
    
    * {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* PWA installation prompt */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--portal-primary);
    color: var(--portal-dark);
    padding: 1rem 2rem;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 255, 204, 0.4);
    display: none;
    z-index: 1000;
    text-align: center;
    max-width: 90%;
}

.install-prompt.show {
    display: block;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: var(--mobile-nav-height);
    left: 0;
    right: 0;
    background: #ff6b6b;
    color: white;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    display: none;
    z-index: 997;
}

body.offline .offline-indicator {
    display: block;
}

/* Mobile-specific utility classes */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
    
    .text-center-mobile {
        text-align: center !important;
    }
    
    .stack-mobile {
        flex-direction: column !important;
    }
    
    .full-width-mobile {
        width: 100% !important;
        max-width: none !important;
    }
}