/**
 * Styles pour le widget Page Réalisations
 * Design : header full-width + body 2 colonnes (image | produits) + alternance gauche/droite
 */

/* ===== CONTAINER ===== */
.rp-container {
    margin: 0 auto;
}

.rp-no-results,
.rp-no-results-msg {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: #888;
}

/* =========================================================
   FILTRES (header avec titre, dropdowns multi-sélection, compteur)
   ========================================================= */
.rp-filters {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 40px;
    margin-top: -64px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.rp-filters__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.rp-filters__title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px;
    font-family: 'Lexend', sans-serif;
}

.rp-filters__subtitle {
    font-size: 13px;
    color: #7f8c8d;
    margin: 0;
}

.rp-filters__count-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 6px 8px;
    background: #f1f5fa;
    border-radius: 999px;
    flex-shrink: 0;
}

.rp-filters__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: #163c79;
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 13px;
    font-family: 'Lexend', sans-serif;
}

.rp-filters__count-label {
    font-size: 13px;
    font-weight: 600;
    color: #163c79;
    font-family: 'Lexend', sans-serif;
}

.rp-filters__dropdowns {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* Dropdown */
.rp-filter-dropdown {
    position: relative;
}

.rp-filter-dropdown__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #1a1a2e;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Lexend', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rp-filter-dropdown__toggle:hover {
    border-color: #163c79;
    color: #163c79;
}

.rp-filter-dropdown.is-active .rp-filter-dropdown__toggle {
    background: #f0f6ff;
    border-color: #163c79;
    color: #163c79;
}

.rp-filter-dropdown__toggle.is-open {
    border-color: #163c79;
    box-shadow: 0 0 0 3px rgba(22, 60, 121, 0.12);
}

.rp-filter-dropdown__icon {
    color: #6b7280;
    flex-shrink: 0;
}

.rp-filter-dropdown.is-active .rp-filter-dropdown__icon,
.rp-filter-dropdown__toggle:hover .rp-filter-dropdown__icon {
    color: #163c79;
}

.rp-filter-dropdown__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #163c79;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    margin-left: 2px;
}

.rp-filter-dropdown__badge[hidden],
.rp-filters__reset[hidden],
.rp-filter-dropdown__panel[hidden] {
    display: none !important;
}

.rp-filter-dropdown__caret {
    color: #6b7280;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.rp-filter-dropdown__toggle.is-open .rp-filter-dropdown__caret {
    transform: rotate(180deg);
}

.rp-filter-dropdown__panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 240px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 6px;
    max-height: 320px;
    overflow-y: auto;
}

.rp-filter-dropdown__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rp-filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #1a1a2e;
    transition: background 0.15s ease;
}

.rp-filter-option:hover {
    background: #f0f6ff;
}

.rp-filter-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.rp-filter-option__check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1.5px solid #d1d5db;
    border-radius: 4px;
    color: #fff;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.rp-filter-option__check svg {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.rp-filter-checkbox:checked+.rp-filter-option__check {
    background: #163c79;
    border-color: #163c79;
}

.rp-filter-checkbox:checked+.rp-filter-option__check svg {
    opacity: 1;
}

.rp-filter-option__label {
    font-weight: 500;
}

/* Bouton réinitialiser */
.rp-filters__reset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Lexend', sans-serif;
}

.rp-filters__reset:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fff5f5;
}

/* Sticky floating */
.rp-filters.is-floating {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: calc(100% - 40px);
    z-index: 50;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
    margin-bottom: 0;
    animation: rpFiltersSlideUp 0.3s ease forwards;
}

@keyframes rpFiltersSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.rp-filters.is-floating.is-near-footer {
    animation: none;
    opacity: 0;
    transform: translateX(-50%) translateY(40px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.rp-filters-placeholder {
    display: none;
}

.rp-filters-placeholder.is-active {
    display: block;
}

/* En mode floating : header masqué, juste les dropdowns */
.rp-filters.is-floating .rp-filters__header {
    display: none;
}

/* =========================================================
   LISTE DES RÉALISATIONS
   ========================================================= */
.rp-list {
    display: flex;
    flex-direction: column;
    gap: 60px;
}

/* =========================================================
   CARTE RÉALISATION
   ========================================================= */
.rp-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    opacity: 0;
    transform: translateY(30px);
    animation: rpFadeIn 0.6s ease forwards;
}

.rp-card:nth-child(1) {
    animation-delay: 0.05s;
}

.rp-card:nth-child(2) {
    animation-delay: 0.10s;
}

.rp-card:nth-child(3) {
    animation-delay: 0.15s;
}

.rp-card:nth-child(4) {
    animation-delay: 0.20s;
}

@keyframes rpFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rp-card+.rp-card {
    padding-top: 60px;
    border-top: 1px solid #e5e7eb;
}

/* HEADER (au-dessus, full width) */
.rp-card__topbar {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    align-items: end;
}

.rp-card__topbar-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.rp-card__topbar-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rp-card__year-pill {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    font-family: 'Lexend Deca', sans-serif;
}

.rp-tag {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-family: 'Lexend Deca', sans-serif;
}

.rp-tag--cible {
    background: #f1f5fa;
    color: #163c79;
}

.rp-tag--type {
    background: #d7f5a5;
    color: #2d4a11;
}

.rp-tag--salle {
    background: #fde7c1;
    color: #7a4a07;
}

.rp-card__title {
    font-size: 32px;
    font-weight: 500;
    color: #163C79;
    margin: 0;
    line-height: 1.05;
    letter-spacing: -0.5px;
    font-family: 'Lexend Deca', sans-serif;
}

.rp-card__subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

.rp-card__subtitle strong {
    color: #1a1a2e;
    font-weight: 600;
}

/* BODY (2 colonnes : image | produits) */
.rp-card__body {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    align-items: stretch;
    position: relative;
    /* Empêche les enfants (notamment la colonne galerie) de pousser
       la grille au-delà de leur fraction → fix débordement horizontal. */
    min-width: 0;
}

/* min-width: 0 sur TOUS les enfants directs de la grid pour qu'aucun
   contenu intrinsèquement large (slides flex) ne dépasse. */
.rp-card__body > * {
    min-width: 0;
}

/* La card elle-même clippe par sécurité (évite que tout débordement
   interne ne pousse la page horizontalement). */
.rp-card {
    overflow: hidden;
}

/* =====================================================================
   COLONNE INFO LATÉRALE : remplace la colonne produits vide pour les
   galeries sans produits liés. Affiche eyebrow + titre + description
   à droite de l'image, qui reste propre sans overlay.
   ===================================================================== */
.rp-card__info-aside {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 4px;
    align-self: center;
}

.rp-card__info-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--rp-green, #7eb036);
}

.rp-card__info-title {
    margin: 0;
    font-size: clamp(20px, 2vw, 24px);
    line-height: 1.25;
    font-weight: 800;
    color: var(--rp-blue, #163c79);
    letter-spacing: -0.3px;
}

.rp-card__info-desc-wrap {
    position: relative;
}

.rp-card__info-desc {
    color: #4a5568;
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
    /* La max-height est posée en inline par le JS pour pouvoir transitionner
       proprement entre la valeur repliée (200px) et la hauteur naturelle. */
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                -webkit-mask-image 0.3s ease,
                mask-image 0.3s ease;
}
.rp-card__info-desc p {
    margin: 0 0 8px;
}
.rp-card__info-desc p:last-child {
    margin-bottom: 0;
}

/* Repli : fondu vers transparent en bas pour signaler que ça continue.
   La max-height elle-même est gérée en inline par le JS. */
.rp-card__info-desc-wrap.is-collapsible:not(.is-expanded) .rp-card__info-desc {
    -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
}

.rp-card__info-toggle {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    border: 0;
    color: var(--rp-blue, #163c79);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease;
}
.rp-card__info-toggle:hover {
    color: var(--rp-green, #7eb036);
}
.rp-card__info-toggle svg {
    transition: transform 0.25s ease;
}
.rp-card__info-desc-wrap.is-expanded .rp-card__info-toggle svg {
    transform: rotate(180deg);
}

/* Affichage des libellés selon l'état */
.rp-card__info-toggle-label-less { display: none; }
.rp-card__info-desc-wrap.is-expanded .rp-card__info-toggle-label-more { display: none; }
.rp-card__info-desc-wrap.is-expanded .rp-card__info-toggle-label-less { display: inline; }

/* MEDIA */
.rp-card__media {
    position: relative;
}

.rp-card__visual {
    position: relative;
    width: 100%;
    /* min-width: 0 force le grid item à respecter sa fraction (1.4fr) et ne
       PAS s'agrandir pour contenir des enfants larges (ex: slides de galerie).
       Sans ça, le track flex pousse la card → débordement horizontal de la page. */
    min-width: 0;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    overflow: hidden;
}

.rp-card__visual>img,
.rp-card__photo-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rp-card__photo-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
}

/* Overlay sur l'image */
.rp-card__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 24px 22px;
    color: #fff;
    background: linear-gradient(to top, rgba(22, 60, 121, 0.88) 0%, rgba(22, 60, 121, 0.55) 45%, rgba(22, 60, 121, 0) 100%);
    pointer-events: none;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.rp-card__overlay-meta {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 8px;
}

.rp-card__overlay-title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.2;
    font-family: 'Lexend Deca', sans-serif;
}

/* Bouton toggle "Détails du projet" / "Fermer" dans l'overlay */
.rp-card__details-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    align-self: flex-start;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.95);
    color: #163c79;
    border: none;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Lexend', sans-serif;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s ease, transform 0.15s ease;
}

.rp-card__details-toggle:hover {
    background: #fff;
    transform: translateY(-1px);
}

/* États du bouton : par défaut on montre "open", quand le panel est ouvert on montre "close" */
.rp-card__details-toggle__icon-close,
.rp-card__details-toggle__label-close { display: none; }

.rp-card__visual.is-details-open .rp-card__details-toggle__icon-open,
.rp-card__visual.is-details-open .rp-card__details-toggle__label-open { display: none; }

.rp-card__visual.is-details-open .rp-card__details-toggle__icon-close,
.rp-card__visual.is-details-open .rp-card__details-toggle__label-close {
    display: inline-flex;
    align-items: center;
}

/* Description inline en bas de l'overlay : animée via grid-template-rows.
   Trick CSS moderne : le wrap passe de 0fr (collapsé, hauteur 0) à 1fr (hauteur naturelle du contenu).
   Plus fluide que max-height car ça suit la vraie taille du contenu. */
.rp-card__overlay-desc-wrap {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s ease, margin-top 0.3s ease;
    margin-top: 0;
}

.rp-card__overlay-desc-inner {
    overflow: hidden;
}

.rp-card__visual.is-details-open .rp-card__overlay-desc-wrap {
    grid-template-rows: 1fr;
    margin-top: 14px;
}

.rp-card__overlay-desc {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    /* Petit slide + fade pour donner l'impression que le texte arrive du bas */
    transform: translateY(8px);
    opacity: 0;
    transition: transform 0.35s ease 0.05s, opacity 0.3s ease 0.05s;
}

.rp-card__visual.is-details-open .rp-card__overlay-desc {
    transform: translateY(0);
    opacity: 1;
}

.rp-card__overlay-desc p {
    margin: 0 0 10px;
}

.rp-card__overlay-desc p:last-child {
    margin-bottom: 0;
}

/* Quand le panel est ouvert : agrandissement du dégradé + masquage des hotspots */
.rp-card__overlay {
    transition: background 0.35s ease, padding-top 0.35s ease;
}

.rp-card__visual.is-details-open .rp-card__overlay {
    background: linear-gradient(to top,
        rgba(22, 60, 121, 0.96) 0%,
        rgba(22, 60, 121, 0.85) 35%,
        rgba(22, 60, 121, 0.45) 75%,
        rgba(22, 60, 121, 0) 100%);
    padding-top: 60px;
}

.rp-card__visual.is-details-open .rp-hotspot,
.rp-card__visual.is-details-open .rp-hotspots-nav,
.rp-card__visual.is-details-open .rp-hotspots-counter {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* =====================================================================
   GALERIE : carrousel scroll-snap + slides à largeur variable selon
   l'aspect-ratio intrinsèque des images (style "masonry horizontal").
   Click sur une slide → ouvre le lightbox plein écran.

   Override : pour les cards galerie on ignore l'aspect-ratio 4/3 hérité
   de .rp-card__visual et on utilise une hauteur fixe → permet de voir
   plusieurs slides à la fois.
   ===================================================================== */
.rp-card__gallery.rp-card__visual {
    aspect-ratio: auto;
    height: auto;
}

.rp-card__gallery {
    position: relative;
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: #f3f4f6;
}

.rp-gallery {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 420px;
    overflow: hidden;
}

.rp-gallery__track {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    height: 100%;
    padding: 0;
}
.rp-gallery__track::-webkit-scrollbar { display: none; }

.rp-gallery__slide {
    flex: 0 0 auto;
    height: 100%;
    border: 0;
    padding: 0;
    background: #e5e7eb;
    cursor: zoom-in;
    overflow: hidden;
    scroll-snap-align: start;
    border-radius: 10px;
    transition: transform 0.2s ease;
}
.rp-gallery__slide:hover {
    transform: translateY(-2px);
}

/* Chaque image : hauteur 100%, largeur auto → slide adopte la largeur
   correspondant à l'aspect-ratio de l'image (portrait = slide étroit,
   paysage = slide large). max-width pour empêcher une image très large
   d'occuper plus d'écran que ses voisines. */
.rp-gallery__slide img {
    height: 100%;
    width: auto;
    max-width: none;
    display: block;
    object-fit: cover;
}

/* Boutons nav prev/next : pastilles flottantes, fade-in au hover du parent */
.rp-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.92);
    color: #163c79;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.rp-gallery:hover .rp-gallery__nav,
.rp-gallery:focus-within .rp-gallery__nav {
    opacity: 1;
}
.rp-gallery__nav:hover { background: #fff; }
.rp-gallery__nav--prev { left: 12px; }
.rp-gallery__nav--next { right: 12px; }

/* Overlay placé en bas, par-dessus le slider */
.rp-card__gallery .rp-card__overlay {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 3;
}

/* =====================================================================
   LIGHTBOX (singleton body-level)
   ===================================================================== */
.rp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    background: rgba(15, 42, 90, 0.92);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}
.rp-lightbox.is-open {
    display: flex;
}

body.rp-lightbox-open {
    overflow: hidden;
}

.rp-lightbox__stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 80px;
}

.rp-lightbox__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.rp-lightbox__close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 5;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}
.rp-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.06);
}

.rp-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}
.rp-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-50%) scale(1.06);
}
.rp-lightbox__nav--prev { left: 18px; }
.rp-lightbox__nav--next { right: 18px; }

.rp-lightbox__counter {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 14px;
    border-radius: 999px;
}

/* BEFORE/AFTER */
.rp-before-after {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

/* Wrapper en flux normal avec sa PROPRE aspect-ratio 4/3 : on ne dépend pas
   de la hauteur du parent (.rp-card__visual peut être étiré par le grid
   .rp-card__body { align-items: stretch } pour matcher la colonne produits,
   ce qui casserait le ratio 4:3 et désalignerait les hotspots). C'est le
   même pattern que .rp-hotspots-stage du type "hotspots" qui est précis. */
.rp-ba-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    user-select: none;
}

/* !important nécessaire : Elementor injecte des styles globaux sur img qui
   écrasaient width/height/object-fit, cassant l'alignement des hotspots. */
.rp-ba-before,
.rp-ba-after {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Layer hotspots du type "avant_apres_hotspots" : positionné par-dessus les
   images, clippé en synchro avec le slider via JS pour n'afficher que les
   points sur la portion "après" révélée. Initialement caché (clip-path inset
   100% à gauche) jusqu'à ce que le JS pose la valeur correcte. */
.rp-ba-hotspots {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    clip-path: inset(0 0 0 50%);
    transition: clip-path 0s;
}

.rp-ba-hotspots .rp-hotspot {
    pointer-events: auto;
}

.rp-ba-after {
    clip-path: inset(0 50% 0 0);
}

.rp-ba-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 60px;
    height: 100%;
    cursor: ew-resize;
    z-index: 10;
    transform: translateX(-50%);
    touch-action: none;
}

/* Quand le panel "Détails du projet" est ouvert, on masque toute l'UI
   du slider avant/après (ligne, handle, slider lui-même, labels Avant/Après)
   pour que la description occupe la scène sans distraction. */
.rp-card__visual.is-details-open .rp-ba-slider,
.rp-card__visual.is-details-open .rp-ba-labels {
    display: none;
}

.rp-ba-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: #fff;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
    transform: translateX(-50%);
}

.rp-ba-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: #163c79;
    border: 3px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.rp-ba-labels {
    position: absolute;
    top: 14px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 14px;
    pointer-events: none;
    z-index: 5;
}

.rp-ba-labels span {
    background: rgba(22, 60, 121, 0.85);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.rp-card__photos-extra {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.rp-card__photos-extra .rp-card__photo {
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
}

.rp-card__photos-extra img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* HOTSPOTS (numérotés) */
.rp-hotspots {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rp-hotspots-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    overflow: visible;
    background: #f3f4f6;
}

.rp-hotspots-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
}

.rp-hotspots-slide.is-active {
    opacity: 1;
    visibility: visible;
}

.rp-hotspots-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rp-hotspot {
    position: absolute;
    width: 32px;
    height: 32px;
    margin-left: -16px;
    margin-top: -16px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    z-index: 3;
}

.rp-hotspot-num {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 28px;
    height: 28px;
    background: #163c79;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    font-family: 'Lexend', sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, background 0.2s ease;
}

.rp-hotspot-pulse {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(22, 60, 121, 0.4);
    animation: rpHotspotPulse 2.4s ease-out infinite;
    pointer-events: none;
}

@keyframes rpHotspotPulse {
    0% {
        transform: scale(0.7);
        opacity: 0.85;
    }

    70%,
    100% {
        transform: scale(1.9);
        opacity: 0;
    }
}

.rp-hotspot:hover .rp-hotspot-num,
.rp-hotspot.is-active .rp-hotspot-num {
    background: #7AC143;
    transform: scale(1.18);
}

.rp-hotspot:hover .rp-hotspot-pulse,
.rp-hotspot.is-active .rp-hotspot-pulse {
    animation: none;
    background: rgba(122, 193, 67, 0.45);
}

.rp-hotspots-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.96);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #163c79;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
    z-index: 4;
    transition: background 0.2s ease, transform 0.2s ease;
}

.rp-hotspots-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.08);
}

.rp-hotspots-nav svg {
    width: 22px;
    height: 22px;
}

.rp-hotspots-nav--prev {
    left: 16px;
}

.rp-hotspots-nav--next {
    right: 16px;
}

.rp-hotspots-counter {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(22, 60, 121, 0.85);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    z-index: 4;
}

.rp-hotspots-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rp-hotspots-thumb {
    position: relative;
    flex: 0 0 auto;
    width: 80px;
    height: 60px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #f3f4f6;
    transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.rp-hotspots-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.rp-hotspots-thumb:hover {
    transform: translateY(-1px);
}

.rp-hotspots-thumb:hover img {
    transform: scale(1.05);
}

.rp-hotspots-thumb.is-active {
    border-color: #163c79;
    box-shadow: 0 2px 8px rgba(22, 60, 121, 0.25);
}

/* Hotspot dans la galerie : overlay reste lisible */
.rp-hotspots .rp-card__overlay {
    z-index: 2;
}

/* =========================================================
   COLONNE PRODUITS (mini-cards horizontales)
   ========================================================= */
/* Position absolue dans le body (qui a position:relative) pour que la colonne
   produits ne pèse pas dans le track-sizing de la row : seule la colonne média
   (en flux) détermine la hauteur. Les valeurs top/right/bottom + width calculée
   reproduisent la cellule "1fr" de la colonne 2 du grid (1fr / 2.4fr de la
   largeur disponible après le gap). */
.rp-card__products {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: calc((100% - 24px) / 2.4);
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

/* Le header (count + bouton tout ajouter) est dans le topbar à droite */
.rp-card__products-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
}

.rp-card__products-count {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    font-family: 'Lexend Deca', sans-serif;
}

.rp-add-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    padding: 8px 14px;
    color: #163c79;
    border: 1px solid #163c79;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: 'Lexend', sans-serif;
}

.rp-add-all-btn:hover {
    background: #163c79;
    color: #fff;
}

.rp-add-all-btn.added {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.rp-add-all-btn.processing {
    opacity: 0.85;
    pointer-events: none;
}

.rp-add-all-btn.already-in-quote {
    background: #475569;
    border-color: #475569;
    color: #fff;
    font-size: 11px;
    pointer-events: none;
}

.rp-card__products-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 14px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f1f5f9;
}

.rp-card__products-list::-webkit-scrollbar {
    width: 8px;
}

.rp-card__products-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 999px;
}

.rp-card__products-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 999px;
}

.rp-card__products-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Indicateur visuel : ombre en bas pour suggérer le scroll */
.rp-card__products::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 14px;
    height: 30px;
    background: linear-gradient(to top, #fff, transparent);
    pointer-events: none;
    border-radius: 0 0 10px 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.rp-card__products.is-scrollable::after {
    opacity: 1;
}

.rp-card__products.is-at-bottom::after {
    opacity: 0;
}

.rp-product-row {
    position: relative;
    display: grid;
    grid-template-columns: 36px 76px 1fr;
    gap: 14px;
    align-items: stretch;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.rp-product-row:hover {
    border-color: #163c79;
    box-shadow: 0 2px 10px rgba(22, 60, 121, 0.08);
}

.rp-product-row.is-active {
    border-color: #7AC143;
    box-shadow: 0 0 0 2px rgba(122, 193, 67, 0.2);
}

.rp-product-row__num {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #163c79;
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 12px;
    font-family: 'Lexend', sans-serif;
    flex-shrink: 0;
    margin-top: 2px;
}

.rp-product-row.is-active .rp-product-row__num {
    background: #7AC143;
}

.rp-product-row__img {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    background: #f8fafc;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.rp-product-row__img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 4px;
}

.rp-product-row__img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rp-product-row__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.rp-product-row__head {
    /* Le coeur est sorti du flow (position absolue), on réserve juste l'espace via padding-right sur le titre */
    padding-right: 32px;
}

.rp-product-row__name {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.rp-product-row__name:hover {
    color: #163c79;
}

.rp-product-row__desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rp-product-row__actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.rp-product-row__see {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    background: #fff;
    color: #1a1a2e;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: 'Lexend', sans-serif;
}

.rp-product-row__see:hover {
    border-color: #163c79;
    color: #163c79;
}

.rp-product-row__add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #163c79;
    color: #fff;
    border: 1px solid #163c79;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Lexend', sans-serif;
}

.rp-product-row__add:hover {
    background: #0f2a5a;
    border-color: #0f2a5a;
}

.rp-product-row__add.added {
    background: #16a34a;
    border-color: #16a34a;
}

.rp-product-row__add.added::after {
    content: ' ✓';
}

.rp-product-row__add.added span:first-of-type {
    display: none;
}

/* Coeur wishlist : positionné en absolu dans le coin haut-droit, hors du flow */
.rp-product-row .aratice-wishlist-toggle--mini {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease;
    z-index: 1;
}

.rp-product-row .aratice-wishlist-toggle--mini:hover {
    transform: scale(1.15);
}

.rp-product-row .aratice-wishlist-toggle--mini .heart-outline {
    display: block;
}

.rp-product-row .aratice-wishlist-toggle--mini .heart-filled {
    display: none;
}

.rp-product-row .aratice-wishlist-toggle--mini.is-wishlisted .heart-outline {
    display: none;
}

.rp-product-row .aratice-wishlist-toggle--mini.is-wishlisted .heart-filled {
    display: block;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
    .rp-card__title {
        font-size: 30px;
    }

    /* Sur tablette/mobile : on aplatit la hiérarchie via display: contents
       et on réordonne via grid-template-areas pour avoir l'ordre :
       topbar-main → media → products-header → products-list */
    .rp-card {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-areas:
            "topbar-main"
            "media"
            "products-header"
            "products-list";
        gap: 20px;
    }

    .rp-card__topbar {
        display: contents;
    }

    .rp-card__topbar-main {
        grid-area: topbar-main;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .rp-card__body {
        display: contents;
    }

    .rp-card__media {
        grid-area: media;
    }

    .rp-card__products-header {
        grid-area: products-header;
        justify-content: space-between;
    }

    .rp-card__products {
        grid-area: products-list;
        position: static;
        width: auto;
    }

    /* Sur mobile : l'aside d'info (galerie sans produits) prend la zone
       qu'aurait occupée la liste produits, donc juste sous l'image. */
    .rp-card__info-aside {
        grid-area: products-list;
        padding: 0;
        align-self: start;
    }
}

/* Boutons de navigation du carousel produits (visibles seulement sur mobile) */
.rp-products-nav {
    display: none;
}

@media (max-width: 768px) {
    .rp-filters {
        padding: 16px 18px;
    }

    /* Hotspots image : caret un peu plus compacts sur mobile */
    .rp-hotspots-nav {
        width: 40px;
        height: 40px;
    }

    .rp-hotspots-nav svg {
        width: 24px;
        height: 24px;
    }

    .rp-hotspots-nav--prev {
        left: 8px;
    }

    .rp-hotspots-nav--next {
        right: 8px;
    }

    .rp-filters__title {
        font-size: 16px;
    }

    .rp-filters__subtitle {
        font-size: 12px;
    }

    .rp-filters__count-wrap {
        padding: 4px 12px 4px 6px;
    }

    .rp-filter-dropdown__toggle {
        padding: 8px 12px;
        font-size: 12px;
    }

    .rp-filters.is-floating {
        bottom: 12px;
        left: 12px;
        right: 12px;
        transform: none;
        max-width: none;
        width: auto;
        animation: rpFiltersSlideUpMobile 0.3s ease forwards;
    }

    @keyframes rpFiltersSlideUpMobile {
        from {
            opacity: 0;
            transform: translateY(40px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .rp-filters.is-floating.is-near-footer {
        transform: translateY(40px);
    }

    .rp-list {
        gap: 40px;
    }

    .rp-card+.rp-card {
        padding-top: 40px;
    }

    .rp-card__title {
        font-size: 26px;
    }

    /* Image principale plus haute sur mobile (4/3 → 1/1) */
    .rp-card__visual,
    .rp-hotspots-stage,
    .rp-before-after {
        aspect-ratio: 1 / 1;
    }

    /* Galerie : hauteur réduite sur mobile, override l'aspect-ratio 1/1 */
    .rp-card__gallery.rp-card__visual {
        aspect-ratio: auto;
    }
    .rp-gallery {
        height: 320px;
    }

    /* Lightbox : padding plus étroit + boutons nav plus petits sur mobile */
    .rp-lightbox__stage {
        padding: 56px 16px;
    }
    .rp-lightbox__nav {
        width: 44px;
        height: 44px;
    }
    .rp-lightbox__nav--prev { left: 8px; }
    .rp-lightbox__nav--next { right: 8px; }

    /* Zone de drag plus généreuse sur mobile pour faciliter le slide tactile. */
    .rp-ba-slider {
        width: 90px;
    }

    /* Exception : pour les types qui ont des hotspots, on conserve le 4/3
       pour que le crop de la photo soit identique à celui du back-office et
       que les hotspots restent précis au pixel près. */
    .rp-card--type-hotspots .rp-card__visual,
    .rp-card--type-hotspots .rp-hotspots-stage,
    .rp-card--type-avant_apres_hotspots .rp-card__visual,
    .rp-card--type-avant_apres_hotspots .rp-before-after {
        aspect-ratio: 4 / 3;
    }

    /* Sur mobile : hotspots plus gros pour le tap */
    .rp-hotspot {
        width: 36px;
        height: 36px;
        margin-left: -18px;
        margin-top: -18px;
    }

    .rp-hotspot-num {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    /* Liste produits sur mobile : empilement vertical (plus de carousel horizontal) */
    .rp-card__products-list {
        flex-direction: column;
        overflow: visible;
        max-height: none;
        gap: 10px;
        padding-right: 0;
    }

    /* Boutons swipe inutiles en mode empilé : on les masque */
    .rp-products-nav {
        display: none;
    }

    /* Boutons d'action des cards produit : forcer sur une seule ligne */
    .rp-product-row__actions {
        flex-wrap: nowrap;
    }

    .rp-product-row__see,
    .rp-product-row__add {
        flex: 1 1 0;
        min-width: 0;
        padding: 7px 10px;
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* L'icône du bouton "Ajouter au devis" est cachée pour gagner de la place */
    .rp-product-row__add svg {
        display: none;
    }

    .rp-card__products::after {
        display: none;
    }

    .rp-card__overlay {
        padding: 18px 16px 16px;
    }

    .rp-card__overlay-title {
        font-size: 18px;
    }
}

@media (max-width: 600px) {
    .rp-card__title {
        font-size: 22px;
    }

    .rp-card__photos-extra {
        grid-template-columns: 1fr;
    }

    .rp-product-row {
        padding: 14px;
    }
}