/* Responsive Design Enhancements for U.S. Elite Investment Club */

/* Mobile First Approach */

/* Extra Small Devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Hero Section */
    .hero-content h1 {
        font-size: 2rem !important;
        line-height: 1.1;
        margin-bottom: 1rem;
    }
    
    .hero-content h2 {
        font-size: 1.1rem !important;
        margin-bottom: 2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    
    .hero-buttons button {
        width: 100%;
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    /* Navigation */
    .nav-brand h1 {
        font-size: 1.1rem;
    }
    
    .nav-brand p {
        font-size: 0.7rem;
    }
    
    /* Pyramid Section */
    .pyramid-layer .bg-white {
        padding: 1rem !important;
        margin: 0.5rem !important;
    }
    
    .pyramid-layer h3 {
        font-size: 1rem !important;
        margin-bottom: 0.5rem;
    }
    
    .pyramid-layer p {
        font-size: 0.8rem !important;
    }
    
    .pyramid-layer .bg-navy,
    .pyramid-layer .bg-gold,
    .pyramid-layer .bg-light-navy,
    .pyramid-layer .bg-neutral-gray {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
    }
    
    /* Approach Cards */
    .approach-card {
        margin-bottom: 2rem;
    }
    
    .approach-card .w-20 {
        width: 3.5rem !important;
        height: 3.5rem !important;
    }
    
    .approach-card h3 {
        font-size: 1.1rem;
    }
    
    /* Form */
    .membership-form {
        padding: 1.5rem !important;
    }
    
    .membership-form input,
    .membership-form select,
    .membership-form textarea {
        font-size: 1rem;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem;
        text-align: center;
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* Hero Section */
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .hero-content h2 {
        font-size: 1.25rem;
    }
    
    /* Pyramid adjustments */
    .pyramid-layer {
        max-width: 90%;
        margin: 0 auto 1rem auto;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Navigation adjustments */
    .desktop-nav {
        display: none;
    }
    
    /* Hero Section */
    .hero-content h1 {
        font-size: 3.5rem;
    }
    
    .hero-content h2 {
        font-size: 1.5rem;
    }
    
    /* Grid adjustments */
    .approach-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2rem;
    }
    
    /* Pyramid responsive */
    .pyramid-container {
        max-width: 100%;
        padding: 0 1rem;
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) {
    /* Show desktop navigation */
    .mobile-menu-btn {
        display: none;
    }
    
    /* Hero optimization */
    .hero-content {
        max-width: 80%;
        margin: 0 auto;
    }
    
    /* Grid optimizations */
    .approach-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Landscape Orientation Adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .hero-section {
        min-height: 100vh;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    
    .hero-content h2 {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }
    
    .scroll-indicator {
        display: none;
    }
}

/* Touch Device Optimizations */
@media (pointer: coarse) {
    /* Larger touch targets */
    button,
    .nav-link,
    .mobile-menu a {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
    }
    
    /* Form inputs */
    input,
    select,
    textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Hover states for touch devices */
    .card-hover:hover {
        transform: none;
    }
    
    .card-hover:active {
        transform: scale(0.98);
    }
}

/* Bilingual Layout Optimizations */
[lang="en"] .hero-content h1 {
    font-size: 3.5rem;
}

[lang="en"] .hero-content h2 {
    font-size: 1.25rem;
}

@media (max-width: 768px) {
    [lang="en"] .hero-content h1 {
        font-size: 2.25rem;
    }
    
    [lang="en"] .hero-content h2 {
        font-size: 1rem;
    }
}

/* Language Toggle Dropdown */
#language-dropdown {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(201, 166, 70, 0.2);
}

#language-dropdown button:hover {
    background-color: #f8f9fa;
    color: #C9A646;
}

/* English Text Adjustments */
[lang="en"] .text-sm {
    font-size: 0.875rem;
}

[lang="en"] .text-xs {
    font-size: 0.75rem;
}

/* Chinese Text Optimizations */
[lang="zh"] .font-serif {
    font-family: 'Playfair Display', 'Noto Serif SC', serif;
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper text rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Sharper borders */
    .border {
        border-width: 0.5px;
    }
}

/* Container Queries for Modern Browsers */
@container (max-width: 500px) {
    .pyramid-layer {
        flex-direction: column;
        text-align: center;
    }
    
    .pyramid-layer .flex {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
}

/* Print Optimizations */
@media print {
    /* Hide interactive elements */
    nav,
    .mobile-menu,
    button,
    .scroll-to-top,
    .hero-buttons {
        display: none !important;
    }
    
    /* Optimize text */
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    /* Ensure sections start on new page */
    section {
        page-break-before: auto;
        page-break-inside: avoid;
    }
    
    /* Remove backgrounds and shadows */
    * {
        background: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    /* Ensure text is black */
    .text-white,
    .text-gold,
    .text-navy {
        color: #000 !important;
    }
}

/* 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;
        scroll-behavior: auto !important;
    }
    
    .parallax-effect {
        transform: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    /* This is optional since the site already uses dark theme */
    .bg-white {
        background-color: #1a1a1a;
        color: white;
    }
    
    .text-neutral-gray {
        color: #a0a0a0;
    }
    
    .border-gray-300 {
        border-color: #404040;
    }
}

/* Focus Visible for Better Accessibility */
.focus-visible:focus {
    outline: 2px solid #C9A646;
    outline-offset: 2px;
}

/* Screen Reader Only Content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #C9A646;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 100;
}

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

/* Loading State Optimizations */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Custom Scrollbar for Mobile */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        display: none;
    }
    
    body {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* iOS Safari Specific Fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix for iOS viewport height */
    .hero-section {
        min-height: -webkit-fill-available;
    }
    
    /* Fix for iOS form styling */
    input,
    select,
    textarea {
        -webkit-appearance: none;
        border-radius: 0;
    }
}

/* Android Chrome Specific Fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select {
        background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
        background-repeat: no-repeat;
        background-position: right 0.7em top 50%;
        background-size: 0.65em auto;
    }
}