/* ----------------------------------------------------------------------------
   Screenshot component
   - Click to open in a lightbox (see screenshot-lightbox.js)
   - Selectors prefixed with `figure.screenshot` to win over Tailwind Typography
     prose styles, which already target `figure` / `figcaption`.
---------------------------------------------------------------------------- */

figure.screenshot {
    margin: 2rem 0;
    padding: 0;
}

figure.screenshot .screenshot__frame {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 1px solid rgb(229 231 235); /* gray-200 */
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 8px 24px -12px rgba(15, 23, 42, 0.12);
    cursor: zoom-in;
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

figure.screenshot .screenshot__frame:hover {
    transform: translateY(-1px);
    border-color: rgb(196 181 253);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 16px 32px -12px rgba(107, 78, 255, 0.25);
}

figure.screenshot .screenshot__frame:focus-visible {
    outline: 2px solid #6B4EFF;
    outline-offset: 3px;
}

figure.screenshot .screenshot__img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    object-position: center;
    background: #fafafa;
    margin: 0;
}

figure.screenshot .screenshot__badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: white;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(4px);
    border-radius: 999px;
    pointer-events: none;
}

figure.screenshot .screenshot__zoom {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 999px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 200ms ease, transform 200ms ease;
    pointer-events: none;
}

figure.screenshot .screenshot__frame:hover .screenshot__zoom,
figure.screenshot .screenshot__frame:focus-visible .screenshot__zoom {
    opacity: 1;
    transform: scale(1);
}

figure.screenshot .screenshot__caption {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: rgb(107 114 128);
    text-align: center;
    line-height: 1.5;
    font-style: normal;
}

/* Variants ---------------------------------------------------------------- */

figure.screenshot.screenshot--small .screenshot__frame,
figure.screenshot.screenshot--small .screenshot__caption {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

figure.screenshot.screenshot--wide {
    margin-left: -1rem;
    margin-right: -1rem;
}

/* Dark mode --------------------------------------------------------------- */

.dark figure.screenshot .screenshot__frame {
    border-color: rgb(38 38 45);
    background: rgb(17 17 22);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.3),
        0 12px 32px -12px rgba(0, 0, 0, 0.6);
}

.dark figure.screenshot .screenshot__frame:hover {
    border-color: rgba(107, 78, 255, 0.5);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.3),
        0 16px 32px -12px rgba(107, 78, 255, 0.45);
}

.dark figure.screenshot .screenshot__img {
    background: rgb(24 24 28);
}

.dark figure.screenshot .screenshot__caption {
    color: rgb(156 163 175);
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 768px) {
    figure.screenshot {
        margin: 1.25rem 0;
    }

    figure.screenshot .screenshot__img {
        max-height: 60vh;
    }

    figure.screenshot.screenshot--wide {
        margin-left: 0;
        margin-right: 0;
    }
}

/* ----------------------------------------------------------------------------
   Lightbox
---------------------------------------------------------------------------- */

.screenshot-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem 1.5rem;
    background: rgba(7, 8, 12, 0.92);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.screenshot-lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.screenshot-lightbox__img {
    max-width: min(96vw, 1400px);
    max-height: 82vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.screenshot-lightbox__caption {
    margin-top: 1rem;
    max-width: min(96vw, 900px);
    color: rgb(229 231 235);
    font-size: 0.95rem;
    text-align: center;
    line-height: 1.5;
}

.screenshot-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    cursor: pointer;
    transition: background 150ms ease;
}

.screenshot-lightbox__close:hover,
.screenshot-lightbox__close:focus-visible {
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

.screenshot-lightbox__close svg {
    width: 1.25rem;
    height: 1.25rem;
}

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