/* ===========================================================================
   agrikole-child — home.css
   Refonte visuelle de l'accueil APABA — style « chaleureux nature ».

   - Chargé UNIQUEMENT sur la front page (functions.php : is_front_page()),
     APRÈS site-custom (dépendance déclarée) → gagne la cascade sans
     !important (sauf override d'inline shortcode explicitement justifié).
   - SCOPING : le thème agrikole compose lui-même l'attribut body class et
     n'applique PAS le filtre WP `body_class` (aucune classe `home`/
     `page-id-*`). On scope donc via le markup du contenu : `body:has(
     .apaba-home-hero)` pour les règles niveau page (idem pattern accepté
     `body:has(.apaba-article)` du plugin, cf. handoff), et les classes
     uniques `.apaba-home-*` / `.apaba-hero-*` (présentes uniquement sur
     l'accueil) pour les sections.
   - La page reste 100 % éditable dans WPBakery : on n'habille que le
     markup produit par les shortcodes natifs (vc_row/el_class, agrikole
     wprt-addons, plugin formations, psacp).
   - Carrousel & trio : v2 (audit DA — sélecteurs RÉELS `.psacp-*`/`.owl-*`
     et `.agrikole-content-box .inner`, pas `.wprt-contentbox`).
   - Palette identité APABA : crème, vert, ardoise, jaune, lime, teal.
   =========================================================================== */

body:has(.apaba-home-hero) {
    --h-cream:   #faf8f5;
    --h-cream2:  #f3ede1;
    --h-green:   #5b8c51;
    --h-green-d: #404a3d;
    --h-lime:    #b0ca41;
    --h-yellow:  #ecdd5e;
    --h-teal:    #1a8781;
    --h-ink:     #404a3d;
    --h-radius:  20px;
    --h-shadow:  0 14px 34px rgba(64, 74, 61, .10);
    --h-shadow-h:0 20px 44px rgba(64, 74, 61, .16);
}

/* ---------------------------------------------------------------------------
   0. Bandeau-titre du thème (« Accueil ») masqué sur l'accueil
   ---------------------------------------------------------------------------
   Le plugin Meta Box est inactif → le metabox agrikole « hide featured
   title » ne s'applique pas (cf. handoff). On masque proprement, scopé.
   header-fix.css gère déjà `#featured-title + #main-content{padding-top:0}`
   (le sélecteur reste valide même si le bandeau est display:none) → le
   hero arrive au ras du header, ce qui est voulu (hero plein écran). */
body:has(.apaba-home-hero) #featured-title {
    display: none;
}
body:has(.apaba-home-hero) #main-content {
    /* Le hero arrive au ras du header ; la dernière section colorée
       (partenaires) arrive au ras du footer (le thème laisse sinon
       padding:100px 0 → bande blanche disgracieuse avant le pied de
       page). Scopé accueil uniquement. */
    padding-top: 0;
    padding-bottom: 0;
}

/* ---------------------------------------------------------------------------
   1. HERO — image + accroche + boutons (cœur de la refonte)
   --------------------------------------------------------------------------- */
.apaba-home-hero {
    position: relative;
    background-color: var(--h-green);              /* repli si image absente */
    background-image:
        linear-gradient(180deg, rgba(64, 74, 61, .50) 0%, rgba(64, 74, 61, .62) 100%),
        url(/wp-content/uploads/2025/09/cereale.png);
    background-position: center, center;
    background-size: cover, cover;
    background-repeat: no-repeat, no-repeat;
}
.apaba-home-hero > .vc_column_container > .vc_column-inner,
.apaba-home-hero .wpb_wrapper {
    text-align: center;
}
.apaba-home-hero .wpb_text_column {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}
.apaba-home-hero .apaba-hero-kicker p {
    margin: 0;
    color: var(--h-yellow);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 3px;
    text-transform: uppercase;
}
.apaba-home-hero .apaba-hero-title p {
    margin: 10px 0 0;
    color: #fff;
    font-family: "Bookman Old Style", Georgia, "Times New Roman", serif;
    font-size: clamp(34px, 5vw, 60px);
    line-height: 1.1;
    font-weight: 700;
    text-shadow: 0 2px 14px rgba(0, 0, 0, .25);
}
.apaba-home-hero .apaba-hero-sub p {
    margin: 16px auto 0;
    max-width: 620px;
    color: rgba(255, 255, 255, .94);
    font-size: clamp(16px, 1.5vw, 20px);
    line-height: 1.6;
}
/* Boutons hero : couleurs portées par les attributs inline du shortcode
   (pilule rounded="999px"). On ne gère ici que la disposition. */
.apaba-home-hero .agrikole-align-box,
.apaba-home-hero [class*="align-box"],
.apaba-home-hero [class*="alignbox"] {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    align-items: center;
}
.apaba-home-hero a[class*="button"],
.apaba-home-hero .agrikole-button {
    margin: 0;
    min-width: 250px;          /* largeur identique pour les 2 CTA */
    box-sizing: border-box;
    text-align: center;
    justify-content: center;
}
/* Les 2 wrappers de bouton occupent la même base → cohérence parfaite */
.apaba-home-hero .agrikole-align-box .button-wrap {
    flex: 0 0 auto;
}

/* ---------------------------------------------------------------------------
   2. Rythme général des sections
   --------------------------------------------------------------------------- */
.apaba-home-section {
    background: var(--h-cream);
}
.apaba-home-section + .apaba-home-section {
    border-top: 1px solid rgba(64, 74, 61, .06);
}
.apaba-home-news {
    background: #fff;
}
.apaba-home-partners {
    background: var(--h-cream2);
}
.apaba-home-news .agrikole-align-box,
.apaba-home-news [class*="align-box"],
.apaba-home-news [class*="alignbox"] {
    text-align: center;
}

/* ---------------------------------------------------------------------------
   3a. Carrousel actualités (Post Slider & Carousel — design-2, layout 17425)
   ---------------------------------------------------------------------------
   Markup réel : .psacp-post-slide > .psacp-post-carousel-content
   > .psacp-post-img-bg > a > img  +  .psacp-post-margin-content.
   Le plugin pose une border #ddd radius 0 sur .content (bords durs) et des
   flèches noires carrées : on restyle intégralement, scopé. Sources images
   hétérogènes (affiches portrait + logos) → ratio fixe + object-fit:contain
   sur fond crème (affiche entière, pas de crop brutal). */
/* IMPORTANT : `.owl-stage-outer` a `overflow:hidden` (indispensable au
   carrousel) → TOUTE ombre portée d'une carte est ROGNÉE en un rectangle
   plein largeur à angles durs (= le « gros div » signalé). On ne met donc
   AUCUNE box-shadow ici ; définition de carte par un filet fin chaud
   (≠ le gris dur 2px #ddd du plugin, qu'on écrase via 4 classes :
   `.apaba-home-news` ajouté → chargé après → gagne). */
.apaba-home-news .psacp-post-carousel-wrap.psacp-design-2 .psacp-post-carousel-content {
    border: 1px solid rgba(64, 74, 61, .12);
    border-radius: var(--h-radius);
    overflow: hidden;
    background: #fff;
    box-shadow: none;
    transition: border-color .2s ease;
}
/* Survol : filet vert doux (pas de translate/shadow → rien à rogner).
   Neutralise aussi le bord bleu #03a9f5 du plugin au survol. */
.apaba-home-news .psacp-post-carousel-wrap.psacp-design-2 .psacp-post-slide:hover .psacp-post-carousel-content {
    border-color: rgba(91, 140, 81, .55);
}
.apaba-home-news .psacp-post-slide { padding: 6px; }

.apaba-home-news .psacp-post-img-bg {
    aspect-ratio: 4 / 3;
    height: auto;                 /* annule le 180px figé du plugin */
    background: var(--h-cream2);  /* fond crème solide — version d'origine */
    overflow: hidden;
}
.apaba-home-news .psacp-post-img-bg a {
    display: block;
    width: 100%;
    height: 100%;
}
.apaba-home-news .psacp-post-img-bg img {
    width: 100%;
    height: 100%;
    object-fit: contain;          /* affiche entière, pas de crop brutal */
    object-position: center;
    transition: transform .4s ease;
}
.apaba-home-news .psacp-post-slide:hover .psacp-post-img-bg img {
    transform: scale(1.03);
}

.apaba-home-news .psacp-post-margin-content {
    padding: 18px 20px 22px;
    text-align: center;
}
.apaba-home-news .psacp-post-title {
    font-size: 19px;
    line-height: 1.3;
    margin: 0 0 8px;
}
.apaba-home-news .psacp-post-title a {
    color: var(--h-ink);
    transition: color .2s ease;
}
.apaba-home-news .psacp-post-title a:hover { color: var(--h-green); }
.apaba-home-news .psacp-post-meta-data.psacp-post-date {
    font-size: 13px;
    color: var(--h-green);
    font-weight: 600;
}
.apaba-home-news .psacp-post-meta-data.psacp-post-date .fa { margin-right: 6px; }

/* Flèches : rondes, palette APABA, hors du visuel. */
.apaba-home-news .owl-nav .owl-prev,
.apaba-home-news .owl-nav .owl-next {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(64, 74, 61, .14);
    color: var(--h-green);
    font-size: 20px;
    line-height: 40px;
    box-shadow: var(--h-shadow);
    position: absolute;
    top: 32%;
    transition: background-color .2s ease, color .2s ease, transform .2s ease;
}
.apaba-home-news .owl-nav .owl-prev { left: -8px; }
.apaba-home-news .owl-nav .owl-next { right: -8px; }
.apaba-home-news .owl-nav .owl-prev:hover,
.apaba-home-news .owl-nav .owl-next:hover {
    background: var(--h-green);
    color: #fff;
    transform: scale(1.06);
}
.apaba-home-news .owl-nav .owl-prev:focus-visible,
.apaba-home-news .owl-nav .owl-next:focus-visible {
    outline: 2px solid var(--h-teal);
    outline-offset: 2px;
}

/* Points : le point visible = le bouton .owl-dot lui-même (le <span>
   interne est 0×0). Le layout psacp 17425 lui injecte une couleur accent
   orange via sa feuille (spécificité élevée) → on contre avec le conteneur
   réel `.psacp-wrap .owl-dots` + `!important` ciblé (override assumé d'un
   accent de page builder tiers, pour cohérence palette APABA). */
.apaba-home-news .owl-dots { margin-top: 22px; text-align: center; }
.apaba-home-news .psacp-wrap .owl-dots .owl-dot {
    width: 9px;
    height: 9px;
    background: rgba(64, 74, 61, .22) !important;
    border-radius: 999px;
    transition: width .25s ease, background-color .25s ease;
}
.apaba-home-news .psacp-wrap .owl-dots .owl-dot span { display: none; }
.apaba-home-news .psacp-wrap .owl-dots .owl-dot:hover {
    background: var(--h-green) !important;
}
.apaba-home-news .psacp-wrap .owl-dots .owl-dot.active {
    width: 26px !important;
    background: var(--h-green) !important;
}
.apaba-home-news .psacp-wrap .owl-dots .owl-dot:focus-visible {
    outline: 2px solid var(--h-teal);
    outline-offset: 3px;
}

/* ---------------------------------------------------------------------------
   3b. Bloc « Nos formations à venir » (shortcode plugin)
   --------------------------------------------------------------------------- */
.apaba-modern-formations-wrap {
    background: #fff;
    border: 1px solid rgba(64, 74, 61, .10);
    border-radius: var(--h-radius);
    box-shadow: var(--h-shadow);
    padding: 14px 16px;
}
.apaba-home-news .apaba-modern-formations-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.apaba-home-news .apaba-formation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 6px;
    border-bottom: 1px solid rgba(64, 74, 61, .10);
}
.apaba-home-news .apaba-modern-formations-list li:last-child .apaba-formation-item,
.apaba-home-news .apaba-formation-item:last-child {
    border-bottom: 0;
}
.apaba-home-news .apaba-formation-info h4 {
    margin: 0 0 4px;
    font-size: 18px;
    line-height: 1.3;
}
.apaba-home-news .apaba-formation-info h4 a { color: var(--h-ink); }
.apaba-home-news .apaba-formation-info h4 a:hover { color: var(--h-green); }
.apaba-home-news .apaba-formation-date {
    font-size: 14px;
    color: var(--h-green);
    font-weight: 600;
}
.apaba-home-news .apaba-btn-outline {
    display: inline-block;
    white-space: nowrap;
    padding: 8px 16px;
    border: 1px solid var(--h-green);
    border-radius: 999px;
    color: var(--h-green);
    font-weight: 600;
    font-size: 14px;
    transition: background-color .2s ease, color .2s ease;
}
.apaba-home-news .apaba-btn-outline:hover {
    background: var(--h-green);
    color: #fff;
}

/* Boutons « Toutes les actualités » / « Toutes nos formations » :
   le shortcode les rend fond blanc + texte vert (→ quasi invisibles au
   repos sur section claire, ne se révèlent qu'au survol). On ajoute un
   contour vert au repos = pilule outline lisible (le `border` n'est pas
   en inline → pas de !important ; le survol vert plein reste géré par les
   attributs hover du shortcode). */
.apaba-home-news .agrikole-button {
    border: 1.5px solid var(--h-green);
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

/* ---------------------------------------------------------------------------
   4. Trio d'accès (Contact / Association / Adhérer) — cartes photo
   ---------------------------------------------------------------------------
   (Le bloc CONSOMMEZ/PRODUISEZ a été retiré : redondant avec les 2 boutons
   du hero — décision utilisateur 2026-05-18.)

   Les images cereale/vigne/tomate intègrent un panneau translucide clair
   dans leur partie HAUTE, prévu pour le texte. On cale donc le contenu
   EN HAUT (`background-position:center top` pour garder ce panneau visible)
   et on renforce une zone claire crème dégradée (lisibilité homogène sur
   les 3 photos — la vigne est plus sombre). Texte ardoise serif (cohérent
   avec la typo du site). Markup réel : .agrikole-content-box > .inner >
   .agrikole-spacer + .wpb_text_column + .agrikole-align-box > a.agrikole-button. */
.apaba-home-trio .vc_column-inner { height: 100%; }
.apaba-home-trio .agrikole-content-box,
.apaba-home-trio .agrikole-content-box .inner { height: 100%; }
.apaba-home-trio .agrikole-content-box .inner {
    position: relative;
    overflow: hidden;
    border-radius: var(--h-radius);
    background-position: center top !important;  /* panneau image = en haut */
    background-size: cover !important;
    box-shadow: var(--h-shadow);
    transition: transform .25s ease, box-shadow .25s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;                 /* contenu calé EN HAUT */
    align-items: center;
    min-height: 340px;
    padding: 30px 26px;
}
/* Zone claire douce dans la moitié HAUTE (renforce le panneau des images) :
   c'est la "différence de couleur" dans laquelle le texte est centré ;
   elle s'estompe avant le bas → le bouton se retrouve sur la photo. */
.apaba-home-trio .agrikole-content-box .inner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(250, 248, 245, .90) 0%,
        rgba(250, 248, 245, .80) 30%,
        rgba(250, 248, 245, .30) 50%,
        rgba(250, 248, 245, 0)   62%
    );
    z-index: 0;
}
.apaba-home-trio .agrikole-content-box .inner > * {
    position: relative;
    z-index: 1;
}
.apaba-home-trio .agrikole-content-box .inner:hover {
    transform: translateY(-4px);
    box-shadow: var(--h-shadow-h);
}
/* Spacers inline du shortcode transformés en "ressorts" flex :
   - 1er spacer (haut)        → petit ressort : centre le texte dans la
     bande claire (pas collé en haut).
   - spacer après le texte    → grand ressort : repousse le bouton VERS
     LE BAS, sur la photo, hors de la zone claire.
   (Le bouton/alignbox est le dernier enfant → il finit en pied de carte,
   à 30px du bord via le padding du .inner.) */
.apaba-home-trio .agrikole-content-box .inner .agrikole-spacer {
    height: 0 !important;
    min-height: 0;
}
.apaba-home-trio .agrikole-content-box .inner > .agrikole-spacer:first-child {
    flex: 1 1 0;
    min-height: 24px;
}
.apaba-home-trio .agrikole-content-box .inner > .wpb_text_column ~ .agrikole-spacer {
    flex: 2.4 1 0;
    min-height: 56px;
}
.apaba-home-trio .agrikole-content-box .inner .wpb_text_column {
    padding: 0 4px;
    text-align: center;
}
.apaba-home-trio .agrikole-content-box .inner .wpb_text_column p {
    color: var(--h-green-d);
    font-family: "Bookman Old Style", Georgia, "Times New Roman", serif;
    font-size: 21px;
    line-height: 1.35;
    font-weight: 700;
    margin: 0;
}
/* Bouton : couleurs/rayon depuis les attributs inline du shortcode */
.apaba-home-trio .agrikole-align-box {
    margin-top: 4px;
    text-align: center;
}
.apaba-home-trio .agrikole-align-box .button-wrap { display: inline-block; }
.apaba-home-trio .agrikole-content-box .inner a.agrikole-button {
    padding: 13px 30px;
    font-size: 16px;
    line-height: 1.2;
    transition: transform .2s ease, box-shadow .2s ease;
}
.apaba-home-trio .agrikole-content-box .inner a.agrikole-button:hover {
    transform: translateY(-2px);
}
.apaba-home-trio .agrikole-content-box .inner a.agrikole-button:focus-visible {
    outline: 2px solid var(--h-green-d);
    outline-offset: 3px;
}

/* ---------------------------------------------------------------------------
   6. Partenaires
   --------------------------------------------------------------------------- */
.apaba-home-partners .wprt-partners img,
.apaba-home-partners [class*="partner"] img {
    filter: grayscale(1);
    opacity: .72;
    transition: filter .25s ease, opacity .25s ease;
}
.apaba-home-partners .wprt-partners img:hover,
.apaba-home-partners [class*="partner"] img:hover {
    filter: grayscale(0);
    opacity: 1;
}

/* ---------------------------------------------------------------------------
   7. Responsive
   --------------------------------------------------------------------------- */
@media only screen and (max-width: 991px) {
    .apaba-home-news .vc_column_container {
        width: 100%;
    }
    .apaba-home-trio .vc_row_inner .vc_column_container { width: 100%; }
    .apaba-home-trio .agrikole-content-box .inner { min-height: 300px; }
}
@media only screen and (max-width: 575px) {
    .apaba-home-hero .agrikole-align-box,
    .apaba-home-hero [class*="align-box"],
    .apaba-home-hero [class*="alignbox"] {
        flex-direction: column;
    }
    .apaba-home-news .apaba-formation-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .apaba-home-news .owl-nav .owl-prev { left: 2px; }
    .apaba-home-news .owl-nav .owl-next { right: 2px; }
    .apaba-home-trio .agrikole-content-box .inner {
        min-height: 280px;
        padding: 26px 20px;
    }
    .apaba-home-trio .agrikole-content-box .inner .wpb_text_column p { font-size: 19px; }
}
