/* Simple screenshots carousel styles */
.screenshots-carousel {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    /* constrain to container/section width */
    margin: 0 auto;
    padding: 0;
    /* arrows will overlay; avoid horizontal padding that causes overflow */
    box-sizing: border-box;
    overflow: visible;
    /* ensure arrows are not clipped */
}

.screenshots-carousel .viewport {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    box-sizing: border-box;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    position: relative;
    /* allow absolutely-positioned controls inside viewport */
}

.screenshots-carousel .slides {
    display: flex;
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.screenshots-carousel .slide {
    flex: 0 0 auto;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    /* responsive card width: prefer percentage of container to avoid vw-driven overflow */
    width: clamp(140px, 28%, 260px);
    /* responsive card width for side-by-side layout */
}

.screenshots-carousel .slide img {
    max-width: 100%;
    max-height: 420px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: zoom-in;
}

.screenshots-carousel .arrow {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
}

.screenshots-carousel .arrow.prev {
    left: 8px;
}

.screenshots-carousel .arrow.next {
    right: 8px;
}

.screenshots-carousel .arrow:focus {
    outline: 2px solid #fff;
}

/* Arrow container: full-height 60px clickable area that hosts the arrow button */
.screenshots-carousel .arrow-container {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    cursor: pointer;
    z-index: 49;
    /* keep behind the button which is z-index:50 */
}

.screenshots-carousel .arrow-container.prev {
    left: 0;
}

.screenshots-carousel .arrow-container.next {
    right: 0;
}

.dialog-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 16px;
    /* room for controls and safe-area */
    box-sizing: border-box;
}

.dialog-content img {
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 80px);
    object-fit: contain;
    z-index: 10;
    border-radius: 5px;
}

.dialog-arrow,
.dialog-close {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: none;
    width: 52px;
    height: 52px;
    border-radius: 6px;
    cursor: pointer;
    z-index: 40;
    /* ensure they sit above the image */
}

.dialog-arrow.prev {
    left: 12px;
}

.dialog-arrow.next {
    right: 12px;
}

.dialog-close {
    top: 12px;
    right: 12px;
    transform: none;
}

/* ensure close is reachable on devices with notches/safe areas */
.dialog-close {
    z-index: 30;
    right: max(12px, env(safe-area-inset-right));
    top: calc(12px + env(safe-area-inset-top));
}

/* dialog controls defined above; duplicate rules removed to avoid conflicts */

@media (max-width: 600px) {
    .screenshots-carousel .slide img {
        max-height: 260px;
    }

    .screenshots-carousel {
        padding: 0 14px;
    }

    .screenshots-carousel .slide {
        width: clamp(140px, 46vw, 200px);
    }

    .screenshots-carousel .arrow {
        min-width: 48px;
        min-height: 48px;
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .dialog-content img {
        max-width: calc(100vw - 32px);
        max-height: calc(100vh - 64px);
    }
}

/* Overlay-based fullscreen viewer (new) */
.screenshot-overlay,
#screenshot_overlay {
    /* Use inset to avoid vw/vh rounding issues on mobile browsers */
    position: fixed;
    inset: 0;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    /* avoid using 100vw/100vh which can cause overflow in some browsers */
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    display: none;
    background: rgba(0, 0, 0, 0.88);
    z-index: 99999;
    -webkit-overflow-scrolling: touch;
}

.screenshot-overlay.open,
#screenshot_overlay.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.screenshot-overlay .dialog-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 16px;
    box-sizing: border-box;
}

.screenshot-overlay .dialog-content img {
    max-width: calc(100% - 48px);
    max-height: calc(100% - 80px);
    object-fit: contain;
    z-index: 10;
}

.screenshot-overlay .dialog-arrow,
.screenshot-overlay .dialog-close {
    z-index: 40;
}

/* Ensure close button respects safe-area on devices with notches */
.screenshot-overlay .dialog-close {
    right: max(12px, env(safe-area-inset-right));
    top: calc(12px + env(safe-area-inset-top));
    z-index: 60;
    /* ensure close button sits above arrow containers */
}

/* Overlay arrow-container: full-height clickable area inside overlay (below close button) */
.screenshot-overlay .arrow-container {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    cursor: pointer;
    z-index: 39;
    /* under the close button but below arrow buttons' z-index */
}

.screenshot-overlay .arrow-container.prev {
    left: 0;
}

.screenshot-overlay .arrow-container.next {
    right: 0;
}

/* inert polyfill helper visuals (prevents pointer interaction) */
.inert-polyfill {
    pointer-events: none !important;
    user-select: none !important;
}

/* visually hidden / screen-reader only helper */
.sr-only {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
    /* added line */
}