/* The video series block (.vs) and its overlay player. Used by learn.html; any page can carry it (see scripts/website-collections.mjs, marker videos:series).
   Left: a dark panel that stays (hand-written in the page). Right: .vs-right = a track of poster cards (real scrolling with scroll-snap, so touch swipe,
   trackpad and the keyboard work; without JavaScript it is just a scrolling row of links to YouTube), the privacy line and previous / next buttons
   that assets/videos.js shows when the cards do not all fit. The overlay (.vsd) is a <dialog> that assets/videos.js builds on the first click.
   Catalogue look: 2px ink rules, 2px corners, flat ink fills, shadow only under the modal card (website/DESIGN.md). */
.vs { border: 2px solid var(--ink); display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.vs-head { padding: 26px 28px; background: var(--ink); color: var(--paper); display: grid; gap: 12px; align-content: center; }
.vs-kick { font: 600 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--chromate); }
.vs-head h2 { font: 900 clamp(26px, 2.6vw, 38px)/1.08 var(--display); margin: 0; padding: 0; border: 0; }
.vs-head p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--paper); opacity: .86; max-width: 46ch; }
.vs-btn { justify-self: start; display: inline-flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 18px; background: var(--chromate); color: var(--ink); font: 800 15px var(--display); text-decoration: none; border-radius: var(--r); }
.vs-btn:hover, .vs-btn:focus-visible { background: var(--paper); }
.vs-btn svg { width: 18px; height: 18px; }
html[lang="ja"] .vs-head h2, html[lang="ja"] .vs-head p, html[lang="ja"] .vs-btn, html[lang="ja"] .vs-card b, html[lang="ja"] .vs-note { font-family: var(--jp); }

/* the right side: the track, then one ruled strip with the privacy line and the buttons */
.vs-right { min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.vs-track { list-style: none; margin: 0; padding: 0; display: flex; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: var(--ink) var(--zinc-3); }
.vs-item { flex: 0 0 max(50%, 260px); min-width: 0; scroll-snap-align: start; border-left: 2px solid var(--ink); }
.vs-item:first-child { border-left: 0; }
.vs-card { display: grid; gap: 6px; height: 100%; padding: 16px; text-decoration: none; align-content: start; }
.vs-card:hover, .vs-card:focus-visible { background: var(--chromate-2); }
.vs-card:focus-visible { outline-offset: -4px; }
.vs-pic { position: relative; display: block; aspect-ratio: 16 / 9; border: 1.5px solid var(--ink); overflow: hidden; }
.vs-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.vs-play { position: absolute; left: 12px; bottom: 12px; width: 44px; height: 44px; display: grid; place-items: center; background: var(--ink); color: var(--paper); border-radius: 50%; }
.vs-play svg { width: 20px; height: 20px; margin-left: 2px; }
.vs-card:hover .vs-play, .vs-card:focus-visible .vs-play { background: var(--cyan); }
.vs-card small { font: 600 12px var(--mono); color: var(--cyan-ink); margin-top: 6px; }
.vs-card b { font: 800 18px/1.25 var(--display); }
/* with the buttons on, the scroll bar goes (swipe, trackpad and Tab still scroll) */
.vs-js .vs-track { scrollbar-width: none; }
.vs-js .vs-track::-webkit-scrollbar { display: none; }

.vs-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 20px; padding: 10px 16px; min-height: 66px; border-top: 2px solid var(--ink); }   /* tall enough for the buttons, so showing them moves nothing */
.vs-note { grid-column: 1; grid-row: 1; margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); max-width: 62ch; }
.vs-note a { color: var(--ink); white-space: nowrap; }
.vs-ctl { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 10px; }
.vs-ctl[hidden] { display: none; }
.vs-count { font: 600 12px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 6ch; text-align: right; white-space: nowrap; }
.vs-nav { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: var(--r); cursor: pointer; }
.vs-nav svg { width: 20px; height: 20px; }
.vs-nav:not([aria-disabled="true"]):hover { background: var(--ink); color: var(--paper); }
.vs-nav:not([aria-disabled="true"]):active { transform: translateY(1px); }
/* the end of the row: dimmed, still focusable (aria-disabled), so a keyboard user does not lose the focus */
.vs-nav[aria-disabled="true"] { background: transparent; color: var(--zinc); border-color: var(--zinc-2); cursor: default; }

@media (max-width: 860px) {
  .vs { grid-template-columns: 1fr; }
  .vs-right { border-top: 2px solid var(--ink); }
  .vs-item { flex-basis: 68%; }
}
@media (max-width: 520px) {
  .vs-head { padding: 22px 18px; }
  .vs-item { flex-basis: 100%; }
  .vs-bar { grid-template-columns: 1fr; }
  .vs-note, .vs-ctl { grid-column: 1; }
  .vs-ctl { grid-row: 1; }
  .vs-note { grid-row: 2; }
  .vs-count { flex: 1; text-align: left; }   /* the counter on the left, the two buttons together on the right */
}
@media (prefers-reduced-motion: no-preference) {
  .vs-play { transition: background .15s; }
  .vs-nav { transition: background .15s, color .15s; }
}

/* ---- the overlay player ---- */
html.vs-lock { overflow: hidden; scrollbar-gutter: stable; background: #484a4c; }   /* the empty scroll bar strip matches the dimmed page */
.vsd { --vsd-chrome: 148px; padding: 0; margin: auto; border: 2px solid var(--ink); border-radius: var(--r); background: var(--ink); color: var(--paper); max-width: none; max-height: calc(100dvh - 16px); overflow: auto; overscroll-behavior: contain;
  width: min(1120px, calc(100vw - 32px), calc((100dvh - var(--vsd-chrome)) * 16 / 9)); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .55); }
.vsd::backdrop { background: rgba(21, 24, 26, .78); backdrop-filter: blur(3px); }
.vsd-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; }
.vsd-t { margin: 0; font: 800 clamp(17px, 2vw, 22px)/1.25 var(--display); }
html[lang="ja"] .vsd-t, html[lang="ja"] .vsd-close, html[lang="ja"] .vsd-foot { font-family: var(--jp); }
.vsd-close { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 12px; border: 0; border-radius: var(--r); background: var(--chromate); color: var(--ink); font: 800 15px var(--display); cursor: pointer; }
.vsd-close svg { width: 18px; height: 18px; }
.vsd-close:hover { background: var(--paper); }
.vsd-close:focus-visible, .vsd-yt:focus-visible { outline-color: var(--chromate); }
.vsd-frame { position: relative; aspect-ratio: 16 / 9; background: #000 center / cover no-repeat; }
.vsd-frame::before { content: ""; position: absolute; inset: 0; background: rgba(21, 24, 26, .6); }
.vsd-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; }
.vsd-frame iframe.on { opacity: 1; }
.vsd-wait { position: absolute; inset: 0; display: grid; place-items: center; font: 600 13px var(--mono); letter-spacing: .04em; color: var(--paper); }
.vsd-wait[hidden] { display: none; }
.vsd-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; padding: 0 16px; min-height: 48px; font-size: 14px; }
.vsd-yt { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: var(--paper); text-underline-offset: 3px; }
.vsd-yt svg { width: 14px; height: 14px; flex: none; }
.vsd-meta { font: 600 12px var(--mono); letter-spacing: .04em; color: var(--chromate); }
@media (max-width: 640px) {
  .vsd { --vsd-chrome: 156px; width: min(100vw, calc((100dvh - var(--vsd-chrome)) * 16 / 9)); max-height: 100dvh; border-left-width: 0; border-right-width: 0; border-radius: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .vsd[open] { animation: vsd-in .24s cubic-bezier(.16, 1, .3, 1); }
  .vsd[open]::backdrop { animation: vsd-fade .24s ease-out; }
  .vsd-frame iframe { transition: opacity .3s ease-out; }
}
@keyframes vsd-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes vsd-fade { from { opacity: 0; } }
