/* ============================================
   MOBILE RESPONSIVE FIXES - clamp() Based
   World's Collide - Fluid Typography & Spacing
   ============================================ */

/* ============================================
   FLUID TYPOGRAPHY WITH CLAMP()
   Formula: clamp(min, preferred, max)
   ============================================ */

/* Base font sizes - fluid across all screens */
body {
    font-size: clamp(14px, 2.5vw, 18px);
}

/* Headings - scale fluidly */
h1 {
    font-size: clamp(1.75rem, 5vw + 0.5rem, 3.5rem);
    line-height: clamp(1.2, 3vw, 1.3);
}

h2 {
    font-size: clamp(1.4rem, 4vw + 0.3rem, 2.75rem);
    line-height: clamp(1.3, 2.5vw, 1.4);
}

h3 {
    font-size: clamp(1.2rem, 3vw + 0.2rem, 2rem);
    line-height: clamp(1.3, 2vw, 1.4);
}

h4 {
    font-size: clamp(1.1rem, 2.5vw + 0.1rem, 1.5rem);
    line-height: clamp(1.3, 1.5vw, 1.4);
}

/* Lead text - fluid */
p, .lead {
    font-size: clamp(0.9rem, 2vw + 0.5rem, 1.15rem);
    line-height: clamp(1.5, 2vw, 1.7);
}

/* ============================================
   NAVBAR - Mobile Optimized with clamp()
   ============================================ */
.navbar {
    padding: clamp(0.5rem, 1vw, 0.75rem) clamp(0.75rem, 2vw, 1.5rem) !important;
}

/* Brand title - ensure visibility on mobile */
.navbar-brand {
    font-size: clamp(1rem, 3vw + 0.3rem, 1.5rem);
    padding-left: 0 !important;
    margin-left: -0.25rem;
}

/* Nav links - readable on mobile */
.nav-link {
    font-size: clamp(0.85rem, 2vw + 0.3rem, 1rem);
    padding: clamp(0.4rem, 1vw, 0.6rem) clamp(0.6rem, 1.5vw, 1rem) !important;
}

/* Mobile navbar collapse - make buttons visible */
@media (max-width: 991px) {
    .navbar-collapse {
        background: rgba(10, 10, 15, 0.98) !important;
        border-radius: 12px !important;
        padding: clamp(0.75rem, 2vw, 1.25rem) !important;
        margin-top: 0.75rem !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        backdrop-filter: blur(12px);
    }
    
    /* Auth buttons in navbar - ensure visibility */
    .navbar-collapse .btn {
        font-size: clamp(0.85rem, 2.5vw + 0.2rem, 1rem) !important;
        padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(1rem, 3vw, 1.5rem) !important;
        margin: 0.35rem !important;
        opacity: 1 !important;
        visibility: visible !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-shadow: none !important;
        color: var(--text-primary) !important;
        border-width: 2px !important;
    }
    
    /* Sign-in button - bright cyan */
    .navbar-collapse .btn-outline-cyan {
        color: #00b4d8 !important;
        border-color: #00b4d8 !important;
        background: rgba(0, 180, 216, 0.1) !important;
    }
    
    /* Register button - bright red/pink */
    .navbar-collapse .btn-gradient {
        background: linear-gradient(135deg, #e63946, #ff6b6b) !important;
        color: #ffffff !important;
        border: 2px solid #e63946 !important;
        text-shadow: none !important;
        font-weight: 600 !important;
    }
    
    /* Stack buttons vertically on very small screens */
    @media (max-width: 480px) {
        .navbar-collapse .btn {
            width: 100% !important;
            margin: 0.25rem 0 !important;
            font-size: clamp(0.9rem, 3vw + 0.3rem, 1.05rem) !important;
        }
    }
}

/* ============================================
   CAROUSEL - Mobile Responsive with clamp()
   ============================================ */
#myCarousel {
    margin-top: clamp(48px, 8vh, 64px) !important;
}

/* Fluid carousel height */
.carousel-item img,
.carousel-bg {
    height: clamp(200px, 45vh, 520px);
    object-fit: cover;
    filter: brightness(0.35) saturate(1.2);
}

/* Slide content - fluid positioning and sizing */
.slide-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1;
    width: clamp(85%, 90vw, 80%);
    max-width: clamp(300px, 85vw, 700px);
    padding: clamp(1.25rem, 4vw, 2.5rem) clamp(1.5rem, 5vw, 3rem);
    border-radius: clamp(12px, 3vw, 16px);
}

/* Slide content headings - fluid */
.slide-content h1 {
    font-size: clamp(1.5rem, 5vw + 0.5rem, 3.5rem);
    line-height: clamp(1.2, 3vw, 1.3);
    margin-bottom: clamp(0.5rem, 2vw, 1rem);
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff, var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.slide-content h2 {
    font-size: clamp(1rem, 3vw + 0.3rem, 1.5rem);
    line-height: clamp(1.4, 2vw, 1.6);
    color: var(--text-secondary);
    font-weight: 400;
}

/* Slide content buttons - fluid */
.slide-content .btn {
    border-radius: clamp(8px, 2vw, 10px);
    padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
    font-size: clamp(0.75rem, 2vw + 0.2rem, 0.9rem);
    font-weight: 600;
}

/* Carousel indicators - visible on mobile */
.carousel-indicators [data-bs-target] {
    width: clamp(8px, 2vw, 10px);
    height: clamp(8px, 2vw, 10px);
    margin: 0 clamp(3px, 0.75vw, 5px);
}

/* Carousel controls - larger touch targets on mobile */
.carousel-control-prev,
.carousel-control-next {
    width: clamp(30px, 6vw, 5%);
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: clamp(24px, 5vw, 32px);
    height: clamp(24px, 5vw, 32px);
}

/* ============================================
   MOBILE-SPECIFIC BREAKPOINTS
   ============================================ */

/* Tablet and below (768px) */
@media (max-width: 768px) {
    /* Hero brand image */
    .hero-brand {
        padding: clamp(3rem, 8vh, 5rem) 0 clamp(1rem, 3vw, 1.5rem);
    }
    
    .hero-brand img {
        max-width: clamp(150px, 40vw, 600px);
        width: clamp(60%, 80vw, 100vw);
    }
    
    /* Quick links - horizontal scroll */
    .quick-links {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding: clamp(0.5rem, 2vw, 0.75rem) clamp(0.75rem, 3vw, 1rem) !important;
        margin: clamp(1rem, 3vw, 1.5rem) calc(-1 * min(1rem, 3vw)) !important;
        justify-content: flex-start !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }
    
    .quick-links::-webkit-scrollbar {
        display: none !important;
    }
    
    .quick-link {
        flex-shrink: 0 !important;
        padding: clamp(0.4rem, 1.5vw, 0.6rem) clamp(0.8rem, 2.5vw, 1.2rem) !important;
        font-size: clamp(0.8rem, 2.5vw + 0.2rem, 0.95rem) !important;
    }
    
    /* Featurette cards */
    .featurette-card {
        padding: clamp(1.25rem, 4vw, 2.5rem);
        margin-bottom: clamp(1rem, 3vw, 2rem);
    }
    
    .featurette-heading {
        font-size: clamp(1.3rem, 4vw + 0.2rem, 2rem);
    }
    
    /* Feature images */
    .feature-image-wrapper img {
        height: clamp(180px, 35vh, 320px);
    }
    
    /* Members section */
    .member-card {
        padding: clamp(1.25rem, 4vw, 2rem) !important;
    }
    
    .member-avatar {
        width: clamp(80px, 20vw, 120px) !important;
        height: clamp(80px, 20vw, 120px) !important;
    }
    
    /* Discord section */
    .discord-section h2 {
        font-size: clamp(1.3rem, 4vw + 0.2rem, 2rem);
    }
    
    .discord-widget-frame {
        padding: 0 clamp(0.5rem, 2vw, 1rem) !important;
    }
}

/* Small mobile (480px) */
@media (max-width: 480px) {
    /* Main content padding */
    main {
        padding: clamp(0.5rem, 2vw, 1rem) !important;
    }
    
    /* Carousel - ensure proper centering */
    #myCarousel {
        margin-top: clamp(44px, 7vh, 60px) !important;
    }
    
    .carousel-item img,
    .carousel-bg {
        height: clamp(180px, 40vh, 400px);
    }
    
    .slide-content {
        width: 92% !important;
        max-width: 340px !important;
        padding: clamp(1rem, 3vw, 1.5rem) clamp(1rem, 3vw, 1.5rem) !important;
    }
    
    /* Featurette sections - stack vertically */
    .featurette-card {
        padding: clamp(1rem, 3vw, 1.75rem);
    }
    
    .featurette-heading {
        font-size: clamp(1.2rem, 3.5vw + 0.2rem, 1.6rem);
    }
    
    .feature-image-wrapper img {
        height: clamp(160px, 30vh, 240px);
    }
    
    /* Hero brand */
    .hero-brand img {
        max-width: clamp(120px, 35vw, 200px);
    }
    
    /* Section headers */
    .section-header h2 {
        font-size: clamp(1.4rem, 4vw + 0.2rem, 2rem);
    }
    
    /* Counter badge */
    .counter-badge {
        font-size: clamp(0.85rem, 2.5vw + 0.2rem, 1rem) !important;
        padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 3vw, 1.5rem) !important;
    }
}

/* Extra small mobile (360px) */
@media (max-width: 360px) {
    .navbar-brand {
        font-size: clamp(0.95rem, 4vw + 0.2rem, 1.2rem);
    }
    
    .hero-brand img {
        max-width: clamp(100px, 30vw, 160px);
    }
    
    .slide-content {
        width: 95% !important;
        padding: 1rem !important;
    }
    
    .slide-content h1 {
        font-size: clamp(1.3rem, 4vw + 0.3rem, 1.8rem);
    }
}

/* ============================================
   ACCESSIBILITY - Ensure text is readable
   ============================================ */

/* Minimum contrast for all text */
.navbar-brand,
.slide-content h1,
.featurette-heading,
.section-header h2 {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Ensure buttons are always visible */
.btn {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Prevent text from being too small */
@media (max-width: 768px) {
    *,
    *::before,
    *::after {
        font-size: max(14px, clamp(0.85rem, 2vw + 0.3rem, 1rem)) !important;
    }
    
    /* But allow headings to use their fluid sizes */
    h1, h2, h3, h4, h5, h6 {
        font-size: auto !important;
    }
}
