/* Video Library (/videos/). Pages come from scripts/build-video-library.mjs;
   behavior is js/video-library.js. Docs: docs/video-library.md.

   .vl-layout   rail (left) + stage (right)
   .vl-rail     the list of videos, grouped like the Products menu
   .vl-picker   phone-only button that opens the list
   .vl-stage    the player, title, text and next/previous links
   The poster reuses .video-card-poster from css/video-card.css. */

.vl { padding: clamp(22px, 3vw, 36px) 0 clamp(56px, 7vw, 96px); background: var(--soft, #f7f7f3); }

.vl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 20px; margin-bottom: clamp(18px, 2.4vw, 28px); }
.vl-head .eyebrow { margin: 0; }
.vl-head-line { margin: 0; color: var(--ink, #050505); font-size: 16px; line-height: 1.4; }
.vl-head-line span { color: var(--muted, #64645f); }

.vl-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); align-items: start; gap: clamp(24px, 3vw, 44px); }

/* --------------------------------------------------------------------- rail */
.vl-rail { position: sticky; top: 88px; min-width: 0; }
.vl-picker { display: none; }
.vl-nav {
  max-height: calc(100vh - 112px); max-height: calc(100dvh - 112px); overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 8px 12px; border: 1px solid var(--line, #e7e7e2); border-radius: var(--radius-md, 18px); background: #fff;
  scrollbar-width: thin;
}
.vl-group + .vl-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line, #e7e7e2); }
.vl-group h2 {
  margin: 0; padding: 12px 10px 6px; color: var(--muted, #64645f);
  font-family: "Geist Mono", monospace; font-size: 11px; font-weight: 560; letter-spacing: 0.12em; line-height: 1.35; text-transform: uppercase;
}
.vl-group ul { margin: 0; padding: 0; list-style: none; }
.vl-group a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 8px 10px;
  border-radius: var(--radius-sm, 10px); color: var(--ink, #050505); font-size: 15px; font-weight: 500; line-height: 1.25; text-decoration: none;
  transition: background-color var(--motion-fast, 160ms) ease;
}
.vl-group a:hover { background: var(--soft, #f7f7f3); }
.vl-group a:focus-visible { outline: 3px solid var(--explore-lilac-border, #6f4bd8); outline-offset: -2px; }
.vl-group a[aria-current="page"] { background: var(--ink, #050505); color: #fff; font-weight: 620; }
.vl-item-name { min-width: 0; }
.vl-item-meta { flex: none; color: var(--muted, #64645f); font-family: "Geist Mono", monospace; font-size: 12px; letter-spacing: 0.02em; }
.vl-group a[aria-current="page"] .vl-item-meta { color: rgba(255, 255, 255, 0.72); }
.vl-item-soon { padding: 3px 7px; border-radius: 999px; background: var(--cream, #f4ecd6); color: var(--explore-cream-ink, #3b2709); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.vl-group a[aria-current="page"] .vl-item-soon { background: rgba(255, 255, 255, 0.18); color: #fff; }

/* -------------------------------------------------------------------- stage */
.vl-stage { min-width: 0; }
.vl-stage.is-loading { opacity: 0.55; transition: opacity 120ms ease; }
.video-card.vl-player { display: block; }
.vl-player .video-card-poster, .vl-frame, .vl-soon { border-radius: var(--radius-md, 18px); }
/* The stage is the page's main object: no hover lift, so it does not jump under the pointer. */
@media (hover: hover) and (pointer: fine) { .video-card.vl-player .video-card-poster:hover { --lift: 0px; } }
.vl-frame { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid var(--line, #e7e7e2); background: #000; box-shadow: 0 1px 2px rgba(31, 29, 61, 0.06), 0 22px 48px -26px rgba(31, 29, 61, 0.34); }
.vl-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.vl-soon { position: relative; display: grid; place-items: center; overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid var(--line, #e7e7e2); background: var(--navy, #1f1d3d); color: #fff; }
.vl-soon picture, .vl-soon img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.vl-soon img { object-fit: cover; filter: saturate(0.7) brightness(0.42); }
.vl-soon-note { position: relative; display: grid; justify-items: center; gap: 8px; max-width: 38ch; margin: 0; padding: 20px; text-align: center; font-size: 16px; line-height: 1.45; }
.vl-soon-note strong { font-size: clamp(22px, 2.6vw, 32px); font-weight: 620; letter-spacing: -0.03em; line-height: 1.1; }
.vl-soon-note span:last-child { color: rgba(255, 255, 255, 0.78); }
.vl-soon-badge { padding: 6px 12px; border-radius: 999px; background: var(--yellow, #f3e28a); color: var(--ink, #050505); font-family: "Geist Mono", monospace; font-size: 12px; font-weight: 560; letter-spacing: 0.12em; text-transform: uppercase; }

.vl-info { max-width: 760px; padding-top: clamp(20px, 2.4vw, 30px); }
.vl-meta { margin: 0 0 10px; color: var(--muted, #64645f); font-family: "Geist Mono", monospace; font-size: 12px; font-weight: 560; letter-spacing: 0.12em; line-height: 1.4; text-transform: uppercase; }
.vl-title { margin: 0 0 12px; font-size: clamp(28px, 3.2vw, 44px); font-weight: 620; letter-spacing: -0.04em; line-height: 1.05; text-wrap: balance; }
.vl-title:focus { outline: none; }
.vl-text { margin: 0; color: var(--muted, #64645f); font-size: clamp(17px, 1.4vw, 19px); line-height: 1.55; text-wrap: pretty; }
.vl-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.vl-actions:empty { display: none; }
.vl-next { max-width: 100%; }
.vl-next-label { font-weight: 500; opacity: 0.72; }
.vl-next-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vl-prev { display: inline-block; margin-top: 18px; color: var(--muted, #64645f); font-size: 14px; text-decoration: none; }
.vl-prev:hover { color: var(--ink, #050505); text-decoration: underline; }

/* -------------------------------------------------- tablets and phones */
@media (max-width: 1023px) {
  .vl-layout { display: block; }
  .vl-rail { position: static; margin-bottom: 16px; }
  /* Without JavaScript the list simply shows in full above the player. */
  .vl-js .vl-picker {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 56px; padding: 9px 16px;
    border: 1px solid var(--line, #e7e7e2); border-radius: var(--radius-md, 18px); background: #fff; color: var(--ink, #050505);
    font: inherit; text-align: left; cursor: pointer;
  }
  .vl-picker span { display: grid; gap: 2px; min-width: 0; }
  .vl-picker small { color: var(--muted, #64645f); font-family: "Geist Mono", monospace; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
  .vl-picker strong { overflow: hidden; font-size: 16px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
  .vl-picker i { flex: none; width: 10px; height: 10px; margin: -4px 4px 0 0; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform var(--motion-fast, 160ms) ease; }
  .vl-picker[aria-expanded="true"] i { margin-top: 4px; transform: rotate(-135deg); }
  .vl-picker:focus-visible { outline: 3px solid var(--explore-lilac-border, #6f4bd8); outline-offset: 2px; }
  .vl-js .vl-nav { display: none; max-height: min(60vh, 520px); margin-top: 8px; }
  .vl-js .vl-rail.is-open .vl-nav { display: block; }
  .vl-nav { max-height: none; }
  .vl-group a { min-height: 44px; }
}

@media (max-width: 560px) {
  .vl-actions .button { width: 100%; }
  .vl-player .video-card-poster, .vl-frame, .vl-soon { border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .vl-stage, .vl-group a, .vl-picker i { transition: none; }
}
