/* ============================================================
   ZMLC — Shared Responsive Foundation
   Imported by every page for consistent cross-device behavior.
   
   Breakpoints:
     sm:  ≤480px   Small phones
     md:  ≤768px   Large phones / Small tablets
     lg:  ≤1024px  Tablets / Small laptops
     xl:  ≤1280px  Standard laptops
     2xl: ≥1281px  Large desktops
   ============================================================ */

/* ===== GLOBAL LOADER (extracted from 6+ inline copies) ===== */
#global-loader {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: #ffffff;
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
#global-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.loader-spinner {
    width: 50px; height: 50px;
    border: 3px solid rgba(196, 165, 54, 0.1);
    border-top-color: #c4a536;
    border-radius: 50%;
    animation: loader-spin 0.8s linear infinite;
    margin-bottom: 20px;
}
@keyframes loader-spin { 100% { transform: rotate(360deg); } }

/* ===== HORIZONTAL OVERFLOW PREVENTION ===== */
html {
    overflow-x: hidden;
}
body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}
section, main, article, aside, footer, header, nav, div {
    max-width: 100vw;
}

/* ===== SAFE AREAS (Notched Devices) ===== */
@supports (padding: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ===== TOUCH TARGETS (WCAG 2.5.5) ===== */
@media (pointer: coarse) {
    button, 
    a, 
    input[type="submit"],
    input[type="button"],
    .filter-chip,
    .team-filter,
    .practice-filter,
    .tab-button,
    .sidebar-item,
    .sidebar-nav a {
        min-height: 44px;
        min-width: 44px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important; /* Prevent iOS zoom on input focus */
        min-height: 48px;
    }
}

/* ===== RESPONSIVE TYPOGRAPHY SCALE ===== */
@media (max-width: 480px) {
    html { font-size: 14px; }
}

@media (min-width: 481px) and (max-width: 768px) {
    html { font-size: 15px; }
}

@media (min-width: 769px) {
    html { font-size: 16px; }
}

/* ===== SMOOTH SCROLLING ===== */
html {
    scroll-behavior: smooth;
}

/* Offset for sticky headers */
[id] {
    scroll-margin-top: 80px;
}

/* ===== MOBILE HAMBURGER ANIMATION ===== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 60;
    color: #1a1a24;
    font-size: 1.5rem;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ===== MOBILE SLIDE-IN MENU ===== */
.mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: #ffffff;
    z-index: 9999;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    padding: 24px 0;
}
.mobile-nav-drawer.open {
    right: 0;
}
.mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.mobile-nav-backdrop.active {
    opacity: 1;
    visibility: visible;
}
.mobile-nav-drawer .nav-close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 1.5rem;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mobile-nav-drawer a {
    display: block;
    padding: 14px 24px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1a1a24;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.2s, color 0.2s;
}
.mobile-nav-drawer a:hover,
.mobile-nav-drawer a.active {
    background: rgba(196, 165, 54, 0.08);
    color: #c4a536;
}
.mobile-nav-drawer a i {
    width: 24px;
    margin-right: 8px;
    color: #c4a536;
}
.mobile-nav-drawer .nav-cta {
    margin: 16px 24px;
    background: linear-gradient(135deg, #c4a536, #d4b84a);
    color: #0a0a0f;
    text-align: center;
    padding: 14px 24px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: none;
    box-shadow: 0 4px 16px rgba(196, 165, 54, 0.3);
}

/* ===== RESPONSIVE GRID HELPERS ===== */
@media (max-width: 480px) {
    .grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3,
    .grid-cols-1.md\:grid-cols-2.lg\:grid-cols-4,
    .grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
}

/* ===== FOOTER RESPONSIVE ===== */
@media (max-width: 768px) {
    footer .grid {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }
    footer .flex.flex-col.md\:flex-row {
        flex-direction: column !important;
        text-align: center;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    footer {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

/* ===== MODAL RESPONSIVE ===== */
@media (max-width: 640px) {
    .fixed.inset-0 > div,
    .testi-modal-content {
        margin: 8px !important;
        max-height: calc(100vh - 16px) !important;
        overflow-y: auto !important;
        border-radius: 16px !important;
    }
}

/* ===== FORM RESPONSIVE ===== */
@media (max-width: 640px) {
    .grid.grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    .testi-form {
        grid-template-columns: 1fr !important;
    }
    .form-group-full,
    .btn-submit-review {
        grid-column: span 1 !important;
    }
}

/* ===== HORIZONTAL SCROLL FILTERS ===== */
.filter-scroll-container {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding-bottom: 4px;
}
.filter-scroll-container::-webkit-scrollbar {
    display: none;
}

/* ===== CARD HOVER — Disable transform on touch devices ===== */
@media (hover: none) and (pointer: coarse) {
    .practice-card:hover,
    .news-card:hover,
    .welcome-card:hover,
    .judgment-card:hover {
        transform: none !important;
    }
}

/* ===== PRECONNECT/PRELOAD HINT (informational — add to HTML <head>) ===== */
/* <link rel="preconnect" href="https://fonts.googleapis.com"> */
/* <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> */
/* <link rel="preconnect" href="https://cdnjs.cloudflare.com"> */

/* ===== LAZY-LOADED IMAGE PLACEHOLDER ===== */
img[loading="lazy"] {
    background: linear-gradient(135deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: img-shimmer 1.5s infinite;
}
@keyframes img-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== UTILITY: Hide on specific breakpoints ===== */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
    .hide-desktop { display: none !important; }
}
@media (max-width: 480px) {
    .hide-sm { display: none !important; }
}
