/* ==========================================================================
   Full Width, Mobile-First Fluid Responsive Design
   Multilingual Alphabet Learning Suite
   ========================================================================== */

/* 1. Base Box Sizing & Fluid Root */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 2. Fluid Layout Containers */
.fluid-container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: clamp(12px, 2.5vw, 40px) !important;
    padding-right: clamp(12px, 2.5vw, 40px) !important;
    margin-left: auto;
    margin-right: auto;
}

.fluid-section {
    width: 100%;
    padding-top: clamp(12px, 2vw, 28px);
    padding-bottom: clamp(16px, 2.5vw, 36px);
}

/* 3. Fluid Responsive Grids (Mobile-First) */
.fluid-grid-cards {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(clamp(80px, 14vw, 140px), 1fr)) !important;
    gap: clamp(8px, 1.5vw, 16px) !important;
    width: 100%;
}

.fluid-grid-dense {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(clamp(65px, 11vw, 100px), 1fr)) !important;
    gap: clamp(6px, 1vw, 12px) !important;
    width: 100%;
}

.fluid-grid-modules {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(clamp(260px, 23vw, 360px), 1fr)) !important;
    gap: clamp(12px, 2vw, 24px) !important;
    width: 100%;
}

.fluid-grid-hsk {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(clamp(110px, 15vw, 180px), 1fr)) !important;
    gap: clamp(8px, 1.5vw, 16px) !important;
    width: 100%;
}

/* 4. Canvas & SVG Fluid Adaptability */
canvas.responsive-canvas,
.responsive-canvas {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    touch-action: none;
    display: block;
}

svg.responsive-svg,
.responsive-svg {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

/* 5. Fluid Responsive Typography */
.fluid-h1 {
    font-size: clamp(1.5rem, 1.1rem + 2vw, 2.75rem) !important;
    line-height: 1.15 !important;
}

.fluid-h2 {
    font-size: clamp(1.2rem, 1rem + 1.2vw, 2rem) !important;
    line-height: 1.25 !important;
}

.fluid-p {
    font-size: clamp(0.8125rem, 0.75rem + 0.35vw, 1rem) !important;
    line-height: 1.5 !important;
}

/* 6. Media Queries & Mobile-First Breakpoints */

/* Mobile HP (< 640px) */
@media (max-width: 639px) {
    .hide-on-mobile {
        display: none !important;
    }
    
    .stack-on-mobile {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .modal-sheet-mobile {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 1.25rem 1.25rem 0 0 !important;
        bottom: 0 !important;
        position: fixed !important;
        max-height: 92vh !important;
    }

    .btn-mobile-touch {
        min-height: 42px !important;
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    /* Wrap button filters */
    .filter-bar-mobile {
        flex-wrap: wrap !important;
        gap: 0.375rem !important;
    }
}

/* Tablet (640px to 1024px) */
@media (min-width: 640px) and (max-width: 1024px) {
    .tablet-col-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Desktop & Ultra-wide PC (>= 1025px) */
@media (min-width: 1025px) {
    .desktop-row {
        flex-direction: row !important;
    }
}

/* Ultra-Wide Monitors (>= 1920px) */
@media (min-width: 1920px) {
    .fluid-grid-cards {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    }
}

/* 7. Performance & Fast Loading Optimizations */
.content-auto {
    content-visibility: auto;
    contain-intrinsic-size: 0 100px;
}

.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* Scrollbar Smoothness */
.custom-scrollbar::-webkit-scrollbar {
    height: 5px;
    width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}
.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #475569;
}
