/*
Theme Name: CidmSavoie
Theme URI: https://cidmsavoie.fr
Author: Elhadji
Author URI: https://cidmsavoie.fr
Description: Thème custom WordPress pour CidmSavoie
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cidmsavoie
Tags: custom-theme, responsive
*/

/* ===== VARIABLES =====
   Palette de contraste WCAG 2.x AAA :
   --orange (#883800) atteint >=7:1 sur blanc ET sur --orange-pale,
   utilisé pour tout texte, icône, bouton et bordure interactive.
   --orange-vivid (#FF6B00) est réservé aux éléments strictement
   décoratifs sans texte (dégradés, lignes d'accent, lueurs de fond) :
   ces éléments ne sont pas soumis aux exigences de contraste de texte.
*/
:root {
    --orange:        #883800;
    --orange-hover:  #6B2C00;
    --orange-vivid:  #FF6B00;
    --orange-light:  #FF8C42;
    --orange-pale:   #FFF3EC;
    --white:         #ffffff;
    --gray-50:       #f9fafb;
    --gray-100:      #f3f4f6;
    --gray-200:      #e5e7eb;
    --gray-500:      #6b7280;
    --gray-700:      #374151;
    --dark:          #111827;
    --header-h:      100px;
    --focus-ring:    #1d4ed8;
}

/* Respecte la préférence "réduire les animations" de l'utilisateur (AAA 2.3.3) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visible cohérent et fortement contrasté sur toute la navigation
   clavier (AAA 2.4.7 / 2.4.11) — ne s'affiche qu'au clavier grâce à
   :focus-visible, n'altère pas l'usage souris/tactile. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Lien d'évitement ("Aller au contenu") — masqué visuellement par défaut,
   réapparaît au premier plan dès qu'il reçoit le focus clavier
   (WCAG 2.4.1 Bypass Blocks). */
.skip-link {
    position: absolute;
    top: -100px;
    left: 12px;
    z-index: 100000;
    background: var(--dark);
    color: var(--white);
    padding: 14px 24px;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: top .2s ease;
}
.skip-link:focus {
    top: 0;
}

/* Classe utilitaire WordPress standard : contenu réservé aux lecteurs
   d'écran, invisible à l'écran sans être supprimé du DOM. */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    width: 1px;
    word-wrap: normal !important;
}
.skip-link.screen-reader-text:focus {
    clip: auto !important;
    clip-path: none;
    height: auto;
    width: auto;
    display: block;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--white);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}


/* ═══════════════════════════════════════
   HEADER — compact, blanc, ombre légère
════════════════════════════════════════ */
header {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--header-h);
    z-index: 1000;
    background: var(--white);
    box-shadow: 0 1px 0 var(--gray-200), 0 4px 20px rgba(0,0,0,.06);
}

.header-container {
    max-width: 1400px;
    height: 100%;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo a { display: flex; align-items: center; }

.site-logo img { height: 150px; width: auto; transition: height .2s; }

.main-nav {
    display: flex;
    gap: 36px;
    align-items: center;
}

.main-nav > a,
.nav-item > a {
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: .2px;
    transition: color .2s;
    position: relative;
    padding-bottom: 4px;
}

.main-nav > a::after,
.nav-item > a::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 0; height: 2px;
    background: var(--orange);
    border-radius: 2px;
    transition: width .25s;
}

.main-nav > a:hover,
.nav-item > a:hover { color: var(--orange); }
.main-nav > a:hover::after,
.nav-item > a:hover::after { width: 100%; }

/* CTA nav */
.nav-cta {
    background: var(--orange);
    color: var(--white) !important;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 600 !important;
    transition: background .2s, transform .2s !important;
}
.nav-cta::after { display: none !important; }
.nav-cta:hover { background: var(--orange-hover) !important; transform: translateY(-1px); }


/* ═══════════════════════════════════════
   BURGER MENU (toggle)
════════════════════════════════════════ */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    cursor: pointer;
    z-index: 1100;
    position: relative;
    flex-shrink: 0;
}

.nav-toggle-bar {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--dark);
    border-radius: 2px;
    transition: transform .3s ease, opacity .3s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,.45);
    backdrop-filter: blur(2px);
    z-index: 1010;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}
.nav-overlay.is-open { opacity: 1; visibility: visible; }


/* ═══════════════════════════════════════
   MEGA MENU (desktop = hover)
════════════════════════════════════════ */
.nav-item { position: relative; }

.mega-menu {
    position: fixed;
    left: 0;
    top: var(--header-h);
    width: 100vw;
    background: var(--white);
    border-top: 2px solid var(--orange);
    box-shadow: 0 20px 60px rgba(0,0,0,.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .25s, transform .25s, visibility .25s;
    z-index: 999;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
}

/* :focus-within ouvre le mega menu dès qu'un lien à l'intérieur (ou le
   déclencheur lui-même) reçoit le focus clavier — sans cela, le mega
   menu déclenché en CSS pur au :hover serait totalement inatteignable
   au clavier (échec WCAG 2.1.1 Keyboard). */
.has-megamenu:hover .mega-menu,
.has-megamenu:focus-within .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

.mega-col h4 {
    color: var(--orange);
    margin-bottom: 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-100);
}

.mega-col ul { list-style: none; }

.mega-col li { margin-bottom: 6px; }

.mega-col li a {
    color: var(--gray-700);
    text-decoration: none;
    font-size: 13.5px;
    transition: color .2s;
    display: block;
    padding: 3px 0;
}
.mega-col li a::after { display: none !important; }
.mega-col li a:hover { color: var(--orange); padding-left: 4px; }


/* ═══════════════════════════════════════
   HERO — blanc + accent orange
════════════════════════════════════════ */
.hero {
    margin-top: var(--header-h);
    min-height: calc(100vh - var(--header-h));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--gray-50);
    padding: 80px 40px;
}

/* Cercle déco orange en haut-droite */
.hero::before {
    content: '';
    position: absolute;
    top: -160px; right: -160px;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(255,107,0,.12) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* Ligne orange diagonale (décorative, sans texte : orange vif autorisé) */
.hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--orange-vivid), #ffb347);
}

.bg-blobs { display: none; }

/* Fond animé du hero — diapositives en fondu enchaîné (voir front-page.php
   pour le calcul du timing, injecté en <style> inline par image). */
.hero-bg-slider {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.hero-bg-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    animation-name: heroBgFade;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    will-change: opacity;
}

/* Voile clair au-dessus des photos : garantit que le texte du hero
   (couleurs sombres définies pour un fond clair) reste parfaitement
   lisible quelle que soit la photo affichée, contraste AAA préservé. */
.hero-bg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(249, 250, 251, 0.82);
}

@media (prefers-reduced-motion: reduce) {
    .hero-bg-slide { animation: none; opacity: 0; }
    .hero-bg-slide:first-child { opacity: 1; }
}

.hero-content {
    max-width: 760px;
    position: relative;
    z-index: 1;
    text-align: center;
}

.location-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--orange-pale);
    border: 1px solid rgba(255,107,0,.25);
    color: var(--orange);
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 28px;
}

.hero h1 {
    font-size: clamp(42px, 6vw, 72px);
    font-weight: 800;
    line-height: 1.08;
    color: var(--dark);
    margin-bottom: 20px;
    letter-spacing: -1.5px;
}

.hero h1 span { color: var(--orange); }

.hero > .hero-content > p,
.hero p {
    font-size: 18px;
    color: var(--gray-500);
    margin-bottom: 40px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.hero img {
    display: block;
    max-height: 150px;
    width: auto;
    margin: 32px auto 0;
    opacity: .9;
}

.cta-buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn {
    padding: 14px 36px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all .25s;
    text-decoration: none;
    display: inline-block;
    letter-spacing: .2px;
}

.btn-primary {
    background: var(--orange);
    color: var(--white);
    box-shadow: 0 6px 20px rgba(255,107,0,.35);
}
.btn-primary:hover {
    background: var(--orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(255,107,0,.45);
}

.btn-secondary {
    background: var(--white);
    color: var(--orange);
    border: 1.5px solid var(--orange);
}
.btn-secondary:hover {
    background: var(--orange-pale);
    transform: translateY(-2px);
}


/* ═══════════════════════════════════════
   SECTIONS COMMUNES
════════════════════════════════════════ */
.section-title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.section-title span { color: var(--orange); }

.section-subtitle {
    font-size: 16px;
    color: var(--gray-500);
    margin-bottom: 56px;
    max-width: 520px;
}

.section-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--orange);
    background: var(--orange-pale);
    padding: 5px 14px;
    border-radius: 100px;
    margin-bottom: 16px;
}


/* ═══════════════════════════════════════
   GALERIE EN IMAGES — grille responsive
════════════════════════════════════════ */
.section-gallery {
    background: var(--gray-50);
    padding: 96px 40px;
    border-top: 1px solid var(--gray-100);
}

.section-gallery-container { max-width: 1400px; margin: 0 auto; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 220px;
    gap: 16px;
}

/* Met en valeur la 1re et la 4e image (mosaïque plus vivante) */
.gallery-item:nth-child(3n+1) { grid-row: span 2; }

.gallery-item {
    margin: 0;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: var(--gray-100);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease;
}

.gallery-item:hover img { transform: scale(1.08); }

.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,.35) 100%);
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
}
.gallery-item:hover::after { opacity: 1; }


/* ═══════════════════════════════════════
   SLIDER / CARROUSEL
════════════════════════════════════════ */
.section-slider {
    background: var(--white);
    padding: 96px 40px;
    border-top: 1px solid var(--gray-100);
}

.section-slider-container { max-width: 1000px; margin: 0 auto; }

.cidm-slider {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: var(--gray-100);
    box-shadow: 0 20px 60px rgba(0,0,0,.1);
}

.cidm-slider-track {
    position: relative;
    aspect-ratio: 16/8;
    width: 100%;
}

.cidm-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .6s ease;
}
.cidm-slide.is-active { opacity: 1; visibility: visible; }

.cidm-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cidm-slide-caption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 32px 28px 20px;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,.65) 100%);
    color: var(--white);
    font-size: 15px;
    font-weight: 600;
}

.cidm-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
    cursor: pointer;
    transition: all .2s;
    z-index: 2;
}
.cidm-slider-arrow:hover { background: var(--white); transform: translateY(-50%) scale(1.08); }
.cidm-slider-prev { left: 16px; }
.cidm-slider-next { right: 16px; }

.cidm-slider-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 2;
}

.cidm-slider-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,.5);
    cursor: pointer;
    padding: 0;
    transition: all .2s;
}
.cidm-slider-dot.is-active,
.cidm-slider-dot:hover { background: var(--white); transform: scale(1.25); }


/* ═══════════════════════════════════════
   SECTION THÉMATIQUES — fond blanc
════════════════════════════════════════ */
.section-thematiques {
    background: var(--white);
    padding: 96px 40px;
    border-top: 1px solid var(--gray-100);
}

.section-thematiques-container { max-width: 1400px; margin: 0 auto; }

.thematiques-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    padding: 28px;
    border-radius: 14px;
    transition: all .25s cubic-bezier(.4,0,.2,1);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--orange-vivid);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s;
}

.card:hover {
    border-color: rgba(255,107,0,.3);
    box-shadow: 0 12px 32px rgba(255,107,0,.1);
    transform: translateY(-4px);
}
.card:hover::before { transform: scaleX(1); }

.card h3 {
    color: var(--dark);
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 700;
}
.card p { color: var(--gray-500); font-size: 13.5px; }


/* ═══════════════════════════════════════
   SECTION SERVICES — fond gris clair
════════════════════════════════════════ */
.section-services {
    background: var(--gray-50);
    padding: 96px 40px;
    border-top: 1px solid var(--gray-100);
}

.section-services-container { max-width: 900px; margin: 0 auto; }

.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    position: relative;
    padding-bottom: 48px;
}

.timeline-item:last-child { padding-bottom: 0; }

/* Ligne verticale */
.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 21px; top: 44px;
    width: 2px;
    bottom: 0;
    background: linear-gradient(180deg, var(--orange-vivid) 0%, transparent 100%);
    opacity: .3;
}

.timeline-line { display: none; }

.timeline-marker {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--orange);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(255,107,0,.35);
    position: relative;
    z-index: 1;
}

.timeline-content {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    padding: 28px 32px;
    flex: 1;
    transition: all .25s;
}

.timeline-item:hover .timeline-content {
    border-color: rgba(255,107,0,.3);
    box-shadow: 0 8px 28px rgba(255,107,0,.1);
    transform: translateX(6px);
}

.timeline-icon { font-size: 28px; display: block; margin-bottom: 12px; }

.timeline-content h3 {
    color: var(--dark);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}
.timeline-content p { color: var(--gray-500); font-size: 15px; }


/* ═══════════════════════════════════════
   SECTION PERMANENCES — blanc + cards orange
════════════════════════════════════════ */
.section-permanences {
    background: var(--white);
    padding: 96px 40px;
    border-top: 1px solid var(--gray-100);
}

.section-permanences-container { max-width: 1400px; margin: 0 auto; }

.permanences-flex {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.permanence-item {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 40px 32px;
    text-align: center;
    transition: all .25s;
    cursor: default;
}

.permanence-item:hover {
    border-color: var(--orange);
    box-shadow: 0 12px 36px rgba(255,107,0,.12);
    transform: translateY(-6px);
}

.permanence-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 20px;
    transition: transform .3s;
}
.permanence-item:hover .permanence-icon { transform: scale(1.1); }

.permanence-item h3 {
    color: var(--dark);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}
.permanence-item p { color: var(--gray-500); font-size: 14.5px; }


/* ═══════════════════════════════════════
   SECTION CONTACT — fond orange foncé
════════════════════════════════════════ */
.section-contact {
    background: var(--dark);
    padding: 96px 40px;
}

.section-contact-container { max-width: 1400px; margin: 0 auto; }

.section-contact .section-title { color: var(--white); margin-bottom: 8px; }
.section-contact .section-subtitle { color: rgba(255,255,255,.55); margin-bottom: 0; }

.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    align-items: start;
    margin-top: 48px;
}

.contact-left { display: flex; flex-direction: column; gap: 16px; }

.contact-item-full {
    background: rgba(255,255,255,.06);
    padding: 22px 26px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.1);
    transition: all .25s;
    display: flex;
    align-items: center;
    gap: 16px;
}

.contact-item-full:hover {
    background: rgba(255,107,0,.15);
    border-color: rgba(255,107,0,.4);
    transform: translateX(6px);
}

.contact-item-full strong {
    color: var(--orange-light);
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 4px;
}

.contact-item-full a,
.contact-item-full p {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-size: 15px;
    transition: color .2s;
}
.contact-item-full a:hover { color: var(--orange-light); }

.contact-right {
    height: 480px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
}


/* ═══════════════════════════════════════
   FOOTER
════════════════════════════════════════ */
footer {
    background: #0d0d0d;
    border-top: 1px solid rgba(255,107,0,.15);
    color: var(--gray-500);
    padding: 56px 40px 28px;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 48px;
}

.footer-section h4 {
    color: var(--white);
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 700;
}

.footer-section p,
.footer-section a {
    color: var(--gray-500);
    text-decoration: none;
    margin-bottom: 10px;
    display: block;
    font-size: 13.5px;
    transition: color .2s;
}
.footer-section a:hover { color: var(--orange-light); }

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    border-top: 1px solid rgba(255,255,255,.06);
    padding-top: 24px;
    text-align: center;
    font-size: 13px;
    color: #555;
}
.footer-bottom a {
    color: var(--orange-light);
    text-decoration: none;
}
.footer-bottom a:hover { text-decoration: underline; }


/* ═══════════════════════════════════════
   FIX HEADER — toutes les pages sans hero
════════════════════════════════════════ */
/* .site-main ne porte PAS de margin-top : chaque page qui l'utilise
   contient déjà en premier enfant un .hero / .page-hero / .article-hero
   qui gère lui-même l'espacement sous le header fixe. Ajouter la même
   margin-top ici en plus créait un double espace (les deux marges ne
   fusionnent pas à cause de l'overflow/position sur ces blocs). */

/* Fix pour archive.php générique */
.archive-generic-wrap {
    margin-top: var(--header-h);
    padding: 64px 40px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}


/* ═══════════════════════════════════════
   ARCHIVE FORMATIONS — filtres + grille
════════════════════════════════════════ */
.archive-stats {
    display: flex;
    gap: 24px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.archive-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--gray-500);
}

.archive-stat strong {
    font-size: 20px;
    font-weight: 800;
    color: var(--orange);
}

/* Barre de filtres */
.archive-filters {
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    position: sticky;
    top: var(--header-h);
    z-index: 100;
    padding: 0 40px;
}

.archive-filters-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 14px 0;
    scrollbar-width: none;
}
.archive-filters-container::-webkit-scrollbar { display: none; }

.filter-btn {
    display: inline-block;
    padding: 7px 18px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    background: var(--gray-100);
    text-decoration: none;
    white-space: nowrap;
    transition: all .2s;
    border: 1.5px solid transparent;
    flex-shrink: 0;
}

.filter-btn:hover {
    background: var(--orange-pale);
    color: var(--orange);
    border-color: rgba(255,107,0,.3);
}

.filter-btn.active {
    background: var(--orange);
    color: var(--white);
    border-color: var(--orange);
}

/* Grille formations archive */
.formations-archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px;
}

.formation-archive-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all .25s;
}

.formation-archive-card:hover {
    box-shadow: 0 16px 48px rgba(255,107,0,.12);
    transform: translateY(-4px);
    border-color: rgba(255,107,0,.35);
}

.formation-card-img {
    display: block;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--orange-pale);
    position: relative;
    text-decoration: none;
}

.formation-card-img img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .4s;
}

.formation-archive-card:hover .formation-card-img img {
    transform: scale(1.05);
}

.formation-card-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--orange-pale), #fff7f0);
}

.formation-card-icon { font-size: 48px; }

.formation-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.formation-card-cat {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--orange);
    text-decoration: none;
}
.formation-card-cat:hover { text-decoration: underline; }

.formation-card-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
}
.formation-card-title a {
    color: var(--dark);
    text-decoration: none;
    transition: color .2s;
}
.formation-card-title a:hover { color: var(--orange); }

.formation-card-excerpt {
    font-size: 14px;
    color: var(--gray-500);
    line-height: 1.6;
    flex: 1;
    margin: 0;
}

.formation-card-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--orange);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 4px;
    transition: gap .2s;
}
.formation-card-link:hover { gap: 8px; text-decoration: underline; }


/* ═══════════════════════════════════════
   SINGLE ARTICLE
════════════════════════════════════════ */
.article-hero {
    margin-top: var(--header-h);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 56px 40px 48px;
    position: relative;
}
.article-hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--orange-vivid), #ffb347);
}
.article-hero-container { max-width: 860px; margin: 0 auto; }

.formation-hero { background: linear-gradient(135deg, var(--orange-pale) 0%, #fff7f0 100%); }
.formation-hero-desc {
    font-size: 17px;
    color: var(--gray-700);
    margin: 16px 0 20px;
    max-width: 640px;
    line-height: 1.7;
}

.article-back {
    display: inline-block;
    color: var(--orange);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
    transition: gap .2s;
}
.article-back:hover { text-decoration: underline; }

.article-hero-title {
    font-size: clamp(28px, 4vw, 48px);
    font-weight: 800;
    color: var(--dark);
    line-height: 1.15;
    letter-spacing: -1px;
    margin-bottom: 24px;
}

.article-hero-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--gray-500);
}
.article-author { display: flex; align-items: center; gap: 8px; }
.article-author-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--orange-pale);
}
.article-sep { color: var(--gray-200); }

.article-featured-img { background: var(--gray-100); }
.article-featured-img-container { max-width: 1000px; margin: 0 auto; }
.article-thumbnail { width: 100%; max-height: 480px; object-fit: cover; display: block; }

/* Layout 2 colonnes */
.article-layout { padding: 64px 40px; background: var(--white); }
.article-layout-container {
    max-width: 1160px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 64px;
    align-items: start;
}

/* Contenu éditeur */
.article-content {
    font-size: 17px;
    line-height: 1.8;
    color: var(--gray-700);
}
.article-content h2 {
    font-size: 26px; font-weight: 700;
    color: var(--dark); margin: 48px 0 16px;
    padding-top: 16px;
    border-top: 2px solid var(--gray-100);
}
.article-content h3 { font-size: 20px; font-weight: 700; color: var(--dark); margin: 32px 0 12px; }
.article-content p { margin-bottom: 20px; }
.article-content a { color: var(--orange); text-decoration: underline; }
.article-content ul, .article-content ol { padding-left: 24px; margin-bottom: 20px; }
.article-content li { margin-bottom: 8px; }
.article-content blockquote {
    border-left: 4px solid var(--orange);
    padding: 16px 24px;
    margin: 32px 0;
    background: var(--orange-pale);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--gray-700);
}
.article-content img { max-width: 100%; border-radius: 10px; margin: 16px 0; }
.article-content strong { color: var(--dark); font-weight: 700; }

/* Tags */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--gray-100);
}
.article-tags a {
    background: var(--orange-pale);
    color: var(--orange);
    text-decoration: none;
    padding: 5px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    transition: background .2s;
}
.article-tags a:hover { background: var(--orange); color: var(--white); }

/* Navigation articles */
.article-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--gray-100);
}
.article-nav-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    text-decoration: none;
    transition: all .2s;
}
.article-nav-item:hover { border-color: var(--orange); box-shadow: 0 4px 16px rgba(255,107,0,.1); }
.article-nav-next { text-align: right; }
.article-nav-dir { font-size: 12px; color: var(--orange); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.article-nav-title { font-size: 14px; font-weight: 600; color: var(--dark); }

/* Sidebar */
.article-sidebar { position: sticky; top: calc(var(--header-h) + 24px); }

.sidebar-widget {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
}
.sidebar-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}
.sidebar-related { display: flex; flex-direction: column; gap: 14px; }
.sidebar-related-item {
    display: flex; gap: 12px; align-items: center;
    text-decoration: none; transition: opacity .2s;
}
.sidebar-related-item:hover { opacity: .75; }
.sidebar-related-thumb { width: 60px; height: 60px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--gray-100); }
.sidebar-related-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-related-body { display: flex; flex-direction: column; gap: 4px; }
.sidebar-related-title { font-size: 13.5px; font-weight: 600; color: var(--dark); line-height: 1.4; }
.sidebar-related-date { font-size: 12px; color: var(--gray-500); }

.sidebar-cta {
    background: var(--dark);
    border-color: var(--dark);
    text-align: center;
}
.sidebar-cta-text {
    color: rgba(255,255,255,.8);
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 18px;
}


/* ═══════════════════════════════════════
   PAGES INTÉRIEURES — HERO BANNER
════════════════════════════════════════ */
.page-hero {
    margin-top: var(--header-h);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 64px 40px 56px;
    position: relative;
    overflow: hidden;
}

.page-hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--orange-vivid), #ffb347);
}

.page-hero-container { max-width: 1400px; margin: 0 auto; }

.page-section { padding: 80px 40px; }
.page-section.bg-white { background: var(--white); }
.page-section.bg-gray  { background: var(--gray-50); border-top: 1px solid var(--gray-100); border-bottom: 1px solid var(--gray-100); }

.page-container { max-width: 1400px; margin: 0 auto; }

.page-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: start;
}


/* ═══════════════════════════════════════
   PAGE FORMATIONS — cards liens
════════════════════════════════════════ */
.formations-grid { display: flex; flex-direction: column; gap: 12px; }

.formation-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    text-decoration: none;
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
}

.formation-card:hover {
    border-color: var(--orange);
    color: var(--orange);
    box-shadow: 0 4px 16px rgba(255,107,0,.1);
    transform: translateX(4px);
}

.formation-arrow {
    color: var(--orange);
    font-size: 16px;
    flex-shrink: 0;
    transition: transform .2s;
}
.formation-card:hover .formation-arrow { transform: translateX(4px); }


/* ═══════════════════════════════════════
   PAGE ARTICLES — grille posts
════════════════════════════════════════ */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

.article-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    overflow: hidden;
    transition: all .25s;
    display: flex;
    flex-direction: column;
}
.article-card:hover {
    box-shadow: 0 12px 36px rgba(0,0,0,.1);
    transform: translateY(-4px);
    border-color: rgba(255,107,0,.3);
}

.article-thumb { display: block; aspect-ratio: 16/9; overflow: hidden; background: var(--gray-100); }
.article-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.article-card:hover .article-thumb img { transform: scale(1.04); }
.article-thumb-placeholder { aspect-ratio: 16/9; background: linear-gradient(135deg, var(--orange-pale), var(--gray-100)); }

.article-body { padding: 24px; flex: 1; display: flex; flex-direction: column; }

.article-meta { font-size: 12px; color: var(--gray-500); margin-bottom: 10px; }

.article-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; line-height: 1.4; }
.article-title a { color: var(--dark); text-decoration: none; transition: color .2s; }
.article-title a:hover { color: var(--orange); }

.article-excerpt { color: var(--gray-500); font-size: 14px; margin-bottom: 20px; flex: 1; }

.article-read-more {
    color: var(--orange);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: gap .2s;
}
.article-read-more:hover { text-decoration: underline; }

.no-content {
    text-align: center;
    padding: 80px 20px;
    color: var(--gray-500);
    font-size: 16px;
}
.no-content h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 12px;
}

/* Formulaire de recherche natif WordPress (get_search_form) */
.search-form {
    display: flex;
    gap: 8px;
    width: 100%;
}
.search-form .search-field {
    flex: 1;
    padding: 12px 16px;
    font-size: 15px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    color: var(--dark);
    font-family: inherit;
}
.search-form .search-field:focus {
    border-color: var(--orange);
    outline: none;
}
.search-form .search-submit {
    padding: 12px 24px;
    background: var(--orange);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s;
}
.search-form .search-submit:hover { background: var(--orange-hover); }
.search-form label { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.search-form .screen-reader-text { margin-bottom: 0; }

.pagination { margin-top: 56px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px; height: 40px;
    padding: 0 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 14px;
    transition: all .2s;
}
.pagination .page-numbers:hover,
.pagination .page-numbers.current {
    background: var(--orange);
    border-color: var(--orange);
    color: var(--white);
}


/* ═══════════════════════════════════════
   PAGE CONTACT
════════════════════════════════════════ */
.contact-page-grid {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 56px;
    align-items: start;
}

.contact-info-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 32px; }

.contact-info-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    transition: all .2s;
}
.contact-info-item:hover {
    border-color: rgba(255,107,0,.3);
    box-shadow: 0 4px 16px rgba(255,107,0,.08);
}

.contact-info-icon { font-size: 28px; flex-shrink: 0; }

.contact-info-item strong {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--orange);
    margin-bottom: 4px;
}
.contact-info-item a,
.contact-info-item p {
    color: var(--dark);
    text-decoration: none;
    font-size: 15px;
    transition: color .2s;
}
.contact-info-item a:hover { color: var(--orange); }

.contact-map {
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.contact-aside-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    padding: 28px;
    margin-bottom: 20px;
}

.contact-aside-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--gray-200);
}

.contact-aside-card ul { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.contact-aside-card li {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--gray-700);
}
.contact-aside-card li span:last-child { font-weight: 600; color: var(--dark); }

.consult-modes { display: flex; flex-direction: column; gap: 16px; }
.consult-mode-item { display: flex; align-items: center; gap: 14px; }
.consult-mode-item > span { font-size: 26px; flex-shrink: 0; }
.consult-mode-item strong { display: block; font-size: 14px; font-weight: 700; color: var(--dark); margin-bottom: 2px; }
.consult-mode-item p { font-size: 13px; color: var(--gray-500); }


/* ═══════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 1024px) {
    .contact-layout { grid-template-columns: 1fr; }
    .contact-right { height: 340px; }
    .page-two-col { grid-template-columns: 1fr; gap: 40px; }
    .contact-page-grid { grid-template-columns: 1fr; }
    .article-layout-container { grid-template-columns: 1fr; }
    .article-sidebar { position: static; }
    .article-nav { grid-template-columns: 1fr; }
    .formations-archive-grid { grid-template-columns: repeat(2, 1fr); }
}


/* ═══════════════════════════════════════
   BURGER MENU — Tablette & Mobile (≤1024px)
════════════════════════════════════════ */
@media (max-width: 1024px) {
    :root { --header-h: 84px; }

    .site-logo img { height: 56px; }

    .nav-toggle { display: flex; }

    .nav-overlay { display: block; }

    .main-nav {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: min(380px, 86vw);
        background: var(--white);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: calc(var(--header-h) + 16px) 0 32px;
        overflow-y: auto;
        box-shadow: -8px 0 40px rgba(0,0,0,.15);
        transform: translateX(100%);
        transition: transform .35s cubic-bezier(.4,0,.2,1);
        z-index: 1050;
    }

    .main-nav.is-open { transform: translateX(0); }

    .main-nav > a,
    .nav-item > a {
        padding: 18px 28px;
        font-size: 16px;
        border-bottom: 1px solid var(--gray-100);
        width: 100%;
        display: block;
    }
    .main-nav > a::after,
    .nav-item > a::after { display: none; }
    .main-nav > a:hover,
    .nav-item > a:hover { background: var(--orange-pale); }

    .nav-item { width: 100%; }

    /* Pas de mega menu déroulant sur mobile/tablette : "Formation" est un
       lien simple comme les autres, le mega menu reste masqué. */
    .mega-menu { display: none !important; }
}

@media (max-width: 768px) {
    .header-container { padding: 0 20px; }
    .site-logo img { height: 48px; }
    .section-thematiques, .section-services,
    .section-permanences, .section-contact,
    footer { padding: 64px 20px; }
    .hero { padding: 48px 20px; }
    .hero img { max-height: 100px; }
    .page-hero, .page-section { padding: 48px 20px; }
    .articles-grid { grid-template-columns: 1fr; }
    .formations-archive-grid { grid-template-columns: 1fr; }
    .article-hero { padding: 40px 20px 36px; }
    .article-layout { padding: 40px 20px; }
    .archive-filters { padding: 0 20px; }
    .main-nav { width: 100%; }

    .section-gallery, .section-slider { padding: 56px 20px; }
    .gallery-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 160px; }
    .gallery-item:nth-child(3n+1) { grid-row: span 1; }
    .cidm-slider-arrow { width: 36px; height: 36px; }
}

@media (max-width: 480px) {
    .gallery-grid { grid-template-columns: 1fr 1fr; grid-auto-rows: 140px; }
}

@media (max-width: 600px) {
    .cta-buttons { flex-direction: column; align-items: center; }
}

/* Empêche le scroll de la page quand le menu mobile est ouvert */
body.nav-open { overflow: hidden; }
