/************************************************************
	SECTION « VOTRE MÉTIER » (template-parts/section-metiers.php)
	Chargé sur la page d'accueil — voir functions.php.
	Préfixe hm- : aucune règle ne touche les autres sections.

	Survol : en CSS tant que le JS n'a pas pris la main
	(.hm-metiers sans .is-ready), puis piloté par GSAP
	(js/home-metiers.js) — jamais les deux sur les mêmes propriétés.
************************************************************/
.hm-metiers {
    --hm-fg: #000;
    --hm-muted: rgba(0, 0, 0, 0.58);
    --hm-line: rgba(0, 0, 0, 0.14);
    --hm-soft: #f3f3f1;
    --hm-ease: cubic-bezier(0.65, 0, 0.35, 1);
    --hm-gap: clamp(0.75rem, 1.4vw, 1.5rem);

    position: relative;
    padding-block: clamp(5rem, 10vw, 10rem);
    background: #fff;
    color: var(--hm-fg);
}

/* En-tête */
.hm-head {
    margin-bottom: clamp(3rem, 6vw, 5.5rem);
}

/* Texte et CTA sous le titre, en ligne sur grand écran */
.hm-head-side {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem 3rem;
    margin-top: clamp(1.75rem, 3vw, 2.75rem);
}

.hm-kicker {
    margin: 0 0 1.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--hm-muted);
}

.hm-title {
    margin: 0;
    font-size: clamp(2.4rem, 6vw, 6.6rem);
    font-weight: 500;
    line-height: 0.98;
    letter-spacing: -0.045em;
}

.hm-title-line {
    display: block;
}

.hm-text {
    max-width: 52ch;
    margin: 0;
    font-size: clamp(1.02rem, 1.15vw, 1.2rem);
    line-height: 1.6;
    color: var(--hm-muted);
}

.hm-all,
.hm-other-btn {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 0.4rem 0.4rem 0.4rem 1.5rem;
    border: 1px solid var(--hm-fg);
    border-radius: 50px;
    background: transparent;
    color: var(--hm-fg);
    font: inherit;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.35s var(--hm-ease), color 0.35s var(--hm-ease);
}

.hm-all:hover,
.hm-all:focus-visible,
.hm-other-btn:hover,
.hm-other-btn:focus-visible {
    background: var(--hm-fg);
    color: #fff;
    text-decoration: none;
}

.hm-all-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--hm-fg);
    color: #fff;
    transition: background-color 0.35s var(--hm-ease), color 0.35s var(--hm-ease), transform 0.35s var(--hm-ease);
}

.hm-all:hover .hm-all-icon,
.hm-all:focus-visible .hm-all-icon,
.hm-other-btn:hover .hm-all-icon,
.hm-other-btn:focus-visible .hm-all-icon {
    background: #fff;
    color: var(--hm-fg);
    transform: rotate(45deg);
}

/* Grille */
.hm-grid-wrap {
    position: relative;
}

.hm-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--hm-gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

.hm-item {
    display: flex;
}

.hm-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: clamp(16rem, 22vw, 20rem);
    padding: clamp(1.4rem, 2vw, 2rem);
    border: 1px solid var(--hm-line);
    border-radius: 24px;
    background: #fff;
    color: var(--hm-fg);
    text-decoration: none;
}

.hm-card:hover,
.hm-card:focus-visible {
    color: var(--hm-fg);
    text-decoration: none;
}

.hm-card:focus-visible {
    outline: 2px solid var(--hm-fg);
    outline-offset: 4px;
}

/* Numéro : masque pour l'apparition */
.hm-num {
    display: block;
    overflow: hidden;
    align-self: flex-start;
    font-size: clamp(2rem, 3vw, 3rem);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.04em;
}

.hm-num-inner {
    display: block;
    color: transparent;
    -webkit-text-stroke: 1px var(--hm-fg);
    transform-origin: left bottom;
}

.hm-card-title {
    margin: auto 0 0.6rem;
    padding-right: 3rem;
    font-size: clamp(1.35rem, 1.9vw, 1.9rem);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.hm-card-text {
    margin: 0;
    padding-right: 3rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--hm-muted);
}

.hm-arrow {
    position: absolute;
    right: clamp(1.4rem, 2vw, 2rem);
    bottom: clamp(1.4rem, 2vw, 2rem);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--hm-fg);
    border-radius: 50%;
}

/* Survol sans JS (GSAP prend le relais quand .is-ready est posée) */
.hm-metiers:not(.is-ready) .hm-card {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.hm-metiers:not(.is-ready) .hm-card:hover,
.hm-metiers:not(.is-ready) .hm-card:focus-visible {
    border-color: var(--hm-fg);
    background: var(--hm-soft);
}

/* Ligne de liaison : dans l'espace entre les deux rangées de cartes */
.hm-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    z-index: 0;
    height: 1px;
    pointer-events: none;
}

.hm-line-fill {
    position: absolute;
    inset: 0;
    background: var(--hm-fg);
    transform-origin: left center;
}

.hm-line-node {
    position: absolute;
    top: 50%;
    width: 9px;
    height: 9px;
    margin: -4.5px 0 0 -4.5px;
    border-radius: 50%;
    background: var(--hm-fg);
}

/* Au centre des espaces entre colonnes (4 colonnes, 3 espaces) */
.hm-line-node:nth-of-type(2) { left: calc(25% - var(--hm-gap) / 4); }
.hm-line-node:nth-of-type(3) { left: 50%; }
.hm-line-node:nth-of-type(4) { left: calc(75% + var(--hm-gap) / 4); }

/* Bloc « pas dans la liste » */
.hm-other {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem 3rem;
    margin-top: clamp(3rem, 5vw, 4.5rem);
    padding-top: clamp(2rem, 3vw, 3rem);
    border-top: 1px solid var(--hm-line);
}

.hm-other-text {
    max-width: 56ch;
}

.hm-other-title {
    margin: 0 0 0.6rem;
    font-size: clamp(1.4rem, 2.2vw, 2.1rem);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.hm-other-text p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--hm-muted);
}

/* Tablette : 2 colonnes, la ligne devient inutile (4 rangées) */
@media (max-width: 1199.98px) {
    .hm-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hm-line {
        display: none;
    }
}

/* Smartphone : une colonne, cartes compactes, flèches toujours visibles */
@media (max-width: 575.98px) {
    .hm-grid {
        grid-template-columns: 1fr;
    }

    .hm-card {
        min-height: 0;
        padding: 1.4rem 1.4rem 1.6rem;
    }

    .hm-num {
        font-size: 1.6rem;
    }

    .hm-card-title {
        margin-top: 2.25rem;
    }

    .hm-other-btn,
    .hm-all {
        width: 100%;
        justify-content: space-between;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hm-all,
    .hm-other-btn,
    .hm-all-icon,
    .hm-metiers:not(.is-ready) .hm-card {
        transition: none;
    }
}
