/* ─── Page Gallery Albums Section ─────────────────────────────────────────── */

.page-galleries {
    padding-block: var(--space-12);
    border-top: 1px solid var(--border-subtle);
}


.page-galleries__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
    max-width: 780px;
    margin-inline: auto;
}

/* ─── Album Card ───────────────────────────────────────────────────────────── */

.gallery-album-card {
    display: block;
    width: 100%;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-card);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
}

.gallery-album-card:hover,
.gallery-album-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .13);
    outline: none;
}

.gallery-album-card:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

.gallery-album-card__cover {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--surface-muted);
    overflow: hidden;
}

.gallery-album-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.32s ease;
    display: block;
}

.gallery-album-card:hover .gallery-album-card__cover img {
    transform: scale(1.05);
}

.gallery-album-card__no-cover {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--surface-muted);
}

.gallery-album-card__badge {
    position: absolute;
    bottom: var(--space-2);
    right: var(--space-2);
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .04em;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.gallery-album-card__info {
    padding: var(--space-3) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gallery-album-card__name {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

.gallery-album-card__count {
    font-size: .8125rem;
    color: var(--text-muted);
}

/* ─── Album Gallery Modal ──────────────────────────────────────────────────── */

.album-gallery {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: stretch;
}

.album-gallery__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .9);
}

.album-gallery__shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: 100dvh;
}

/* Header */

.album-gallery__header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    flex-shrink: 0;
}

.album-gallery__title {
    flex: 1;
    min-width: 0;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-gallery__counter {
    flex-shrink: 0;
    font-size: .8125rem;
    color: rgba(255, 255, 255, .55);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.album-gallery__close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .8);
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.album-gallery__close:hover {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

/* Main image */

.album-gallery__main {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    padding: 0 var(--space-3);
    gap: var(--space-2);
}

.album-gallery__img-wrap {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.album-gallery__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
    display: block;
}

/* Nav buttons */

.album-gallery__nav {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .75);
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.album-gallery__nav:hover {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

/* Thumbnail strip */

.album-gallery__thumbs {
    flex-shrink: 0;
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    padding: var(--space-3) var(--space-5);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.album-gallery__thumbs::-webkit-scrollbar {
    height: 4px;
}

.album-gallery__thumbs::-webkit-scrollbar-track {
    background: transparent;
}

.album-gallery__thumbs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .2);
    border-radius: 2px;
}

.album-gallery__thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    background: rgba(255, 255, 255, .05);
    transition: border-color 0.15s ease, opacity 0.15s ease;
    opacity: 0.55;
}

.album-gallery__thumb:hover {
    opacity: 0.85;
}

.album-gallery__thumb.is-active {
    border-color: var(--accent-gold);
    opacity: 1;
}

.album-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

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

/* Single card — span both columns */
.page-galleries__grid:has(.gallery-album-card:only-child) .gallery-album-card {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .page-galleries__grid {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }

    .album-gallery__nav {
        width: 36px;
        height: 36px;
    }

    .album-gallery__thumb {
        width: 52px;
        height: 52px;
    }

    .album-gallery__header {
        padding: var(--space-3) var(--space-4);
    }

    .album-gallery__thumbs {
        padding: var(--space-2) var(--space-4);
    }
}
