/* =====================================================================
   Project gallery (gallery_content-dynamic.xml, gallery.js).
   One card per project, the shared card (components.css .dc-card: 4:3
   photo with the number of photos, grey label, project name), filter buttons
   by application, and a full-screen viewer: the project's photos on black
   with the details and thumbnails beside them (below them on phones). Headings, buttons and colours come from
   theme_dincel components.css.
   ===================================================================== */

.gp {
    padding: 40px 0 72px;
    background: #fff;
    font-family: var(--dc-font);
}
.gp-breadcrumbs {
    margin-bottom: 20px;
}

/* ---------- filter buttons ---------- */

.gp-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 28px 0 0;
}
.gp-filters[hidden] {
    display: none;
}
.gp-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--dc-line);
    border-radius: 0;
    background: #fff;
    color: var(--dc-text);
    font-family: var(--dc-font);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.gp-filter:hover {
    border-color: var(--dc-ink);
}
.gp-filter:focus-visible {
    outline: 2px solid var(--dc-red);
    outline-offset: 2px;
}
.gp-filter[aria-pressed="true"] {
    border-color: var(--dc-ink);
    background: var(--dc-ink);
    color: #fff;
}
.gp-filter-count {
    color: var(--dc-muted);
    font-size: 0.75rem;
    font-weight: 400;
}
.gp-filter[aria-pressed="true"] .gp-filter-count {
    color: rgba(255, 255, 255, 0.7);
}

/* ---------- grid ---------- */

.gp-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 32px 20px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}
.gp-item[hidden] {
    display: none;
}
/* the cards are the shared card (components.css .dc-card) */
.gp-empty {
    margin: 28px 0 0;
    color: var(--dc-muted);
}

/* ---------- viewer ----------
   Desktop: the photo on black, a 400px white column beside it with the bar
   (counter and close), the project and its thumbnails.
   Phones: a black bar, the photo full width, then the thumbnails and the
   project on white; the whole viewer scrolls and the bar stays at the top. */

/* the page doesn't scroll behind the viewer */
html.gp-viewer-open {
    overflow: hidden;
}
.gp-viewer,
.gp-viewer:modal {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: #000;
    color: var(--dc-text);
    font-family: var(--dc-font);
}
.gp-viewer[open] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "stage bar" "stage panel";
}
.gp-viewer:focus {
    outline: none;
}
.gp-viewer::backdrop {
    background: #000;
}
/* Odoo hides any [aria-hidden] element, so the icons go without it */
.gp-viewer svg {
    display: block;
    pointer-events: none;
}

/* bar: counter and close */
.gp-viewer-bar {
    grid-area: bar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 12px 0 36px;
    background: #fff;
}
.gp-viewer-count {
    margin: 0;
    color: var(--dc-muted);
    font-size: 0.8125rem;
}
.gp-viewer-close {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-left: auto;
    padding: 0;
    border: 1px solid var(--dc-line);
    border-radius: 0;
    background: #fff;
    color: var(--dc-ink);
    cursor: pointer;
    transition: background-color 0.15s;
}
.gp-viewer-close:hover {
    background: var(--dc-soft);
}
.gp-viewer-close:focus-visible {
    outline: 2px solid var(--dc-red);
    outline-offset: 2px;
}

/* photo */
.gp-viewer-stage {
    grid-area: stage;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 24px 72px;
}
.gp-viewer-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.2s;
}
.gp-viewer.is-loading .gp-viewer-img {
    opacity: 0.35;
}
.gp-viewer-nav {
    position: absolute;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transform: translateY(-50%);
    transition: background-color 0.15s, color 0.15s;
}
.gp-viewer-nav:hover {
    background: #fff;
    color: var(--dc-ink);
}
.gp-viewer-nav:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.gp-viewer-nav[hidden] {
    display: none;
}
.gp-viewer-prev {
    left: 12px;
}
.gp-viewer-next {
    right: 12px;
}

/* the project */
.gp-viewer-panel {
    grid-area: panel;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px 36px 36px;
    background: #fff;
}
.gp-details-label {
    margin: 0 0 8px;
    color: var(--dc-muted);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.gp-viewer-details .dc-heading {
    line-height: 1.15;
}
.gp-facts {
    margin: 24px 0 0;
    padding: 0;
}
.gp-facts div {
    padding: 14px 0;
    border-top: 1px solid var(--dc-line);
}
.gp-facts div:last-child {
    border-bottom: 1px solid var(--dc-line);
}
.gp-facts dt {
    margin: 0 0 4px;
    color: var(--dc-muted);
    font-size: 0.8125rem;
    font-weight: 400;
}
.gp-facts dd {
    margin: 0;
    color: var(--dc-text);
    font-size: 0.9375rem;
    line-height: 1.5;
}
.gp-details-cta {
    margin-top: 28px;
}

/* the project's photos */
.gp-viewer-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 28px;
}
.gp-viewer-thumbs[hidden] {
    display: none;
}
.gp-viewer-thumb {
    flex: none;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: var(--dc-soft);
    cursor: pointer;
    opacity: 0.6;
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition: opacity 0.15s, outline-color 0.15s;
}
.gp-viewer-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}
.gp-viewer-thumb:hover {
    opacity: 1;
}
/* a ring rather than an outline: the theme clears outlines on clicked buttons */
.gp-viewer-thumb[aria-current="true"] {
    opacity: 1;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--dc-ink);
}
.gp-viewer-thumb:focus-visible {
    opacity: 1;
    outline-color: var(--dc-red);
}

/* ---------- tablets and phones ---------- */

@media (max-width: 1199.98px) {
    .gp-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* viewer: one column that scrolls; the bar stays on top */
@media (max-width: 991.98px) {
    .gp-viewer[open] {
        display: block;
        overflow-y: auto;
        overscroll-behavior: contain;
        background: #fff;
    }
    .gp-viewer-bar {
        position: sticky;
        top: 0;
        z-index: 2;
        height: 56px;
        padding: 0 4px 0 16px;
        background: #000;
    }
    .gp-viewer-count {
        color: rgba(255, 255, 255, 0.75);
        font-size: 0.875rem;
    }
    .gp-viewer-close {
        border: 0;
        background: transparent;
        color: #fff;
    }
    .gp-viewer-close:hover {
        background: rgba(255, 255, 255, 0.12);
    }
    .gp-viewer-close:focus-visible {
        outline-color: #fff;
        outline-offset: -4px;
    }
    /* the photo full width at its own shape, never taller than most of the screen */
    .gp-viewer-stage {
        display: block;
        padding: 0;
        background: #000;
    }
    .gp-viewer-img {
        display: block;
        width: 100%;
        height: auto;
        max-height: 70vh;
        max-height: 70svh;
        margin: 0 auto;
    }
    .gp-viewer-nav {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.45);
    }
    .gp-viewer-prev {
        left: 8px;
    }
    .gp-viewer-next {
        right: 8px;
    }
    /* thumbnails straight under the photo, then the project */
    .gp-viewer-panel {
        display: flex;
        overflow: visible;
        padding: 0 16px 32px;
    }
    .gp-viewer-thumbs {
        order: -1;
        flex-wrap: nowrap;
        margin: 0 -16px 20px;
        padding: 12px 16px;
        overflow-x: auto;
        border-bottom: 1px solid var(--dc-line);
        scrollbar-width: none;
    }
    .gp-viewer-thumbs::-webkit-scrollbar {
        display: none;
    }
    /* a project with one photo has no thumbnails */
    .gp-viewer-panel:has(.gp-viewer-thumbs[hidden]) .gp-viewer-details {
        padding-top: 20px;
    }
    .gp-viewer-thumb {
        width: 64px;
        height: 48px;
    }
    .gp-facts {
        margin-top: 16px;
    }
    .gp-facts div {
        padding: 12px 0;
    }
}

@media (max-width: 767.98px) {
    .gp {
        padding: 24px 0 48px;
    }
    .gp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px 12px;
    }
    /* filters scroll sideways instead of wrapping into many rows */
    .gp-filters {
        flex-wrap: nowrap;
        margin-right: -15px;
        margin-left: -15px;
        padding: 0 15px 4px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .gp-filters::-webkit-scrollbar {
        display: none;
    }
    .gp-filter {
        flex: none;
    }
    .gp-details-cta {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gp-viewer-img {
        transition: none;
    }
}
