/* Responsive Design - Mobile First Approach */

/* Global overflow prevention */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: border-box !important;
}

/* Container adjustments */
.container {
    max-width: 100% !important;
    overflow-x: hidden !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

/* Mobile Phones (up to 480px) */
@media screen and (max-width: 480px) {
    /* Typography */
    #home h1 {
        font-size: 2.5rem !important;
        line-height: 1.1;
        margin-bottom: 1rem;
    }
    
    #home p {
        font-size: 1rem !important;
        margin-bottom: 0.5rem;
    }
    
    /* Section headers */
    h2 {
        font-size: 3rem !important;
        line-height: 1.1 !important;
    }
    
    /* Navigation */
    nav .container {
        padding: 0.75rem 1rem;
    }
    
    nav img {
        width: 2rem;
        height: 2rem;
    }
    
    nav h1 {
        font-size: 1rem;
    }
    
    nav p {
        font-size: 0.6rem;
    }
    
    /* Buttons */
    .register-btn {
        font-size: 0.9rem;
        padding: 0.75rem 1.5rem;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    /* Server Cards Mobile */
    .server-card {
        padding: 1.5rem !important;
        margin-bottom: 1rem;
        min-height: auto !important;
    }
    
    .server-card .text-3xl {
        font-size: 1.5rem !important;
    }
    
    .server-card .w-16 {
        width: 3rem !important;
        height: 2rem !important;
    }
    
    /* Step Cards Mobile */
    .step-card {
        padding: 1.5rem !important;
        margin-bottom: 1rem;
        min-height: 350px !important;
    }
    
    .step-card .text-3xl {
        font-size: 1.75rem !important;
    }
    
    .step-card .w-32 {
        width: 6rem !important;
        height: 6rem !important;
    }
    
    .step-card .w-14 {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
    
    /* Sections */
    section {
        padding: 3rem 0;
        width: 100% !important;
        overflow-x: hidden !important;
    }
    
    .container {
        padding: 0 1rem;
        max-width: 100% !important;
    }
    
    /* Grid adjustments */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        width: 100% !important;
    }
    
    /* Server section mobile */
    .lg\\:flex-row {
        flex-direction: column !important;
    }
    
    .lg\\:w-1\\/3, .lg\\:w-2\\/3 {
        width: 100% !important;
    }
    
    /* Character image mobile */
    .floating {
        max-width: 250px !important;
        margin: 0 auto;
    }
}

/* Large Mobile Phones and Small Tablets (481px to 768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
    #home h1 {
        font-size: 3.5rem;
    }
    
    #home p {
        font-size: 1.125rem;
    }
    
    .register-btn {
        font-size: 1rem;
        padding: 0.875rem 2rem;
    }
    
    .server-card,
    .step-card,
    .community-card {
        padding: 1.5rem;
    }
    
    /* Two columns for community cards */
    #community .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablets (769px to 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    #home h1 {
        font-size: 4rem;
    }
    
    /* Three columns for step cards */
    #how-to-play .grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Two columns for server cards */
    #servers .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large Tablets and Small Desktops (1025px to 1366px) */
@media screen and (min-width: 1025px) and (max-width: 1366px) {
    .container {
        max-width: 1200px;
    }
}

/* Large Desktops (1367px and up) */
@media screen and (min-width: 1367px) {
    .container {
        max-width: 1400px;
    }
    
    #home h1 {
        font-size: 6rem;
    }
}

/* Landscape orientation adjustments */
@media screen and (orientation: landscape) and (max-height: 600px) {
    #home {
        min-height: 120vh;
    }
    
    #home h1 {
        font-size: 2.5rem;
    }
    
    nav {
        padding: 0.5rem 0;
    }
}

/* High DPI displays */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #000000;
        --bg-secondary: #0a0a0a;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
    }
}

/* Light mode preference (if user prefers light mode) */
@media (prefers-color-scheme: light) {
    body {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #404040 100%);
    }
}

/* Reduced 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;
    }
    
    .floating,
    .glow,
    .particle {
        animation: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .server-card,
    .step-card,
    .community-card,
    .register-btn {
        border: 2px solid #ffffff !important;
    }
    
    .nav-link:hover {
        background: #ffffff;
        color: #000000;
    }
}

/* Print styles */
@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    #three-bg,
    .particles,
    nav,
    #loading-screen {
        display: none !important;
    }
    
    #home {
        background: white !important;
        color: black !important;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .server-card:hover,
    .step-card:hover,
    .community-card:hover {
        transform: none;
    }
    
    .register-btn:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    }
    
    /* Larger touch targets */
    button,
    .nav-link,
    .community-card {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Ultra-wide monitors */
@media screen and (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
    
    #home h1 {
        font-size: 8rem;
    }
    
    #home p {
        font-size: 1.5rem;
    }
}

/* 4K displays */
@media screen and (min-width: 2560px) {
    .container {
        max-width: 2000px;
    }
    
    #home h1 {
        font-size: 10rem;
    }
}

/* Foldable devices */
@media screen and (min-width: 1024px) and (max-height: 600px) {
    #home {
        flex-direction: row;
        text-align: left;
    }
    
    #home .text-center {
        text-align: left;
        max-width: 50%;
    }
}
