.lf-section-row{
    align-items: flex-start;
}

.lf-caracteristics{
    display: flex;
    flex-wrap: wrap;
    gap: 16px 0;
}

.lf-caracteristic-col{
    display: flex;
    flex-direction: column;
    flex: 1 1 50%;
    gap: 1px;
}

/* ===== SECTIONS CONTENU ===== */

.single-project .project-header {
    margin-bottom: 80px;
}

/* Wrapper des sections d'images/texte. Sur desktop il est "transparent"
   (display: contents) : les sections restent rendues comme enfants directs
   de main → aucun impact sur la mise en page desktop. Il ne sert qu'à
   permettre l'aplatissement en une grille commune sur mobile. */
.sp-content {
    display: contents;
}

.sp-gallery-1,
.sp-gallery-2 {
    --sp-gap: 40px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: auto;
    grid-auto-flow: dense;
    gap: var(--sp-gap);
    margin-bottom: var(--sp-gap);
}

/* Cellule de base */
.sp-img {
    overflow: hidden;
}

.sp-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

/* Tailles */
.sp-img-m {
    grid-column: span 2;
    grid-row: span 2;
    aspect-ratio: 1 / 1;
}

.sp-img-l {
    grid-column: span 3;
    grid-row: span 3;
    aspect-ratio: 1 / 1;
}

.sp-img-ms {
    grid-column: span 2;
    grid-row: span 1;
    position: relative;
    height: 0;
    /* 50% = moitié de la largeur (2 cols) = 1 col + gap/2 ; on retire gap/2 → height exactement = 1 col */
    padding-top: calc(50% - var(--sp-gap) / 2);
}

.sp-img-ms img {
    position: absolute;
    inset: 0;
}

.sp-img-lm {
    grid-column: span 3;
    grid-row: span 2;
    aspect-ratio: 3 / 2;
}

/* ===== SECTION DESCRIPTION ===== */

.sp-description {
    --sp-gap: 40px;
    display: flex;
    align-items: flex-start;
    gap: var(--sp-gap);
    margin-bottom: var(--sp-gap);
}

.sp-description-text {
    flex: 3;
    align-self: center;
    padding: 0 9%;
}

.sp-img-desc {
    flex: 0 0 auto;
    /* largeur d'exactement 2 colonnes de la grille 5 colonnes (= .sp-img-m) */
    width: calc(2 * (100% - 4 * var(--sp-gap)) / 5 + var(--sp-gap));
    aspect-ratio: 1 / 1;
}

/* ===== LIGHTBOX ===== */

.sp-lightbox {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 40px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sp-lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.sp-lightbox-right {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    align-items: center;
    flex-shrink: 0;
}

.sp-lightbox-close {
    background: none;
    border: none;
    color: #fff;
    font-family: var(--font-family);
    font-size: 28px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.sp-lightbox-close:hover {
    opacity: 1;
}

.sp-lightbox-body {
    display: flex;
    align-items: center;
    gap: 210px;
    flex: 1;
    width: 100%;
    justify-content: center;
    min-height: 0;
}

.sp-lightbox-nav {
    background: none;
    border: none;
    color: #fff;
    font-family: var(--font-family);
    font-size: 32px;
    padding: 0 8px;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}

.sp-lightbox-nav:hover {
    opacity: 1;
}

.sp-lightbox-nav svg{
    width: 30px;
}

.sp-lightbox-nav path{
    fill: #fff;
}

.sp-lightbox-prev svg{
    transform: rotate(90deg);
}

.sp-lightbox-next svg{
    transform: rotate(270deg);
}

.sp-lightbox-next {
    margin-top: auto;
    margin-bottom: auto;
}

.sp-lightbox-stage {
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    transition: width 0.4s ease, height 0.4s ease;
}

.sp-lightbox-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    opacity: 0;
}

.sp-lightbox-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    max-width: 100%;
    flex-shrink: 0;
    scrollbar-width: none;
}

.sp-lightbox-thumbs::-webkit-scrollbar {
    display: none;
}

.sp-lightbox-thumb {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    background: none;
    border: 2px solid transparent;
    padding: 0;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.sp-lightbox-thumb:hover {
    opacity: 0.8;
}

.sp-lightbox-thumb.active {
    opacity: 1;
    border-color: #fff;
}

.sp-lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== SECTION NEXT PROJECT ===== */

.next-project{
    position: relative;
    margin-top: 120px;
}

.next-project a{
    text-decoration: none;
}

/* .next-project a img{
    position: absolute;
    width: 100%;
    height: -webkit-fill-available;
    object-fit: cover;
    z-index: -1;
    filter: brightness(0.6);
    transition: filter 0.3s ease;
} */

.next-project:hover{
    filter: brightness(1);
}

.next-project a .next-project-text{
    padding: 0 40px;
}

.next-project a .next-project-title{
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 30px;
}

.next-project a .next-project-title p{
    margin: 0;
}

.next-project a .next-project-title span svg{
    width: 1.7rem;
}



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

@media (max-width: 768px){

    .sp-gallery-1,
    .sp-gallery-2 {
        --sp-gap: 20px;
    }

    /* ── Empilement mobile ──────────────────────────────────────
       On aplatit les 3 sections d'images/texte dans UNE grille
       2 colonnes commune (flux continu, comme projects.php). */
    .sp-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin-bottom: 40px;
    }

    .sp-gallery-1,
    .sp-description,
    .sp-gallery-2 {
        display: contents;
    }

    /* Toutes les images : carrées, 2 par ligne (on annule les tailles desktop) */
    .sp-content .sp-img {
        grid-column: auto;
        grid-row: auto;
        width: auto;
        height: auto;
        padding-top: 0;
        margin: 0;
        aspect-ratio: 1 / 1;
    }

    .sp-content .sp-img img {
        position: static;
        height: 100%;
    }

    /* 1) La 1ère image de sp-gallery-1 : pleine largeur, en tête, ratio naturel */
    .sp-gallery-1 .sp-img:first-child {
        grid-column: 1 / -1;
        order: -2;
        aspect-ratio: auto;
    }

    .sp-gallery-1 .sp-img:first-child img {
        height: auto;
    }

    /* 2) Le texte : pleine largeur, juste après la 1ère image */
    .sp-description-text {
        grid-column: 1 / -1;
        order: -1;
        padding: 0;
    }

    .lf-caracteristics{
        flex: inherit !important;
        width: 100%;
    }

    .lf-caracteristic-col {
        width: 33%;
        flex: inherit;
    }

    .single-project .project-header {
        margin-bottom: 40px;
    }

    .sp-lightbox {
        padding: 20px;
    }

    /* Image pleine largeur. La body garde son flex:1 (→ miniatures tout en bas)
       et passe en wrap : la photo occupe toute la ligne, les flèches passent
       donc SOUS la photo, groupées et centrées. */
    .sp-lightbox-body {
        position: relative;
        flex-wrap: wrap;
        align-content: center;
        justify-content: center;
        gap: 16px 44px;
        flex: none;
    }

    /* On aplatit la colonne de droite pour que la flèche "suivante" rejoigne
       la "précédente" sur la même ligne, sous la photo. */
    .sp-lightbox-right {
        display: contents;
    }

    .sp-lightbox-stage {
        flex: 0 0 100%;          /* la photo prend toute la ligne → flèches dessous */
        max-width: 100%;
    }

    .sp-lightbox-nav svg {
        width: 23px;
    }

    .sp-lightbox-prev,
    .sp-lightbox-next {
        order: 1;                /* placées après la photo */
        margin: 0;
    }

    .sp-lightbox-close {
        position: absolute;
        top: -35px;
        right: 0px;
        z-index: 2;
    }
}