/* Photo Catalog V2 — vinyl liner pool shape selector: pill tabs + size/drawing panel */

.pht-cat.v2 {
    --pht-cat-v2-brd: hsl(from var(--text-color) h s l / 0.2);


    /* ── Tab bar: compact content-sized pills (matches V1) ── */

    .pht-cat-v2-tabs {
        li {
            display: contents;
        }
    }

    .pht-cat-v2-tab {
        font-weight: 700;
        font-size: 0.83rem;
        line-height: 1;
        color: inherit;
        background: var(--inner-theme);
        border: none;
        border-radius: 4.375rem;
        padding: 0.55rem 1.1rem;
        cursor: pointer;
        box-shadow: 0 1px 4px hsl(from var(--text-color) h s l / 0.12);
        transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;

        &.active {
            background-color: var(--text-color);
            color: var(--background);
        }

        @media (hover: hover) and (pointer: fine) {
            &:is(:hover, :focus-visible):not(.active) {
                box-shadow: 0 2px 8px hsl(from var(--text-color) h s l / 0.25);
            }
        }
    }


    /* ── Panel ─────────────────────────────────────────── */

    .pht-cat-v2-pnl-in {
        padding: 1.75rem;
        border: 1px solid var(--pht-cat-v2-brd);
    }

    .pht-cat-v2-cols {
        display: flex;
        flex-wrap: wrap;
        gap: var(--grd-sp-dyn, 1.5rem);
    }

    .pht-cat-v2-col {
        flex: 1 1 min(100%, 20rem);
        min-width: 0;
    }


    /* ── Size list: plain text rows ────────────────────── */

    .pht-cat-v2-szs-hd {
        margin-bottom: 0.5rem;
    }

    .pht-cat-v2-szs {
        li {
            padding: 0.66rem 0.25rem;
            border-bottom: 1px solid var(--pht-cat-v2-brd);
        }

        li:last-child {
            border-bottom: none;
        }
    }


    /* ── Shape drawings (filtered gallery images) ──────── */

    .pht-cat-v2-imgs {
        --itm-val: 100;

        &:has(li:nth-child(2)) {
            --itm-val: 50;
        }

        figure {
            margin: 0;
        }
    }

    .pht-cat-v2-zm {
        display: block;
        width: 100%;
        padding: 0;
        border: none;
        background: transparent;
        color: inherit;
        cursor: zoom-in;

        img {
            display: block;
            width: 100%;
            height: auto;
            object-fit: contain;
        }
    }

    .pht-cat-v2-img-cap {
        font-size: 0.78rem;
        font-style: italic;
        text-align: center;
        padding-top: 0.5rem;
    }


    /* ── Static photo feed (grd/mx-4 handles columns) ──── */

    .pht-cat-v2-phts {
        .pht-cat-v2-zm img {
            height: 100%;
            object-fit: cover;
            transition: transform 0.4s ease;
        }

        @media (hover: hover) and (pointer: fine) {
            .pht-cat-v2-zm:hover img {
                transform: scale(1.05);
            }
        }

        @media screen and (min-width:1280px) {
            &.grd {
                --itm-val: 25;
            }
        }
    }


    /* ── Liner colour swatches (own gallery, under the tabs) ── */

    .pht-cat-v2-clrs {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .pht-cat-v2-clr {
        position: relative;
        margin: 0;
        overflow: hidden;
        border-radius: 0.25rem;
        background: var(--background);
        box-shadow: 0 1px 5px hsl(from var(--text-color) h s l / 0.18);
    }

    .pht-cat-v2-clr-btn {
        display: block;
        width: 100%;
        padding: 0;
        border: none;
        background: transparent;
        color: inherit;
        cursor: zoom-in;

        img {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.4s ease;
        }

        @media (hover: hover) and (pointer: fine) {
            &:is(:hover, :focus-visible) img {
                transform: scale(1.05);
            }
        }
    }


    /* ── Label bar across the bottom of the swatch ─────── */

    .pht-cat-v2-clr-cap {
        position: absolute;
        inset-inline: 0;
        bottom: 0;
        padding: 0.4rem 0.6rem;
        text-align: center;
        font-weight: 700;
        font-size: 0.85rem;
        line-height: 1.2;
        background: hsl(from var(--text-color) h s l / 0.55);
        color: var(--background);
        pointer-events: none; /* clicks fall through to the zoom button beneath */

        em {
            font-style: italic;
        }
    }


    /* ── Lightbox (module-scoped, palette flipped via bg-bx ulk-bg) ── */

    .lightbox {
        position: fixed;
        inset: 0;
        z-index: 9999;
        background: hsl(from var(--background) h s l / 0.96);
        display: flex;
        flex-direction: column;
    }

    .lightbox[hidden] {
        display: none;
    }

    .lightbox-bar {
        flex: 0 0 auto;
        border-bottom: 1px solid hsl(from var(--text-color) h s l / 0.1);
    }

    .lightbox-close {
        border: none;
        background: transparent;
        color: inherit;
        cursor: pointer;
        padding: 0.25em 0.5em;
        display: inline-flex;
        align-items: center;
        justify-content: center;

        &:hover {
            opacity: 0.7;
        }
    }

    .lightbox-stage {
        flex: 1 1 auto;
        position: relative;
        min-height: 0;
        overflow: hidden;
    }

    .lightbox-img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        display: block;
    }

    .lightbox-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 48px;
        height: 48px;
        border-radius: 50%;
        border: 1px solid hsl(from var(--text-color) h s l / 0.3);
        background: hsl(from var(--text-color) h s l / 0.15);
        color: inherit;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;

        &:hover {
            background: hsl(from var(--text-color) h s l / 0.3);
            transform: translateY(-50%) scale(1.05);
        }
    }

    .lightbox-nav--prev { left: 1rem; }
    .lightbox-nav--next { right: 1rem; }


    /* ── Responsive ────────────────────────────────────── */

    @media screen and (max-width: 699px) {
        .pht-cat-v2-tab {
            font-size: 0.78rem;
            padding: 0.5rem 0.9rem;
        }

        .pht-cat-v2-pnl-in {
            padding: 1.25rem;
        }
    }
}

/* Body scroll lock while the lightbox is open — <body> sits above the
   module root in the DOM, so this can't nest under .pht-cat.v2 */
body.pht-cat-lock {
    overflow: hidden;
}
