/*
 * Click-to-enlarge for product media (see media-lightbox.js).
 * Loaded after site-layout.css. Uses the site's custom properties only.
 */

/* ---- Trigger: the link that wraps a screenshot or demo ---- */
.media-enlarge {
    position: relative;
    display: block;
    cursor: zoom-in;
    color: inherit;
}

/* Wrapping the media in a link breaks these direct-child selectors. */
.capability-media > .media-enlarge > img,
.capability-media > .media-enlarge > video {
    display: block;
    width: 100%;
    height: auto;
    border: var(--border);
    border-radius: 7px;
    box-shadow: var(--shadow-soft);
}
.capability-media > .media-enlarge > video { background: #1d1c21; }
.media-crop > .media-enlarge { position: absolute; inset: 0; }
.demo-panel > .demo-enlarge { height: 100%; }

/* Keep off-screen carousel slides out of the tab order. */
.demo-panel:not(.active) > .demo-enlarge {
    visibility: hidden;
    transition: visibility 0s .35s;
}

.media-enlarge:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 3px;
}

/* Small "Enlarge" affordance. */
.media-enlarge::after {
    content: "Enlarge";
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 2;
    padding: 5px 10px;
    border: 1px solid var(--ink);
    border-radius: 4px;
    box-shadow: var(--shadow-pixel);
    background: var(--paper-strong);
    color: var(--ink);
    font: 700 var(--fs-label)/1.2 var(--font-body);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}
.media-enlarge:hover::after,
.media-enlarge:focus-visible::after { opacity: 1; }
.demo-enlarge::after { bottom: 18px; }
@media (hover: none) {
    .media-enlarge::after { opacity: 1; }
}

/* ---- Viewer ---- */
html.mlb-lock { overflow: hidden; }

.mlb {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(20, 19, 24, .97);
    color: #fff;
    overflow: hidden;
}
.mlb[open] {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mlb-in .18s ease-out;
}
.mlb::backdrop { background: transparent; }

.mlb-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 64px 16px 16px;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
}
.mlb-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    max-width: 100%;
}
.mlb-media {
    display: block;
    width: auto;
    height: auto;
    max-width: min(100%, 100vw - 32px);
    max-height: calc(100vh - 160px);
    max-height: calc(100dvh - 160px);
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #1d1c21;
    box-shadow: 0 0 60px rgba(0, 0, 0, .5);
}
.mlb-caption {
    max-width: 72ch;
    margin: 0;
    font: var(--fs-small)/1.6 var(--font-body);
    text-align: center;
    color: #e9e6df;
}
.mlb-caption[hidden] { display: none; }

.mlb-close {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid var(--ink);
    border-radius: 4px;
    box-shadow: var(--shadow-pixel);
    background: var(--paper-strong);
    color: var(--ink);
    font: 400 28px/1 var(--font-body);
    cursor: pointer;
}
.mlb-close:hover { background: var(--paper-muted); }
.mlb-close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

@keyframes mlb-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .mlb[open] { animation: none; }
    .media-enlarge::after { transition: none; }
}
