/* =====================================================
   Section Communes Home — Intercommunalités (front-page)
   ===================================================== */

.habari-communes-home {
    padding: 60px 0 40px;
    background: #fff;
}

.habari-communes-home__inner {}

/* ── En-tête ── */
.habari-communes-home__header {
    text-align: center;
    margin-bottom: 36px;
}

.habari-communes-home__title {
    font-family: var(--habari-font-heading);
    font-size: 2rem;
    color: var(--habari-secondary-navy);
    margin: 0 0 10px;
}

.habari-communes-home__subtitle {
    color: #666;
    font-size: .95rem;
    margin: 8px 0 0;
}

.habari-communes-home__title-bar {
    width: 60px;
    height: 3px;
    background: var(--habari-primary-brand);
    margin: 0 auto;
}

/* ── Onglets ── */
.habari-communes-home__tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.habari-communes-home__tab {
    padding: 9px 22px;
    border: 1px solid var(--habari-secondary-navy);
    background: #fff;
    color: var(--habari-secondary-navy);
    font-family: var(--habari-font-heading);
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;

    letter-spacing: .4px;
    transition: background .18s, color .18s, border-color .18s;
    line-height: 1;
}

.habari-communes-home__tab:hover {
    background: var(--habari-secondary-navy);
    color: #fff;
}

.habari-communes-home__tab--active,
.habari-communes-home__tab--active:hover {
    background: var(--habari-primary-brand);
    border-color: var(--habari-primary-brand);
    color: #fff;
}

/* ── Panels ── */
.habari-communes-home__panel {
    display: none;
}

.habari-communes-home__panel--active {
    display: block;
}

/* ── Grilles ── */
.habari-communes-home__grid {
    gap: 8px;
}

/* Layout 2 : deux paysages empilés */
.habari-communes-home__grid--layout-2 {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 280px 280px;
}

/* Layout 4 :
   [ carré 1 ][ carré 2 ][ portrait 4 ]
   [ paysage 3           ][ portrait 4 ]
*/
.habari-communes-home__grid--layout-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 270px 270px;
}

.habari-communes-home__grid--layout-4 .habari-communes-home__card:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}
.habari-communes-home__grid--layout-4 .habari-communes-home__card:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}
.habari-communes-home__grid--layout-4 .habari-communes-home__card:nth-child(3) {
    grid-column: 1 / 3;
    grid-row: 2;
}
.habari-communes-home__grid--layout-4 .habari-communes-home__card:nth-child(4) {
    grid-column: 3;
    grid-row: 1 / 3;
}

/* Layout 5 :
   [ carré 1 ][ carré 2 ][ portrait 5 ]
   [ carré 3 ][ carré 4 ][ portrait 5 ]
*/
.habari-communes-home__grid--layout-5 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 270px 270px;
}

.habari-communes-home__grid--layout-5 .habari-communes-home__card:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}
.habari-communes-home__grid--layout-5 .habari-communes-home__card:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}
.habari-communes-home__grid--layout-5 .habari-communes-home__card:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
}
.habari-communes-home__grid--layout-5 .habari-communes-home__card:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
}
.habari-communes-home__grid--layout-5 .habari-communes-home__card:nth-child(5) {
    grid-column: 3;
    grid-row: 1 / 3;
}

/* ── Card ── */
.habari-communes-home__card {
    position: relative;
    overflow: hidden;
    background: var(--habari-secondary-navy);
    text-decoration: none;
    display: block;
}

.habari-communes-home__card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform .4s ease;
}

.habari-communes-home__card:hover .habari-communes-home__card-img {
    transform: scale(1.04);
}

.habari-communes-home__card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(3, 34, 77, .88) 0%,
        rgba(3, 34, 77, .25) 50%,
        transparent 100%
    );
    z-index: 1;
}

.habari-communes-home__card-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 18px;
    z-index: 2;
}

.habari-communes-home__card-name {
    font-family: var(--habari-font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 5px;
    line-height: 1.3;
}

.habari-communes-home__card-excerpt {
    font-size: .78rem;
    color: rgba(255, 255, 255, .78);
    line-height: 1.45;
    margin: 0;
}

/* ── Divider ── */
.habari-communes-home__divider {
    width: 30%;
    margin: 0 auto;
    border: none;
    border-top: 1px solid var(--habari-dark-off);
}
