/* ==========================================================
   Photographer Platform – Public Gallery Lightbox
   pp-gallery.css

   Lightbox overlay styles only.
   The existing .collection-grid masonry styles are untouched.
   ========================================================== */


/* ----------------------------------------------------------
   Dim the page content while the lightbox is open.
   Uses the same element and transition as the pp-xfade system
   so the effect feels consistent.
---------------------------------------------------------- */

html.pp-lightbox-open #main-content {
    opacity: 0.08;
    transition: opacity 0.4s ease;
}

html:not(.pp-lightbox-open) #main-content {
    transition: opacity 0.4s ease;
}


/* ----------------------------------------------------------
   Lightbox overlay
   Semi-transparent so the site (and logo) shows faintly behind.
   padding: top for close btn, sides for nav arrows.
---------------------------------------------------------- */

.ppg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 52px 80px 0;
}

.ppg-lightbox[hidden] {
    display: none !important;
}

.ppg-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    /* Subtle backdrop blur so the site behind is visible but not distracting */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}


/* ----------------------------------------------------------
   Fixed chrome: close / prev / next
   All fixed so they don't participate in dialog layout.
   Resets Divi's button styles throughout.
---------------------------------------------------------- */

.ppg-lightbox__close,
.ppg-lightbox__nav,
.ppg-lightbox__play-btn {
    border-radius: 0;
    text-shadow: none;
    box-shadow: none;
    letter-spacing: 0;
    line-height: 0;
    font-size: 0;
}

.ppg-lightbox__close {
    position: fixed;
    top: 14px;
    right: 18px;
    z-index: 10;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(60, 60, 60, .2);
    background: rgba(60, 60, 60, .07);
    color: rgba(50, 50, 50, .75);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.ppg-lightbox__close:hover    { background: rgba(60, 60, 60, .15); color: #222; }

.ppg-lightbox__close:focus-visible {
    outline: 2px solid rgba(50, 50, 50, .5);
    outline-offset: 2px;
}

.ppg-lightbox__nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(60, 60, 60, .2);
    background: rgba(60, 60, 60, .07);
    color: rgba(50, 50, 50, .75);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.ppg-lightbox__nav:hover      { background: rgba(60, 60, 60, .15); }
.ppg-lightbox__nav[hidden]    { display: none !important; }

.ppg-lightbox__nav:focus-visible {
    outline: 2px solid rgba(50, 50, 50, .5);
    outline-offset: 2px;
}

.ppg-lightbox__prev { left:  16px; }
.ppg-lightbox__next { right: 16px; }


/* ----------------------------------------------------------
   Dialog — fills the padded viewport area
---------------------------------------------------------- */

.ppg-lightbox__dialog {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 1400px;
    max-height: calc(100vh - 52px);
    max-height: calc(100dvh - 52px);
    /* Clicks on empty space beside the image shouldn't bubble to backdrop */
    pointer-events: none;
}

.ppg-lightbox__dialog > * {
    pointer-events: auto;
}


/* ----------------------------------------------------------
   Image area — A/B crossfade slots
---------------------------------------------------------- */

.ppg-lightbox__image-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* Both slots fill the pane, stacked absolutely */
.ppg-lightbox__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.6s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.ppg-lightbox__img.is-active {
    opacity: 1;
}

/* Loading spinner — sits above both slots */
.ppg-lightbox__spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}

.ppg-lightbox__spinner[hidden] { display: none !important; }

.ppg-lightbox__spinner::after {
    content: '';
    width: 28px;
    height: 28px;
    border: 2px solid rgba(50, 50, 50, .12);
    border-top-color: rgba(50, 50, 50, .45);
    border-radius: 50%;
    animation: ppg-spin 0.65s linear infinite;
}

@keyframes ppg-spin {
    to { transform: rotate(360deg); }
}


/* ----------------------------------------------------------
   Footer — caption left, controls (play btn + counter) right
   justify-content: space-between pins controls to the right
   edge even when the caption is hidden.
---------------------------------------------------------- */

.ppg-lightbox__footer {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding: 10px 0 16px;
    min-height: 44px;
}
p.ppg-lightbox__caption {
	padding-bottom: 0;
}
.ppg-lightbox__caption {
    margin: 0;
    min-width: 0;
    font-size: 17px;
    line-height: 1.45;
    color: rgba(50, 50, 50, .65);
    text-align: center;
    grid-column: 2;
    align-self: center;
}

.ppg-lightbox__caption[hidden] { display: none !important; }

/* Right-hand group: play button + counter */
.ppg-lightbox__controls {
    display: flex;
    align-items: center;
    gap: 12px;
    grid-column: 1;
}

/* Play / Pause button */
.ppg-lightbox__play-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(60, 60, 60, .2);
    background: rgba(60, 60, 60, .06);
    color: rgba(50, 50, 50, .65);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.ppg-lightbox__play-btn:hover {
    background: rgba(60, 60, 60, .14);
    color: #222;
}

.ppg-lightbox__play-btn:focus-visible {
    outline: 2px solid rgba(50, 50, 50, .5);
    outline-offset: 2px;
}

/* Show play icon by default, pause icon when playing */
.ppg-lightbox__play-btn .ppg-icon--pause { display: none; }
.ppg-lightbox__play-btn.is-playing .ppg-icon--play  { display: none; }
.ppg-lightbox__play-btn.is-playing .ppg-icon--pause { display: block; }

/* Progress ring */
.ppg-progress-ring {
    flex-shrink: 0;
    overflow: visible;
}

.ppg-progress-ring__track {
    fill: none;
    stroke: rgba(50, 50, 50, .15);
    stroke-width: 1.5;
}

.ppg-progress-ring__fill {
    fill: none;
    stroke: rgba(50, 50, 50, .45);
    stroke-width: 1.5;
    stroke-linecap: round;
    /* Start from 12 o'clock */
    transform-origin: 16px 16px;
    transform: rotate(-90deg);
    /* Circumference of r=12 circle ≈ 75.4 */
    stroke-dasharray: 75.4;
    stroke-dashoffset: 75.4; /* empty by default */
    opacity: 0;
    transition: opacity 0.4s ease;
}

.ppg-progress-ring__fill.is-spinning {
    opacity: 1;
    animation: ppg-ring-fill linear forwards;
    /* duration set inline via JS to match SLIDESHOW_INTERVAL */
}

@keyframes ppg-ring-fill {
    from { stroke-dashoffset: 75.4; }
    to   { stroke-dashoffset: 0; }
}



.ppg-lightbox__position {
    margin: 0;
    font-size: 13px;
    color: rgba(50, 50, 50, .55);
    white-space: nowrap;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
    grid-column: 3;
    text-align: right;
    align-self: center;
}


/* ----------------------------------------------------------
   Responsive
---------------------------------------------------------- */

@media (max-width: 768px) {
    .ppg-lightbox { padding: 52px 60px 0; }
    .ppg-lightbox__prev { left:  8px; }
    .ppg-lightbox__next { right: 8px; }
}

@media (max-width: 600px) {
    .ppg-lightbox { padding: 48px 0 0; }

    .ppg-lightbox__dialog {
        max-height: calc(100dvh - 48px);
        max-height: calc(100vh - 48px);
    }

    /* Hide arrows on mobile — swipe to navigate */
    .ppg-lightbox__nav { display: none !important; }

    .ppg-lightbox__footer { padding: 8px 14px 16px; }
    .ppg-lightbox__caption { font-size: 15px; }
}