/* ═══════════════════════════════════════════
   Gallery — Album Grid + Masonry + Lightbox
   ═══════════════════════════════════════════ */

/* ── Album Grid (page-gallery.php) ── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    margin-top: 32px;
}

.album-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .08);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    padding: 15px;
}

.album-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .15);
}

.album-card-img {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
    border-radius: 8px;
}

.album-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.album-card:hover .album-card-img img {
    transform: scale(1.08);
}

.album-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(transparent 40%, rgba(0, 0, 0, .6));
    opacity: 0;
    transition: opacity 0.35s ease;
    display: flex;
    align-items: flex-end;
    padding: 20px;
    border-radius: 8px;
}

.album-card:hover .album-card-overlay {
    opacity: 1;
}

.album-card-overlay span {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.album-card-body {
    padding: 18px 20px;
}

.album-card-title {
    font-size: 18px;
    font-weight: 700;
    color: #3D5561;
    margin: 0 0 6px;
    line-height: 1.3;
}

.album-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #999;
}

.album-card-meta .photo-count {
    background: #FDF2E0;
    color: #E3A14C;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
}

/* ── Single Album — Photo Masonry ── */
.album-header {
    margin-top: 32px;
    margin-bottom: 32px;
}

.album-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: #E3A14C;
    text-decoration: none;
    transition: all 0.25s;
    margin-bottom: 20px;
    padding: 8px 18px;
    border: 2px solid #E3A14C;
    border-radius: 8px;
    background: transparent;
}

.album-back-link:hover {
    color: #fff;
    background: #E3A14C;
}

.album-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.album-title-bar h2 {
    font-size: 32px;
    font-weight: 800;
    color: #3D5561;
    margin: 0;
}

.album-title-bar .album-info {
    font-size: 14px;
    color: #999;
}

.photo-grid {
    columns: 4;
    column-gap: 12px;
}

.photo-grid-item {
    break-inside: avoid;
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform 0.25s ease;
}

.photo-grid-item:hover {
    transform: scale(1.02);
}

.photo-grid-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: filter 0.3s ease;
}

.photo-grid-item:hover img {
    filter: brightness(0.85);
}

/* ── Lightbox ── */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, .92);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: lbFadeIn 0.25s ease;
}

.gallery-lightbox.active {
    display: flex;
}

@keyframes lbFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.lightbox-img-wrap {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img-wrap img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
    transition: opacity 0.2s ease;
}

.lightbox-close {
    position: absolute !important;
    top: 24px !important;
    right: 28px !important;
    width: 52px !important;
    height: 52px !important;
    background: rgba(255, 255, 255, .15) !important;
    border: 2px solid rgba(255, 255, 255, .3) !important;
    border-radius: 50% !important;
    color: #fff !important;
    font-size: 28px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s !important;
    z-index: 10;
    padding: 0 !important;
    line-height: 1 !important;
    text-align: center !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .3) !important;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, .3) !important;
    border-color: rgba(255, 255, 255, .5) !important;
    transform: scale(1.1) !important;
}

.lightbox-nav {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 56px !important;
    height: 56px !important;
    background: rgba(255, 255, 255, .15) !important;
    border: 2px solid rgba(255, 255, 255, .3) !important;
    border-radius: 50% !important;
    color: #fff !important;
    font-size: 26px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s !important;
    z-index: 10;
    padding: 0 !important;
    line-height: 1 !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .3) !important;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, .3) !important;
    border-color: rgba(255, 255, 255, .5) !important;
    transform: translateY(-50%) scale(1.1) !important;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .7);
    font-size: 14px;
    font-weight: 600;
    z-index: 10;
}

/* ── Responsive ── */
@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .photo-grid {
        columns: 3;
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .album-card-img {
        height: 200px;
    }

    .photo-grid {
        columns: 2;
        column-gap: 8px;
    }

    .photo-grid-item {
        margin-bottom: 8px;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .lightbox-prev {
        left: 8px;
    }

    .lightbox-next {
        right: 8px;
    }
}

/* ── Empty State ── */
.gallery-empty {
    text-align: center;
    padding: 60px 20px;
}

.gallery-empty .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.gallery-empty h3 {
    font-size: 24px;
    color: #3D5561;
    margin-bottom: 8px;
}

.gallery-empty p {
    font-size: 15px;
    color: #999;
}

/* ── Floating Back Button ── */
.gallery-fab {
    position: fixed;
    bottom: 28px;
    left: 28px;
    background: #3D5561;
    color: #fff !important;
    text-decoration: none;
    padding: 12px 22px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.3s ease;
}

.gallery-fab.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.gallery-fab:hover {
    background: #E3A14C;
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(0, 0, 0, .3);
}