/* ==========================================================================
   PAGE D'ACCUEIL - Chavigny Distribution
   S'appuie sur les variables et composants de css/chavigny.css
   ========================================================================== */

.hm-section {
    padding: 56px 0;
}

.hm-section-grey {
    background: var(--ch-grey-light);
}

.hm-section-more {
    margin: 28px 0 0;
    text-align: center;
}

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

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

.hm-slide {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: stretch;
    min-height: 380px;
    background: var(--ch-grey-light);
    overflow: hidden;
}

.hm-slide-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    padding: 48px 32px 64px 56px;
}

.hm-slide-kicker {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--ch-radius-pill);
    background: var(--ch-white);
    color: var(--ch-red);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.hm-slide-title {
    margin: 0;
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: clamp(1.6rem, 1.1rem + 2vw, 2.6rem);
    font-weight: 700;
    line-height: 1.15;
}

.hm-slide-title strong {
    color: var(--ch-red);
}

.hm-slide-title sup {
    font-size: .55em;
}

.hm-slide-text {
    max-width: 520px;
    margin: 0;
    color: var(--ch-grey-dark);
    font-size: 1.08rem;
    line-height: 1.55;
}

.hm-slide-code {
    align-self: flex-start;
    margin: 0;
    padding: 6px 14px;
    border-radius: var(--ch-radius-sm);
    background: var(--ch-red);
    color: var(--ch-white);
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

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

.hm-slide-actions:empty {
    display: none;
}

/* Visuel : image (champ background du carrousel) ou pictogrammes */
.hm-slide-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-position: center;
    background-size: cover;
}

.hm-slide.has-image .hm-slide-visual {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18%);
    mask-image: linear-gradient(90deg, transparent 0, #000 18%);
}

.hm-slide-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    background: var(--ch-white);
    box-shadow: 0 0 0 22px rgba(255, 255, 255, .5), 0 0 0 44px rgba(255, 255, 255, .25);
    color: var(--ch-red);
    font-size: 5.5rem;
}

.hm-slide-float {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: var(--ch-white);
    box-shadow: var(--ch-shadow);
    color: var(--ch-grey-dark);
    font-size: 1.6rem;
    animation: hm-float 6s ease-in-out infinite;
}

.hm-slide-float-1 { top: 16%; left: 14%; }
.hm-slide-float-2 { bottom: 16%; right: 12%; animation-delay: -2s; }
.hm-slide-float-3 { top: 18%; right: 14%; animation-delay: -4s; }

@keyframes hm-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Contrôles : pause + pagination */
.hm-hero-controls {
    position: absolute;
    left: 56px;
    bottom: 22px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 14px;
}

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

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

.hm-hero-pagination {
    display: flex;
    gap: 8px;
}

.hm-hero-pagination .swiper-pagination-bullet,
.hm-dots .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    margin: 0 !important;
    border-radius: var(--ch-radius-pill);
    background: var(--ch-grey);
    opacity: .45;
    transition: width .25s var(--ch-ease), opacity .25s var(--ch-ease), background-color .25s var(--ch-ease);
}

.hm-hero-pagination .swiper-pagination-bullet-active,
.hm-dots .swiper-pagination-bullet-active {
    width: 28px;
    background: var(--ch-red);
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Catégories
   -------------------------------------------------------------------------- */
.hm-categories-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 32px 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hm-category {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--ch-text);
    text-align: center;
    text-decoration: none;
}

.hm-category-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 150px;
    aspect-ratio: 1 / 1;
    border-radius: var(--ch-radius);
    background: var(--ch-grey-light);
    color: var(--ch-grey);
    font-size: 2.8rem;
    overflow: hidden;
    transition: background-color .25s var(--ch-ease), color .25s var(--ch-ease), transform .25s var(--ch-ease), box-shadow .25s var(--ch-ease);
}

/* Image adaptée automatiquement au bloc, quel que soit son format (logo, photo, portrait, paysage) :
   affichée en entier, centrée, avec une marge intérieure ; fond blanc des photos fondu dans le gris */
.hm-category-visual img {
    display: block;
    width: 100%;
    height: 100%;
    padding: 14%;
    object-fit: contain;
    object-position: center;
    mix-blend-mode: multiply;
    transition: transform .4s var(--ch-ease);
}

.hm-category-label {
    font-size: .95rem;
    font-weight: 500;
    line-height: 1.3;
    transition: color .2s var(--ch-ease);
}

.hm-category:hover .hm-category-visual {
    background: var(--ch-red);
    color: var(--ch-white);
    transform: translateY(-4px);
    box-shadow: 0 10px 22px rgba(208, 52, 58, .22);
}

.hm-category:hover .hm-category-visual img {
    transform: scale(1.06);
}

/* Bloc avec image : survol en contour rouge (un fond rouge masquerait l'image) */
.hm-category:hover .hm-category-visual:has(img) {
    background: var(--ch-white);
    box-shadow: 0 0 0 2px var(--ch-red), 0 10px 22px rgba(208, 52, 58, .18);
}

.hm-category:hover .hm-category-visual:has(img) img {
    mix-blend-mode: normal;
}

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

/* --------------------------------------------------------------------------
   Nos agences
   -------------------------------------------------------------------------- */
.hm-agences-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 48px;
}

.hm-map-card {
    padding: 8px 8px 20px;
    border-radius: var(--ch-radius);
    background: var(--ch-white);
    box-shadow: var(--ch-shadow);
}

/* Onglets univers : séparateurs gris, univers actif en rouge souligné */
.hm-map-tabs {
    display: flex;
    margin: 0 0 4px;
    border-bottom: 1px solid var(--ch-grey-light);
}

.hm-map-tab {
    position: relative;
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    color: var(--ch-grey-dark);
    font-family: var(--ch-font);
    font-size: .95rem;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: color .2s var(--ch-ease);
}

.hm-map-tab + .hm-map-tab::before {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 0;
    width: 1px;
    background: var(--ch-grey);
    opacity: .5;
}

/* Pastille de couleur de l'univers (code couleur de la carte) */
.hm-map-tab-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border: 2px solid var(--ch-white);
    border-radius: 50%;
    background: var(--univers, var(--ch-red));
    box-shadow: 0 0 0 1px var(--univers, var(--ch-red));
}

.hm-map-tab::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: -1px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--univers, var(--ch-red));
    transform: scaleX(0);
    transition: transform .2s var(--ch-ease);
}

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

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

.hm-map-tab.is-active::after {
    transform: scaleX(1);
}

.hm-map-tab-count {
    min-width: 24px;
    padding: 2px 7px;
    border-radius: var(--ch-radius-pill);
    background: var(--ch-grey-light);
    color: var(--ch-grey-dark);
    font-size: .75rem;
    font-weight: 700;
}

.hm-map-tab.is-active .hm-map-tab-count {
    background: var(--univers, var(--ch-red));
    color: var(--ch-white);
}

.hm-map-panel {
    padding: 0 12px;
    animation: hm-fade .3s var(--ch-ease);
}

.hm-map-panel[hidden] {
    display: none;
}

.hm-map-panel:focus {
    outline: none;
}

.hm-map-panel:focus-visible {
    outline: 3px solid rgba(208, 52, 58, .45);
    outline-offset: 2px;
}

@keyframes hm-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Carte interactive */
.hm-map {
    height: 420px;
    margin: 0 12px;
    border-radius: calc(var(--ch-radius) - 4px);
    background: var(--ch-grey-light);
    z-index: 0;
}

.hm-map .leaflet-tile-pane {
    filter: grayscale(1) contrast(.9) brightness(1.05);
}

.hm-map .leaflet-popup-content {
    margin: 12px 16px;
    font-family: var(--ch-font);
    font-size: .88rem;
    line-height: 1.4;
}

.hm-map .leaflet-popup-content > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.hm-map .leaflet-popup-content strong {
    color: var(--ch-text);
    font-size: .95rem;
}

.hm-popup-sub {
    color: var(--ch-grey-dark);
    font-size: .8rem;
}

.hm-map .leaflet-popup-content a {
    margin-top: 6px;
    color: var(--ch-red);
    font-weight: 700;
}

/* Marqueur : goutte rouge (showroom : gris foncé) */
.hm-marker {
    display: block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--ch-white);
    border-radius: 50% 50% 50% 0;
    background: var(--pin, var(--ch-red));
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
    transform: rotate(-45deg);
    transition: transform .15s var(--ch-ease);
}

/* Showroom : même couleur que l'univers, repère rond (comme sur la page Contact) */
.hm-marker--showroom {
    border-radius: 50%;
}

.leaflet-marker-icon:hover .hm-marker,
.leaflet-marker-icon:focus .hm-marker {
    transform: rotate(-45deg) scale(1.15);
}

/* Liste des dépôts de l'univers (boutons : centrent la carte sur le dépôt) */
.hm-depots-title {
    margin: 16px 0 10px;
    color: var(--ch-grey-dark);
    font-size: .9rem;
}

.hm-depots-title strong {
    color: var(--ch-red);
}

.hm-depots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 132px;
    margin: 0;
    padding: 0 0 2px;
    list-style: none;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--ch-border) transparent;
}

.hm-depot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius-pill);
    background: var(--ch-white);
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: .82rem;
    cursor: pointer;
    transition: border-color .15s var(--ch-ease), color .15s var(--ch-ease), background-color .15s var(--ch-ease);
}

.hm-depot i {
    color: var(--univers, var(--ch-red));
}

.hm-depot:hover,
.hm-depot.is-active {
    border-color: var(--univers, var(--ch-red));
    color: var(--ch-text);
}

.hm-depot.is-active {
    background: var(--ch-white);
    box-shadow: inset 0 0 0 1px var(--univers, var(--ch-red));
    font-weight: 700;
}

.hm-depot.is-showroom {
    border-color: transparent;
    background: var(--ch-grey-light);
}

.hm-depot.is-showroom i {
    color: var(--univers, var(--ch-grey-dark));
}

.hm-agences-text {
    color: var(--ch-text);
    font-size: 1rem;
    line-height: 1.6;
    text-align: center;
}

.hm-agences-text p {
    margin: 0 0 16px;
}

.hm-agences-text .ch-btn {
    margin-top: 8px;
}

/* --------------------------------------------------------------------------
   Carrousels (marques, sélection) : flèches rouges et points
   -------------------------------------------------------------------------- */
.hm-carousel {
    position: relative;
    padding: 0 52px;
}

.hm-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-top: -18px;
    border: 0;
    border-radius: 50%;
    background: var(--ch-red);
    color: var(--ch-white);
    font-size: .8rem;
    cursor: pointer;
    transition: background-color .2s var(--ch-ease), opacity .2s var(--ch-ease), transform .2s var(--ch-ease);
}

.hm-arrow:hover {
    background: var(--ch-red-dark);
    transform: scale(1.08);
}

.hm-arrow-prev { left: 0; }
.hm-arrow-next { right: 0; }

.hm-arrow.swiper-button-disabled {
    opacity: .3;
    cursor: default;
    transform: none;
}

.hm-arrow.swiper-button-lock {
    display: none;
}

.hm-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.hm-dots.swiper-pagination-lock {
    display: none;
}

/* Marques */
.hm-brands-swiper .swiper-slide {
    height: auto;
}

.hm-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 96px;
    padding: 14px 18px;
    border: 1px solid transparent;
    border-radius: var(--ch-radius);
    background: var(--ch-white);
    text-decoration: none;
    transition: border-color .2s var(--ch-ease), box-shadow .2s var(--ch-ease), transform .2s var(--ch-ease);
}

.hm-brand img {
    max-width: 100%;
    max-height: 60px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Marque sans logo : nom mis en forme comme un logotype */
.hm-brand-name {
    position: relative;
    display: -webkit-box;
    max-width: 100%;
    padding-bottom: 8px;
    overflow: hidden;
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: .06em;
    line-height: 1.15;
    text-align: center;
    text-transform: uppercase;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: color .2s var(--ch-ease);
}

.hm-brand-name::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 28px;
    height: 3px;
    border-radius: 3px;
    background: var(--ch-red);
    transform: translateX(-50%);
    transition: width .2s var(--ch-ease);
}

.hm-brand:hover .hm-brand-name {
    color: var(--ch-red);
}

.hm-brand:hover .hm-brand-name::after {
    width: 44px;
}

.hm-brand:hover {
    border-color: var(--ch-border);
    box-shadow: var(--ch-shadow);
    transform: translateY(-2px);
}

/* Sélection du moment */
.hm-selection-swiper {
    padding: 6px 4px 10px;
}

.hm-selection-swiper .swiper-slide {
    height: auto;
}

.hm-selection-swiper .swiper-slide > .pc {
    height: 100%;
}

/* --------------------------------------------------------------------------
   Derniers devis
   -------------------------------------------------------------------------- */
.hm-devis-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hm-devis-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    padding: 20px 22px;
    border: 1px solid var(--ch-border);
    border-left: 4px solid var(--ch-red);
    border-radius: var(--ch-radius);
    background: var(--ch-white);
    color: var(--ch-text);
    text-decoration: none;
    transition: box-shadow .2s var(--ch-ease);
}

.hm-devis-card:hover {
    box-shadow: var(--ch-shadow-lg);
}

.hm-devis-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.hm-devis-etat {
    padding: 3px 10px;
    border-radius: var(--ch-radius-pill);
    background: var(--ch-grey-light);
    color: var(--ch-grey-dark);
    font-size: .75rem;
    font-weight: 700;
}

.hm-devis-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    color: var(--ch-grey-dark);
    font-size: .88rem;
}

.hm-devis-meta i {
    color: var(--ch-red);
}

.hm-devis-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--ch-grey-light);
    color: var(--ch-grey-dark);
    font-size: .88rem;
}

.hm-devis-total strong {
    color: var(--ch-text);
    font-size: 1.05rem;
}

/* --------------------------------------------------------------------------
   Catalogues
   -------------------------------------------------------------------------- */
.hm-catalogues-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 28px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hm-catalogue {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    height: 100%;
    padding: 26px 22px 24px;
    border-radius: var(--ch-radius-lg);
    background: var(--ch-grey-light);
    color: var(--ch-text);
    text-align: center;
    text-decoration: none;
    transition: box-shadow .25s var(--ch-ease), transform .25s var(--ch-ease);
}

.hm-catalogue-cover {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 170px;
    aspect-ratio: 3 / 4;
    color: var(--ch-grey);
    font-size: 3rem;
}

.hm-catalogue-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
    transition: transform .3s var(--ch-ease);
}

.hm-catalogue-title {
    color: var(--ch-grey-dark);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.hm-catalogue:hover {
    box-shadow: var(--ch-shadow-lg);
    transform: translateY(-3px);
}

.hm-catalogue:hover .hm-catalogue-cover img {
    transform: rotate(-2deg) scale(1.03);
}

.hm-catalogue:hover .hm-catalogue-title {
    color: var(--ch-red);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .hm-categories-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1023px) {
    .hm-section {
        padding: 44px 0;
    }

    .hm-hero {
        padding-top: 12px;
    }

    .hm-slide {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .hm-slide-content {
        padding: 32px 28px 64px;
    }

    .hm-slide-visual {
        display: none;
    }

    .hm-slide.has-image .hm-slide-visual {
        display: block;
        order: -1;
        height: 180px;
        -webkit-mask-image: none;
        mask-image: none;
    }

    .hm-hero-controls {
        left: 28px;
        bottom: 20px;
    }

    .hm-agences-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .hm-map {
        height: 360px;
    }

    .hm-devis-grid {
        grid-template-columns: 1fr;
    }

    .hm-catalogues-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
    }
}

@media (max-width: 640px) {
    .hm-section {
        padding: 36px 0;
    }

    .hm-slide-content {
        padding: 26px 20px 60px;
    }

    .hm-slide-text {
        font-size: .98rem;
    }

    .hm-slide-actions .ch-btn {
        flex: 1 1 100%;
    }

    .hm-hero-controls {
        left: 20px;
    }

    .hm-categories-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 22px 12px;
    }

    .hm-category-visual {
        font-size: 2rem;
    }

    .hm-category-label {
        font-size: .82rem;
    }

    .hm-carousel {
        padding: 0;
    }

    .hm-arrow {
        display: none;
    }

    .hm-brand {
        height: 76px;
        padding: 10px;
    }

    .hm-brand img {
        max-height: 44px;
    }

    .hm-map-tab {
        flex-direction: column;
        gap: 4px;
        font-size: .85rem;
    }

    .hm-map {
        height: 300px;
        margin: 0 4px;
    }

    .hm-map-panel {
        padding: 0 4px;
    }

    .hm-catalogue {
        padding: 18px 12px;
    }

    .hm-catalogue-title {
        font-size: .9rem;
    }
}

@media (max-width: 400px) {
    .hm-categories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .hm-category-visual,
    .hm-catalogue,
    .hm-brand {
        transition: none;
    }
}

/* Bulle de la carte : adresse et téléphone du dépôt */
.hm-popup-address {
    display: block;
    margin-top: 6px;
    color: var(--ch-grey-dark);
    font-size: .82rem;
    line-height: 1.45;
}

.hm-popup-phone {
    display: inline-block;
    margin-top: 4px;
    color: var(--ch-text);
    font-size: .85rem;
    font-weight: 700;
    text-decoration: none;
}

.hm-popup-phone::before {
    content: "\f095";
    margin-right: 6px;
    color: var(--ch-red);
    font-family: "Font Awesome 5 Pro";
    font-weight: 300;
}

.hm-popup-phone:hover {
    color: var(--ch-red);
}

/* Catégorie avec image de famille (admin) : image plus grande, sans effet de fusion avec le fond */
.hm-category-visual.has-photo {
    background: var(--ch-white);
    box-shadow: inset 0 0 0 1px var(--ch-border);
}

.hm-category-visual.has-photo img {
    padding: 8%;
    mix-blend-mode: normal;
}
