/**
 * Bloc Hub — Styles
 *
 * Cards alignées sur le design des widgets de la colonne 3 du mega-menu
 * (.mega-3col-widgets > *) : aspect landscape, titre centré DM Serif Display,
 * overlay dégradé, bordure blanche intérieure animée au hover.
 */

/* ---- Utilitaire screen-reader-only ---- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Container : titre sur toute la largeur en haut,
       description à gauche + carousel à droite en dessous ---- */
.bloc-hub {
    /* Palette teal harmonisée sur la couleur du H2 (#1F5C56) */
    --hub-teal: #1F5C56;
    --hub-teal-dark: #143F3A;
    --hub-teal-mid: #2D7A72;
    --hub-teal-rgb: 31, 92, 86;
    --hub-block-bg: #F4F7F7;
    --hub-block-bg-rgb: 244, 247, 247;
    --hub-shadow: 0 8px 24px rgba(var(--hub-teal-rgb), 0.18);

    /* Container transparent — pas de fond ni d'ombre sur le bloc entier */
    max-width: 1200px;
    margin: 48px auto;
}

/* Section haute (titre + carousel + contrôles) : fond + ombre */
.bloc-hub__header {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    row-gap: 20px;
    padding: 48px 56px;
    background: var(--hub-block-bg);
    border-radius: 3px;
    box-shadow: var(--hub-shadow);
}

.bloc-hub__title {
    grid-column: 1;
    grid-row: 1;
}

.bloc-hub__carousel-section {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
}

.bloc-hub__controls {
    grid-column: 1;
    grid-row: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: 4px 0 0;
}

@media (max-width: 1240px) {
    .bloc-hub {
        margin: 32px 20px;
    }
}

@media (max-width: 900px) {
    .bloc-hub__header {
        padding: 32px 24px;
    }
}

/* H2 principal du bloc : 28–36px / 600–700 */
.bloc-hub__title {
    margin: 0;
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 36px;
    line-height: 1.1;
    font-weight: 700;
    color: var(--hub-teal);
    letter-spacing: -0.005em;
    text-align: left;
}

@media (max-width: 1100px) {
    .bloc-hub__title { font-size: 30px; }
}

@media (max-width: 700px) {
    .bloc-hub__title { font-size: 24px; }
}

/* ---- Carousel : viewport + flèches de navigation ---- */
.bloc-hub__carousel {
    position: relative;
    /* Respiration horizontale : le viewport est inset à l'intérieur, les cards
       ne touchent pas les bords de la colonne → les border-radius sont
       visibles dans toutes les tailles d'écran. */
    padding: 0 16px;
}

@media (max-width: 900px) {
    .bloc-hub__carousel {
        padding: 0;
    }
}

.bloc-hub__viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
}

/* Overlays latéraux STATIQUES : bande étroite aux bords du viewport.
   Les 3 cards restent quasi entièrement visibles, seuls les 10%
   extrêmes de chaque côté sont estompés vers le fond du bloc. */
.bloc-hub__viewport::before,
.bloc-hub__viewport::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 10%;
    z-index: 3;
    pointer-events: none;
}

.bloc-hub__viewport::before {
    left: 0;
    background: linear-gradient(to right,
            var(--hub-block-bg) 0%,
            rgba(var(--hub-block-bg-rgb), 0) 100%);
}

.bloc-hub__viewport::after {
    right: 0;
    background: linear-gradient(to left,
            var(--hub-block-bg) 0%,
            rgba(var(--hub-block-bg-rgb), 0) 100%);
}

@media (max-width: 900px) {
    .bloc-hub__viewport::before,
    .bloc-hub__viewport::after {
        display: none;
    }
}

/* Rangée de contrôles : [flèche prev] [dots] [flèche next] */
/* (voir définition consolidée plus haut à grid-row: 3) */

/* Flèches prev/next */
.bloc-hub__nav {
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: var(--hub-teal);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--hub-shadow);
    transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.bloc-hub__nav::after {
    content: none !important;
}

.bloc-hub__nav:hover,
.bloc-hub__nav:focus-visible {
    background: var(--hub-teal);
    color: #fff;
    box-shadow: var(--hub-shadow);
    transform: scale(1.06);
    outline: none;
}

.bloc-hub__nav:active {
    transform: scale(0.96);
}

.bloc-hub__nav:focus-visible {
    outline: 2px solid var(--hub-teal);
    outline-offset: 3px;
}

@media (max-width: 700px) {
    .bloc-hub__controls {
        gap: 12px;
    }

    .bloc-hub__nav {
        width: 38px;
        height: 38px;
    }
}

.bloc-hub__cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2rem;
    /* Easing "easeOutExpo" : décélération très douce, donne une sensation luxueuse au slide */
    transition: transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

.bloc-hub__cards.no-transition {
    transition: none !important;
}

.bloc-hub__card-wrap {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 0 0 calc((100% - 4rem) / 3);
    transform: scale(0.90);
    transition: transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

.bloc-hub__card-wrap.is-active {
    transform: scale(1);
}

/* Responsive : empile verticalement et désactive le carousel sous 900px */
@media (max-width: 900px) {
    .bloc-hub__cards {
        flex-direction: column;
        transform: none !important;
    }

    .bloc-hub__card-wrap {
        flex: 0 0 auto;
        opacity: 1;
        transform: none;
    }

    /* Les clones d'infinite loop n'ont pas de sens en stack vertical */
    .bloc-hub__card-wrap.is-clone {
        display: none;
    }
}

/* --- Card (reprend les dimensions/style de .mega-3col-widgets>*) --- */
.bloc-hub__card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    aspect-ratio: 2.2 / 1;
    overflow: hidden;
    background-color: #2e2e2e;
    background-size: cover;
    background-position: center;
    border-radius: 3px;
    text-decoration: none;
    color: #fff;
    transition: box-shadow 0.3s ease;
    isolation: isolate;
}

.bloc-hub__card::after {
    content: '';
    position: absolute;
    inset: 8px;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    transition: inset 0.3s ease, border-color 0.3s ease;
    pointer-events: none;
}

.bloc-hub__card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.55) 0%,
            rgba(0, 0, 0, 0.1) 60%,
            transparent 100%);
    z-index: 1;
    transition: background 0.3s ease;
}

.bloc-hub__card.has-no-image {
    background: linear-gradient(135deg, var(--hub-teal-mid) 0%, var(--hub-teal) 100%);
}

/* ---- Image ---- */
.bloc-hub__card-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: 0;
    transition: transform 0.5s ease;
}

/* Zoom léger sur l'image lorsque la card active est survolée */
.bloc-hub__card.is-active:hover .bloc-hub__card-image {
    transform: scale(1.04);
}

/* ---- Titre centré (style mega-3col-widget-title) ---- */
.bloc-hub__card-title {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    /* H3 level : 22–26px / 600 */
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: clamp(22px, 1vw + 14px, 26px);
    font-weight: 600;
    color: #fff;
    padding: clamp(0.8rem, 0.6vw + 0.4rem, 1.4rem);
    line-height: 1.15;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    transition: transform 0.3s ease, text-shadow 0.3s ease;
}

/* ---- États "hover-like" réservés à la card active ----
   Les effets (overlay plus sombre, bordure qui grossit, titre qui monte)
   ne s'appliquent QUE quand la card a la classe .is-active.
   Le :hover de la souris sur une card active ajoute les mêmes styles
   (compatibilité avec le survol direct du slot actif).
   :focus-visible est conservé sur toutes les cards pour l'accessibilité clavier. */
.bloc-hub__card.is-active::before,
.bloc-hub__card.is-active:hover::before,
.bloc-hub__card:focus-visible::before {
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.65) 0%,
            rgba(0, 0, 0, 0.25) 60%,
            rgba(0, 0, 0, 0.1) 100%);
}

.bloc-hub__card.is-active::after,
.bloc-hub__card.is-active:hover::after,
.bloc-hub__card:focus-visible::after {
    inset: 12px;
    border-color: rgba(255, 255, 255, 0.7);
}

.bloc-hub__card.is-active .bloc-hub__card-title,
.bloc-hub__card.is-active:hover .bloc-hub__card-title,
.bloc-hub__card:focus-visible .bloc-hub__card-title {
    transform: translateY(-4px);
    text-shadow:
        0 2px 12px rgba(255, 255, 255, 0.25),
        0 1px 4px rgba(0, 0, 0, 0.4);
}

.bloc-hub__card:focus-visible {
    outline: 2px solid var(--hub-teal);
    outline-offset: 3px;
}

/* ---- Progress dots ---- */
.bloc-hub__progress {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.bloc-hub__dot {
    position: relative;
    width: 28px;
    height: 4px;
    border-radius: 3px;
    background: rgba(var(--hub-teal-rgb), 0.2);
    overflow: hidden;
    transition: background-color 0.25s ease;
}

.bloc-hub__dot.is-active {
    background: rgba(var(--hub-teal-rgb), 0.3);
}

.bloc-hub__dot::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--hub-teal);
    transform: scaleX(0);
    transform-origin: left center;
}

.bloc-hub__dot.is-running::after {
    animation: blocHubDotFill var(--hub-interval, 4500ms) linear forwards;
}

@keyframes blocHubDotFill {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

/* ---- Accessibilité : prefers-reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {

    .bloc-hub__description,
    .bloc-hub__card,
    .bloc-hub__card::before,
    .bloc-hub__card::after,
    .bloc-hub__card-title,
    .bloc-hub__dot {
        transition: none;
    }

    .bloc-hub__card.is-active .bloc-hub__card-title,
    .bloc-hub__card.is-active:hover .bloc-hub__card-title,
    .bloc-hub__card:focus-visible .bloc-hub__card-title {
        transform: none;
    }

    .bloc-hub__dot.is-active {
        background: var(--hub-teal);
    }

    .bloc-hub__dot::after,
    .bloc-hub__dot.is-running::after {
        display: none;
    }
}


/* ================================================================
   Section grille : toutes les cards en 3 colonnes
   (photo au-dessus, titre + description en dessous)
   ================================================================ */
.bloc-hub__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 120px;
    padding: 0 56px;
}

/* Quand la grille est affichée seule (sans carousel au-dessus) */
.bloc-hub__grid--standalone {
    margin-top: 0;
}

@media (max-width: 900px) {
    .bloc-hub__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        padding: 0 24px;
    }
}

@media (max-width: 600px) {
    .bloc-hub__grid {
        padding: 0 16px;
    }
}

@media (max-width: 600px) {
    .bloc-hub__grid {
        grid-template-columns: 1fr;
    }
}

/* ================================================================
   Card de la grille — Animation fluide sans flash

   Principe : le texte reste TOUJOURS en bas (flex-end). Pas de
   repositionnement → pas de snap → pas de flash.

   Le clip-path fait l'effet visuel principal : "rideau teal" qui
   monte de bas en haut. Couleurs en cascade synchronisée.

   ENTRÉE (hover-in) :
   T=0.00s  clip-path s'ouvre + fond blanc→teal
   T=0.05s  titre couleur teal→blanc
   T=0.10s  image zoom lent
   T=0.15s  description couleur gris→blanc

   SORTIE (hover-out) : tout revient en 0.3s, pas de delays.
   ================================================================ */
.bloc-hub__grid-card {
    position: relative;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: var(--hub-shadow);
    --grid-body-h: 150px;
    padding-bottom: var(--grid-body-h);
    transition: box-shadow 0.3s ease;
}

.bloc-hub__grid-card::after {
    content: none !important;
}

.bloc-hub__grid-card:hover,
.bloc-hub__grid-card:focus-visible {
    box-shadow: 0 12px 28px rgba(var(--hub-teal-rgb), 0.22);
    outline: none;
}

.bloc-hub__grid-card:focus-visible {
    outline: 2px solid var(--hub-teal);
    outline-offset: 3px;
}

/* ---- Image ---- */
.bloc-hub__grid-card-media {
    display: block;
    aspect-ratio: 16 / 9;
    flex: 1 0 auto;
}

.bloc-hub__grid-card-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: 0;
    transition: transform 0.3s ease;
}

.bloc-hub__grid-card:hover .bloc-hub__grid-card-image {
    transform: scale(1.05);
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.1s;
}

/* ---- Body : bande blanche en bas → overlay teal via clip-path.
   justify-content passe de flex-end à flex-start au hover SANS animation
   (transition: 0s) → le texte se repositionne instantanément. ---- */
.bloc-hub__grid-card-body {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 10px;
    padding: 24px 24px 28px;
    background: #fff;
    text-align: left;
    clip-path: inset(calc(100% - var(--grid-body-h)) -2px -2px -2px);
    /* SORTIE */
    transition: clip-path 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.25s ease,
                padding 0.3s ease;
}

.bloc-hub__grid-card:hover .bloc-hub__grid-card-body,
.bloc-hub__grid-card:focus-visible .bloc-hub__grid-card-body {
    clip-path: inset(-2px);
    background: rgba(var(--hub-teal-rgb), 0.85);
    justify-content: flex-start;
    padding: 28px 24px;
    /* ENTRÉE */
    transition: clip-path 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                background-color 0.4s ease,
                padding 0.4s ease;
}

/* ---- Titre : reste visible, change de couleur (étape 2) ---- */
/* H2 des cards grille */
.bloc-hub__grid-card-title {
    margin: 0;
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.15;
    color: var(--hub-teal);
    text-align: left;
    /* SORTIE */
    transition: color 0.25s ease;
}

.bloc-hub__grid-card:hover .bloc-hub__grid-card-title,
.bloc-hub__grid-card:focus-visible .bloc-hub__grid-card-title {
    color: #fff;
    /* ENTRÉE : couleur change pendant que le clip s'ouvre */
    transition: color 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.05s;
}

/* ---- Description : disparaît (étape 1), titre seul (étape 2),
   réapparaît lettre par lettre en blanc (étape 3).
   Le mask-image crée un "rideau" gauche→droite qui révèle le texte
   progressivement comme une écriture manuscrite. ---- */
.bloc-hub__grid-card-desc {
    font-family: 'Gravity', sans-serif;
    /* Corps de texte : 16–18px / 400 */
    font-size: 16px;
    font-weight: 400;
    line-height: 1.55;
    color: #666;
    text-align: left;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 1;
    transform: translateY(0);
    /* SORTIE : retour rapide */
    transition: opacity 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.bloc-hub__grid-card:hover .bloc-hub__grid-card-desc,
.bloc-hub__grid-card:focus-visible .bloc-hub__grid-card-desc {
    display: block;
    color: rgba(255, 255, 255, 0.92);
    font-size: 16px;
    opacity: 1;
    transform: translateY(0);
    /* ENTRÉE : fade-in + slide-up cascadé après le titre */
    animation: hubDescFadeIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

@keyframes hubDescFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Accessibilité ---- */
@media (prefers-reduced-motion: reduce) {

    .bloc-hub__grid-card,
    .bloc-hub__grid-card-image,
    .bloc-hub__grid-card-body,
    .bloc-hub__grid-card-title,
    .bloc-hub__grid-card-desc {
        transition: none;
    }

    .bloc-hub__grid-card:hover .bloc-hub__grid-card-image {
        transform: none;
    }
}