/*
 * Homepage Styles (front-page.php)
 * Refactored and sorted for clarity.
 * -------------------------------------------------- */

/* --- General Section Styles --- */

/* Smooth jump to anchors */
/* html { scroll-behavior: smooth; } */

/* Avoid anchored image sticking to the top nav */
/* img[id] { scroll-margin-top: 120px; } */

.front-page-content .container {
    margin-left: auto;
    margin-right: auto;
    max-width: 1000px;
    padding-left: 20px;
    padding-right: 20px;
}

.front-page-section:not(.hero-section) {
    margin-bottom: 40px;
    margin-top: 40px;
    padding: 20px 0;
    text-align: center;
}

.front-page-section h2 {
    margin-bottom: 1em;
}

.front-page-section p {
    font-size: 1em;
    line-height: 1.7;
    margin-bottom: 2em;
    margin-left: auto;
    margin-right: auto;
    max-width: 700px;
}

@media (max-width: 450px) {
    .front-page-section h2 {
        margin-bottom: 2em;
    }
}

/* ==========================================================
   1. HERO : STYLES DE BASE (Desktop Standard)
   ========================================================== */

:root { --header-height: 140px; }

.hero-section {
    position: relative;
    width: 100%;
    max-width: 1500px;
    /* default: fill viewport height (use dvh for mobile UI bars) */
    min-height: 100dvh;
    margin: 0 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: var(--site-color-background);
    box-sizing: border-box;
    padding-top: 0; /* no push by default; JS adds .hero-offset and sets --header-height */
}

/* When JS detects a hero at the top it adds .hero-offset and updates --header-height.
   Use the token to push the hero below the header and make its usable height equal
   to the remaining viewport: calc(100dvh - header). Avoid adding header height to
   the hero (which would create extra scrolling). */
.hero-section.hero-offset {
    padding-top: var(--header-height);
    height: calc(100dvh - var(--header-height)) !important;
}

/* Sur mobile, le header est souvent plus grand ou différent */
@media (max-width: 900px) {
    .hero-section.hero-offset {
       /* keep same variable-driven behaviour on narrow screens */
       padding-top: var(--header-height);
       height: calc(100dvh - var(--header-height)) !important;
    }
}

@media (max-width: 900px) {
    /* On cible toute section qui suit immédiatement le Hero */
    .hero-section + section[data-aos],
    .hero-section + div[data-aos],
    .hero-section + article[data-aos] {
        /* On force l'affichage immédiat pour éviter le vide */
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

.hero-img {    
    border-radius: 0 !important;
    display: block;
    transform-origin: center center;
    will-change: auto;
}

/* Ensure the image container clips scaled images so zoom doesn't overflow */
.hero-image {
    position: relative;
    overflow: hidden;
    /* border-radius: var(--site-image-border-radius); */
}

.hero-content {
    display: flex;
    flex-direction: column;
    width: 100%; 
}

/* Mobile default overlay: when no hero content bg is set, use a subtle
   dark overlay on small screens to improve contrast for stacked text. The
   variable `--hero-content-bg-color-rgba` is emitted by PHP only when the
   background option is enabled; when omitted we fall back to this value
   on mobile. */
:root { --hero-content-bg-mobile-default: rgba(0,0,0,0); }
@media (max-width: 600px) {
    :root { --hero-content-bg-mobile-default: rgba(0,0,0,0.35); }
}
.hero-content { background-color: var(--hero-content-bg-color-rgba, var(--hero-content-bg-mobile-default)); }



/* On centre toujours horizontalement le inner */
.hero-content-inner {
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: none; /* Allow Customizer-controlled width via --hero-content-width */
}

/* Ensure all text inside the hero-content-inner follows the computed/forced hero content text color */
.hero-content-inner,
.hero-content-inner p,
.hero-content-inner .hero-philosophy,
.hero-content-inner .hero-subtitle,
.hero-content-inner li,
.hero-content-inner a {
    color: var(--hero-content-text-color, var(--site-color-text));
    text-shadow: var(--hero-content-text-shadow, none);
}

/* Ensure paragraphs inside the hero content use the full available width
   and have comfortable line-height for readability. */
.hero-content-inner p {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}
.hero-content-inner .hero-philosophy { max-width: 100%; }

/* --- Typographie (Base) --- */
.hero-section h1 {
    color: var(--hero-title-color) !important;
    margin-bottom: 0.5em;
    font-family: var(--hero-title-font-family, var(--font-site-title));
    font-weight: var(--hero-title-weight, 700);
}
/* Note: hero H1 uses the CSS variable above; preview-specific inline JS
   writes font-family to the element when the Customizer control changes.
   Avoid !important here so inline styles from the preview script take
   precedence and the Customizer selection is visible immediately. */
.hero-section .hero-philosophy {
    color: var(--hero-content-text-color, var(--site-color-text));
    /* font-size: 2em; */
    font-weight: var(--hero-philosophy-weight, 500);
    margin-bottom: 1em;
}

/* --- Bouton (Base) --- */
.hero-section .hero-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    background: var(--hero-button-bg-color, linear-gradient(45deg, var(--accent-main, var(--accent-soft)), var(--site-color-text)));
    background-size: 200% 200%;
    border-radius: var(--site-image-border-radius);
    border: var(--hero-button-border, 1.5px solid var(--site-color-text));
    padding: 12px 25px;
    color: var(--hero-button-text-color, var(--site-color-text));
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    transition: transform 0.15s ease, background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    margin: 1em auto;
}

/* Effet léger de zoom au survol pour le bouton du hero */
.hero-section .hero-button:hover {
    transform: translateY(-2px) scale(1.03);
}




/* ==========================================================
   2. LES MODES DE DISPOSITION (Desktop)
   ========================================================== */

/* --- MODE CENTERED --- */
.hero--centered {
    display: grid; /* On utilise Grid */
    grid-template-areas: "hero-stack"; /* On définit une zone unique */
    grid-template-columns: 1fr; /* force la grille à occuper toute la largeur */
    align-items: center;
    justify-content: stretch; /* éviter le shrink-to-fit qui réduit la largeur */
    text-align: center;
    /* height: 100%;  */
}

/* On force l'image et le contenu à aller dans la même zone */
.hero--centered .hero-image,
.hero--centered .hero-content {
    grid-area: hero-stack; 
}

/* L'image remplit tout le fond */
.hero--centered .hero-image {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero--centered .hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Important pour que l'image ne soit pas déformée */
}

.hero--centered .hero-content {
    grid-area: hero-stack;
    /* Do not let the content grow unexpectedly — fill the hero area and center it */
    flex: 0 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    /* max-width: var(--hero-centered-max-width, 900px); */
    padding: 20px;
    margin-top: 0;
}

/* Ensure the content inner remains centered; allow width controlled by CSS variable */
.hero--centered .hero-content-inner {
    margin-left: auto;
    margin-right: auto;
    max-width: none;
}

/* --- MODE TRAVELING (PANORAMIQUE) --- */
.hero-traveling {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* L'image de fond pour Traveling (gérée via style inline dans le PHP) */
.hero-traveling .hero-slide-background {
    position: absolute;
    inset: 0;
    width: 120%; /* Plus large pour permettre le mouvement */
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 1;
    -webkit-animation: traveling-pan var(--hero-traveling-duration, 20s) linear infinite alternate;
        animation: traveling-pan var(--hero-traveling-duration, 20s) linear infinite alternate;
    -webkit-animation-play-state: running !important;
        animation-play-state: running !important;
    /* will-change: auto; */
    will-change: transform;
    -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
}

/* --- MODE : SPLIT / TWO-COLUMN (Statique) --- */
.hero--split:not(.hero-carousel), 
.hero--two-column:not(.hero-carousel) {
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: var(--hero-split-gap, 40px);
    /* padding: 0; */
}
.hero--split:not(.hero-carousel) .hero-content, 
.hero--two-column:not(.hero-carousel) .hero-content {
    justify-content: center;
    max-width: 400px;
    padding-left: 0;
    padding-right: 0;
    /* padding: 60px 40px; */
}
.hero--split:not(.hero-carousel) .hero-image, 
.hero--two-column:not(.hero-carousel) .hero-image {
    /* flex: 1.8; */
    position: relative;
    overflow: hidden;
    /* max-width: 60%; */
}
.hero--split:not(.hero-carousel) .hero-image .hero-img, 
.hero--two-column:not(.hero-carousel) .hero-image .hero-img {
    width: 100%;
    height: 100%;    /* Remplit toute la hauteur de la colonne */
    object-fit: cover; /* Recadre l'image sans la déformer */
    border-radius: var(--site-image-border-radius);
}

/* --- MODE : CAROUSEL (Swiper) --- */
.hero-swiper {
    width: 100% !important;
    /* height: 100%; */
    position: relative;
    overflow: hidden;
    display: block !important; /* Swiper doit être un bloc pour calculer */
}

.hero-swiper .swiper-wrapper {
    display: flex !important;
    flex-direction: row !important; /* Force l'alignement horizontal des slides */
    height: 100%;
    width: 100%;
}

.hero-swiper .swiper-slide {
    flex-shrink: 0; 
    width: 100% !important;
    height: 100%;
    position: relative;
    /* Ici, on peut utiliser Flex pour le contenu interne */
    display: flex; 
}


.hero-carousel:not(.hero--two-column) .swiper-slide {
    display: flex !important;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}
.hero-carousel:not(.hero--two-column) .hero-swiper {
    height: 100%;
}

/* Background element used by slides (fills slide, gets inline background-image) */
.hero-carousel:not(.hero--two-column) .hero-slide-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 1; /* Derrière le texte */
}

/* Masquer les slides non-actives */
.hero-section.hero-carousel .swiper-slide:not(.swiper-slide-active):not(:first-child) {
    opacity: 0;
    pointer-events: none; /* Rendre inactif au clic */
    visibility: hidden;
    z-index: 0 !important;
}
/* On force la première slide à être visible AVANT le JS */
.hero-section.hero-carousel .swiper-slide:first-child, 
.hero-section.hero-carousel .swiper-slide:first-child .hero-img {
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 1;
}

.hero--split.hero-carousel .hero-content, 
.hero--two-column.hero-carousel .hero-content {
    justify-content: center;
    max-width: 600px;
    padding: 60px 40px;
}
.hero--split.hero-carousel .hero-image, 
.hero--two-column.hero-carousel .hero-image {
    /* flex: 1.8; */
    position: relative;
    overflow: hidden;
    /* max-width: 60%; */
}

/* Navigation (arrows) appearance */
.hero-swiper .swiper-button-prev,
.hero-swiper .swiper-button-next {
    background: var(--swiper-navigation-bg, transparent);
    color: var(--accent-text, var(--accent-main));
    left: var(--swiper-navigation-sides-offset, 16px);
    position: absolute;
    /* top: calc(50% + (var(--header-height, 180px) / 2)); */
    /* transform: translateY(-50%); */
    z-index: 9;
}

.hero-swiper .swiper-button-next {
    left: auto;
    right: var(--swiper-navigation-sides-offset, 16px);
}

/* Pagination bullets */
.hero-swiper .swiper-pagination {
    bottom: var(--swiper-pagination-bottom, 16px);
    z-index: 9;
}

.hero-swiper .swiper-pagination-bullet {
    background: var(--swiper-pagination-bullet-inactive-color, rgba(255,255,255,0.5));
    margin: 0 var(--swiper-pagination-bullet-horizontal-gap, 6px);
    opacity: 1;
}

.hero-swiper .swiper-pagination-bullet-active {
    background: var(--accent-main);
}

/* Carousel en mode Two-Column */
.hero-carousel.hero--two-column .swiper-slide {
    flex-direction: row;
    align-items: stretch;
    /* padding: 0 10%; */
    gap: 40px;
}
.hero-carousel.hero--two-column .hero-content,
.hero-carousel.hero--two-column .hero-image {
    flex: 1;
    position: relative;
    text-align: center;
    z-index: 10;
}

/* --- INVERSION (Content First) --- */
.content-first { flex-direction: row-reverse !important; 
}

/* ==========================================================
   3. ANIMATIONS (Zoom & Traveling)
   ========================================================== */
.hero-zoom .hero-img, .hero-zoom .hero-slide-background {
    animation: hero-zoom-in var(--hero-zoom-duration, 18s) ease-in-out infinite alternate;
}
@keyframes hero-zoom-in {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

@keyframes traveling-pan {
    from { transform: translateX(0) scale(1); }
    to { transform: translateX(-10%) scale(1.1); }
}

@-webkit-keyframes traveling-pan {
    from { -webkit-transform: translateX(0) scale(1); transform: translateX(0) scale(1); }
    to { -webkit-transform: translateX(-10%) scale(1.1); transform: translateX(-10%) scale(1.1); }
}

/* Larger variant used on very wide viewports (1500px+).
   The media query switches to `traveling-pan-large` and a wider
   background; define corresponding keyframes here so the animation
   continues to run on big screens. */
@keyframes traveling-pan-large {
    from { transform: translateX(0) scale(1); }
    to   { transform: translateX(-15%) scale(1.12); }
}

@-webkit-keyframes traveling-pan-large {
    from { -webkit-transform: translateX(0) scale(1); transform: translateX(0) scale(1); }
    to   { -webkit-transform: translateX(-15%) scale(1.12); transform: translateX(-15%) scale(1.12); }
}

/* ==========================================================
   HERO: Subtle content 'Slide Up Reveal' (single-unit)
   - Triggered when body has class `hero-content-subtle-motion-enabled`
   - The entire `.hero-content-inner` animates as one unit (translateY + opacity)
   - Parent `.hero-content` is used for overflow:hidden to create the reveal
   - Starts 0.3s after `.swiper-slide-active` is present
   ========================================================== */

/* Use overflow:hidden on the immediate parent to perform the reveal without
   applying clip-path on the element that uses backdrop-filter. */
.hero-content-subtle-motion-enabled .swiper-slide .hero-content,
.hero-content-subtle-motion-enabled .hero-carousel .swiper-slide .hero-content {
    overflow: hidden;
}

/* Initial state: slightly shifted down and invisible */

.hero-content-subtle-motion-enabled .hero-content-inner {
    transform: translateY(20px);
    opacity: 0;
    will-change: transform, opacity;
    transition: transform 1600ms cubic-bezier(0.1, 0.7, 0.1, 1), opacity 1600ms cubic-bezier(0.1, 0.7, 0.1, 1);
}

/* Active slide: animate into place after a slightly longer delay so the
   background image is visible briefly before the content reveals */
.hero-content-subtle-motion-enabled .swiper-slide-active .hero-content-inner {
    transform: translateY(0);
    opacity: 1;
    transition-delay: 0.5s;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .hero-content-subtle-motion-enabled .hero-content-inner {
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

/* ==========================================================
   4. LE CONTENU 
   ========================================================== */
/* --- Effet de flou et fond semi-transparent pour le contenu --- */
.hero-content {
    position: relative;
    z-index: 10;   
    display: flex !important;
    flex-direction: column;
    height: auto;
    background: transparent !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

.hero-content-inner {
    margin-left: auto;
    margin-right: auto;
    /* width: 60%; */
    /* Width controlled by Customizer via --hero-content-width (percent). Responsive overrides applied below. */
    /* Default: allow the variable, but cap in two-column layouts via a more specific rule below. */
    width: var(--hero-content-width, 60%);
    max-width: 100%;
    padding: 20px;
    /* transition: all 0.3s ease; */
    border-radius: var(--site-image-border-radius);
    background-color: var(--hero-content-bg-color-rgba, rgba(0,0,0,0.3));
    -webkit-backdrop-filter: blur(var(--hero-content-backdrop-filter-blur, 5px)) brightness(var(--hero-content-backdrop-filter-brightness, 100%));
    backdrop-filter: blur(var(--hero-content-backdrop-filter-blur, 5px)) brightness(var(--hero-content-backdrop-filter-brightness, 100%));
    
    /* Par défaut transparent (pour le mode Two-column) */
}

/* Responsive: ensure hero content is full-width on narrow screens regardless of percent */
@media (max-width: 900px) {
    .hero-content-inner {
        /* Allow the Customizer-controlled `--hero-content-width` to take effect on
           narrow screens while still capping it to 90% so the content doesn't
           overflow the viewport. Use min() to compare the saved percent with 90%. */
        width: min(var(--hero-content-width, 90%), 90%) !important;
        max-width: min(var(--hero-content-width, 90%), 90%) !important;
    }
}

/* Cap width when hero is in two-column layout so content doesn't overflow image area. */
.hero--two-column .hero-content-inner,
.hero--two-column .hero-content .hero-content-inner {
    width: min( var(--hero-content-width, 60%), 67% );
}

/* Allow full hero-content-width when content is centered/overlaid on the image/slide */
.hero--centered .hero-content-inner,
.hero-carousel:not(.hero--two-column) .hero-content-inner,
.hero-traveling .hero-content-inner {
    /* Allow almost-full-width for centered/overlay heroes while keeping responsive behavior.
       Use viewport-based max-width so the text can span almost the full hero even when
       the parent `.container` limits its width. */
    width: min(var(--hero-content-width, 60%), 95vw);
    max-width: 95vw;
    box-sizing: border-box; /* ensure padding doesn't reduce available width unexpectedly */
    padding-left: 20px;
    padding-right: 20px;
}

/* ACTIVATION DE L'OVERLAY : Uniquement si mode centered OU mode mobile */
.hero--centered .hero-content-inner,
.hero-traveling .hero-content-inner,
.hero-carousel:not(.hero--two-column) .hero-content-inner {
    padding: 20px;
}


/* --- Alignements (Desktop uniquement) --- */
/* On limite ces alignements aux modes où le texte survole l'image */
.hero--centered .hero-content,
.hero-traveling .hero-content {
    /* min-height: 100%; */
    /* height: 100%; */
    display: flex;
    flex-direction: column;
    text-align: center;
}

.hero-carousel:not(.hero--two-column) .hero-content {
    position: relative;
    z-index: 10; /* Devant l'image */
    flex: 1;     /* PREND TOUTE LA HAUTEUR RESTANTE */
    display: flex !important;
    flex-direction: column;
    width: 100%;
    margin-bottom: 20px ;
}

.hero--centered .hero__content--top,
.hero-carousel:not(.hero--two-column) .hero__content--top { justify-content: flex-start; }

.hero--centered .hero__content--center,
.hero-carousel:not(.hero--two-column) .hero__content--center { justify-content: center; }

/* .hero--centered .hero__content--bottom,
.hero-carousel:not(.hero--two-column) .hero__content--bottom { justify-content: flex-end; padding-bottom: 60px; } */

/* On applique le padding bottom variable UNIQUEMENT si on n'est pas en 2 colonnes */
.hero--centered .hero__content--bottom,
.hero-carousel:not(.hero--two-column) .hero__content--bottom {
    justify-content: flex-end;
    /* padding-bottom: clamp(40px, 10vh, 120px) !important; */
}

/* Cas spécial : Le carrousel 2 colonnes en Desktop doit rester centré verticalement 
   quels que soient les réglages de position du texte */
.hero-carousel.hero--two-column .swiper-slide {
    align-items: center !important; 
}

/* ==========================================================
   5. RESPONSIVE
   ========================================================== */

.hero-section {
    /* On définit une variable de base qui évolue entre 1200px et 1500px */
    /* 1.5rem sur mobile -> 2.2em sur desktop */
    --base-font-size: clamp(1.25rem, 0.95rem + 1.3vw, 2.2rem);
}

.hero-section h1 {
    font-size: var(--base-font-size);
    margin-bottom: 0.5em;
}

.hero-section .hero-philosophy {
    /* Garde le ratio de 72% */
    font-size: calc(var(--base-font-size) * 0.62);
}

.hero-section .hero-button {
    /* Garde le ratio de 63% */
    font-size: calc(var(--base-font-size) * 0.55);
}

/* --- DESKTOP (1500px+) --- */
@media (min-width: 1500px) {
    /* On very large viewports, prefer viewport-based sizing but respect
       the dynamic header height when .hero-offset is present. Use `dvh`
       to avoid mobile UI-bar issues. */
    .hero-section:not(.hero-offset), .hero-carousel:not(.hero-offset) { height: 100dvh; }
    .hero-section.hero-offset, .hero-carousel.hero-offset { height: calc(100dvh - var(--header-height)); }
    .hero-panoramic.hero-traveling .hero-slide-background {
        -webkit-animation: traveling-pan-large var(--hero-traveling-duration, 20s) linear infinite alternate;
        animation: traveling-pan-large var(--hero-traveling-duration, 20s) linear infinite alternate;
        width: 150vw;
        position: absolute;
    }
    .hero--split:not(.hero-carousel) .hero-content, .hero--two-column:not(.hero-carousel) .hero-content {
        max-width: 700px;
    }
    /* .hero-section h1 { font-size: 2.2em;} */
    /* .hero-section .hero-philosophy { font-size: 1.6em; } */
    /* .hero-section .hero-button { font-size: 1.4em; } */
}

@media (max-width: 1500px) {
    /* .hero-section, .hero-carousel { 
        height: auto; 
        min-height: 70vh; 
    } */
    
    .hero-swiper .swiper-button-prev::after,
    .hero-swiper .swiper-button-next::after { 
        /* height: 30px; width: 30px;  */
        /* top: 50% ; */
        font-size: xx-large;
    }
}
    
@media (max-width: 1200px) {
    /* .hero-section, .hero-carousel { 
        height: 100% !important; 
        min-height: 70vh; 
    } */
    
    /* .hero-section h1 { font-size: 2em; } */
    /* .hero-section .hero-philosophy { font-size: 1.4em; } */
    /* .hero-section .hero-button { font-size: 1.2em; } */
    
    /* Ajustement flèches carousel */
    .hero-swiper .swiper-button-prev::after,
    .hero-swiper .swiper-button-next::after { 
        /* height: 30px; width: 30px;  */
        /* top: 50% ; */
        font-size: medium;
    }
}

/* --- TABLET (768px and down) --- */
@media (max-width: 768px) {
    /* .hero-section, .hero-carousel { 
        height: 100%; 
        min-height: 70vh; 
    } */
   
    .hero--split:not(.hero-carousel), .hero--two-column:not(.hero-carousel) {
        gap: 10px;
    }
    .hero--two-column:not(.hero-carousel) .hero-content {
        padding: 40px 20px;
    }
    /* .hero-section h1 { font-size: 1.6em; }  */
    /* .hero--two-column .hero-content h1, .hero--two-column .hero-content .hero-philosophy {
        font-size: 1.3em ;
    }    */
    
    /* Cacher navigation pour clarté */
    .hero-swiper .swiper-button-prev, .hero-swiper .swiper-button-next { display: none; }

    /* Désactiver animations lourdes */
    /* .hero-zoom .hero-img { animation: none !important; } */
}

@media (min-width: 550px) {    
 /* Desktop: when layout is two-column we hide the content overlay (no background)
    but keep the variables available so the overlay can be shown on small screens.
    This ensures two-column desktop has no overlay while mobile still shows it. */
    .hero--two-column .hero-content-inner,
    .hero--split .hero-content-inner,
    .hero-carousel.hero--two-column .hero-content-inner {
        background: transparent !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        /* padding: 0 !important; */
    }
}

/* --- MOBILE (550px and down) --- */
@media (max-width: 550px) {
    .hero-section:not(.hero-offset) { height: 100dvh; }
    .hero-section.hero-offset { height: calc(100dvh - var(--header-height)); }
    /* .hero-section h1 { font-size: 1.4em; } */
    /* .hero-section .hero-philosophy { font-size: 1.2em; } */
    /* .hero-section .hero-button { font-size: 0.9em; } */

    /* .hero--two-column .hero-content h1, .hero--two-column .hero-content .hero-philosophy {
        font-size: 1.2em !important;
    } */
    .hero-image { order: -1; width: 100% !important; max-width: 100% !important; }
    .hero-section .hero-button { margin-top: 0.5em; }

    /* On transforme le conteneur en pile (stack) */
    .hero--two-column, 
    .hero-carousel.hero--two-column .swiper-slide {
        display: grid !important; /* Grid est plus simple pour la superposition */
        grid-template-areas: "hero-stack";
        gap: 0;
        /* height: 80vh; */
    }

    /* L'image et le contenu occupent la même zone (ils se superposent) */
    /* .hero--two-column .hero-image,
    .hero--two-column .hero-content { */
    .hero-image, .hero-content {
        grid-area: hero-stack;
        width: 100% !important;
        /* max-width: 100% !important; */
        height: 100% !important;
    }

    /* L'image passe en arrière-plan */
    .hero--two-column .hero-image {
        z-index: 1;
    }

    /* Le contenu passe devant avec son effet de flou */
    /* .hero--two-column  */
    .hero-content {
        z-index: 2;
        background: transparent !important;       
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        padding: 25px;
    }

    /* On crée un panneau unique pour TOUT le contenu */
    /* On utilise une largeur max pour ne pas recouvrir toute l'image latéralement */
    /* .hero--two-column  */
    .hero-content-inner { 
        /* If `--hero-content-bg-color-rgba` is not provided by PHP (background disabled),
           fall back to a sensible default opacity of 0.35 to keep text readable. */
        background-color: var(--hero-content-bg-color-rgba, var(--hero-content-bg-mobile-default)) !important;
        -webkit-backdrop-filter: blur(var(--hero-content-backdrop-filter-blur, 15px)) brightness(var(--hero-content-backdrop-filter-brightness, 100%));
        backdrop-filter: blur(var(--hero-content-backdrop-filter-blur, 15px)) brightness(var(--hero-content-backdrop-filter-brightness, 100%));        
        padding: 5px;        
        max-width: 90%;        
        /* max-width: 400px; */
        text-align: center;
        box-shadow: var(--shadow-lg);
        border-radius: var(--site-image-border-radius);
        /* transition: all 0.3s ease; */
        /* overflow: hidden; */
    }
    /* Par défaut transparent (pour le mode Two-column) */


    /* On s'assure que les textes à l'intérieur n'ont plus leurs propres fonds */
    .hero--two-column .hero-content h1,
    .hero--two-column .hero-content .hero-philosophy {
        background: transparent !important;
        /* color: #ffffff !important; */
        margin-bottom: 15px;
    }

    /* On s'assure que l'image remplit bien tout le fond */
    .hero--two-column .hero-img {
        z-index: 1;
        height: 100% !important;
        object-fit: cover;
        border-radius: 0; /* Souvent mieux sur mobile de border à border */
    }
    /* Overrides d'alignement mobile */
    .hero-content.hero__content--mobile-top    { justify-content: flex-start !important; }
    .hero-content.hero__content--mobile-center { justify-content: center !important; }
    .hero-content.hero__content--mobile-bottom { justify-content: flex-end !important; }
}

@media (max-width: 430px) {
    .hero-section:not(.hero-offset) { height: 70dvh; }
    .hero-section.hero-offset { height: calc(70dvh - var(--header-height)); }
    /* .hero-section h1 { font-size: 1.2em; } */
    /* .hero-section .hero-philosophy { font-size: 1em; } */
    /* .hero-section .hero-button { font-size: 0.8em; } */

    .hero--centered .hero-content-inner { padding: 5px; }
 
    .hero-carousel:not(.hero--two-column) .hero-content-inner {
        width: 90%;
        padding: 10px;
    }
}




/* --- Presentation Section --- */

.presentation-flex {
    align-items: center;
    display: flex;
    gap: 60px;
    justify-content: center;
    text-align: left;
}

.presentation-text {
    color: var(--site-color-text);
    flex: 1 1 500px;
    line-height: var(--presentation-line-height, 1.6);
    max-width: 400px;
}

.presentation-text span {
    color: var(--site-color-text);
    font-size: 1.3em;
    font-weight: 300;
    letter-spacing: 1px;
}

.presentation-image {
    flex-shrink: 0;
    width: 100%;
    max-width: 350px;
}

.presentation-image img {
    display: block;
    width: 100%;
    height: auto; /* Le navigateur calcule la hauteur grâce aux attributs width/height de WP */
    border-radius: var(--site-image-border-radius);
    box-shadow: var(--shadow-sm);
    object-fit: cover;
    transition: opacity 0.3s ease-in-out;
}

.presentation-read-more-button {
    margin-top: 1.5em;
    display: flex;
    justify-content: center;
    max-width: 400px; /* correspond à la largeur max de .presentation-text */
    margin-left: auto; /* centre le wrapper horizontalement dans .container */
    margin-right: auto;
    clear: both; /* s'assure qu'il soit sous tout élément flottant */
}

/* Rangée utilisée quand le bouton est placé sous le bloc texte+image */
.presentation-read-more-row {
    display: flex;
    gap: 60px;
    justify-content: center; /* centre la rangée globale */
    margin-top: 0.75em;
    width: 100%; /* occupe toute la largeur du conteneur */
}

/* Quand le bouton est rendu à l'intérieur de .presentation-text, l'aligner
   à gauche pour suivre le flux du texte (pas centré). */
.presentation-text .presentation-read-more-button {
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start;
}

/* Le bouton dans la rangée doit rester centré horizontalement */
.presentation-read-more-row .presentation-read-more-button {
    margin: 0;
    display: inline-flex;
    justify-content: center;
}

@media (max-width: 1200px) {   
    .presentation-flex {
        gap: 60px;
    }
    .presentation-image {
        max-width: 300px;
    }
}
@media (max-width: 768px) {   
    .presentation-flex {
        gap: 20px;
    }
    .presentation-image {
        max-width: 200px;
    }
}
@media (max-width: 600px) {
    .presentation-flex {
        flex-direction: column-reverse;
        justify-content: center;
        text-align: center;
        /* gap: 20px; */
    }
    .presentation-text {
        flex: 1 1 100%;
        margin: 0 auto;
        max-width: 100%;
    }
    .presentation-image {
        flex-basis: auto;
        margin: 0 auto;
        max-width: 80%;
    }
    .presentation-image img {
        max-width: 100%;
    }
    /* Adjust read-more row for mobile: stack and center button */
    .presentation-read-more-row {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }
    .presentation-read-more-row .presentation-text-col {
        display: none; /* placeholder inutile sur mobile */
    }
    .presentation-read-more-row .presentation-read-more-button,
    .presentation-read-more-button {
        max-width: 100%;
        justify-content: center; /* centrer le bouton sur mobile */
    }
    /* Si le bouton est dans .presentation-text (placement = below_text),
       le centrer en mobile lorsque la section passe en column-reverse. */
    .presentation-text .presentation-read-more-button {
        justify-content: center;
        margin-left: auto;
        margin-right: auto;
    }
    
}
/* @media (max-width: 450px) {
    .presentation-flex {
        flex-direction: column-reverse;
        gap: 20px; 
        justify-content: center;
        text-align: center;
    }
    .presentation-text {
        flex: 1 1 100%;
        margin: 0 auto;
        max-width: 100%;
    }
    .presentation-image {
        flex-basis: auto;
        margin: 0 auto;
        max-width: 80%;
    }
    .presentation-image img {
        max-width: 100%;
    }
    .presentation-read-more-button {
        max-width: 100%;
        justify-content: center;
    }
} */
/* --- Portfolio Gallery Section --- */

:root { 
    --gallery-gap: 15px; 
}

/* 1. Conteneur Principal : On utilise Flex pour le centrage naturel */
.gallery-grid-3x3 {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gallery-gap);
    justify-content: center; /* Centre la dernière ligne si incomplète */
    align-items: start;
    margin: 0 auto;
    /* max-width: 900px; */
}

/* 2. Éléments de la Galerie */
.gallery-item {
    aspect-ratio: 1 / 1; /* Carrés parfaits */
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    /* Desktop par défaut : 3 colonnes */
    width: calc((100% - 2 * var(--gallery-gap)) / 3);
}

.gallery-item img {
    border-radius: var(--site-image-border-radius, 8px);
    display: block;
    height: 100%;
    width: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

/* 3. Responsive : Tablettes (2 colonnes) */
@media (max-width: 899px) and (min-width: 600px) {
    .gallery-grid-3x3 > .gallery-item { 
        width: calc((100% - var(--gallery-gap)) / 2); 
    }
    /* Affiche la 4ème image pour éviter un trou sur 2 lignes */
    .gallery-grid-3x3 .gallery-item:nth-child(4) {
        display: block !important;
    }
}

/* 4. Responsive : Mobiles (1 colonne) */
@media (max-width: 599px) {
    .gallery-grid-3x3 {
        display: flex !important;
        justify-content: center !important;
    }
    .gallery-grid-3x3 > .gallery-item {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Gestion du bouton Voir Plus sur mobile */
    .gallery-grid-3x3 .gallery-item.gallery-item--extra { display: none !important; }
    .gallery-grid-3x3.expanded .gallery-item.gallery-item--extra { display: block !important; }
}

/* 5. Logique intelligente avec :has() (Évite les paires décalées à gauche) */

/* Cas : 1 seule image */
@media (min-width: 600px) {
    .gallery-grid-3x3:has(> .gallery-item:only-child) > .gallery-item {
        width: calc((100% - var(--gallery-gap)) / 2);
        max-width: 450px;
    }
}

/* Cas : 2 images ou 4/5 images -> On force le 2 colonnes pour l'équilibre */
.gallery-grid-3x3:has(> .gallery-item:nth-child(2):nth-last-child(1)) > .gallery-item,
.gallery-grid-3x3:has(> .gallery-item:nth-child(4):nth-last-child(1)) > .gallery-item,
.gallery-grid-3x3:has(> .gallery-item:nth-child(5):nth-last-child(1)) > .gallery-item {
    width: calc((100% - var(--gallery-gap)) / 2);
}

/* Cas : 8 images -> 4 colonnes sur grand écran */
@media (min-width: 900px) {
    .gallery-grid-3x3:has(> .gallery-item:nth-child(8):nth-last-child(1)) > .gallery-item { 
        width: calc((100% - 3 * var(--gallery-gap)) / 4); 
    }
}

/* 6. Gestion du bouton "Voir plus" (Actions) */
.gallery-actions { 
    margin-top: 1.5rem; 
    text-align: center;
}

/* Cacher le bouton sur Desktop (où tout est affiché) */
@media (min-width: 900px) {
    .gallery-actions { display: none; }
    .gallery-grid-3x3 .gallery-item.gallery-item--extra { display: block; }
}

/* Logique de masquage automatique du bouton selon le nombre d'images (Server-side classes) */
@media (max-width: 599px) {
    .gallery-count-1 .gallery-actions, 
    .gallery-count-2 .gallery-actions, 
    .gallery-count-3 .gallery-actions {
        display: none !important;
    }
}

@media (min-width: 600px) and (max-width: 899px) {
    .gallery-count-1 .gallery-actions, 
    .gallery-count-2 .gallery-actions, 
    .gallery-count-3 .gallery-actions, 
    .gallery-count-4 .gallery-actions {
        display: none !important;
    }
}

@media (min-width: 900px) {
    /* Cache le bouton selon les colonnes (2, 3 ou 4) */
    /* cols = 2 => cache de 1 à 6 */
    .gallery-cols-2 .gallery-count-1 .gallery-actions,
    .gallery-cols-2 .gallery-count-2 .gallery-actions,
    .gallery-cols-2 .gallery-count-3 .gallery-actions,
    .gallery-cols-2 .gallery-count-4 .gallery-actions,
    .gallery-cols-2 .gallery-count-5 .gallery-actions,
    .gallery-cols-2 .gallery-count-6 .gallery-actions {
        display: none !important;
    }

    /* cols = 3 => cache de 1 à 9 */
    .gallery-cols-3 .gallery-count-1 .gallery-actions,
    .gallery-cols-3 .gallery-count-2 .gallery-actions,
    .gallery-cols-3 .gallery-count-3 .gallery-actions,
    .gallery-cols-3 .gallery-count-4 .gallery-actions,
    .gallery-cols-3 .gallery-count-5 .gallery-actions,
    .gallery-cols-3 .gallery-count-6 .gallery-actions,
    .gallery-cols-3 .gallery-count-7 .gallery-actions,
    .gallery-cols-3 .gallery-count-8 .gallery-actions,
    .gallery-cols-3 .gallery-count-9 .gallery-actions {
        display: none !important;
    }

    /* cols = 4 => cache de 1 à 9 */
    .gallery-cols-4 .gallery-count-1 .gallery-actions,
    .gallery-cols-4 .gallery-count-2 .gallery-actions,
    .gallery-cols-4 .gallery-count-3 .gallery-actions,
    .gallery-cols-4 .gallery-count-4 .gallery-actions,
    .gallery-cols-4 .gallery-count-5 .gallery-actions,
    .gallery-cols-4 .gallery-count-6 .gallery-actions,
    .gallery-cols-4 .gallery-count-7 .gallery-actions,
    .gallery-cols-4 .gallery-count-8 .gallery-actions,
    .gallery-cols-4 .gallery-count-9 .gallery-actions {
        display: none !important;
    }
}


/* --- LAPTOP (1200px and down) --- */

    /* Portfolio tabs styles - adapted from your preferred presentation styles */
    .portfolio-tabs {
        margin: 2.5rem 0;
    }
    .portfolio-tabs .tabs-nav {
        display: flex;
        justify-content: center;
        margin-bottom: 2em;
        /* border-bottom: 2px solid var(--site-color-border-light); */
    }

    .portfolio-tabs .tab-toggle {
        padding: 10px 20px;
        cursor: pointer;
        border: none;
        background-color: transparent;
        font-size: 1.2em;
        font-family: var(--font-body);
        color: var(--site-color-text);
        position: relative;
        bottom: -2px;
        transition: color 0.3s ease, border-bottom-color 0.3s ease;
        border-bottom: 2px solid transparent;
    }

    .portfolio-tabs .tab-toggle.tab-toggle--active {
        color: var(--site-color-text);
        font-weight: 500;
        border-bottom-color: var(--accent-main);
    }

    /* Panels are visible by default; visibility controlled by [hidden] or .active for compatibility */
    .portfolio-tabs .tabs-panel {
        display: block;
        line-height: 1.8;
    }

    /* When panels are explicitly hidden (attribute used by JS), hide them */
    .portfolio-tabs .tabs-panel[hidden] {
        display: none !important;
    }

    /* Backwards-compatible: panels with .active class are shown */
    .portfolio-tabs .tabs-panel.active {
        display: block;
    }

    /* Content inside panels */
    .portfolio-tabs .tabs-panel p,
    .portfolio-tabs .tabs-panel ul,
    .portfolio-tabs .tabs-panel ol,
    .portfolio-tabs .tabs-panel h1,
    .portfolio-tabs .tabs-panel h2,
    .portfolio-tabs .tabs-panel h3,
    .portfolio-tabs .tabs-panel h4,
    .portfolio-tabs .tabs-panel h5,
    .portfolio-tabs .tabs-panel h6,
    .portfolio-tabs .tabs-panel .wp-block-group,
    .portfolio-tabs .tabs-panel .wp-block-image,
    .portfolio-tabs .tabs-panel .wp-block-gallery,
    .portfolio-tabs .tabs-panel .wp-block-columns {
        margin-bottom: 1em;
    }

    .portfolio-tabs .tabs-panel h2 {
        margin-top: 2em;
        margin-bottom: 1em;
        color: var(--site-color-text);
    }

    .portfolio-tabs .tabs-panel .wp-block-group {
        padding: 1.5em;
    }

    .portfolio-tabs .tabs-panel ul,
    .portfolio-tabs .tabs-panel ul.wp-block-list {
        margin-left: 2em;
        margin-bottom: 1.5em;
        line-height: 1.7;
        list-style: none;
        padding-left: 0;
    }

    .portfolio-tabs .tabs-panel ol,
    .portfolio-tabs .tabs-panel ol.wp-block-list {
        margin-left: 2em;
        margin-bottom: 1.5em;
        line-height: 1.7;
        list-style: decimal;
        padding-left: 2.2em;
    }

    .portfolio-tabs .tabs-panel li {
        margin-bottom: 0.8em;
        position: relative;
        padding-left: 1em;
    }

    /* --- MOBILE: make tabs horizontally scrollable and hide scrollbar --- */
    @media (max-width: 767px) {
        .portfolio-tabs .tabs-nav {
            display: flex;
            overflow-x: auto;
            /* iOS legacy fallback (handled via @supports below) */
            /* modern cross-browser touch/scroll control */
            touch-action: pan-x; /* allow horizontal panning only */
                /* overscroll-behavior-x is guarded below via @supports to avoid
                    compatibility warnings in older Safari/iOS while preserving
                    behavior where supported. */
            /* optional: enable snap-to-tab behaviour */
            scroll-snap-type: x proximity;
            /* scrollbar hiding: Firefox handled via @supports block below; */
            /* WebKit and IE fallbacks remain (::-webkit-scrollbar, -ms-overflow-style). */
            -ms-overflow-style: none; /* IE 10+ */
            justify-content: flex-start; /* align left for scrolling */
            gap: 0.5rem;
            padding: 0.25rem 0.5rem;
            margin-bottom: 1rem;
        }
        .portfolio-tabs .tabs-nav::-webkit-scrollbar { display: none; }

        .portfolio-tabs .tab-toggle {
            flex: 0 0 auto; /* do not shrink, preserve size */
            white-space: nowrap;
            padding: 8px 14px;
            font-size: 1em;
            /* align snapping start when using scroll-snap */
            scroll-snap-align: start;
        }

        /* Ensure active underline stays visible and moves with the element */
        .portfolio-tabs .tab-toggle.tab-toggle--active {
            border-bottom-width: 3px;
        }

        /* Fade-out mask on both edges to suggest more content */
        .portfolio-tabs .tabs-nav {
            position: relative;
            -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 10%, rgba(0,0,0,1) 90%, rgba(0,0,0,0) 100%);
            mask-image: linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 10%, rgba(0,0,0,1) 90%, rgba(0,0,0,0) 100%);
            /* keep clicks functional across the full area */
        }

        /* Trailing spacer to naturally cut the last tab on small screens */
        .portfolio-tabs .tabs-nav::after {
            content: '';
            flex: 0 0 44px; /* width of invisible spacer at the end */
            display: block;
        }
    }

/* Apply iOS-only legacy smooth scrolling when supported, mobile-only */
@supports (-webkit-overflow-scrolling: touch) {
    @media (max-width: 767px) {
        .portfolio-tabs .tabs-nav {
            -webkit-overflow-scrolling: touch;
        }
    }
}

/* Guarded overscroll-behavior: apply only where supported to avoid
   Toolscompat/VSCode warnings for older Safari on iOS (<16). */
@supports (overscroll-behavior: contain) {
    @media (max-width: 767px) {
        .portfolio-tabs .tabs-nav {
            overscroll-behavior-x: contain;
        }
    }
}

/* Guarded scrollbar-width: apply only where supported (Firefox).
   This avoids ToolsCompat/VSCode warnings in browsers that don't support it. */
@supports (scrollbar-width: none) {
    @media (max-width: 767px) {
        .portfolio-tabs .tabs-nav {
            scrollbar-width: none;
        }
    }
}

    /* @media (max-width: 640px) {
        .portfolio-tabs .tabs-nav {
            flex-wrap: wrap;
        }
        .portfolio-tabs .tab-toggle {
            flex: 1 1 48%;
            text-align: center;
        }
    } */


/* --- Instagram Feed Container --- */
.instagram-feed-container {
    margin: 0 auto;
    max-width: 900px; /* Align with gallery-grid-3x3 max-width */
    padding: 0;
}

/* Ensure consistent sizing for 4-image galleries on tablet and desktop.
   This forces the 2-column layout and makes extras match regular items. */
@media (min-width: 600px) {
    .gallery-grid-3x3.gallery-count-4 > .gallery-item {
        width: calc((100% - var(--gallery-gap)) / 2) !important;
        flex: 0 0 calc((100% - var(--gallery-gap)) / 2) !important;
        max-width: calc((100% - var(--gallery-gap)) / 2) !important;
        aspect-ratio: 1 / 1 !important;
    }
    .gallery-grid-3x3.gallery-count-4 > .gallery-item img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block !important;
    }
}

/* Style for Instagram Feed "Load More" button */
.sbi_load_btn {
    font-family: var(--font-body) !important;
}


/* --- Badge coin 'À adopter' (corner ribbon) --- */
/* Ensure gallery item container is a positioning context */
.gallery-item {
    position: relative;
}

/* The image should be positioned (per user's request) */
.portfolio-gallery-item {
    display: block;
    position: relative;
}

.badge-adopter {
    position: absolute;
    top: 70px;
    left: -50px;
    background: var(--accent-main); /* accent color, adjust as needed */
    color: var(--site-color-background);
    padding: 4px 70px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0px;
    z-index: 20;
    box-shadow: var(--shadow-lg);
    transform: rotate(-25deg);
    transform-origin: 0 0;
    font-family: var(--font-navigation);
    font-size: 0.85rem;
    text-transform: uppercase;
}

@media (max-width: 480px) {
    .badge-adopter {
        /* Au lieu de changer top/left, on peut réduire la police */
        font-size: 0.65rem;
        padding: 4px 70px; /* On réduit un peu la largeur de la bande */
        /* Si le ruban paraît trop gros, on utilise scale */
        transform: rotate(-25deg) scale(1); 
    }
}

/* --- Services Section --- */

.services-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
}

.service-item {
    backface-visibility: hidden;
    border-radius: var(--site-image-border-radius);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 300px;
    justify-content: flex-end;
    margin-left: auto;
    margin-right: auto;
    max-width: 300px;
    overflow: hidden;
    position: relative;
    text-decoration: none;
    transform: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    will-change: transform;
}

.service-item:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-6px);
}

.service-item.no-image {
    background: linear-gradient(to top right, var(--accent-main, var(--accent-soft)), var(--accent-secondary-main));
}

.service-item.no-image h3 {
    color: var(--service-card-title-color, var(--site-color-text));
}
    .services-grid.service-titles-centered .service-item .card-content h3,
    .services-grid.service-titles-centered .service-item h3 {
        text-align: center;
    }

/* Overlay gradient at the bottom of image cards to improve text readability */
.service-item:not(.no-image)::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 45%;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0));
    z-index: 3;
    pointer-events: none;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

.service-item img {
    backface-visibility: hidden;
    border-radius: var(--site-image-border-radius);
    height: 100%;
    left: 0;
    object-fit: cover;
    position: absolute;
    top: 0;
    transition: transform 0.3s ease;
    transform-origin: center center;
    width: 100%;
    z-index: 1;
}

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

.service-item .overlay {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.3) 40%, transparent 80%);
    border-radius: var(--site-image-border-radius);
    height: 120%;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 2;
}

.service-item .card-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: flex-end;
    padding: 1.5em;
    position: relative;
    text-align: left;
    z-index: 4;
}

.service-item h3 {
    color: var(--service-card-title-color, var(--site-color-text));
    /* font-size: clamp(1.4em, 2.5vw, 2.1em); */
    font-weight: var(--service-card-title-weight, 700);
    line-height: 1.3;
    margin-bottom: 0;
    margin-top: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    /* white-space: nowrap; */
}


/* Force white title on image cards (overlay) to ensure legibility in preview and published),
   keep variable-based color for no-image (accent) cards. */
.service-item:not(.no-image) .card-content h3 {
    /* Use server-provided token for image-card titles (defaults to white).
       This lets PHP compute a different color in future if needed. */
    color: var(--service-card-image-title-color, #ffffff);
    text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

.service-item span {
    display: none;
}

@media (max-width: 768px) {
    .services-grid {
        gap: 2.5em;
        grid-template-columns: 1fr;
        justify-items: center;
    }
      .service-item {
        height: 300px;
        margin: 0 auto;
        max-width: 400px;
    }
    .service-item .card-content {
        padding: 1.2em;
    }
}


/* --- Latest Posts Section --- */
.latest-posts-section {
    width: 100%;
    overflow-x: hidden; 
    overflow-y: visible;
    position: relative;
}
/*  Global Item Design */
.latest-post-item {
    background-color: var(--site-color-background);
    border: 1px solid var(--site-color-border-dark);
    border-radius: var(--site-image-border-radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%; /* Important pour l'alignement Swiper */
}

.latest-post-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
}

.latest-post-item .post-thumbnail {
    width: 100%;
    aspect-ratio: 3 / 4; /* Cela crée un rectangle harmonieux peu importe la taille */
    margin-bottom: 20px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: var(--site-image-border-radius);
}

.latest-post-item .post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    /* Si tu ne veux ABSOLUMENT PAS couper l'image, utilise 'contain', 
       mais tu auras des bandes noires sur les côtés. 'cover' reste le plus pro. */
}

.latest-post-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.5em 0;
    min-height: 2.8em;
}

.latest-post-excerpt {
    flex-grow: 1;
    font-size: 0.85em;
    margin-bottom: 1.5em;
    display: -webkit-box;    
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.latest-post-read-more {
    font-weight: 700;
    /* transition: color 0.3s ease; */
}

.latest-post-read-more.button {
    align-self: flex-start;
    background: none;
    border: none;
    padding: 0;
    color: var(--accent-text, var(--accent-main));
    font-weight: 600;
    margin-top: auto; /* Pousse le bouton toujours tout en bas de la carte */
    flex-shrink: 0;
}

/* --- Zone Desktop & Tablette (au-dessus de 600px) --- */
@media (min-width: 601px) {
    /* Désactivation de Swiper pour repasser en Grille */
    .latest-posts-carousel .swiper-wrapper {
        display: grid !important;
        gap: 30px;
        transform: none !important;
        width: 100% !important;
        align-items: stretch !important;
        grid-template-columns: repeat(3, 1fr) !important; /* Desktop par défaut */
        max-width: 1100px; /* Ajuste selon la largeur max de ton site */
        margin: 0 auto;    /* Centre le bloc complet */
        justify-content: center; /* Centre les colonnes elles-mêmes */
    }

    /* On cache les éléments de navigation Swiper */
    .latest-posts-section .swiper-pagination,
    .latest-posts-section .swiper-button-next,
    .latest-posts-section .swiper-button-prev {
        display: none !important;
    }

    /* On s'assure que les slides se comportent comme des blocs de grille */
    .latest-posts-carousel .swiper-slide {
        opacity: 1 !important;
        transform: none !important;
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
    }
}

/* 2. TABLETTE (601px à 850px) : Grille 2 colonnes */
/* TABLETTE (601px à 1024px) : Grille 2 colonnes */
@media (min-width: 601px) and (max-width: 1024px) {
    .latest-posts-carousel .swiper-wrapper {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
        max-width: 800px; /* Limite la largeur pour centrer proprement 2 éléments */
    }
    .latest-posts-carousel .swiper-slide {
        width: 100% !important;
        min-width: 0; /* Empêche le contenu de pousser la largeur de la colonne */
    }
    /* Masquer la 3ème carte lorsque nous affichons seulement 2 colonnes */
    .latest-posts-carousel .swiper-slide:nth-child(3) {
        display: none !important;
    }
}

/* 3. DESKTOP (>=1025px) : Grille 3 colonnes */
@media (min-width: 1025px) {
    .latest-posts-carousel .swiper-wrapper {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .latest-posts-carousel .swiper-slide:nth-child(3) {
        display: flex !important;
    }
}

/* Centering behaviour when fewer posts than columns */
.latest-posts-carousel.posts-count-1 .swiper-wrapper {
    grid-template-columns: 1fr !important;
    max-width: 420px !important;
}
.latest-posts-carousel.posts-count-2 .swiper-wrapper {
    grid-template-columns: repeat(2, 1fr) !important;
    max-width: 820px !important;
}

.latest-posts-carousel.posts-count-2, .latest-posts-carousel.posts-count-1 {
    justify-content: center !important;
}


@media (max-width: 600px) {
    .latest-posts-carousel .swiper-wrapper {
        display: flex !important; /* Swiper a besoin de flex, pas de grid */
    }

    .latest-posts-carousel {
        overflow: visible !important; /* Permet de voir les cartes voisines */
        touch-action: pan-y !important; /* [INDISPENSABLE] Libère le scroll vertical */
        padding-bottom: 50px !important; /* Espace pour la pagination */
    }

    .latest-posts-carousel .swiper-slide {
        opacity: 0.5;
        transition: opacity 0.3s ease, transform 0.3s ease;
        height: auto;
        width: 82% !important;
        flex: 0 0 82% !important; /* ~1.2 slides per view -> 82% width for active slide */
        min-width: 60% !important;
        box-sizing: border-box;
        margin: 0 !important;
        margin-right: 20px !important; /* Espace entre les slides */
    }

    .latest-posts-carousel .swiper-slide-active {
        opacity: 1;
    }

    .latest-posts-section .swiper-button-next,
    .latest-posts-section .swiper-button-prev {
        display: none !important;
    }

    .latest-posts-section .swiper-pagination-bullet {
        background: var(--card-background, #000);
        opacity: 0.5;
    }

    /* Style des points de navigation */
    .latest-posts-section .swiper-pagination-bullet-active {
        background: var(--accent-soft);
        opacity: 1;
    }

    .latest-post-item {
        margin-bottom: 10px; /* Petit espacement supplémentaire */        
        width: 95% !important; /* Crée l'espace visuel à la place de la marge */
        margin: 0 auto !important; /* Centre les cartes dans le carousel */
    }
}

/* --- Sécurité pour les petits écrans (320px) --- */
@media (max-width: 360px) {
    .latest-post-item {
        padding: 15px; /* On réduit un peu le padding interne pour gagner de la place */
        height: auto !important; /* On laisse la carte s'étirer selon le texte */
        min-height: 0; /* On donne juste une base */
    }

    .latest-post-item .post-thumbnail {
        /* On passe sur un format plus horizontal pour gagner de la place */
        aspect-ratio: 1 / 1 !important; 
        margin-bottom: 8px;
    }

    .latest-post-title {
        font-size: 0.95rem; /* On réduit la taille du titre */
        word-wrap: break-word; /* Force la coupure des mots trop longs */
        overflow-wrap: break-word;
        min-height: 0;
    }

    .latest-post-excerpt {
        font-size: 0.70rem; /* Texte légèrement plus petit */
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* On réduit un peu la hauteur de l'image pour laisser de la place au texte */
    .latest-post-item img {
        height: 160px !important;
    }
}

/* Sécurité anti-débordement universelle */
.latest-post-item * {
    max-width: 100%;
    box-sizing: border-box;
}

/* --- Contact CTA Section --- */

#contact-cta {
    margin-top: 80px;
}

.contact-cta-section {
    /* Color overlay above image: gradient + image (gradient uses rgba token and opacity) */
    /* Logique de base : Cadre activé/désactivé via le Customizer */
    border: calc(var(--cta-frame-enabled, 0) * var(--cta-frame-size, 0px)) solid rgba(var(--cta-frame-color-rgb, 0,0,0), 1) !important;
    background-image: linear-gradient(rgba(var(--cta-bg-color-rgb, 249,249,249), var(--cta-bg-opacity, 1)), rgba(var(--cta-bg-color-rgb, 249,249,249), var(--cta-bg-opacity, 1))), var(--cta-bg-image, none);
    background-size: var(--cta-bg-size, cover);
    background-repeat: var(--cta-bg-repeat, no-repeat);
    background-position: var(--cta-bg-position, center);
    box-sizing: border-box;
    color: var(--cta-button-text-color, var(--site-color-text));
    margin: 0 auto;
    max-width: var(--cta-section-max-width, 1500px);
    border-radius: var(--site-image-border-radius);
    overflow: hidden;
}

.contact-cta-section .container {
    padding-left: 20px;
    padding-right: 20px;
    margin-left: auto;
    margin-right: auto;
}

.contact-cta-section h2 {
    color: var(--cta-button-text-color, var(--site-color-text));
    margin: 20px 10px;
}

.contact-cta-section p {
    color: var(--cta-button-text-color, var(--site-color-text));
    font-weight: 500;
    margin-bottom: 1em;
    /* letter-spacing: 1.1px; */
}

.contact-cta-section .button-secondary {
    background-color: var(--button-secondary-bg-color);
    border: 2px solid var(--button-secondary-border-color);
    color: var(--cta-button-text-color, var(--button-secondary-text-color));
    margin-top: 20px;
    margin-bottom: 20px;
}

.contact-cta-section .button-secondary:hover {
    background-color: var(--button-secondary-bg-hover-color);
    border-color: var(--button-secondary-border-hover-color);
    color: var(--button-secondary-text-hover-color);
    transform: translateY(-2px);
}

@media (max-width: 1200px) {
    .contact-cta-section {
        /* 1. On enlève l'arrondi car ça touche les bords */
        border-radius: 0 !important;

        /* 2. On masque les bordures latérales pour le look "full-width" */
        border-left: none !important;
        border-right: none !important;
    }
}

/* Fix: for mid-desktop widths ensure hero respects header height when offset is present */
@media (min-width: 730px) and (max-width: 1499px) {
    .hero-section.hero-offset { height: calc(100dvh - var(--header-height)) !important; }
}


