/* Video Closet — /video-closet/
 *
 * Loads after /prometheus/css/prometheus.css and reuses its tokens, reset,
 * masthead, icon buttons and search box. Differences: the page runs the full
 * width of the window (a responsive gutter instead of the 48rem column), and
 * the content is a thumbnail grid. House design language: quiet-precision.
 * Dark mode is the token swap in prometheus.css; nothing here sets a colour
 * that isn't a token, except the player's black backdrop.
 */

:root {
    --gutter: clamp(1rem, 3vw, 2.5rem);
    --tile-min: 17rem;
}

body.vd {
    max-width: none;
    padding: 0 var(--gutter) var(--space-16);
}

/* ------------------------------------------------------------
   Controls: the /prometheus/ search box (.gl-search, ⌘K hint), styled by
   prometheus.css, and a sort segmented control in the style of its filter
   panel's (.gl-windows). The row keeps Prometheus's 48rem width on this
   full-width page so the search box doesn't stretch across the window.
   ------------------------------------------------------------ */
.vd .gl-controls { max-width: var(--measure); }

.vd-sort {
    flex: none;
    grid-template-columns: repeat(3, auto);
    align-items: stretch;
    height: var(--control-h);
    padding: 3px;
    border-radius: calc(var(--radius-control) + 3px);
}
.vd-sort span {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 .8rem;
    font-size: .875rem;
}

.vd-count {
    margin: var(--space-2) 0 var(--space-6);
    font-size: .875rem;
    color: var(--color-fg-faint);
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   Grid
   ------------------------------------------------------------ */
.vd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--tile-min)), 1fr));
    gap: var(--space-8) var(--space-4);
}

.vd-card { min-width: 0; }

.vd-thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    padding: 0;
    border: 0;
    border-radius: var(--radius-media);
    overflow: hidden;
    background: var(--bg-well);
    cursor: pointer;
}
.vd-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 200ms var(--ease);
}
.vd-thumb img.is-loaded { opacity: 1; }
/* hover: the image dims a little, as on post players */
.vd-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
    pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
    .vd-thumb:hover::after { opacity: .18; }
}
.vd-thumb:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* small play glyph, bottom-left, for affordance */
.vd-play {
    position: absolute;
    left: .6rem;
    bottom: .6rem;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    /* frosted white, as on post players: reads on dark and light thumbs */
    background: rgba(255, 255, 255, .62);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 1px 6px rgba(0, 0, 0, .18);
    color: #111;
}
.vd-play svg { width: .75rem; height: .75rem; margin-left: 2px; }

.vd-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-top: .6rem;
    font-size: .9375rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--color-fg);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: from-font;
    text-underline-offset: .15em;
    transition: text-decoration-color var(--dur) var(--ease);
}
.vd-title:hover { text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }

.vd-meta {
    margin-top: .25rem;
    font-size: .8125rem;
    color: var(--color-fg-faint);
    font-variant-numeric: tabular-nums;
}

#vd-more { height: 1px; }

.vd-empty {
    margin-top: var(--space-8);
    color: var(--color-fg-muted);
}

/* ------------------------------------------------------------
   Player: the main site's video lightbox, copied from
   templates/2024/css/main.css (.lightbox, #close-lightbox, #lightbox-iframe,
   plus its global iframe rule). The site sets html to 10px and this page
   is 16px, so its rem values are written here in px. Keep the two in step.
   ------------------------------------------------------------ */
.lightbox.hidden {
    display: none;
}

.lightbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}
.lightbox:focus { outline: none; }

.lightbox-content {
    background-color: rgba(0, 0, 0, 1.0);
    width: 100%;
    max-height: 90%;
    padding: 0;
}

#lightbox-iframe {
    display: block;
    aspect-ratio: 1.77778;
    height: auto;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    max-height: calc(100vh - 70px);
}

#close-lightbox {
    color: #ffffff;
    font-size: 22px;
    font-weight: 500;
    cursor: pointer;
    padding: 10px;
    margin: -20px 0 7px 0;
}
