/* Local GLightbox skin, shared by article and portfolio detail pages. */
.pd__gallery-help {
    margin: 16px 0 0;
    color: var(--page-muted, #b6bdca);
    font-size: 14px;
}

.pd__thumb:focus-visible {
    outline: 3px solid #fdb614;
    outline-offset: 4px;
}

.pd__thumb:focus-visible .pd__thumb-icon { opacity: 1; }

/* Mounting at body level escapes .pd's isolated stacking context. */
.pd-gallery-viewer.glightbox-container {
    z-index: 2147483000 !important;
    height: 100%;
    height: 100dvh;
    direction: ltr;
    --gallery-top: calc(76px + env(safe-area-inset-top, 0px));
    --gallery-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

.pd-gallery-viewer .goverlay { background: rgba(8, 12, 20, .97); }

.pd-gallery-viewer .gslider {
    box-sizing: border-box;
    padding: var(--gallery-top) 16px var(--gallery-bottom);
}

.pd-gallery-viewer .ginner-container {
    height: auto;
    max-width: 100%;
}

.pd-gallery-viewer .gslide-image img {
    max-width: calc(100vw - 32px);
    min-width: 0;
    object-fit: contain;
    border-radius: 10px;
}

.pd-gallery-viewer .gslide:not(.zoomed) .gslide-image img {
    max-height: calc(100vh - var(--gallery-top) - var(--gallery-bottom)) !important;
    max-height: calc(100dvh - var(--gallery-top) - var(--gallery-bottom)) !important;
}

.pd-gallery-viewer .gslide-image img[hidden] { display: none; }

.pd-gallery-heading {
    position: absolute;
    top: calc(24px + env(safe-area-inset-top, 0px));
    right: max(20px, env(safe-area-inset-right, 0px));
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 28px;
}

.pd-gallery-viewer .gbtn {
    position: static;
    display: inline-flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 88px;
    width: auto;
    height: 48px;
    padding: 0 14px;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 12px;
    background: #202938;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    line-height: 1;
    opacity: 1;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.pd-gallery-viewer .gbtn svg {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
}

.pd-gallery-viewer .gbtn path { fill: currentColor; }
.pd-gallery-viewer .gbtn:hover { background: #35425a; }
.pd-gallery-viewer .gbtn:focus-visible { outline: 3px solid #fdb614; outline-offset: 3px; }
.pd-gallery-viewer .gbtn.glightbox-button-hidden { display: none !important; }

.pd-gallery-viewer .gclose {
    position: absolute;
    z-index: 100001;
    top: calc(14px + env(safe-area-inset-top, 0px));
    left: max(16px, env(safe-area-inset-left, 0px));
    right: auto;
}

.pd-gallery-controls {
    position: absolute;
    z-index: 100001;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px;
    max-width: calc(100% - 16px);
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 18px;
    background: #111925;
}

.pd-gallery-counter {
    min-width: 64px;
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.pd-gallery-error {
    padding: 20px;
    color: #fff;
    font-size: 16px;
    line-height: 2;
    direction: rtl;
    text-align: center;
}

@media (max-width: 575.98px) {
    .pd__gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .pd__thumb-icon { opacity: 1; }
    .pd-gallery-controls { gap: 6px; }
    .pd-gallery-viewer .gbtn { min-width: 80px; padding: 0 10px; }
}

@media (max-height: 480px) and (orientation: landscape) {
    .pd-gallery-viewer.glightbox-container { --gallery-top: calc(62px + env(safe-area-inset-top, 0px)); --gallery-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
    .pd-gallery-controls { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
    .pd-gallery-viewer .gclose { top: calc(6px + env(safe-area-inset-top, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
    .pd-gallery-viewer * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
