/* Compact image preview shared by project galleries and blog posts. */
.image-lightbox-trigger,
.project-image-preview-trigger,
[data-image-lightbox] {
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent !important;
}

/* Prevent mobile tap shrink / scale animation on image preview triggers */
.image-lightbox-trigger.tapped,
.project-image-preview-trigger.tapped,
[data-image-lightbox].tapped,
.image-lightbox-trigger:active,
.project-image-preview-trigger:active,
[data-image-lightbox]:active,
.image-lightbox__image:active,
.image-lightbox__image.tapped {
    transform: none !important;
    opacity: 1 !important;
}

.image-lightbox-trigger:focus-visible,
.project-image-preview-trigger:focus-visible {
    outline: 2px solid #67e8f9;
    outline-offset: 3px;
}

/* ── Lightbox Overlay ─────────────────────────────────────────────── */
.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(17, 24, 39, 0.70);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    cursor: zoom-out;
    animation: lightboxOverlayIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.image-lightbox[hidden] {
    display: none;
}

/* ── Lightbox Dialog Card ───────────────────────────────────────────
   Same glass treatment as the search modal / mobile menu: gray-800/80
   fill, gray-700/50 border, inset white/5 ring, black drop shadow with
   a faint cyan glow. */
.image-lightbox__dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: fit-content;
    max-width: min(960px, calc(100vw - 2.5rem));
    max-height: calc(100svh - 2.5rem);
    padding: 0.5rem;
    overflow: hidden;
    background: rgba(31, 41, 55, 0.80);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(55, 65, 81, 0.5);
    border-radius: 1.25rem;
    box-shadow:
        0 0 50px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(6, 182, 212, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    cursor: zoom-out;
    animation: lightboxDialogIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.image-lightbox__image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: min(74svh, 680px);
    border-radius: 0.85rem;
    object-fit: contain;
    cursor: zoom-out;
}

.image-lightbox__caption:empty {
    display: none;
}

.image-lightbox__caption {
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.4rem 1rem 0.3rem;
    color: #94a3b8;
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: center;
    cursor: zoom-out;
}

body.image-lightbox-open {
    overflow: hidden;
}

/* ── Entrance Animations ──────────────────────────────────────────── */
@keyframes lightboxOverlayIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes lightboxDialogIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@media (max-width: 640px) {
    .image-lightbox {
        padding: 0.85rem;
    }

    .image-lightbox__dialog {
        max-width: calc(100vw - 1.75rem);
        max-height: calc(100svh - 1.75rem);
        border-radius: 1rem;
        padding: 0.4rem;
    }

    .image-lightbox__image {
        max-height: 78svh;
        border-radius: 0.65rem;
    }

    .image-lightbox__caption {
        font-size: 0.775rem;
        padding: 0.5rem 0.75rem 0.35rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .image-lightbox,
    .image-lightbox__dialog {
        animation: none;
    }
}
