/* ================================================================
   Service Gallery Modal
   Popup that opens when user clicks a service thumbnail image
   ================================================================ */

/* ── Overlay ─────────────────────────────────────────────────── */
.gallery-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: galleryFadeIn 0.2s ease;
}
.gallery-overlay.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Modal Container ─────────────────────────────────────────── */
.gallery-modal {
    background: var(--color-bg-card, #1a1a2e);
    border-radius: 16px;
    width: 90vw;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    animation: gallerySlideUp 0.25s ease;
}

/* ── Header ──────────────────────────────────────────────────── */
.gallery-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border, #2a2a3e);
    flex-shrink: 0;
}
.gallery-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-primary, #fff);
    margin: 0;
}
.gallery-modal-close {
    background: none;
    border: none;
    color: var(--color-text-muted, #888);
    font-size: 28px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.gallery-modal-close:hover {
    color: var(--color-text-primary, #fff);
}

/* ── Scrollable Body ─────────────────────────────────────────── */
.gallery-modal-body {
    overflow-y: auto;
    padding: 24px;
    flex: 1;
}

/* ── Empty State ─────────────────────────────────────────────── */
.gallery-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-text-muted, #888);
    font-size: 15px;
}

/* ── Entry Block ─────────────────────────────────────────────── */
.gallery-entry {
    margin-bottom: 32px;
}
.gallery-entry:last-child {
    margin-bottom: 0;
}
.gallery-entry-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text-primary, #fff);
    margin: 0 0 4px;
}
.gallery-entry-desc {
    font-size: 13px;
    color: var(--color-text-secondary, #aaa);
    margin: 0 0 14px;
    line-height: 1.5;
}

/* ── Photo Grid ──────────────────────────────────────────────── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}
.gallery-thumb {
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: var(--color-bg-elevated, #222);
}
.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}
.gallery-thumb:hover img {
    transform: scale(1.05);
}

/* ── Full Image Lightbox (inside modal) ──────────────────────── */
.gallery-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.gallery-lightbox.open {
    display: flex;
}
.gallery-lightbox img {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 6px;
}
.gallery-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
    z-index: 10002;
}

/* ── Clickable service image indicator ───────────────────────── */
.service-detail-image {
    position: relative;
    cursor: pointer;
}
.service-detail-image::after {
    content: 'View Gallery';
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.service-detail-image:hover::after {
    opacity: 1;
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes galleryFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes gallerySlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .gallery-modal {
        width: 96vw;
        max-height: 90vh;
        border-radius: 12px;
    }
    .gallery-modal-header {
        padding: 16px 18px;
    }
    .gallery-modal-body {
        padding: 18px;
    }
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }
    .gallery-modal-title {
        font-size: 16px;
    }
}
