/* ===========================================================
   Modern attachment-page gallery (image.php) — DESKTOP
   Loaded only on attachment pages, with filemtime cache-busting,
   because morning's style.css is served via a plain <link> with no
   version string (header.php) and is cached hard by the browser/CDN.
   ----------------------------------------------------------- */

/* Immersive: the sidebar markup is removed from image.php and #content carries
   the .pt-gallery-immersive class, so widen it to the full wrapper inner width
   (950 - 2*15). The #content.pt-gallery-immersive selector (1,1,0) outranks the
   theme's base #content { width:630px } (1,0,0) rule. */
#content.pt-gallery-immersive {
    width: 100%;
    margin: 0;
}
/* The theme caps .post-content at max-width:630px; lift it so the gallery can
   span the full wrapper width on attachment pages. */
#content.pt-gallery-immersive .post-content {
    max-width: 100%;
}

.post-content .pt-gallery-single {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 0 12px;
    border: 0;
    color: inherit;
    font-weight: normal;
    text-decoration: none;
    overflow: hidden;
}
.post-content .pt-gallery-single:hover { text-decoration: none; }
.post-content .pt-gallery-single img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

.pt-gallery {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 0 12px;
    background: #000;
    overflow: hidden;
}

.pt-gallery .pt-gallery-counter {
    position: absolute;
    top: 10px;
    left: 12px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
    font-weight: 500;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: background-color 0.15s ease;
}
.pt-gallery .pt-gallery-counter:hover,
.pt-gallery .pt-gallery-counter:focus {
    background: rgba(0, 0, 0, 0.75);
    outline: none;
    color: #fff;
}
.pt-gallery .pt-gallery-counter-icon {
    display: block;
    opacity: 0.85;
}

.pt-gallery-grid {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    background: #0b0b0b;
    color: #fff;
}
.pt-gallery-grid[hidden] {
    display: none;
}
.pt-gallery-grid-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}
.pt-gallery-grid-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.pt-gallery-grid-logo {
    width: 90px;
    height: auto;
    flex-shrink: 0;
    display: block;
}
.pt-gallery-grid-title {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pt-gallery-grid-close {
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}
.pt-gallery-grid-close:hover,
.pt-gallery-grid-close:focus {
    opacity: 1;
    outline: none;
}
.pt-gallery-grid-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    box-sizing: border-box;
}
.pt-gallery-grid-items {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}
.pt-gallery-grid-items .pt-gallery-grid-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    background: #222;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
}
.pt-gallery-grid-items .pt-gallery-grid-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pt-gallery-grid-items .pt-gallery-grid-thumb.is-active {
    border-color: #fff;
}
@media (min-width: 1200px) {
    .pt-gallery-grid-items {
        grid-template-columns: repeat(8, 1fr);
    }
}

body.pt-gallery-grid-open {
    overflow: hidden;
}

.pt-gallery .pt-gallery-open-full,
.pt-gallery .pt-gallery-share {
    position: absolute;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #fff;
    font-weight: normal;
    text-decoration: none;
    cursor: pointer;
    opacity: 0.65;
    transition: opacity 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
}
.pt-gallery .pt-gallery-open-full { top: 0; right: 0; }
.pt-gallery .pt-gallery-share    { bottom: 0; left: 0; }
.pt-gallery .pt-gallery-open-full:hover,
.pt-gallery .pt-gallery-open-full:focus,
.pt-gallery .pt-gallery-share:hover,
.pt-gallery .pt-gallery-share:focus {
    opacity: 1;
    outline: none;
    color: #fff;
    text-decoration: none;
    border: 0;
}
.pt-gallery .pt-gallery-open-full svg,
.pt-gallery .pt-gallery-share svg {
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}
.pt-gallery .pt-gallery-share[hidden] {
    display: none;
}

.pt-gallery-main {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.pt-gallery-nav {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 25%;
    z-index: 4;
    display: flex;
    align-items: center;
    padding: 0 8px;
    margin: 0;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}
.pt-gallery-nav:hover,
.pt-gallery-nav:focus {
    opacity: 1;
    outline: none;
}
.pt-gallery-nav-prev { left: 0; justify-content: flex-start; }
.pt-gallery-nav-next { right: 0; justify-content: flex-end; }
.pt-gallery-nav svg {
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}
.pt-gallery-nav-disabled {
    opacity: 0;
    pointer-events: none;
}

.pt-gallery-hint {
    position: absolute;
    z-index: 6;
    padding: 5px 10px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 12px;
    font-weight: normal;
    line-height: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}
/* Navigation guides sit next to the chevron arrows (vertically centered). */
.pt-gallery-hint-nav-prev {
    top: 50%;
    left: 44px;
    transform: translateY(-50%);
}
.pt-gallery-hint-nav-next {
    top: 50%;
    right: 44px;
    transform: translateY(-50%);
}
.pt-gallery-hint-grid {
    top: 46px;
    left: 12px;
}
.pt-gallery-hint.pt-gallery-hint-visible,
.pt-gallery-tip.pt-gallery-hint-visible {
    opacity: 1;
}
.pt-gallery-hint[hidden] {
    display: none;
}

/* Reveal nav guides on chevron hover/focus, grid hint on counter hover/focus. */
.pt-gallery .pt-gallery-nav-prev:hover ~ .pt-gallery-hint-nav-prev,
.pt-gallery .pt-gallery-nav-prev:focus ~ .pt-gallery-hint-nav-prev,
.pt-gallery .pt-gallery-nav-next:hover ~ .pt-gallery-hint-nav-next,
.pt-gallery .pt-gallery-nav-next:focus ~ .pt-gallery-hint-nav-next,
.pt-gallery .pt-gallery-counter:hover ~ .pt-gallery-hint-grid,
.pt-gallery .pt-gallery-counter:focus ~ .pt-gallery-hint-grid {
    opacity: 1;
}

/* Hover tooltips for the corner controls (share, open-full). */
.pt-gallery-tip {
    position: absolute;
    z-index: 6;
    padding: 5px 10px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 12px;
    font-weight: normal;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.pt-gallery .pt-gallery-tip-open-full {
    top: 100%;
    right: 4px;
    margin-top: 2px;
}
.pt-gallery .pt-gallery-tip-share {
    bottom: 100%;
    left: 4px;
    margin-bottom: 2px;
}
.pt-gallery .pt-gallery-open-full:hover .pt-gallery-tip,
.pt-gallery .pt-gallery-open-full:focus .pt-gallery-tip,
.pt-gallery .pt-gallery-share:hover .pt-gallery-tip,
.pt-gallery .pt-gallery-share:focus .pt-gallery-tip {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .pt-gallery-main .swiper-wrapper,
    .pt-gallery-main .swiper-slide,
    .pt-gallery-thumbs .swiper-wrapper,
    .pt-gallery-thumbs .swiper-slide,
    .pt-gallery-nav,
    .pt-gallery-share,
    .pt-gallery-open-full,
    .pt-gallery-hint,
    .pt-gallery-tip {
        transition: none !important;
        animation: none !important;
    }
}

.pt-gallery-main .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}
.pt-gallery-main .swiper-zoom-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pt-gallery-main .swiper-zoom-container > img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
}

.pt-gallery-thumbs {
    width: 100%;
    background: #111;
    padding: 6px 0;
    box-sizing: border-box;
}
.pt-gallery-thumbs .swiper-wrapper {
    align-items: center;
}
.pt-gallery-thumbs .swiper-slide {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    opacity: 0.55;
    border: 2px solid transparent;
    transition: opacity 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
    background: #222;
}
.pt-gallery-thumbs .swiper-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pt-gallery-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border-color: #fff;
}
