/* ==========================================================================
   Digitalize Hub — MOBILE CSS (v3.7.0)
   ----------------------------------------------------------------------------
   ADAPTIVE design — the mobile version is COMPLETELY DIFFERENT from desktop,
   not just a responsive shrink. Based on research-driven mobile patterns:
     • Bottom tab bar (thumb zone) instead of top nav
     • Sticky bottom CTA bar
     • Full-screen menu takeover
     • Reordered content (action first)
     • Horizontal carousels instead of stacked grids
     • Touch-native form controls (44px+ targets)
     • Vertical hero composition
   Loaded after main.css so it overrides on mobile widths.
   ========================================================================== */

/* v3.7.2 FIX: HIDE mobile-only elements on desktop (they were showing as
   big icons after the footer because they had no display:none on desktop).
   These are only shown inside the @media (max-width: 767px) block below. */
.dh-mobile-tabbar,
.dh-mobile-menu,
.dh-mobile-cta-bar,
.dh-mobile-menu-close { display: none !important; }

/* ===== BREAKPOINT: < 768px gets the completely different mobile layout ===== */
@media (max-width: 767px) {

    /* ---------- 1. HIDE desktop nav, show bottom tab bar ---------- */
    .dh-header { position: sticky; top: 0; z-index: 100; background: var(--bg); border-bottom: 1px solid var(--border); }
    .dh-header-inner { padding: 12px 16px; }
    .dh-nav { display: none !important; } /* hidden — replaced by bottom tab bar */
    .dh-menu-toggle { display: none !important; } /* hidden — replaced by bottom tab bar */
    .dh-topbar { display: none !important; } /* top bar hidden on mobile */
    .dh-header-cta { display: none !important; } /* header CTA moves to bottom bar */

    /* Bottom tab bar — fixed at bottom, always visible (thumb zone) */
    .dh-mobile-tabbar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 60px;
        background: var(--bg);
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 12px rgba(0,0,0,.06);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    .dh-mobile-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 8px 12px;
        border: 0;
        background: none;
        color: var(--text-muted);
        font-size: 10px;
        font-weight: 600;
        text-decoration: none;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }
    .dh-mobile-tab svg { width: 22px; height: 22px; }
    .dh-mobile-tab.is-active { color: var(--accent); }

    /* ---------- 2. Full-screen menu takeover ---------- */
    .dh-mobile-menu {
        position: fixed;
        inset: 0;
        z-index: 300;
        background: var(--bg);
        display: none;
        flex-direction: column;
        padding: 80px 24px 24px;
        overflow-y: auto;
    }
    .dh-mobile-menu.is-open { display: flex; }
    .dh-mobile-menu-close {
        position: absolute;
        top: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
        border: 0;
        background: var(--bg-alt);
        border-radius: 50%;
        font-size: 24px;
        color: var(--text);
    }
    .dh-mobile-menu a {
        display: block;
        padding: 16px 0;
        font-family: var(--font-heading);
        font-size: 24px;
        font-weight: 600;
        color: var(--text);
        border-bottom: 1px solid var(--border);
    }
    .dh-mobile-menu a:active { color: var(--accent); }

    /* ---------- 3. Hero — vertical composition ---------- */
    .dh-hero { min-height: 100vh; padding: 70px 0 80px; display: flex; flex-direction: column; justify-content: center; }
    .dh-hero-inner { flex-direction: column; gap: 24px; padding: 0 16px; }
    .dh-hero-copy { text-align: center; order: 2; }
    .dh-hero-card { order: 1; width: 100%; max-width: none; }
    .dh-hero-title { font-size: clamp(2rem, 8vw, 3rem); line-height: 1.1; }
    .dh-hero-sub { font-size: 16px; }
    .dh-hero-actions { flex-direction: column; gap: 12px; width: 100%; }
    .dh-hero-actions .dh-btn { width: 100%; text-align: center; padding: 14px 24px; }
    .dh-hero-scroll { display: none; } /* no scroll indicator on mobile */

    /* ---------- 4. Sticky bottom CTA bar ---------- */
    .dh-mobile-cta-bar {
        position: fixed;
        bottom: 60px; /* above the tab bar */
        left: 0;
        right: 0;
        z-index: 199;
        padding: 10px 16px;
        background: var(--bg);
        border-top: 1px solid var(--border);
        display: flex;
        gap: 8px;
        align-items: center;
        transform: translateY(100%);
        transition: transform .3s ease;
    }
    .dh-mobile-cta-bar.is-visible { transform: translateY(0); }
    .dh-mobile-cta-bar .dh-btn { flex: 1; padding: 12px 16px; font-size: 14px; text-align: center; }

    /* ---------- 5. Sections — reordered + full-bleed ---------- */
    .dh-section { padding: 60px 0; }
    .dh-container { padding: 0 16px; }

    /* About — stacked, image first */
    .dh-about-grid { grid-template-columns: 1fr !important; gap: 24px; }

    /* Services — stack vertically (not horizontal carousel) */
    .dh-services-list { display: grid !important; grid-template-columns: 1fr !important; gap: 16px; overflow: visible !important; scroll-snap-type: none !important; }
    .dh-services-list > * { flex: none !important; width: 100% !important; scroll-snap-align: none !important; }

    /* Work — stack vertically (not horizontal scroll) */
    .dh-work-grid { display: grid !important; grid-template-columns: 1fr !important; gap: 24px; overflow: visible !important; scroll-snap-type: none !important; }
    .dh-work-grid > * { flex: none !important; width: 100% !important; scroll-snap-align: none !important; }

    /* Gallery — 2-column grid (not 3) */
    .dh-gallery-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }

    /* Testimonials — single column */
    .dh-testi-grid { grid-template-columns: 1fr !important; }
    .dh-testi-item { padding: 20px; }

    /* Process — vertical timeline (not horizontal) */
    .dh-process-grid { grid-template-columns: 1fr !important; gap: 16px; }

    /* FAQ — full width, no sidebar */
    .dh-faq-wrap { grid-template-columns: 1fr !important; }
    .dh-faq-side { display: none !important; }

    /* Contact — stacked, form first (action-first) */
    .dh-contact-grid { grid-template-columns: 1fr !important; }
    .dh-contact-left { order: 2; }
    .dh-contact-form { order: 1; }

    /* Pricing — stack vertically (not horizontal carousel) */
    .dh-pricing-grid { display: grid !important; grid-template-columns: 1fr !important; gap: 20px; overflow: visible !important; scroll-snap-type: none !important; max-width: 480px; margin-inline: auto; }
    .dh-pricing-grid > * { flex: none !important; width: 100% !important; scroll-snap-align: none !important; }

    /* Team — 2-column grid */
    .dh-team-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }

    /* Stats — 2-column grid */
    .dh-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }

    /* ---------- 6. Touch-native form controls ---------- */
    .dh-form input,
    .dh-form textarea,
    .dh-form select {
        min-height: 48px;
        font-size: 16px; /* prevents iOS zoom */
        padding: 12px 16px;
    }
    .dh-radio-group { flex-wrap: wrap; gap: 8px; }
    .dh-radio-group label { min-height: 44px; padding: 10px 16px; }

    /* ---------- 7. Footer — simplified ---------- */
    .dh-footer-grid { grid-template-columns: 1fr !important; gap: 24px; }
    .dh-footer-bottom { flex-direction: column; gap: 12px; text-align: center; }

    /* ---------- 8. Floating buttons — repositioned ---------- */
    .dh-to-top { bottom: 70px !important; right: 12px !important; left: auto !important; width: 44px; height: 44px; }
    .dh-fab { bottom: 70px !important; }

    /* ---------- 9. Lightbox — touch-optimized ---------- */
    .dh-lightbox { padding: 20px 10px; }
    .dh-lightbox img { max-width: 95vw; max-height: 75vh; border-radius: 8px; }
    .dh-lightbox-close { top: 12px; right: 12px; width: 40px; height: 40px; }
    .dh-lightbox-nav { width: 44px; height: 44px; }
    .dh-lightbox-prev { left: 8px; }
    .dh-lightbox-next { right: 8px; }
    .dh-lightbox-cap { bottom: 12px; font-size: 14px; padding: 6px 12px; }

    /* ---------- 10. Cookie banner — bottom sheet style ---------- */
    .dh-cookie { left: 8px !important; right: 8px !important; bottom: 70px !important; max-width: none !important; border-radius: 12px; }

    /* Add bottom padding so content isn't hidden behind tab bar */
    body.dh-theme { padding-bottom: 60px; }

    /* Section headings — centered on mobile */
    .dh-section-head { text-align: center; }
    .dh-section-head .dh-h2 { font-size: clamp(1.5rem, 5vw, 2rem); }

    /* ---------- v4.2.0: New sections mobile fixes ---------- */

    /* Blog — single column */
    .dh-blog-grid { grid-template-columns: 1fr !important; }

    /* Skills — single column bars/circles */
    .dh-skills-grid { grid-template-columns: 1fr !important; gap: 16px; }
    .dh-skill-bar-fill { width: 100% !important; }

    /* Awards — single column */
    .dh-awards-grid { grid-template-columns: 1fr !important; }

    /* Mission — stack vertically */
    .dh-mission-grid { grid-template-columns: 1fr !important; }

    /* Showreel — full width, smaller text */
    .dh-showreel-split { grid-template-columns: 1fr !important; gap: 24px; }
    .dh-showreel-cover { min-height: 280px; }

    /* Partners — 2-column logos */
    .dh-partners-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
    .dh-partners-marquee { animation: none !important; flex-wrap: wrap; justify-content: center; }

    /* Quote — centered, no parallax */
    .dh-quote-parallax { background-attachment: scroll !important; }
    .dh-quote-text { font-size: clamp(1.25rem, 5vw, 1.75rem) !important; }

    /* Compare — horizontal scroll table */
    .dh-compare-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .dh-compare-table { min-width: 600px; }
    .dh-compare-cards { grid-template-columns: 1fr !important; gap: 16px; }

    /* Stats progress bars — smaller */
    .dh-stat-bar { height: 6px !important; }

    /* Hero — smaller text, no parallax */
    .dh-hero { min-height: 70vh !important; }
    .dh-hero-title { font-size: clamp(2rem, 8vw, 3rem) !important; }
    .dh-hero-sub { font-size: clamp(1rem, 4vw, 1.125rem) !important; }
    .dh-hero-img { transform: none !important; }
    .dh-hero-card { display: none !important; }

    /* Logos — wrap */
    .dh-logos-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }

    /* CTA banner — centered */
    .dh-cta-banner { text-align: center; padding: 40px 20px; }
    .dh-cta-banner .dh-btn { width: 100%; max-width: 280px; }
}

/* ===== iPhone-specific tweaks (safe areas) ===== */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 767px) {
        .dh-mobile-tabbar { padding-bottom: env(safe-area-inset-bottom, 0); height: calc(60px + env(safe-area-inset-bottom, 0)); }
        .dh-mobile-cta-bar { bottom: calc(60px + env(safe-area-inset-bottom, 0)); }
        body.dh-theme { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0)); }
    }
}
