dialog.slb {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    background: transparent;
    color: #f1f5f9;
    color-scheme: dark;
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    animation: slb-fade-in 0.18s ease-out;
}
dialog.slb::backdrop {
    background-color: rgba(9, 13, 22, 0.9);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    animation: slb-fade-in 0.18s ease-out;
}
dialog.slb.slb-closing,
dialog.slb.slb-closing::backdrop {
    animation: slb-fade-out 0.14s ease-in forwards;
}
@keyframes slb-fade-in { from { opacity: 0; } }
@keyframes slb-fade-out { to { opacity: 0; } }
@keyframes slb-picture-in { from { opacity: 0; transform: scale(0.97); } }
@keyframes slb-spin { to { transform: rotate(360deg); } }

.slb-stage {
    position: absolute;
    inset: 0;
    display: flex;
    box-sizing: border-box;
    padding: 60px 76px;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
    user-select: none;
    -webkit-user-select: none;
}
.slb-picture {
    display: block;
    margin: auto; /* centres it, and keeps its top left corner reachable when zoomed */
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    -webkit-user-drag: none;
}
.slb-picture.slb-in { animation: slb-picture-in 0.2s ease-out; }
.slb-zoomable .slb-picture { cursor: zoom-in; }
.slb-stage.slb-zoomed {
    padding: 0;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: auto;
}
.slb-zoomed .slb-picture {
    max-width: none;
    max-height: none;
    border-radius: 0;
    cursor: grab;
}
.slb-zoomed.slb-panning .slb-picture { cursor: grabbing; }

.slb-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    box-sizing: border-box;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: slb-spin 0.8s linear infinite;
}
.slb-error {
    margin: auto;
    padding: 24px 32px;
    max-width: 360px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.08);
    text-align: center;
}
.slb-error p { margin: 0 0 12px; }
dialog.slb .slb-error a {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 6px;
    background-color: #ffffff;
    color: #0f172a;
    font-weight: 600;
    text-decoration: none;
}
dialog.slb [hidden] {
    display: none !important;
}

.slb-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 56px;
    padding: 0 8px 0 20px;
    box-sizing: border-box;
    background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
    pointer-events: none;
}
.slb-bar > * { pointer-events: auto; }
.slb-counter {
    margin-right: auto;
    font-variant-numeric: tabular-nums;
    color: rgba(241, 245, 249, 0.85);
    pointer-events: none;
}

dialog.slb button {
    margin: 0;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}
dialog.slb .slb-btn, dialog.slb .slb-nav { /* dialog.slb: above the site's a:link / a:visited colors */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #f1f5f9;
    cursor: pointer;
    transition: background-color 0.12s, opacity 0.12s;
}
.slb-btn {
    width: 40px;
    height: 40px;
    background-color: transparent;
}
.slb-btn:hover { background-color: rgba(255, 255, 255, 0.14); }
.slb-btn:disabled { opacity: 0.35; cursor: default; background-color: transparent; }
.slb-nav {
    position: absolute;
    top: 50%;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    background-color: rgba(255, 255, 255, 0.1);
}
.slb-nav:hover { background-color: rgba(255, 255, 255, 0.22); }
.slb-prev { left: 14px; }
.slb-next { right: 14px; }
.slb-btn:focus-visible, .slb-nav:focus-visible, .slb-error a:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}
dialog.slb svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.slb-nav svg { width: 26px; height: 26px; }

.slb-caption {
    position: absolute;
    left: 50%;
    bottom: 14px;
    max-width: min(80ch, calc(100% - 32px));
    transform: translateX(-50%);
    box-sizing: border-box;
    padding: 6px 14px;
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.5);
    text-align: center;
    overflow-wrap: anywhere;
    pointer-events: none;
}
.slb-zoomed ~ .slb-caption { display: none; }

/* narrow screens: set by fitToVisualViewport, as a media query would see the layout viewport */
.slb-narrow .slb-stage { padding: 56px 8px; }
.slb-narrow .slb-nav {
    top: auto;
    bottom: 10px;
    margin-top: 0;
    width: 44px;
    height: 44px;
    background-color: rgba(0, 0, 0, 0.45);
}
.slb-narrow .slb-prev { left: 10px; }
.slb-narrow .slb-next { right: 10px; }
.slb-narrow .slb-caption { bottom: 64px; }
@media (hover: none) {
    .slb-btn:hover { background-color: transparent; }
}
@media (prefers-reduced-motion: reduce) {
    dialog.slb, dialog.slb::backdrop, .slb-picture.slb-in { animation: none; }
}
