/* ================================================================
   gallery.css — Photo gallery grid + lightbox modal
   ================================================================ */

/* ───────────── Gallery layout adjustment ───────────── */
.gallery-main {
    max-width: 1100px;
}

.gallery-main .page-content {
    max-width: 100%;
}

/* ───────────── Gallery Grid ───────────── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 32px;
}

/* ───────────── Gallery Card ───────────── */
.gallery-card {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-align: left;
    transition: transform 200ms ease, box-shadow 200ms ease;
}

.gallery-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

[data-theme="dark"] .gallery-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

/* ───────────── Card Image ───────────── */
.gallery-card-img-wrap {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background-color: var(--border);
    border-radius: var(--radius);
}

.gallery-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 400ms ease;
}

.gallery-card:hover .gallery-card-img-wrap img {
    transform: scale(1.04);
}

/* Hover overlay */
.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 200ms ease;
}

.gallery-card:hover .gallery-card-overlay {
    background: rgba(0, 0, 0, 0.3);
}

.gallery-card-zoom {
    font-size: 1.4rem;
    color: #fff;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 200ms ease, transform 200ms ease;
    font-weight: 300;
    line-height: 1;
}

.gallery-card:hover .gallery-card-zoom {
    opacity: 1;
    transform: scale(1);
}

/* ───────────── Lightbox Backdrop ───────────── */
.lightbox-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms ease;
    z-index: 200;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.lightbox-backdrop.is-open {
    opacity: 1;
    pointer-events: all;
}

/* ───────────── Lightbox ───────────── */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 201;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 250ms ease, transform 250ms ease;
}

.lightbox.is-open {
    pointer-events: all;
    opacity: 1;
    transform: scale(1);
}

/* ───────────── Lightbox Inner ───────────── */
.lightbox-inner {
    display: flex;
    flex-direction: row;
    gap: 0;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    max-width: 880px;
    width: 100%;
    max-height: 90vh;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.4);
}

/* ───────────── Lightbox Image ───────────── */
.lightbox-img-wrap {
    flex: 1 1 55%;
    background-color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 320px;
}

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

/* ───────────── Lightbox Info Panel ───────────── */
.lightbox-info {
    flex: 0 0 280px;
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
}

.lightbox-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.3;
}

.lightbox-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ───────────── Close Button ───────────── */
.lightbox-close {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 202;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease;
    backdrop-filter: blur(4px);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* ───────────── Responsive ───────────── */
@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .lightbox-inner {
        flex-direction: column;
        max-height: 95vh;
    }

    .lightbox-img-wrap {
        flex: 0 0 220px;
    }

    .lightbox-info {
        flex: 1;
        padding: 24px 20px;
    }

    .gallery-main {
        max-width: 100%;
    }
}