/* ==========================================================================
   CARROUSEL PRINCIPAL (vue/snippets/hero-slider.php)
   Variables par slide (injectées en style inline) :
     --sl-text  : couleur unique de la police
     --sl-bg    : couleur de fond (si pas de photo de fond)
     --sl-voile : opacité du voile sur la photo de fond (0 à .9)
   Variables par bouton : --btn-bg, --btn-text
   ========================================================================== */

.hm-hero {
    padding: 24px 0 8px;
}

.hm-slider {
    position: relative;
}

.hm-slider-swiper {
    position: relative;
    overflow: hidden;
    border-radius: var(--ch-radius-lg);
    background: var(--ch-grey-light);
    isolation: isolate;
}

.hm-slider-swiper .swiper-slide {
    display: flex;
    height: auto;
}

/* --------------------------------------------------------------------------
   Slide
   -------------------------------------------------------------------------- */
.hm-sl {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    min-height: 460px;
    overflow: hidden;
    background: var(--sl-bg, #efefef);
    color: var(--sl-text, #2a2b2e);
}

/* Photo de fond + voile de lisibilité (plus dense côté texte) */
.hm-sl-fond {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center;
}

.hm-sl-voile {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(90deg,
            rgba(0, 0, 0, var(--sl-voile, .45)) 0%,
            rgba(0, 0, 0, calc(var(--sl-voile, .45) * .7)) 50%,
            rgba(0, 0, 0, calc(var(--sl-voile, .45) * .25)) 100%);
}

.hm-sl-inner {
    position: relative;
    z-index: 1;
    display: grid;
    width: 100%;
    align-items: center;
}

/* Sans photo : bloc texte à gauche, largeur de lecture confortable */
.hm-sl--sans-photo .hm-sl-inner {
    grid-template-columns: minmax(0, 760px);
}

.hm-sl--sans-photo .hm-sl-content {
    padding: 64px 72px;
}

/* Photo à droite / à gauche : deux colonnes, la photo occupe toute la hauteur */
.hm-sl--photo-droite .hm-sl-inner,
.hm-sl--photo-gauche .hm-sl-inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
}

.hm-sl--photo-droite .hm-sl-content {
    padding: 56px 40px 56px 72px;
}

.hm-sl--photo-gauche .hm-sl-content {
    padding: 56px 72px 56px 40px;
}

.hm-sl--photo-gauche .hm-sl-media {
    order: -1;
}

/* Photo au milieu : photo centrée au-dessus du texte centré */
.hm-sl--photo-milieu .hm-sl-inner {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    align-content: center;
    padding: 36px 56px 44px;
    text-align: center;
}

.hm-sl--photo-milieu .hm-sl-media {
    order: -1;
    margin-bottom: 22px;
}

.hm-sl--photo-milieu .hm-sl-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 760px;
}

.hm-sl--photo-milieu .hm-sl-actions {
    justify-content: center;
}

/* --------------------------------------------------------------------------
   Contenu texte
   -------------------------------------------------------------------------- */
.hm-sl-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.hm-sl-kicker {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    color: inherit;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .12em;
    line-height: 1.3;
    text-transform: uppercase;
}

.hm-sl-kicker::before {
    content: "";
    flex: 0 0 28px;
    height: 2px;
    background: currentColor;
}

.hm-sl-title {
    margin: 0;
    color: inherit;
    font-family: var(--ch-font);
    font-size: clamp(1.7rem, 1.1rem + 2.3vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.01em;
    text-wrap: balance;
}

.hm-sl-text {
    max-width: 560px;
    margin: 18px 0 0;
    color: inherit;
    font-size: clamp(1rem, .95rem + .3vw, 1.15rem);
    line-height: 1.55;
    opacity: .92;
}

.hm-sl-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.hm-sl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 28px;
    border-radius: var(--ch-radius-pill);
    background: var(--btn-bg, #d0343a);
    color: var(--btn-text, #ffffff);
    font-family: var(--ch-font);
    font-size: .98rem;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
    transition: transform .2s var(--ch-ease), box-shadow .2s var(--ch-ease), filter .2s var(--ch-ease);
}

.hm-sl-btn:hover,
.hm-sl-btn:focus-visible {
    color: var(--btn-text, #ffffff);
    filter: brightness(.93);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, .18);
}

.hm-sl-btn:focus-visible {
    outline: 3px solid var(--sl-text, #2a2b2e);
    outline-offset: 3px;
}

.hm-sl-btn:active {
    transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Photo d'illustration
   -------------------------------------------------------------------------- */
.hm-sl-media {
    position: relative;
    margin: 0;
    min-width: 0;
}

.hm-sl-media img {
    display: block;
    max-width: 100%;
}

/* Mode "cadre" : photo recadrée, bord diagonal côté texte */
.hm-sl--photo-droite .hm-sl-media--cadre,
.hm-sl--photo-gauche .hm-sl-media--cadre {
    align-self: stretch;
    min-height: 100%;
}

.hm-sl--photo-droite .hm-sl-media--cadre img,
.hm-sl--photo-gauche .hm-sl-media--cadre img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hm-sl--photo-droite .hm-sl-media--cadre {
    clip-path: polygon(12% 0, 100% 0, 100% 100%, 0 100%);
}

.hm-sl--photo-gauche .hm-sl-media--cadre {
    clip-path: polygon(0 0, 100% 0, 88% 100%, 0 100%);
}

.hm-sl--photo-milieu .hm-sl-media--cadre {
    width: min(100%, 440px);
    height: 190px;
    border-radius: var(--ch-radius);
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .15);
}

.hm-sl--photo-milieu .hm-sl-media--cadre img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Mode "détourée" : produit sur fond transparent, entier et ombré */
.hm-sl-media--detouree {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.hm-sl-media--detouree img {
    width: auto;
    max-height: 380px;
    object-fit: contain;
    filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .18));
}

.hm-sl--photo-milieu .hm-sl-media--detouree {
    padding: 0;
}

.hm-sl--photo-milieu .hm-sl-media--detouree img {
    max-height: 190px;
}

/* --------------------------------------------------------------------------
   Animation d'entrée (uniquement quand le JS a initialisé le carrousel)
   -------------------------------------------------------------------------- */
.hm-slider.is-ready .hm-sl-content > * {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .6s var(--ch-ease), transform .6s var(--ch-ease);
}

.hm-slider.is-ready .swiper-slide-active .hm-sl-content > * {
    opacity: 1;
    transform: none;
}

.hm-slider.is-ready .swiper-slide-active .hm-sl-content > :nth-child(2) { transition-delay: .08s; }
.hm-slider.is-ready .swiper-slide-active .hm-sl-content > :nth-child(3) { transition-delay: .16s; }
.hm-slider.is-ready .swiper-slide-active .hm-sl-content > :nth-child(4) { transition-delay: .24s; }

.hm-slider.is-ready .hm-sl-media img,
.hm-slider.is-ready .hm-sl-fond {
    transform: scale(1.06);
    transition: transform 7s linear;
}

.hm-slider.is-ready .swiper-slide-active .hm-sl-media img,
.hm-slider.is-ready .swiper-slide-active .hm-sl-fond {
    transform: scale(1);
}

/* --------------------------------------------------------------------------
   Flèches (souris : visibles au survol / clavier : au focus)
   -------------------------------------------------------------------------- */
.hm-sl-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--ch-text);
    font-size: 1.1rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s var(--ch-ease), background-color .2s var(--ch-ease), color .2s var(--ch-ease), transform .2s var(--ch-ease);
}

.hm-sl-arrow--prev { left: 18px; }
.hm-sl-arrow--next { right: 18px; }

.hm-slider-swiper:hover .hm-sl-arrow,
.hm-sl-arrow:focus-visible {
    opacity: 1;
}

.hm-sl-arrow:hover {
    background: var(--ch-red);
    color: var(--ch-white);
    transform: scale(1.06);
}

@media (hover: none) {
    .hm-sl-arrow {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   Barre de navigation : pause, onglets à progression, compteur
   -------------------------------------------------------------------------- */
.hm-sl-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 14px;
    padding: 0 4px;
}

.hm-sl-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--ch-border);
    border-radius: 50%;
    background: var(--ch-white);
    color: var(--ch-grey-dark);
    font-size: .75rem;
    cursor: pointer;
    transition: border-color .2s var(--ch-ease), color .2s var(--ch-ease);
}

.hm-sl-toggle:hover {
    border-color: var(--ch-red);
    color: var(--ch-red);
}

.hm-sl-tabs {
    flex: 1 1 auto;
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: 16px;
}

.hm-sl-tab {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 8px 0;
    border: 0;
    background: none;
    color: var(--ch-grey-dark);
    font-family: var(--ch-font);
    font-size: .88rem;
    text-align: left;
    cursor: pointer;
}

.hm-sl-tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color .2s var(--ch-ease);
}

.hm-sl-tab-track {
    position: relative;
    display: block;
    height: 3px;
    border-radius: 3px;
    background: var(--ch-border);
    overflow: hidden;
}

.hm-sl-tab-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: var(--ch-red);
}

.hm-sl-tab:hover .hm-sl-tab-label {
    color: var(--ch-red);
}

.hm-sl-tab.is-active {
    color: var(--ch-text);
    font-weight: 700;
}

.hm-sl-counter {
    flex: 0 0 auto;
    margin: 0;
    color: var(--ch-grey-dark);
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
}

.hm-sl-counter strong {
    color: var(--ch-red);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .hm-sl--photo-droite .hm-sl-content {
        padding: 48px 32px 48px 48px;
    }

    .hm-sl--photo-gauche .hm-sl-content {
        padding: 48px 48px 48px 32px;
    }

    .hm-sl--sans-photo .hm-sl-content {
        padding: 56px 48px;
    }
}

/* Tablette portrait et mobile : empilement photo puis texte */
@media (max-width: 860px) {
    .hm-hero {
        padding-top: 12px;
    }

    .hm-sl {
        min-height: 0;
    }

    .hm-sl--photo-droite .hm-sl-inner,
    .hm-sl--photo-gauche .hm-sl-inner,
    .hm-sl--photo-milieu .hm-sl-inner {
        grid-template-columns: minmax(0, 1fr);
        align-content: start;
        padding: 0;
    }

    .hm-sl--photo-droite .hm-sl-content,
    .hm-sl--photo-gauche .hm-sl-content,
    .hm-sl--photo-milieu .hm-sl-content,
    .hm-sl--sans-photo .hm-sl-content {
        padding: 28px 24px 32px;
    }

    .hm-sl--photo-milieu .hm-sl-content {
        max-width: none;
    }

    .hm-sl-media {
        order: -1;
    }

    .hm-sl--photo-droite .hm-sl-media--cadre,
    .hm-sl--photo-gauche .hm-sl-media--cadre,
    .hm-sl--photo-milieu .hm-sl-media--cadre {
        width: 100%;
        height: 210px;
        min-height: 0;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        clip-path: none;
    }

    .hm-sl--photo-milieu .hm-sl-media--cadre img {
        position: absolute;
        inset: 0;
    }

    .hm-sl-media--detouree {
        height: 210px;
        margin: 0;
        padding: 20px 20px 0;
    }

    .hm-sl-media--detouree img,
    .hm-sl--photo-milieu .hm-sl-media--detouree img {
        max-height: 190px;
    }

    .hm-sl-voile {
        background: rgba(0, 0, 0, var(--sl-voile, .45));
    }

    .hm-sl--fond-image .hm-sl-content {
        padding-top: 44px;
        padding-bottom: 44px;
    }

    .hm-sl-text {
        margin-top: 12px;
    }

    .hm-sl-actions {
        margin-top: 22px;
    }

    .hm-sl-bar {
        gap: 14px;
    }

    .hm-sl-tabs {
        gap: 8px;
    }

    .hm-sl-tab-label {
        display: none;
    }

    .hm-sl-tab {
        padding: 14px 0; /* zone tactile confortable autour de la barre */
    }
}

@media (max-width: 480px) {
    .hm-slider-swiper {
        border-radius: var(--ch-radius);
    }

    .hm-sl-kicker {
        margin-bottom: 12px;
        font-size: .75rem;
    }

    .hm-sl-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hm-sl-btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hm-slider.is-ready .hm-sl-content > *,
    .hm-slider.is-ready .hm-sl-media img,
    .hm-slider.is-ready .hm-sl-fond {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hm-sl-btn,
    .hm-sl-arrow {
        transition: none;
    }
}
