/* ==========================================================================
   CAPPS PLATFORM - COMPLETE MOBILE & TABLET RESPONSIVE ENGINE (400px - 900px)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. GLOBAL VIEWPORT CONTAINMENT (Fixes All Horizontal Overflows & Text Scaling)
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   2. TABLET & SMALL LAPTOP BREAKPOINT (769px to 900px)
   -------------------------------------------------------------------------- */
@media screen and (min-width: 769px) and (max-width: 900px) {

    /* Sidebar Adjustment */
    .capps-sidebar {
        width: 60px !important;
    }

    .capps-sidebar-link span {
        display: none !important; /* Icon-only sidebar on medium tablets */
    }

    /* Hero Section Stacking */
    .hero-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    .media-frame.media-frame--hero {
        min-height: 400px !important;
        height: 420px !important;
    }

    /* Info Card Repositioning */
    .hero-mockup-wrapper {
        display: flex !important;
        flex-direction: column !important;
    }

    .hero-info-card {
        position: static !important;
        width: 100% !important;
        margin-top: 1.5rem !important;
    }

    /* Grid Layouts Adjustment */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }

    .showcase-item,
    .showcase-item.reverse {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 1.5rem !important;
        align-items: center !important;
    }

    html, body {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        -webkit-text-size-adjust: 100%;
        box-sizing: border-box;
    }

    *, *::before, *::after {
        box-sizing: inherit;
    }

    .capps-root, main, section, .container, .container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        box-sizing: border-box !important;
    }

}

/* --------------------------------------------------------------------------
   3. LARGE SMARTPHONES & PORTRAIT TABLETS (577px to 768px)
   -------------------------------------------------------------------------- */
@media screen and (min-width: 577px) and (max-width: 768px) {

    /* Hide Desktop Sidebar */
    .capps-sidebar {
        display: none !important;
    }

    /* Header Optimization */
    .matek-site-header__inner {
        padding: 0.75rem 1rem !important;
    }

    .matek-phone {
        display: none !important;
    }

    /* Hero Section */
    .hero {
        padding-top: 90px !important;
        padding-bottom: 2rem !important;
    }

    .media-frame.media-frame--hero {
        min-height: 320px !important;
        height: 360px !important;
    }

    /* Horizontal Touch-Scroll for Hero Tabs */
    .hero-preview-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-snap-type: x mandatory !important;
        padding-bottom: 0.75rem !important;
        gap: 0.5rem !important;
    }

    .hero-tab {
        flex: 0 0 auto !important;
        scroll-snap-align: start !important;
        white-space: nowrap !important;
        font-size: 0.85rem !important;
        padding: 0.5rem 0.85rem !important;
    }

    /* Showcase Section Stacking */
    .showcase-item,
    .showcase-item.reverse {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.25rem !important;
        margin-bottom: 3rem !important;
    }

    .showcase-text {
        width: 100% !important;
    }

    /* Performance & Form Sections */
    .why-grid,
    .demo-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
    }

    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.75rem !important;
    }

    /* Footer Adjustment */
    .portages_footer_bloc .row {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .portages_footer_bloc_8 {
        width: 50% !important;
        margin-bottom: 1.5rem !important;
    }

    html, body {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        -webkit-text-size-adjust: 100%;
        box-sizing: border-box;
    }

    *, *::before, *::after {
        box-sizing: inherit;
    }

    .capps-root, main, section, .container, .container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        box-sizing: border-box !important;
    }

}

/* --------------------------------------------------------------------------
   4. STANDARD & COMPACT SMARTPHONES (400px to 576px)
   -------------------------------------------------------------------------- */
@media screen and (min-width: 400px) and (max-width: 576px) {

    /* Global Typography Scaling */
    h1, .video-showcase__title, h2 {
        font-size: 1.45rem !important;
        line-height: 1.35 !important;
    }

    p, .demo-subtitle, .hero-info-card__desc {
        font-size: 0.92rem !important;
        line-height: 1.5 !important;
    }

    /* Header & Navigation */
    .matek-site-header__inner {
        padding: 0.5rem 0.75rem !important;
    }

    .matek-brand__logo {
        width: 130px !important;
        height: auto !important;
    }

    .matek-phone,
    .capps-sidebar {
        display: none !important;
    }

    /* Hero & Frame Scaling */
    .hero {
        padding-top: 85px !important;
        padding-bottom: 1.5rem !important;
    }

    .media-frame.media-frame--hero {
        min-height: 240px !important;
        height: 280px !important;
    }

    /* PDF Viewer Scrollbars for Mobile */
    .pdf-viewer-container::-webkit-scrollbar {
        width: 6px !important;
        height: 6px !important;
    }

    .hero-info-card {
        position: static !important;
        width: 100% !important;
        padding: 1rem !important;
        margin-top: 1rem !important;
    }

    /* Horizontal Scroll Tabs */
    .hero-preview-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-snap-type: x mandatory !important;
        padding-bottom: 0.5rem !important;
        margin-bottom: 0.75rem !important;
    }

    .hero-tab {
        flex: 0 0 auto !important;
        scroll-snap-align: start !important;
        white-space: nowrap !important;
        font-size: 0.8rem !important;
        padding: 0.4rem 0.75rem !important;
    }

    /* Buttons & CTAs Full Width */
    .btn,
    .matek-btn--primary,
    .capps-widget__btn,
    button[type="submit"] {
        width: 100% !important;
        text-align: center !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
        justify-content: center !important;
    }

    .cta-actions,
    .capps-widget__actions {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.75rem !important;
    }

    /* Performance Stats Stacking */
    .stats-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .stat-card {
        text-align: center !important;
        padding: 1rem !important;
    }

    /* Form Controls */
    .demo-form input {
        width: 100% !important;
        font-size: 0.95rem !important;
    }

    /* Modal Player Optimization */
    .video-modal__content {
        width: 95% !important;
        margin: 0 auto !important;
    }

    /* Footer Layout Full Stacking */
    .portages_footer_bloc .row {
        display: flex !important;
        flex-direction: column !important;
        text-align: center !important;
        gap: 1.25rem !important;
    }

    .portages_footer_bloc_8,
    .portages_footer_bloc_10,
    .portages_footer_bloc_2,
    .portages_footer_bloc_13 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    .portages_footer_bloc_17,
    .portages_footer_bloc_16 {
        justify-content: center !important;
    }

    /* Adjust Floating Contact Action Widgets */
    .phonebox-wrapper,
    .whatsapp-wrapper,
    .mailbox-wrapper {
        scale: 0.85;
        bottom: 12px !important;
    }

    .whatsapp-wrapper {
        right: 65px !important;
    }

    .mailbox-wrapper {
        right: 120px !important;
    }

    html, body {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        -webkit-text-size-adjust: 100%;
        box-sizing: border-box;
    }

    *, *::before, *::after {
        box-sizing: inherit;
    }

    .capps-root, main, section, .container, .container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        box-sizing: border-box !important;
    }

}

/* --------------------------------------------------------------------------
   5. CUSTOM SCROLLBAR STYLING FOR TOUCH-SCROLL TABS (400px to 900px)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 900px) {
    .hero-preview-tabs::-webkit-scrollbar {
        height: 4px !important;
    }

    .hero-preview-tabs::-webkit-scrollbar-track {
        background: rgba(15, 23, 42, 0.6) !important;
        border-radius: 4px !important;
    }

    .hero-preview-tabs::-webkit-scrollbar-thumb {
        background: linear-gradient(90deg, #38bdf8 0%, #6366f1 100%) !important;
        border-radius: 4px !important;
    }
}


/*****/

/* ==========================================================================
   HERO TABS MOBILE RESPONSIVE FIX
   ========================================================================== */


/*** 123*/

/* ==========================================================================
   HERO TABS MOBILE REDESIGN - BOTTOM POSITION & SQUARE BUTTONS (<= 768px)
   ========================================================================== */

@media screen and (max-width: 768px) {

    /* 1. Reorder container elements so the tabs render BELOW the slider/frame */
    .hero-visual {
        display: flex !important;
        flex-direction: column !important;
    }

    .hero-mockup-wrapper {
        order: 1 !important; /* Slider frame loads first */
    }

    .hero-preview-tabs {
        order: 2 !important; /* Tabs render below slider frame */
        display: flex !important;
        flex-wrap: wrap !important; /* Fits square buttons in a clean grid */
        justify-content: center !important;
        gap: 0.6rem !important;
        padding: 1rem 0.5rem !important;
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
        overflow-x: visible !important; /* Grid flow instead of inline horizontal strip */
    }

    /* 2. Style tab elements into square buttons */
    .hero-tab {
        flex: 0 0 calc(25% - 0.6rem) !important; /* 4 square buttons per row on mobile */
        aspect-ratio: 1 / 1 !important; /* Enforces a 1:1 square ratio */
        height: auto !important;
        min-width: 65px !important;
        /* Flex alignment for content within squares */
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        /* Square styling with subtle rounded corners */
        border-radius: 8px !important;
        padding: 0.4rem !important;
        font-size: 0.72rem !important;
        font-weight: 600 !important;
        text-align: center !important;
        white-space: normal !important; /* Allows two-line titles inside the square */
        line-height: 1.15 !important;
        /* Theme visuals */
        background: rgba(30, 41, 59, 0.8) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        color: #94a3b8 !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
        transition: all 0.2s ease-in-out !important;
    }

        /* Icon adjustments inside square buttons */
        .hero-tab i {
            font-size: 1.25rem !important;
            margin-bottom: 0.2rem !important;
            display: block !important;
        }

        /* Active & Focus States */
        .hero-tab.is-active,
        .hero-tab:active {
            background: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%) !important;
            border-color: #38bdf8 !important;
            color: #ffffff !important;
            transform: translateY(-2px) !important;
            box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35) !important;
        }

    html, body {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        -webkit-text-size-adjust: 100%;
        box-sizing: border-box;
    }

    *, *::before, *::after {
        box-sizing: inherit;
    }

    .capps-root, main, section, .container, .container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        box-sizing: border-box !important;
    }

}

/* Fallback for ultra-narrow devices (under 400px): 3 squares per row */
@media screen and (max-width: 400px) {
    .hero-tab {
        flex: 0 0 calc(33.333% - 0.6rem) !important;
        font-size: 0.68rem !important;
    }

    html, body {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        -webkit-text-size-adjust: 100%;
        box-sizing: border-box;
    }

    *, *::before, *::after {
        box-sizing: inherit;
    }

    .capps-root, main, section, .container, .container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        box-sizing: border-box !important;
    }

}


/******/

/* ==========================================================================
   SHOWCASE IMAGE MOBILE VISIBILITY FIX
   ========================================================================== */
@media screen and (max-width: 768px) {

    /* 1. Ensure the parent frames expand properly on mobile */
    .showcase-item .browser-frame,
    .showcase-item .media-frame--showcase {
        width: 100% !important;
        height: auto !important;
        min-height: 200px !important; /* Prevents frame collapse */
        display: block !important;
        position: relative !important;
        overflow: hidden !important;
    }

    /* 2. Force the image to stay visible, auto-scale, and render above layers */
    .media-frame--showcase img {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 2 !important;
        position: relative !important;
    }

    /* 3. Keep the zoom overlay elements pinned properly without blocking the image */
    .capps-zoom-badge,
    .capps-shine {
        position: absolute !important;
        pointer-events: none !important;
    }
}

/*****/

/* ==========================================================================
   MOBILE FOOTER COLOR & TOUCH FIX
   ========================================================================== */
@media screen and (max-width: 768px) {

    /* 1. Base Container Dark Background & Contrast Reset */
    #footer_div {
        background: #0f172a !important; /* Deep dark background */
        color: #94a3b8 !important;
    }

        /* 2. Section Titles / Headings */
        #footer_div .portages_footer_bloc_20,
        #footer_div .text-sun {
            color: #38bdf8 !important; /* Vivid Cyan accent for headers */
            font-weight: 700 !important;
            letter-spacing: 0.05em !important;
            text-transform: uppercase !important;
        }

        /* 3. Footer Links Base Colors */
        #footer_div a,
        #footer_div .portages_footer_bloc_14,
        #footer_div .portages_footer_bloc_5 a,
        #footer_div .portages_footer_bloc_16 a,
        #footer_div .portages_footer_bloc_13 a {
            color: #cbd5e1 !important; /* High contrast light slate text */
            text-decoration: none !important;
            transition: color 0.2s ease-in-out, opacity 0.2s ease-in-out !important;
        }

            /* 4. Touch & Active Tap States (Replaces sticky mobile :hover) */
            #footer_div a:active,
            #footer_div a:focus,
            #footer_div a.hover\:text-sun:active,
            #footer_div .portages_footer_bloc_14:active {
                color: #38bdf8 !important; /* Bright cyan activation state on tap */
                opacity: 0.85 !important;
            }

        /* 5. Contact Info Block Details */
        #footer_div .portages_footer_bloc_17,
        #footer_div .portages_footer_bloc_16 {
            display: flex !important;
            align-items: center !important;
            color: #cbd5e1 !important;
        }

        /* 6. Copyright & Legal Text */
        #footer_div .portages_footer_bloc_2 p,
        #footer_div .portages_footer_bloc_13 {
            color: #64748b !important; /* Muted slate for legal text */
            font-size: 0.82rem !important;
        }

            /* 7. Legal Links Spacing & Alignment on Mobile Stacking */
            #footer_div .portages_footer_bloc_13 a {
                display: inline-block !important;
                margin-top: 0.5rem !important;
                margin-left: 0.5rem !important;
                margin-right: 0.5rem !important;
            }
}

/****/

/* ==========================================================================
   ULTRA-PREMIUM MOBILE HERO BUTTONS (ONLY <= 768px - NO DESKTOP REGRESSION)
   ========================================================================== */

@media screen and (max-width: 768px) {

    /* 1. Flex Reordering: Pins Mockup on Top, Tabs Below */
    .hero-visual {
        display: flex !important;
        flex-direction: column !important;
    }

    .hero-mockup-wrapper {
        order: 1 !important;
    }

    /* 2. Enhanced Bottom Container (Frosted Bar / Smooth Horizontal Scroll Grid) */
    .hero-preview-tabs {
        order: 2 !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-snap-type: x mandatory !important;
        scroll-behavior: smooth !important;
        width: 100% !important;
        gap: 0.65rem !important;
        padding: 0.85rem 0.6rem 1rem 0.6rem !important;
        margin-top: 1.25rem !important;
        margin-bottom: 0.5rem !important;
        background: rgba(15, 23, 42, 0.65) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-radius: 16px !important;
        box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 12px 32px rgba(0, 0, 0, 0.35) !important;
    }

    /* 3. High-End Square Glass Tile Styling */
    .hero-tab {
        flex: 0 0 78px !important; /* Fixed square dimension base */
        height: 78px !important; /* Pure 1:1 Aspect Ratio Square */
        scroll-snap-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        position: relative !important;
        border-radius: 14px !important;
        padding: 0.45rem !important;
        font-size: 0.72rem !important;
        font-weight: 600 !important;
        line-height: 1.15 !important;
        letter-spacing: -0.01em !important;
        white-space: normal !important;
        word-break: keep-all !important;
        background: linear-gradient(145deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        color: #94a3b8 !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25) !important;
        transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
        outline: none !important;
    }

        /* Icon Sizing inside Square Tiles */
        .hero-tab i {
            font-size: 1.35rem !important;
            margin-bottom: 0.3rem !important;
            color: #38bdf8 !important;
            transition: transform 0.2s ease !important;
        }

        /* 4. Active "Glow & Lift" State for Active Tab */
        .hero-tab.is-active {
            background: linear-gradient(135deg, #0284c7 0%, #4338ca 100%) !important;
            border-color: #38bdf8 !important;
            color: #ffffff !important;
            transform: translateY(-3px) scale(1.02) !important;
            box-shadow: 0 0 20px rgba(56, 189, 248, 0.45), 0 8px 18px rgba(0, 0, 0, 0.4) !important;
        }

            .hero-tab.is-active i {
                color: #ffffff !important;
                transform: scale(1.15) !important;
            }

            /* Active Indicator Dot */
            .hero-tab.is-active::after {
                content: "" !important;
                position: absolute !important;
                bottom: 5px !important;
                width: 16px !important;
                height: 3px !important;
                background: #38bdf8 !important;
                border-radius: 4px !important;
                box-shadow: 0 0 8px #38bdf8 !important;
            }

        /* Direct Touch/Tap Feedback */
        .hero-tab:active {
            transform: scale(0.94) !important;
            opacity: 0.9 !important;
        }

    /* Custom Sleek Scrollbar */
    .hero-preview-tabs::-webkit-scrollbar {
        height: 3px !important;
    }

    .hero-preview-tabs::-webkit-scrollbar-track {
        background: transparent !important;
    }

    .hero-preview-tabs::-webkit-scrollbar-thumb {
        background: linear-gradient(90deg, #38bdf8 0%, #6366f1 100%) !important;
        border-radius: 3px !important;
    }
}

/*****/



/* ==========================================================================
   VERSION 2: CYBERPUNK DARK GLASS MOBILE HEADER (ONLY <= 768px)
   ========================================================================== */

@media screen and (max-width: 768px) {

    /* 1. Floating Capsule Top Bar */
    .matek-site-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 1000 !important;
        background: rgba(10, 15, 30, 0.85) !important;
        backdrop-filter: blur(20px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
        border-bottom: 1px solid rgba(56, 189, 248, 0.3) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 15px rgba(56, 189, 248, 0.15) !important;
    }

    .matek-site-header__inner {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0.55rem 0.75rem !important;
        gap: 0.4rem !important;
    }

    /* 2. Logo Glow Accent */
    .matek-brand__logo {
        width: 105px !important;
        height: auto !important;
        filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.4)) !important;
    }

    /* 3. Modern Segmented Language Switcher */
    .matek-lang.flags-container {
        display: flex !important;
        align-items: center !important;
        gap: 0.15rem !important;
        background: rgba(15, 23, 42, 0.9) !important;
        padding: 0.18rem !important;
        border-radius: 12px !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    .flag-item {
        background: transparent !important;
        border: none !important;
        padding: 0.2rem !important;
        border-radius: 8px !important;
        opacity: 0.6 !important;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

        .flag-item img,
        .portages_index_bloc_390 {
            width: 16px !important;
            height: 16px !important;
            border-radius: 4px !important;
            object-fit: cover !important;
        }

        .flag-item:active {
            opacity: 1 !important;
            background: rgba(56, 189, 248, 0.2) !important;
            transform: scale(1.1) !important;
        }

    /* 4. Micro CTA Button with Glowing Edge */
    .matek-btn--primary {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.35rem !important;
        padding: 0.42rem 0.8rem !important;
        font-size: 0.73rem !important;
        font-weight: 800 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.04em !important;
        border-radius: 10px !important;
        color: #0f172a !important;
        background: #38bdf8 !important;
        box-shadow: 0 0 15px rgba(56, 189, 248, 0.5) !important;
        border: none !important;
        transition: all 0.15s ease !important;
    }

        /* Glowing Pulsing Status Light inside Button */
        .matek-btn--primary::before {
            content: "" !important;
            display: inline-block !important;
            width: 6px !important;
            height: 6px !important;
            background: #0f172a !important;
            border-radius: 50% !important;
        }

        .matek-btn--primary:active {
            transform: scale(0.93) !important;
            background: #818cf8 !important;
            box-shadow: 0 0 22px rgba(129, 140, 248, 0.8) !important;
        }

    /* 5. Safe Layout Offset */
    body.matek-page {
        padding-top: 58px !important;
    }
}


/* ==========================================================================
   FIX PRIORITAIRE : override du min-height:520px fixe (règle inline du <head>)
   ========================================================================== */

@media screen and (min-width: 577px) and (max-width: 768px) {
    body .media-frame.media-frame--hero,
    html body .media-frame.media-frame--hero {
        min-height: 320px !important;
        height: 360px !important;
    }
}

@media screen and (min-width: 400px) and (max-width: 576px) {
    body .media-frame.media-frame--hero,
    html body .media-frame.media-frame--hero {
        min-height: 240px !important;
        height: 280px !important;
    }
}

@media screen and (max-width: 400px) {
    body .media-frame.media-frame--hero,
    html body .media-frame.media-frame--hero {
        min-height: 220px !important;
        height: 240px !important;
    }
}

/* L'image doit rester entièrement visible dans ce cadre réduit,
   pas rognée (les captures d'écran perdraient leur contenu utile) */
@media screen and (max-width: 768px) {
    body #hero-preview-image {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: center !important;
    }

    /* Le lecteur vidéo et le viewer PDF héritent déjà de top/left/right/bottom:0,
       donc ils s'adaptent automatiquement à la nouvelle hauteur du parent */
    body .pdf-viewer-container,
    body .hero-video-player {
        min-height: unset !important;
    }
}

/* Cohérence header fixe / offset body sur mobile,
   pour éviter que le hero commence sous le header */
@media screen and (max-width: 768px) {
    body.matek-page {
        padding-top: 58px !important;
    }

    .hero {
        padding-top: 16px !important; /* le padding-top de 85/90px devient inutile
                                          puisque body.matek-page gère déjà le décalage */
    }
}


/****/

/* ==========================================================================
   FIX FINAL — HERO TABS + SLIDER MOBILE (spécificité ID pour trancher
   définitivement entre toutes les règles concurrentes de capps.css)
   ========================================================================== */

@media screen and (max-width: 768px) {

    /* 1. Ordre : slider (mockup) en premier, tabs en dessous */
    #capps-hero .hero-visual {
        display: flex !important;
        flex-direction: column !important;
    }

    #capps-hero .hero-mockup-wrapper {
        order: 1 !important;
        width: 100% !important;
        padding: 0 !important;
    }

    /* 2. Cadre du slider : hauteur réduite et cohérente sur mobile */
    #capps-hero .media-frame.media-frame--hero {
        position: relative !important;
        width: 100% !important;
        min-height: 260px !important;
        height: 300px !important;
        overflow: hidden !important;
    }

    #capps-hero #hero-preview-image {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: center !important;
    }

    #capps-hero .pdf-viewer-container,
    #capps-hero .hero-video-player {
        min-height: unset !important;
        height: 100% !important;
    }

    /* 3. Carte info : jamais en position absolue sur mobile */
    #capps-hero .hero-info-card.glass-panel {
        position: relative !important;
        bottom: auto !important;
        right: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 1rem !important;
    }

    /* 4. Bandeau de tabs — un seul design, scroll horizontal propre */
    #capps-hero .hero-preview-tabs {
        order: 2 !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-snap-type: x mandatory !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 0.6rem !important;
        margin: 1rem 0 0.5rem 0 !important;
        padding: 0.75rem 0.5rem !important;
        border-radius: 16px !important;
        background: rgba(15, 23, 42, 0.65) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35) !important;
    }

    /* 5. Boutons de tab — taille fixe, un seul style */
    #capps-hero .hero-tab {
        flex: 0 0 72px !important;
        width: 72px !important;
        min-width: 72px !important;
        max-width: 72px !important;
        height: 72px !important;
        aspect-ratio: unset !important;
        scroll-snap-align: start !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        white-space: normal !important;
        line-height: 1.15 !important;
        font-size: 0.66rem !important;
        font-weight: 600 !important;
        padding: 0.35rem !important;
        border-radius: 12px !important;
        background: rgba(30, 41, 59, 0.85) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        color: #94a3b8 !important;
        transition: all 0.2s ease !important;
    }

        #capps-hero .hero-tab i {
            font-size: 1.05rem !important;
            margin-bottom: 0.15rem !important;
            display: block !important;
        }

        #capps-hero .hero-tab.is-active {
            background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
            border-color: #38bdf8 !important;
            color: #ffffff !important;
            transform: translateY(-2px) !important;
            box-shadow: 0 4px 14px rgba(56, 189, 248, 0.4) !important;
        }

    /* 6. Scrollbar fine et propre pour le bandeau */
    #capps-hero .hero-preview-tabs::-webkit-scrollbar {
        height: 3px !important;
    }

    #capps-hero .hero-preview-tabs::-webkit-scrollbar-thumb {
        background: linear-gradient(90deg, #38bdf8 0%, #6366f1 100%) !important;
        border-radius: 3px !important;
    }
}

@media screen and (max-width: 400px) {
    #capps-hero .media-frame.media-frame--hero {
        min-height: 220px !important;
        height: 240px !important;
    }

    #capps-hero .hero-tab {
        flex: 0 0 64px !important;
        width: 64px !important;
        min-width: 64px !important;
        max-width: 64px !important;
        height: 64px !important;
        font-size: 0.6rem !important;
    }
}