/* =====================================================================
   AI Value – responsive.css (partagé par toutes les pages)
   À charger APRÈS le <style> de chaque page.
   ===================================================================== */

:root {
    /* Variables utilisées par les pages mais jamais définies (cause du menu transparent) */
    --primary-blue: #020513;
    --cyan-accent: #00CAC3;
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: hidden; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
html.nav-locked, html.nav-locked body { overflow: hidden; }
img, video, canvas, svg, iframe { max-width: 100%; }
img, video { height: auto; }
body { overflow-wrap: break-word; }
.dropdown.active > a { color: var(--hover-cyan); }

/* ---------- Grilles : plus de minimum qui dépasse de l'écran ---------- */
.cards-grid        { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.press-grid        { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.reviews-grid      { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.pedagogy-grid,
.profiles-grid     { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.features-grid     { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.testimonials-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }

/* =====================================================================
   DESKTOP ÉTROIT (993px – 1180px) : barre plus compacte
   ===================================================================== */
@media (min-width: 993px) and (max-width: 1180px) {
    .navbar-container { padding-left: 22px; }
    nav ul { gap: 1.1rem; }
    nav a { font-size: 0.88rem; }
    .navbar-actions { gap: 0.9rem; }
    .diag-contact { padding: 9px 16px; }
    .mega-menu { width: min(620px, 86vw); }
}

/* Écrans tactiles en largeur desktop (iPad paysage) : tap pour ouvrir */
.dropdown.active .mega-menu { visibility: visible; opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 993px) {
    nav ul li:nth-last-child(1).active .mega-menu,
    nav ul li:nth-last-child(2).active .mega-menu { transform: translateY(0); }
    .dropdown.active .chevron { transform: rotate(180deg); color: var(--hover-cyan); }
}

/* =====================================================================
   TABLETTE & MOBILE (≤ 992px) : NAVBAR + MENU HAMBURGER
   ===================================================================== */
@media (max-width: 992px) {

    body { background-attachment: scroll; }   /* le fond "fixed" provoque des décalages sur iOS/Android */

    .navbar-container {
        top: max(10px, env(safe-area-inset-top));
        width: calc(100% - 20px);
        max-width: 720px;
        padding: 8px 8px 8px 18px;
        border-radius: 28px;
        flex-wrap: wrap;
        align-items: center;
        background-color: rgba(2, 5, 19, 0.94);
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px - env(safe-area-inset-top));
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .brand { margin-right: auto; min-width: 0; }
    .brand b { font-size: 1.2rem; white-space: nowrap; }

    /* Bouton hamburger -> croix */
    .hamburger {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
        width: 44px; height: 44px; padding: 0; margin-left: auto; flex-shrink: 0;
        border-radius: 50%; cursor: pointer; -webkit-tap-highlight-color: transparent;
        transition: background-color 0.2s ease;
    }
    .hamburger:hover, .hamburger:focus-visible { background-color: rgba(0, 202, 195, 0.12); outline: none; }
    .hamburger span { display: block; width: 22px; height: 3px; transition: transform 0.25s ease, opacity 0.2s ease; }
    .navbar-container.menu-open .hamburger span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .navbar-container.menu-open .hamburger span:nth-child(2) { opacity: 0; }
    .navbar-container.menu-open .hamburger span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    /* Panneau de navigation */
    nav {
        display: none; order: 3; flex: 0 0 100%; width: 100%;
        margin: 8px 0 0; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    nav.mobile-active,
    .navbar-container.menu-open nav { display: block; }
    nav ul { flex-direction: column; align-items: stretch; gap: 2px; width: 100%; }
    nav ul li, .dropdown { width: 100%; padding: 0; }

    .dropdown > a {
        justify-content: space-between; min-height: 48px; padding: 12px 10px;
        font-size: 1.05rem; border-radius: 10px;
    }
    .dropdown > a:hover { background-color: rgba(0, 202, 195, 0.06); }
    .chevron { width: 18px; height: 18px; flex-shrink: 0; }
    .dropdown:hover .chevron { transform: none; color: #9CA3AF; }
    .dropdown.active .chevron { transform: rotate(180deg); color: var(--hover-cyan); }

    /* Méga-menu -> liste déroulante intégrée au panneau */
    .navbar-container .mega-menu {
        position: static; left: auto; right: auto; top: auto;
        visibility: visible; opacity: 1; transform: none !important; transition: none;
        width: 100%; max-width: none; display: none; grid-template-columns: 1fr; gap: 0.25rem;
        margin: 0 0 8px 10px; padding: 2px 0 6px 8px;
        background: transparent; border: 0; border-left: 2px solid rgba(0, 202, 195, 0.25); border-radius: 0;
        box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    }
    .navbar-container .dropdown.active .mega-menu { display: grid; }
    .mega-column { gap: 2px; }
    .mega-section-title { margin: 10px 0 4px; padding-left: 10px; font-size: 0.7rem; color: rgba(255, 255, 255, 0.45); }
    .mega-item { padding: 10px; gap: 12px; align-items: center; min-height: 48px; }
    .mega-icon { width: 36px; height: 36px; border-radius: 8px; }
    .mega-icon svg { width: 18px; height: 18px; }
    .mega-title { font-size: 0.98rem; margin-bottom: 0; }
    .mega-desc { display: none; }

    /* Langue + bouton Diagnostic en bas du panneau */
    .navbar-actions {
        display: none; order: 4; flex: 0 0 100%; width: 100%; flex-wrap: wrap;
        justify-content: space-between; align-items: center; gap: 12px;
        margin-top: 8px; padding: 14px 4px 8px; border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .navbar-actions.mobile-active,
    .navbar-container.menu-open .navbar-actions { display: flex; }
    .lang-switcher { font-size: 1rem; }
    .lang-btn { padding: 8px 6px; }
    .diag-contact { flex: 1 1 150px; text-align: center; padding: 12px 20px; }

    /* Retour en haut + footer */
    #scrollTopBtn { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); width: 42px; height: 42px; }

    footer { padding: 3rem 6% calc(1.5rem + env(safe-area-inset-bottom)); }
    footer .footer-content {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2rem 1.5rem; padding-bottom: 1.5rem; margin-bottom: 1.5rem;
    }
    footer .footer-content > .footer-col:first-child { grid-column: 1 / -1; }
    footer .footer-col p { max-width: none !important; }
    .footer-bottom { line-height: 1.8; }
}

@media (min-width: 600px) and (max-width: 992px) {
    .mega-desc { display: block; font-size: 0.78rem; }
    footer .footer-content { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* =====================================================================
   TITRES, TEXTES, BOUTONS (≤ 992px)
   ===================================================================== */
@media (max-width: 992px) {
    .page-header h1, .hero-content h1, .hero-section h1, .contact-text h1, .diag-ia-text h1 {
        font-size: clamp(1.8rem, 6.5vw + 0.3rem, 2.8rem); line-height: 1.15; letter-spacing: -0.5px;
    }
    .academy-brand-name { font-size: clamp(2.4rem, 10vw, 3.6rem); }
    .stat-number { font-size: clamp(2.6rem, 11vw, 4rem); }
    .teep-header h2 { font-size: clamp(1.7rem, 6vw, 2.4rem); }
    .page-header { margin-bottom: 2.5rem; }
}

@media (max-width: 480px) {
    .brand img { height: 30px; }
    .brand b { font-size: 1.1rem; }
    .navbar-container { padding-left: 14px; }

    .hero-section { padding: 105px 18px 32px; }
    .pill-badge { font-size: 10.5px; letter-spacing: 1px; padding: 7px 14px; margin-bottom: 22px; }
    .hero-paragraph { line-height: 1.7; }
    .hero-buttons { flex-direction: column; width: 100%; max-width: 340px; gap: 14px; }
    .hero-buttons .start-btn { width: 100%; text-align: center; padding: 15px 24px; }

    footer .footer-content { gap: 1.75rem 1rem; }
}

/* Slider de logos plus compact sur mobile */
@media (max-width: 600px) {
    .clients-section { padding: 24px 0 56px; }
    .logo-track { width: calc(170px * 12); animation-name: scroll-logos-sm; }
    .slide-logo { width: 170px; padding: 0 10px; }
    .slide-logo img { height: 64px; max-width: 140px; }
    @keyframes scroll-logos-sm { 0% { transform: translateX(0); } 100% { transform: translateX(calc(-170px * 6)); } }
}

/* Très petits écrans (≤ 360px) */
@media (max-width: 360px) {
    .navbar-container { width: calc(100% - 14px); }
    .brand b { font-size: 1rem; }
    .brand img { height: 28px; }
    h1 { word-break: break-word; }
}


/* Animations : pas de mouvement forcé si l'utilisateur l'a désactivé */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* =====================================================================
   CORRECTIFS PAR PAGE
   ===================================================================== */

/* ---------- FORMATIONS : le hero restait en 2 colonnes sur mobile ---------- */
@media (max-width: 992px) {
    [data-page="formations"] .hero-section { flex-direction: column; align-items: stretch; padding: 130px 5% 50px; gap: 2.5rem; }
    [data-page="formations"] .hero-content,
    [data-page="formations"] .hero-image { flex: none; width: 100%; min-width: 0; }
    [data-page="formations"] .quote-box { margin-bottom: 1rem; padding: 20px; }
    [data-page="formations"] .quote-box p { font-size: 1.05rem; }
    [data-page="formations"] .academy-photo { width: 100%; }
    [data-page="formations"] .platform-section,
    [data-page="formations"] .social-proof-section,
    [data-page="formations"] .partners-cta-section { padding: 3.5rem 5%; }
    [data-page="formations"] .section-header { margin-bottom: 2.5rem; }
    [data-page="formations"] .section-header h2,
    [data-page="formations"] .cta-box h2 { font-size: clamp(1.6rem, 6vw, 2.2rem); }
    [data-page="formations"] .features-grid,
    [data-page="formations"] .reviews-grid { gap: 1.5rem; }
    [data-page="formations"] .stats-container { gap: 2rem 3rem; margin-bottom: 3rem; }
    [data-page="formations"] .partners-logos { gap: 1.5rem; padding: 20px 24px; }
    [data-page="formations"] .partners-logos img { height: 44px; max-width: 100%; }
    [data-page="formations"] .feature-card,
    [data-page="formations"] .review-card { padding: 26px 22px; }
}
@media (max-width: 480px) {
    [data-page="formations"] .btn-cta { display: block; padding: 15px 24px; font-size: 1.05rem; text-align: center; }
}

/* ---------- OFFRES : en-tête logos + bannière titre ---------- */
@media (max-width: 992px) {
    [data-page="offres"] .logos-left { flex-wrap: wrap; justify-content: center; gap: 10px; font-size: 18px; }
    [data-page="offres"] .content-body { padding: 20px 16px; }
    [data-page="offres"] .quote { font-size: 16px; }
    [data-page="offres"] .mid-highlight { margin: 28px 0; font-size: 17px; }
    [data-page="offres"] .mid-highlight .red-text { font-size: 20px; }
    [data-page="offres"] .title-right { font-size: clamp(18px, 5.2vw, 24px); }
    [data-page="offres"] .title-left { font-size: clamp(18px, 5vw, 22px); }
    [data-page="offres"] .module-number { font-size: 26px; }
    [data-page="offres"] .offer-footer-text { font-size: 16px; margin-top: 28px; }
}

/* ---------- Titres de section : taille fluide ---------- */
@media (max-width: 992px) {
    .section-header h2, .gallery-title, .cta-box h2 { font-size: clamp(1.5rem, 5.5vw, 2.2rem); line-height: 1.2; }
    [data-page="formations"] > p { padding-left: 5%; padding-right: 5%; }
    body[data-page="formations"] > p { padding: 0 5%; }
}

/* ---------- Cartes : paddings réduits ---------- */
@media (max-width: 600px) {
    .intro-block, .filters-container, .client-card, .legitimacy-section,
    .profile-card, .pedagogy-card { padding: 1.5rem 1.25rem; }
    [data-page="formateurs"] .pedagogy-section,
    [data-page="formateurs"] .stats-section { padding: 3rem 5%; }
    [data-page="formateurs"] .map-dot { width: 9px; height: 9px; }
    [data-page="formateurs"] .pulse-ring { top: -4px; left: -4px; right: -4px; bottom: -4px; }
}

/* ---------- RÉFÉRENCES : logos + galerie ---------- */
@media (max-width: 992px) {
    [data-page="references"] .legitimacy-section { padding: 2rem 1.25rem; margin-bottom: 3rem; }
    [data-page="references"] .legitimacy-logos { gap: 1.5rem; }
    [data-page="references"] .legit-logo { max-width: 100%; }
    [data-page="references"] .legit-logo img { display: block; width: auto; max-width: min(100%, 240px); max-height: 90px; height: auto; object-fit: contain; }
    [data-page="references"] .gallery-title { margin-bottom: 1.75rem; }
    /* Galerie : la grille remplace l'accordéon (qui coupait les images et ne marchait pas au doigt) */
    [data-page="references"] .gallery-container { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); height: auto; gap: 2px; }
    [data-page="references"] .gallery-item { flex: none; min-height: 0; aspect-ratio: 4 / 3; background-size: cover; background-position: center; }
    [data-page="references"] .gallery-item:hover { flex: none; }
}
@media (max-width: 480px) {
    [data-page="references"] .gallery-container { grid-template-columns: 1fr; }
    [data-page="references"] .gallery-item { aspect-ratio: 16 / 9; }
}

/* ---------- FILTRES (cas clients / réalisations) ---------- */
@media (max-width: 992px) {
    .filter-row { flex-wrap: wrap; }
    .filter-label { min-width: 0; padding-top: 0; }
    .filter-buttons, .filter-options { flex-wrap: wrap; }
    .filter-btn { padding: 9px 14px; min-height: 40px; }
    .cards-grid { gap: 1.25rem; }
}

/* ---------- FORMULAIRES (contact-ia / diagnostic-ia) ---------- */
@media (max-width: 992px) {
    .contact-ia-main, .diag-ia-main { padding-left: 5%; padding-right: 5%; }
    .contact-text h1, .diag-ia-text h1 { margin-bottom: 1.25rem; }
    .contact-ia-form-wrapper, .diag-ia-form-wrapper { width: 100%; min-width: 0; }
    input, select, textarea { font-size: 16px; max-width: 100%; }  /* 16px : évite le zoom automatique d'iOS au focus */
}
@media (max-width: 600px) {
    .contact-ia-form-wrapper, .diag-ia-form-wrapper { padding: 22px 16px; border-radius: 14px; }
    .btn-submit { width: 100%; padding: 15px 20px; }
}

/* ---------- Desktop 993–1280px : méga-menus centrés sous la barre (plus de coupure à gauche) ---------- */
@media (min-width: 993px) and (max-width: 1280px) {
    .navbar-container .dropdown { position: static; }
    .navbar-container .mega-menu,
    .navbar-container nav ul li:nth-last-child(1) .mega-menu,
    .navbar-container nav ul li:nth-last-child(2) .mega-menu {
        left: 50%; right: auto; top: calc(100% + 8px); transform: translateX(-50%) translateY(10px);
    }
    .navbar-container .dropdown:hover .mega-menu,
    .navbar-container .dropdown.active .mega-menu,
    .navbar-container nav ul li:nth-last-child(1):hover .mega-menu,
    .navbar-container nav ul li:nth-last-child(2):hover .mega-menu,
    .navbar-container nav ul li:nth-last-child(1).active .mega-menu,
    .navbar-container nav ul li:nth-last-child(2).active .mega-menu { transform: translateX(-50%) translateY(0); }
    .navbar-container .mega-menu::before { content: ''; position: absolute; top: -24px; left: 0; right: 0; height: 24px; }
}
