/* ══════════════════════════════════════════════════════
   MOBILE.CSS — ElyseeScope
   Partagé entre toutes les pages.
   1. Barre de navigation fixe en bas (mobile uniquement)
   2. Scroll horizontal pour les sections de cartes
   3. Corrections de débordement général
   ══════════════════════════════════════════════════════ */

/* ────────────────────────────────────────
   BASE : fond de réserve pour la barre basse
   ──────────────────────────────────────── */
.mobile-bottom-nav {
    display: none; /* caché sur desktop */
}

@media (max-width: 768px) {

    /* Espace pour que le contenu ne passe pas sous la barre */
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* ── Hamburger & sidebar supprimés sur mobile ── */
    .hamburger {
        display: none !important;
    }
    .sidebar {
        display: none !important;
    }
    .sidebar-overlay {
        display: none !important;
    }

    /* ── Main content : pleine largeur quand sidebar cachée ── */
    .main-content {
        margin-left: 0 !important;
    }
    .site-footer {
        margin-left: 0 !important;
    }

    /* ── Liens de nav cachés (bottom nav prend le relais) ── */
    .nav-links {
        display: none !important;
    }
    .nav-cta {
        display: none !important;
    }
    /* index.html / gazette.html : actions de nav */
    .nav-actions .nav-link,
    .nav-actions .nav-cta,
    .nav-actions .nav-tag {
        display: none !important;
    }
    .nav-actions {
        flex: 0 !important;
        padding: 0 !important;
        min-width: 0 !important;
    }

    /* ── Barre de navigation du bas ── */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: rgba(245, 244, 240, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid #dddbd6;
        box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.07);
        z-index: 500;
        align-items: stretch;
    }

}

/* ── Styles des items (actifs même sur desktop pour éviter le FOUC) ── */
.mbn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: #6b7280;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    transition: color 0.15s;
    padding: 6px 2px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.mbn-item:active {
    background: rgba(0, 0, 0, 0.04);
}
.mbn-item.active {
    color: #2563eb;
}
.mbn-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2.5px;
    background: #2563eb;
    border-radius: 0 0 3px 3px;
}
.mbn-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}
.mbn-item.active .mbn-icon {
    transform: scale(1.08);
}
.mbn-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}
.mbn-item.active .mbn-icon svg {
    stroke-width: 2.2;
}
.mbn-label {
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
}


/* ══════════════════════════════════════════════════════
   SCROLL HORIZONTAL POUR LES SECTIONS DE CARTES
   ══════════════════════════════════════════════════════ */

@media (max-width: 768px) {

    /* ─ Mixin utilitaire horizontal-scroll ─
       Appliqué via .hscroll ou directement sur les sélecteurs ci-dessous */
    .hscroll,
    .preview-grid,
    #homethemesGrid,
    .themes-grid,
    .actu-grid,
    .section-grid,
    .editions-grid {
        display: flex !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        flex-wrap: nowrap !important;
        gap: 0.85rem !important;
        padding-bottom: 1rem !important;
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
        margin-left: -1.25rem !important;
        margin-right: -1.25rem !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Réinitialise les propriétés de grille */
        grid-template-columns: unset !important;
    }

    .hscroll::-webkit-scrollbar,
    .preview-grid::-webkit-scrollbar,
    #homethemesGrid::-webkit-scrollbar,
    .themes-grid::-webkit-scrollbar,
    .actu-grid::-webkit-scrollbar,
    .section-grid::-webkit-scrollbar,
    .editions-grid::-webkit-scrollbar {
        display: none;
    }

    /* Taille des cartes dans les conteneurs scrollables */
    .preview-grid > *,
    .section-grid > *,
    .actu-grid > *,
    .editions-grid > *,
    .hscroll > * {
        flex: 0 0 264px !important;
        min-width: 0;
        scroll-snap-align: start;
    }

    #homethemesGrid > * {
        flex: 0 0 150px !important;
        min-height: 90px;
        scroll-snap-align: start;
    }

    .themes-grid > * {
        flex: 0 0 160px !important;
        min-width: 0;
        scroll-snap-align: start;
    }

    /* ─ Stats grid : garde 2×2 ─ */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        overflow-x: hidden;
    }

    /* ─ Pilier grid : 1 colonne ─ */
    .pillar-grid {
        grid-template-columns: 1fr !important;
    }

    /* ─ Sections intérieures : pas de débordement ─ */
    .content-section {
        overflow-x: hidden;
    }

    /* ─ Tableaux : scroll horizontal dans le wrapper ─ */
    .comp-table-outer {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* index.html : section accueil padding réduit */
    #accueil {
        min-height: auto;
        padding: 2.5rem 1.25rem 2rem !important;
    }

    /* padding général des sections sur mobile */
    .content-section {
        padding: 2.5rem 1.25rem !important;
    }

    /* ─ Filtres : scroll horizontal si trop longs ─ */
    .filters {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .filters::-webkit-scrollbar { display: none; }
    .filters .filter-btn {
        flex-shrink: 0;
    }

    /* ─ Barre de filtres top-actu ─ */
    .filters-bar {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .filters-bar::-webkit-scrollbar { display: none; }

    /* ══════════════════════════════════════════════════════
       CAROUSEL ACTUS — pleine largeur, une carte à la fois
       ══════════════════════════════════════════════════════ */

    /* actu-grid (6 Top Actu homepage) — override 264px → 100% */
    .actu-grid {
        gap: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-bottom: 0 !important;
    }
    .actu-grid > * {
        flex: 0 0 100% !important;
        width: 100% !important;
        scroll-snap-align: center;
        border-radius: 14px;
    }

    /* actu-fil-list (9 articles fil homepage) — transform en carousel horizontal */
    .actu-fil-list {
        flex-direction: row !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        border: none !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        gap: 0 !important;
    }
    .actu-fil-list::-webkit-scrollbar { display: none; }
    .actu-fil-list > .actu-fil-item,
    .actu-fil-list > .actu-fil-skel {
        flex: 0 0 100% !important;
        width: 100% !important;
        min-width: 0;
        scroll-snap-align: center;
        border: 1px solid var(--border) !important;
        border-radius: 14px !important;
        border-bottom: 1px solid var(--border) !important;
    }

    /* articlesList (top-actu page) — carousel horizontal */
    #articlesList {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0 !important;
    }
    #articlesList::-webkit-scrollbar { display: none; }
    #articlesList > .article-card {
        flex: 0 0 100% !important;
        width: 100% !important;
        min-width: 0;
        scroll-snap-align: center;
        margin-bottom: 0 !important;
        /* Restore card look for mobile carousel */
        background: var(--card, #fff) !important;
        border: 1px solid var(--border) !important;
        border-bottom: 1px solid var(--border) !important;
        border-radius: 14px !important;
        padding: 1rem 1.125rem !important;
        box-shadow: var(--shadow, 0 1px 4px rgba(0,0,0,0.06)) !important;
    }

    /* ── Navigation du carousel ─────────────────────────── */
    .cmb-nav {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.65rem;
        margin-top: 0.75rem;
        padding: 0 0.25rem;
    }
    .cmb-btn {
        width: 34px;
        height: 34px;
        border-radius: 50%;
        border: 1.5px solid var(--border, #dddbd6);
        background: var(--card, #fff);
        color: var(--text, #111827);
        font-size: 1.3rem;
        line-height: 1;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.15s, opacity 0.15s;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    }
    .cmb-btn:active { background: var(--deep, #eae8e3); }
    .cmb-btn:disabled { opacity: 0.3; cursor: default; }
    .cmb-indicator {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
    .cmb-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--border, #dddbd6);
        transition: background 0.2s, transform 0.2s;
        cursor: pointer;
        flex-shrink: 0;
    }
    .cmb-dot.active {
        background: var(--blue, #2563eb);
        transform: scale(1.45);
    }
    .cmb-counter {
        font-size: 0.82rem;
        color: var(--muted, #6b7280);
        font-weight: 500;
        font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    }
    .cmb-sep {
        margin: 0 2px;
        opacity: 0.5;
    }

}
