/* ========================================
   GRID 2+1
======================================== */

.b-grid-2-1 {
    width: 100%;
    display: grid; /* MODIFICATION */
    grid-template-rows: repeat(2, minmax(380px, 1fr)); /* MODIFICATION */
}

/* ========================================
   TOP CARDS
======================================== */

.b-grid-2-1 .top {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
}

.b-grid-2-1 .top .card {
    position: relative;
    display: flex;
    align-items: flex-start; /* MODIFICATION */
    min-width: 0;
    min-height: 100%; /* MODIFICATION */
    overflow: hidden;
    border-radius: 0;
    color: var(--color-white);
    text-decoration: none;
}

/* Une seule carte : pleine largeur */

.b-grid-2-1 .top .card:only-child {
    grid-column: 1 / -1;
}

/* ========================================
   BACKGROUND IMAGES
======================================== */

.b-grid-2-1 .card > .g-image-cover,
.b-grid-2-1 .bottom > .g-image-cover {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.b-grid-2-1 .card > .g-image-cover img,
.b-grid-2-1 .bottom > .g-image-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   TOP CONTENT
======================================== */

.b-grid-2-1 .top .content {
    position: relative;
    z-index: 1;
    width: 70%;
    min-width: 0;
    padding: clamp(30px, 3vw, 55px);
    color: var(--color-white);
}

/* Title */

.b-grid-2-1 .top .title {
    max-width: 650px;
    margin: 0;
    font-family: var(--font-secondary);
    font-size: clamp(32px, 3.4vw, 58px);
    font-weight: 700;
    line-height: 1.05;
    color: inherit;
    white-space: normal;
    overflow-wrap: break-word;
}

/* Action */

.b-grid-2-1 .top .action {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    margin-top: clamp(25px, 3vw, 40px);
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
    color: inherit;
}

.b-grid-2-1 .top .arrow {
    font-size: 22px;
    width: 25px;
    line-height: 1;
    transition: transform 0.2s ease;
}

/* ========================================
   TOP LINKS
======================================== */

.b-grid-2-1 .top .card.is-link {
    transition: color 0.2s ease;
}

.b-grid-2-1 .top .card.is-link:hover {
    color: var(--color-white);
}

.b-grid-2-1 .top .card.is-link:hover .arrow {
    transform: translateX(6px);
}

.b-grid-2-1 .top .card.is-link:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: -3px;
}

/* ========================================
   TOP CARDS - HOVER
======================================== */

.b-grid-2-1 .top .card.is-link {
    cursor: pointer;
}

.b-grid-2-1 .top .card.is-link > .g-image-cover img {
    transition:
        transform 450ms ease,
        filter 450ms ease;
}

@media (hover: hover) {
    .b-grid-2-1 .top .card.is-link:hover > .g-image-cover img {
        transform: scale(1.08);
        filter: brightness(0.6);
    }

    .b-grid-2-1 .top .card.is-link:hover .arrow {
        transform: translateX(10px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .b-grid-2-1 .top .card.is-link > .g-image-cover img {
        transition: none;
    }
}

/* ========================================
   BOTTOM CARD
======================================== */

.b-grid-2-1 .bottom {
    position: relative;
    border-top: 2px solid var(--color-white);
    min-height: 380px;
    overflow: hidden;
    background-color: var(--color-white);
    color: var(--color-black);
}

/*
   Si une image existe, le contenu doit être blanc.
   :has() permet de détecter le picture présent.
*/

.b-grid-2-1 .bottom:has(> .g-image-cover) {
    color: var(--color-white);
}

/*
   Si une couleur globale est définie sans image,
   la couleur du texte doit être adaptée à cette couleur
   via les règles du thème.
*/

.b-grid-2-1 .bottom-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    height: 100%; /* MODIFICATION */
    padding: clamp(55px, 6vw, 95px) clamp(20px, 4vw, 65px);
}

/* ========================================
   BOTTOM ITEMS
======================================== */

.b-grid-2-1 .items {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(5, auto);
    width: 100%;
    max-width: 1450px;
    margin: 0 auto;
}

.b-grid-2-1 .items .item {
    position: relative;
    display: grid;
    grid-template-rows: subgrid;
    grid-row: 1 / 6;
    align-items: center;
    justify-items: center;
    min-width: 0;
    padding: 0 clamp(15px, 3vw, 45px);
    color: inherit;
    text-align: center;
    text-decoration: none;
}

/* Alignement des éléments sur les lignes communes */

.b-grid-2-1 .items .icon {
    grid-row: 1;
}

.b-grid-2-1 .items .suptitle {
    grid-row: 2;
}

.b-grid-2-1 .items .item-title {
    grid-row: 3;
}

.b-grid-2-1 .items .subtitle {
    grid-row: 4;
}

.b-grid-2-1 .items .paragraph {
    grid-row: 5;
}

/* Vertical separators */

.b-grid-2-1 .items .item:not(:first-child)::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 1px;
    height: 50px;
    background: currentColor;
    opacity: 0.75;
    transform: translateY(-50%);
}

/* ========================================
   BOTTOM ICONS
======================================== */

.b-grid-2-1 .items .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 65px;
    height: 65px;
    margin-bottom: 25px;
}

.b-grid-2-1 .items .icon svg,
.b-grid-2-1 .items .icon img {
    display: block;
    width: 55px;
    height: 55px;
    object-fit: contain;
}

/* ========================================
   BOTTOM TEXT
======================================== */

.b-grid-2-1 .items .suptitle {
    max-width: 350px;
    font-family: var(--font-secondary);
    font-size: clamp(17px, 1.1vw, 20px);
    font-weight: 700;
    line-height: 1.35;
}

.b-grid-2-1 .items .item-title {
    margin-top: 25px;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
}

.b-grid-2-1 .items .subtitle {
    font-family: var(--font-primary);
    font-size: 11px;
    font-style: italic;
    line-height: 1.4;
}

.b-grid-2-1 .items .paragraph {
    margin-top: 15px;
    font-size: 13px;
    line-height: 1.5;
}

.b-grid-2-1 .items .paragraph p {
    margin: 0;
}

/* ========================================
   BOTTOM LINKS
======================================== */

.b-grid-2-1 .items .item.is-link {
    transition: color 0.2s ease;
}

.b-grid-2-1 .items .item.is-link:hover {
    color: var(--color-primary);
}

.b-grid-2-1 .items .item.is-link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 5px;
}

/* ========================================
   BOTTOM ITEMS - HOVER
======================================== */

.b-grid-2-1 .items .item.is-link {
    z-index: 1;
    isolation: isolate;
    cursor: pointer;
    transition: color 350ms ease;
}

/* Voile sombre derrière le contenu */

.b-grid-2-1 .items .item.is-link::after {
    content: '';
    position: absolute;
    inset: -25px 8px;
    z-index: -1;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: scale(0.94);
    pointer-events: none;
    transition:
        opacity 350ms ease,
        transform 350ms ease;
}

/* Pictogramme */

.b-grid-2-1 .items .item.is-link .icon {
    transition: transform 350ms ease;
}

/* Survol */

@media (hover: hover) {
    .b-grid-2-1 .items .item.is-link:hover {
        color: var(--color-primary);
    }

    .b-grid-2-1 .items .item.is-link:hover::after {
        opacity: 1;
        transform: scale(1);
    }

    .b-grid-2-1 .items .item.is-link:hover .icon {
        transform: scale(1.12);
    }
}

/* Navigation clavier */

.b-grid-2-1 .items .item.is-link:focus-visible::after {
    opacity: 1;
    transform: scale(1);
}

.b-grid-2-1 .items .item.is-link:focus-visible .icon {
    transform: scale(1.12);
}

/* Séparateurs : toujours blancs */

.b-grid-2-1 .items .item.is-link::before {
    color: var(--color-white);
}

/* Accessibilité */

@media (prefers-reduced-motion: reduce) {
    .b-grid-2-1 .items .item.is-link,
    .b-grid-2-1 .items .item.is-link::after,
    .b-grid-2-1 .items .item.is-link .icon {
        transition: none;
    }
}

/* ========================================
   TABLET
======================================== */

@media (max-width: 991px) {
    .b-grid-2-1 .top .card {
        min-height: 350px;
    }

    .b-grid-2-1 .top .title {
        font-size: clamp(30px, 4vw, 44px);
    }

    .b-grid-2-1 .items .item {
        padding: 0 18px;
    }
}

/* ========================================
   MOBILE
======================================== */

@media (max-width: 767px) {
    .b-grid-2-1 {
        grid-template-rows: auto; /* MODIFICATION */
    }

    .b-grid-2-1 .top {
        grid-template-columns: 1fr;
    }

    .b-grid-2-1 .top .card {
        min-height: 350px;
    }

    .b-grid-2-1 .top .content {
        padding: 30px 25px;
        width: 100%;
    }

    .b-grid-2-1 .top .title {
        font-size: clamp(32px, 8vw, 46px);
    }

    .b-grid-2-1 .bottom-content {
        padding: 55px 25px;
    }

    .b-grid-2-1 .items {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        gap: 50px;
    }

    .b-grid-2-1 .items .item {
        grid-row: auto;
        grid-template-rows: repeat(5, auto);
        padding: 0;
    }

    .b-grid-2-1 .items .item::before {
        display: none;
    }

    .b-grid-2-1 .items .icon {
        margin-bottom: 15px;
    }

    .b-grid-2-1 .items .item-title {
        margin-top: 18px;
    }
}

/* ========================================
   REDUCED MOTION
======================================== */

@media (prefers-reduced-motion: reduce) {
    .b-grid-2-1 .top .arrow,
    .b-grid-2-1 .items .item.is-link {
        transition: none;
    }
}
