/* Portfolio Grid — front. */

.pgp,
.pgp-single {
    --pgp-gap: 1.25rem;
    --pgp-line: #d9dcde;
    --pgp-panel: #f2f3f4;
    --pgp-accent: #25414f;
    --pgp-muted: rgba(0, 0, 0, .62);
    --pgp-radius: 2px;
    --pgp-min: 220px;
    --pgp-cmin: var(--pgp-min);
    --pgp-ratio: 4/3;
    --pgp-sticky: 0px;
    --pgp-title: #1d2327;
    --pgp-cat: #25414f;
    --pgp-max-width: 1240px;
    --pgp-justify: stretch;
    --pgp-desc-size: 1rem;
    --pgp-desc-color: #1d2327;
    --pgp-desc-max: 75ch;
    --pgp-sec-title-size: 1.5rem;
    --pgp-card-title-size: 1rem;
    --pgp-card-sub-size: .875rem;
    --pgp-panel-title-size: 1.35rem;
    --pgp-line-height: 1.6;
    --pgp-card-title-lines: 0;
    --pgp-panel-desc-max: 60vh;
}
.pgp {
    position: relative;
    box-sizing: border-box;
    max-width: var(--pgp-max-width);
    margin-left: auto;
    margin-right: auto;
    line-height: var(--pgp-line-height);
}
.pgp *, .pgp *::before, .pgp *::after { box-sizing: inherit; }
.pgp [hidden] { display: none !important; }
.pgp img { display: block; max-width: 100%; }
.pgp a:focus-visible, .pgp button:focus-visible, .pgp input:focus-visible,
.pgp-single a:focus-visible { outline: 2px solid var(--pgp-accent); outline-offset: 3px; }
.pgp-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* --- Barre de statut -------------------------------------------------- */
.pgp-status { min-height: 1.4em; margin: 0 0 .75rem; font-size: .875em; color: var(--pgp-muted); }
.pgp-empty { padding: 2rem 0; color: var(--pgp-muted); }

/* --- Barre de catégories (Desktop) ------------------------------------ */
.pgp-nav {
    position: -webkit-sticky;
    position: sticky;
    top: var(--pgp-sticky);
    z-index: 999;
    margin-bottom: 1rem;
    background: #fff;
    border-bottom: 1px solid var(--pgp-line);
    width: 100%;
    max-width: 100%;
    overflow: visible; 
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.pgp-nav::-webkit-scrollbar { display: none; width: 0; height: 0; }

.pgp-nav ul {
    display: flex;
    margin: 0 auto;
    padding: 0;
    list-style: none;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
}
.pgp-nav li { flex: 0 0 auto; }
.pgp-nav a {
    display: block;
    padding: .8em 0 .7em;
    color: var(--pgp-cat);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    font-size: 0.95em;
}
.pgp-nav a:hover { border-bottom-color: var(--pgp-line); }
.pgp-nav a[aria-current="true"] { border-bottom-color: var(--pgp-accent); font-weight: 600; }

/* --- Tablette / Petits laptops : Retour à la ligne propre ------------- */
@media (min-width: 1201px) and (max-width: 1500px) {
    .pgp-nav ul {
        flex-wrap: wrap !important;
        row-gap: 0.2rem !important;
        padding-bottom: 0.5rem !important;
    }
}

/* --- Menu déroulant mobile/tablette ----------------------------------- */
.pgp-nav-select {
    display: none;
    width: 100%;
    margin: 0 0 .75rem;
    padding: .7em 2.4em .7em .9em;
    font: inherit;
    font-size: .95em;
    color: var(--pgp-cat);
    background: #fff;
    border: 1px solid var(--pgp-line);
    border-radius: var(--pgp-radius);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2325414f' d='M6 8 0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .9em center;
    background-size: 12px 8px;
    cursor: pointer;
}
.pgp-nav-select:focus { outline: 2px solid var(--pgp-accent); outline-offset: 2px; }

/* --- Tablette et Mobile (< 1200px) : Select sticky -------------------- */
@media (max-width: 1200px) {
    .pgp-nav { display: none !important; }
    
    .pgp-nav-select { 
        display: block !important; 
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 50px !important; 
        z-index: 9999 !important;
        background-color: #fff !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
        width: 100% !important;
    }
    
    /* On ajuste les marges pour que les titres ne soient pas cachés sous le menu collant */
    .pgp-sec { scroll-margin-top: 180px; }
    .pgp-panel { scroll-margin-top: 180px; }
}

/* --- Sections par catégorie ------------------------------------------- */
.pgp-sec { 
    margin-top: clamp(2rem, 5vw, 3.5rem); 
    scroll-margin-top: calc(var(--pgp-sticky) + 40px); 
}
.pgp-sec:first-of-type { margin-top: 1.5rem; }
.pgp-sec__head { margin-bottom: 1.25rem; }
.pgp-sec__banner { margin-bottom: .75rem; aspect-ratio: 4 / 1; overflow: hidden; border-radius: var(--pgp-radius); background: var(--pgp-line); }
.pgp-sec__img { width: 100%; height: 100%; object-fit: cover; }
.pgp-sec__title { margin: 0 0 .5rem; font-size: var(--pgp-sec-title-size); line-height: 1.25; color: var(--pgp-title); }
.pgp-sec__desc { margin: 0 0 .75rem; color: var(--pgp-desc-color); font-size: var(--pgp-desc-size); max-width: 100%; }
.pgp-sec__desc > :first-child { margin-top: 0; }
.pgp-sec__desc > :last-child { margin-bottom: 0; }
.pgp-sec__all { display: inline-block; font-size: .9em; color: var(--pgp-accent); text-underline-offset: 3px; }

/* --- Grille et Colonnes ----------------------------------------------- */
.pgp-grid {
    position: relative;
    display: grid;
    gap: var(--pgp-gap);
    justify-content: var(--pgp-justify);
    align-items: start;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}
.pgp-grid[data-cols="auto"] { grid-template-columns: repeat(auto-fill, minmax(var(--pgp-cmin), 1fr)); }
.pgp-grid[data-cols="2"]    { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pgp-grid[data-cols="3"]    { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pgp-grid[data-cols="4"]    { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pgp-grid[data-cols="5"]    { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pgp-grid[data-cols="6"]    { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* Tablette : 2 colonnes */
@media (max-width: 1200px) {
    .pgp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Mobile : On garde 2 colonnes pour la découverte */
@media (max-width: 600px) {
    .pgp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.75rem !important; 
    }
    .pgp-card__title { font-size: 0.9rem !important; }
    .pgp-card__sub { font-size: 0.8rem !important; }
}

/* --- Cartes ------------------------------------------------------------ */
.pgp-card { min-width: 0; display: flex; flex-direction: column; }
.pgp-card__link {
    display: flex; flex-direction: column; height: 100%; width: 100%;
    padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
    color: inherit; font: inherit;
}

.pgp-card__media { 
    position: relative; 
    margin: 0; 
    aspect-ratio: var(--pgp-ratio); 
    overflow: hidden; 
    background: var(--pgp-line); 
    border-radius: var(--pgp-radius); 
    flex: 0 0 auto; 
}

.pgp-card__img, .pgp-card__ph { display: block; width: 100%; height: 100%; object-fit: contain; }
.pgp-card__img { transition: transform .5s ease; }
.pgp-card__link:hover .pgp-card__img { transform: scale(1.03); }
.pgp-card__media::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .2s; pointer-events: none; }
.pgp-card.is-active .pgp-card__media::after { box-shadow: inset 0 0 0 3px var(--pgp-accent); }

.pgp-card__title {
    margin: .6em 0 0;
    font-size: var(--pgp-card-title-size);
    font-weight: 600;
    line-height: 1.3;
    color: var(--pgp-title);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--pgp-card-title-lines);
    line-clamp: var(--pgp-card-title-lines);
    overflow: hidden;
}
.pgp-card__title.no-clamp {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
}
.pgp-card__sub {
    display: block;
    margin-top: auto;
    padding-top: .3em;
    font-size: var(--pgp-card-sub-size);
    color: var(--pgp-muted);
}

/* --- Panneau ouvert dans la grille ------------------------------------- */
.pgp-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .18s ease;
    scroll-margin-top: calc(var(--pgp-sticky) + 12px);
    min-width: 0;
}
.pgp-panel.is-open { grid-template-rows: 1fr; transition-duration: .32s; }
.pgp-panel__clip { min-height: 0; overflow: hidden; padding-top: 10px; }
.pgp-panel__inner { position: relative; background: var(--pgp-panel); border-radius: var(--pgp-radius); }
.pgp-panel__inner::before {
    content: "";
    position: absolute;
    top: -7px;
    left: var(--pgp-notch, 50%);
    width: 14px; height: 14px;
    margin-left: -7px;
    background: var(--pgp-panel);
    transform: rotate(45deg);
}
.pgp-panel__close {
    position: absolute;
    top: .5rem; right: .5rem;
    z-index: 3;
    width: 2.5rem; height: 2.5rem;
    padding: 0;
    font-size: 1.75rem; line-height: 1;
    color: inherit; background: transparent; border: 0; cursor: pointer;
}
.pgp-panel__close:hover { color: var(--pgp-accent); }
.pgp-panel__body {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 2.5rem);
    padding: clamp(1rem, 3vw, 2rem);
}
.pgp-panel__body.is-single { grid-template-columns: minmax(0, 1fr); }
.pgp-panel__text { padding-right: 2rem; min-width: 0; }
.pgp-panel__title { margin: 0; font-size: var(--pgp-panel-title-size); line-height: 1.25; color: var(--pgp-title); }
.pgp-panel__title:focus { outline: none; }
.pgp-panel__sub { margin: .35em 0 0; color: var(--pgp-muted); }
.pgp-panel__desc { margin-top: 1rem; }
.pgp-panel__desc > :first-child { margin-top: 0; }
.pgp-panel__desc > :last-child { margin-bottom: 0; }

.pgp-panel__desc.is-scroll {
    max-height: var(--pgp-panel-desc-max);
    overflow-y: auto;
    padding-right: .5rem;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent);
            mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent);
}

/* --- Galerie du panneau (collante) ------------------------------------- */
.pgp-gal { min-width: 0; position: sticky; top: 1rem; align-self: start; }
.pgp-gal__main {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    margin: 0;
    aspect-ratio: 4 / 3;
    max-height: 70vh;
    background: rgba(0, 0, 0, .05);
    border-radius: var(--pgp-radius);
    overflow: hidden;
}
.pgp-gal__main img { width: 100%; height: 100%; object-fit: contain; }
.pgp-gal__zoom { display: block; width: 100%; height: 100%; padding: 0; background: none; border: 0; cursor: zoom-in; }
.pgp-gal__cap {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: .5em .9em;
    font-size: .85em; color: #fff;
    background: linear-gradient(transparent, rgba(0, 0, 0, .6));
    pointer-events: none;
}
.pgp-gal__nav {
    position: absolute; top: 50%; z-index: 1;
    width: 2.5rem; height: 2.5rem;
    margin-top: -1.25rem; padding: 0 0 .15em;
    font-size: 1.6rem; line-height: 1;
    color: #fff; background: rgba(20, 22, 24, .55);
    border: 0; border-radius: 50%; cursor: pointer;
}
.pgp-gal__nav:hover { background: rgba(20, 22, 24, .8); }
.pgp-gal__prev { left: .6rem; } .pgp-gal__next { right: .6rem; }
.pgp-gal__thumbs { display: flex; gap: .5rem; margin-top: .6rem; overflow-x: auto; padding-bottom: 4px; }
.pgp-gal__thumb {
    flex: 0 0 auto;
    width: 64px; height: 64px;
    padding: 0; overflow: hidden;
    background: var(--pgp-line);
    border: 2px solid transparent;
    border-radius: var(--pgp-radius);
    cursor: pointer; opacity: .75;
}
.pgp-gal__thumb img { width: 100%; height: 100%; object-fit: cover; }
.pgp-gal__thumb[aria-current="true"] { border-color: var(--pgp-accent); opacity: 1; }

@media (max-width: 760px) {
    .pgp-panel__body { grid-template-columns: minmax(0, 1fr); }
    .pgp-panel__text { padding-right: 0; }
    .pgp-gal { position: static; }
    .pgp-panel__desc.is-scroll { max-height: none; overflow: visible; -webkit-mask-image: none; mask-image: none; }
    .pgp-sec__banner { aspect-ratio: 16 / 7; }
}

/* --- Lightbox (<dialog>) ----------------------------------------------- */
.pgp-lb { width: 100%; max-width: 100vw; height: 100%; max-height: 100vh; margin: 0; padding: 0; color: #fff; background: rgba(12, 14, 15, .94); border: 0; }
.pgp-lb::backdrop { background: rgba(12, 14, 15, .94); }
.pgp-lb[open] { display: flex; align-items: center; justify-content: center; }
.pgp-lb__fig { margin: 0; max-width: 92vw; text-align: center; }
.pgp-lb__fig img { max-width: 92vw; max-height: 84vh; width: auto; height: auto; object-fit: contain; }
.pgp-lb__fig figcaption { margin-top: .6em; font-size: .9em; opacity: .85; }
.pgp-lb__close, .pgp-lb__nav { position: absolute; padding: 0; color: #fff; background: transparent; border: 0; cursor: pointer; line-height: 1; }
.pgp-lb__close { top: .75rem; right: 1rem; font-size: 2.5rem; }
.pgp-lb__nav { top: 50%; margin-top: -1.5rem; font-size: 3rem; }
.pgp-lb__prev { left: 1rem; } .pgp-lb__next { right: 1rem; }

/* --- Page catégorie ---------------------------------------------------- */
.pgp-archive { max-width: var(--pgp-max-width, 1240px); margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.pgp-archive__head h1 { margin: 0 0 .75rem; font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.2; color: var(--pgp-title, #1d2327); }
.pgp-archive__intro { max-width: var(--pgp-desc-max, 75ch); margin-bottom: 1.75rem; }
.pgp-archive__banner { margin: 0 0 1.5rem; aspect-ratio: 16 / 5; overflow: hidden; border-radius: var(--pgp-radius, 2px); background: var(--pgp-line, #d9dcde); }
.pgp-archive__banner img { width: 100%; height: 100%; object-fit: cover; }

/* Fil d'Ariane */
.pgp-breadcrumb { font-size: .875em; color: var(--pgp-muted, rgba(0,0,0,.62)); margin-bottom: 1rem; }
.pgp-breadcrumb a { color: var(--pgp-accent, #25414f); text-decoration: none; }
.pgp-breadcrumb a:hover { text-decoration: underline; }

/* --- Fiche individuelle (rendu dans le panneau) ----------------------- */
.pgp-single__sub { margin: 0 0 1rem; font-size: 1.1em; color: var(--pgp-muted); }
.pgp-single__media { display: grid; gap: var(--pgp-gap); margin: 0 0 1.5rem; }
.pgp-single__fig { margin: 0; }
.pgp-single__fig img { display: block; width: 100%; height: auto; border-radius: var(--pgp-radius); }
.pgp-single__fig figcaption { margin-top: .4em; font-size: .875em; color: var(--pgp-muted); }
.pgp-related__title { margin: 2rem 0 1rem; }

/* --- Mouvement réduit -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .pgp *, .pgp *::before, .pgp *::after { transition: none !important; animation: none !important; }
}

/* Conteneur BeBuilder dédié au plugin pour garantir le sticky */
.pgp-sticky-wrapper {
    align-items: flex-start !important;
    display: flex !important; 
    flex-direction: column !important;
}

@media (max-width: 1200px) {
    html { overflow-x: hidden !important; }
    body, body.responsive-overflow-x-mobile { overflow-x: visible !important; }
}