/* Photo Shoot Packages — client-managed galleries.
   Standalone: these render via shortcode on pages that may not load the
   booking wizard stylesheet, so the palette is redeclared here. */

.psp-gallery {
    --psp-gallery-columns: 4;
    --psp-gallery-gap: 10px;

    /* No-JS fallback. CSS columns fill in document order until a target
       height, which leaves the early columns short when portraits are mixed
       in - psp-gallery.js replaces this with true shortest-column masonry and
       switches the container to .is-masonry below. */
    column-count: var(--psp-gallery-columns);
    column-gap: var(--psp-gallery-gap);
    margin: 0;
    padding: 0;
}

/* JS-justified layout: each row is scaled to fill the width exactly, so the
   gallery is a rectangle with a flat bottom. Row height and item widths are
   set inline by psp-gallery.js. */
.psp-gallery.is-justified {
    column-count: auto;
    column-gap: normal;
    display: block;
}

.psp-gallery-row {
    display: flex;
    gap: var(--psp-gallery-gap);
    margin-bottom: var(--psp-gallery-gap);
    /* Rounding can leave a sub-pixel overhang on the last item. */
    overflow: hidden;
}

.psp-gallery-row:last-child {
    margin-bottom: 0;
}

.psp-gallery.is-justified .psp-gallery-item {
    /* Width comes from the inline style; never let flex renegotiate it or the
       row stops matching the computed height. */
    flex: 0 0 auto;
    height: 100%;
    margin: 0;
}

.psp-gallery.is-justified .psp-gallery-image {
    width: 100%;
    height: 100%;
    /* Ratios are exact, so this only absorbs sub-pixel rounding. */
    object-fit: cover;
}

.psp-gallery-item {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 var(--psp-gallery-gap);
    /* Without this a tile can be split across two columns. */
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    overflow: hidden;
    border-radius: 2px;
    line-height: 0;
    cursor: zoom-in;
    text-decoration: none;
    box-shadow: none;
}

.psp-gallery-image {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.45s ease;
}

.psp-gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(45, 45, 45, 0.35);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.psp-gallery-item:hover .psp-gallery-overlay,
.psp-gallery-item:focus-visible .psp-gallery-overlay {
    opacity: 1;
}

.psp-gallery-item:hover .psp-gallery-image {
    transform: scale(1.04);
}

.psp-gallery-item:focus-visible {
    outline: 2px solid #D97757;
    outline-offset: 2px;
}

.psp-gallery-empty {
    margin: 0;
    padding: 16px;
    border: 1px dashed #E8DFD3;
    border-radius: 6px;
    background: #FAF7F3;
    color: #777777;
    font-size: 14px;
    text-align: center;
}

/* Mirrors the tablet/mobile columns and gaps of the Elementor galleries
   these replaced. */
@media (max-width: 1024px) {
    .psp-gallery {
        column-count: 3;
        --psp-gallery-gap: 8px;
    }
}

@media (max-width: 767px) {
    .psp-gallery {
        column-count: 2;
        --psp-gallery-gap: 6px;
    }
}

/* ==========================================================================
   Lightbox
   ========================================================================== */
.psp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 16, 14, 0.94);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.psp-lightbox.is-open {
    opacity: 1;
}

.psp-lightbox-figure {
    margin: 0;
    max-width: 92vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.psp-lightbox-image {
    max-width: 92vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 2px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.psp-lightbox-caption {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    text-align: center;
    max-width: 60ch;
}

.psp-lightbox-btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.psp-lightbox-btn:hover,
.psp-lightbox-btn:focus-visible {
    background: rgba(255, 255, 255, 0.28);
    outline: none;
}

.psp-lightbox-close { top: 18px; right: 18px; font-size: 26px; }
.psp-lightbox-prev  { left: 18px;  top: 50%; transform: translateY(-50%); }
.psp-lightbox-next  { right: 18px; top: 50%; transform: translateY(-50%); }

.psp-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    letter-spacing: 1px;
}

@media (max-width: 767px) {
    .psp-lightbox-btn { width: 40px; height: 40px; font-size: 19px; }
    .psp-lightbox-close { top: 10px; right: 10px; }
    .psp-lightbox-prev { left: 8px; }
    .psp-lightbox-next { right: 8px; }
    .psp-lightbox-image { max-height: 72vh; }
}

@media (prefers-reduced-motion: reduce) {
    .psp-gallery-image,
    .psp-gallery-overlay,
    .psp-lightbox {
        transition: none;
    }

    .psp-gallery-item:hover .psp-gallery-image {
        transform: none;
    }
}
