/* Video grid (Videos page), drawn by assets/js/videos/grid.js.
   Groups: the year (or the length) rides a sticky left rail on a wide screen, a sticky bar on a phone.
   Cards: cover, a length rule scaled to the longest recording, title, spine glyph and kind. A white
   plate glides behind the card under the pointer; the pointer across a card shows its frames. */

.vg { position: relative; }
.vg__ghosts { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.vg__plate {
  position: absolute; left: 0; top: 0; z-index: 0; width: 0; height: 0;
  border-radius: 18px; background: var(--paper);
  box-shadow: 0 1px 2px rgba(10, 13, 18, 0.05), 0 12px 36px rgba(10, 13, 18, 0.10), 0 0 0 1px var(--line);
  opacity: 0; scale: 0.97; pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1), width 0.5s cubic-bezier(0.32, 0.72, 0, 1), height 0.5s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.28s cubic-bezier(0.28, 0.11, 0.32, 1), scale 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}
.vg__plate.is-on { opacity: 1; scale: 1; }

/* ---------- groups ---------- */
.vg-group {
  display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0 1.75rem;
  margin-top: 2.8rem; padding-top: 1.7rem; border-top: 1px solid var(--line);
}
.vg-group:first-of-type { margin-top: 1.4rem; }
.vg-group__head { position: sticky; top: calc(var(--nav-h) + 1.6rem); z-index: 2; align-self: start; }
.vg-group__t { font-size: 2.7rem; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: lining-nums; }
.vg-group__t.is-band { font-size: 1.45rem; line-height: 1.15; letter-spacing: -0.01em; }
.vg-group__n { margin: 0.5rem 0 0; font-family: var(--label); font-weight: 500; font-size: 0.95rem; color: var(--muted); }
.vg-group__now {
  margin: 1rem 0 0; font-family: var(--label); font-weight: 600; font-size: 1rem; color: var(--accent);
  opacity: 0; transition: opacity 0.25s cubic-bezier(0.28, 0.11, 0.32, 1);
}
.vg-group__now.is-on { opacity: 1; }
.vg-group__cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.6rem 1.6rem; align-items: start; }

/* ---------- a card ---------- */
.vg-card {
  position: relative; z-index: 1; display: flex; flex-direction: column;
  color: var(--ink); text-decoration: none; outline: none; scroll-margin: 110px 0 40px;
  -webkit-tap-highlight-color: transparent;
}
.vg-card__media, .vg-card__body { display: block; }
.vg-card__thumb {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; isolation: isolate;
  border-radius: 8px; background: var(--mist-2);
}
.vg-card__thumb::after {
  content: ''; position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(10, 13, 18, 0.07);
}
.vg-card__img, .vg-card__frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vg-card__img { opacity: 0; transition: opacity 0.5s cubic-bezier(0.28, 0.11, 0.32, 1), transform 0.9s cubic-bezier(0.28, 0.11, 0.32, 1); }
.vg-card__img.is-in { opacity: 1; }
.vg-card__frame { z-index: 1; opacity: 0; transition: opacity 0.34s cubic-bezier(0.28, 0.11, 0.32, 1); }
.vg-card__frame.is-on { opacity: 1; }
.vg-card:focus-visible .vg-card__thumb { outline: 2px solid var(--accent); outline-offset: 3px; }

/* surgical footage: blurred, always, in the grid; its frames are never fetched */
.vg-card.is-graphic .vg-card__img { filter: blur(10px) saturate(0.45); transform: scale(1.15); }
.vg-card.is-graphic:hover .vg-card__img { transform: scale(1.2); }
.vg-card__veil {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center;
  background: color-mix(in srgb, var(--lightbox) 26%, transparent);
  font-family: var(--label); font-weight: 600; font-size: 0.95rem; color: var(--paper);
  text-shadow: 0 1px 8px rgba(10, 13, 18, 0.45);
}

/* the length: a rule as long as the recording, against the longest one in the library */
.vg-card__len { display: flex; align-items: center; gap: 0.55rem; height: 1.1rem; margin-top: 0.7rem; }
.vg-card__fill {
  position: relative; flex: none; width: calc(var(--len) * (100% - 4.6rem)); min-width: 4px; height: 3px;
  border-radius: 2px; background: var(--ink); opacity: 0.6;
  transition: background-color 0.3s, opacity 0.3s;
}
.vg-card__mark {
  position: absolute; top: 50%; left: calc(var(--at, 0.5) * 100%); width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(10, 13, 18, 0.2);
  opacity: 0; scale: 0.3;
  transition: left 0.42s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s, scale 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.vg-card__clock { font-family: var(--label); font-weight: 600; font-size: 0.86rem; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1; }
.vg-card:hover .vg-card__fill, .vg-card.is-scrub .vg-card__fill, .vg-card:focus-visible .vg-card__fill { background: var(--accent); opacity: 1; }
.vg-card.is-scrub .vg-card__mark { opacity: 1; scale: 1; }
/* while looking inside, the rule shows its three stops: a quarter, half and three quarters in */
.vg-card.is-scrub .vg-card__fill {
  background: linear-gradient(to right, var(--accent) calc(25% - 1px), var(--paper) 0 calc(25% + 1px), var(--accent) 0 calc(50% - 1px), var(--paper) 0 calc(50% + 1px), var(--accent) 0 calc(75% - 1px), var(--paper) 0 calc(75% + 1px), var(--accent) 0);
}
.vg-card:hover .vg-card__clock, .vg-card.is-scrub .vg-card__clock { color: var(--ink); }

.vg-card__t {
  margin-top: 0.5rem; font-family: var(--display); font-weight: 600; font-size: 1.12rem; line-height: 1.28;
  letter-spacing: 0; text-wrap: pretty; transition: color 0.3s;
}
.vg-card:hover .vg-card__t, .vg-card:focus-visible .vg-card__t { color: var(--accent-deep); }
.vg-card__m {
  display: flex; align-items: center; gap: 0.55rem; margin-top: 0.5rem;
  font-family: var(--label); font-weight: 500; font-size: 0.88rem; line-height: 1.3; color: var(--muted);
}
.vg-card__w { display: block; margin-top: 0.2rem; font-family: var(--label); font-weight: 500; font-size: 0.88rem; line-height: 1.3; color: var(--muted); }

/* the spine glyph: the site's own spine, lying down, its region lit */
.vg-spine { flex: none; width: 94px; height: 11px; overflow: visible; --vg-off: color-mix(in srgb, var(--ink) 15%, var(--paper)); }
.vg-spine--craniocervical { --vg-craniocervical: var(--accent); }
.vg-spine--cervical { --vg-cervical: var(--accent); }
.vg-spine--thoracolumbar { --vg-thoracolumbar: var(--accent); }
.vg-spine--lumbar { --vg-lumbar: var(--accent); }
.vg-spine--sacropelvic { --vg-sacropelvic: var(--accent); }

/* ---------- widths ---------- */
@media (max-width: 1180px) {
  .vg-group__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .vg-group { grid-template-columns: minmax(0, 1fr); }
  .vg-group__head { position: static; display: flex; align-items: baseline; gap: 0.8rem; margin-bottom: 1.2rem; }
  .vg-group__t { font-size: clamp(1.7rem, 4.6vw, 2.1rem); }
  .vg-group__t.is-band { font-size: clamp(1.35rem, 3.6vw, 1.6rem); }
  .vg-group__n { margin: 0; }
  .vg-group__now { margin: 0 0 0 auto; font-size: 0.92rem; }
}
@media (max-width: 600px) {
  /* a phone reads the library as a list: cover on the left, words on the right, the group name
     pinned under the bar while its recordings pass */
  .vg-group { margin-top: 1.4rem; padding-top: 0; border-top: 0; }
  .vg-group:first-of-type { margin-top: 0.8rem; }
  .vg-group__head {
    position: sticky; top: calc(var(--nav-h) + 10px); z-index: 2;
    margin: 0 calc(-1 * var(--gutter)) 0.9rem; padding: 0.65rem var(--gutter) 0.55rem;
    background: var(--paper); border-bottom: 1px solid var(--line);
  }
  .vg-group__t { font-size: 1.55rem; }
  .vg-group__t.is-band { font-size: 1.25rem; }
  .vg-group__n { font-size: 0.88rem; }
  .vg-group__cards { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .vg-card { display: grid; grid-template-columns: 44% minmax(0, 1fr); column-gap: 0.9rem; align-items: start; }
  .vg-card__thumb { border-radius: 6px; }
  .vg-card__len { margin-top: 0.45rem; gap: 0.4rem; }
  .vg-card__fill { width: calc(var(--len) * (100% - 3.4rem)); }
  .vg-card__clock { font-size: 0.78rem; }
  .vg-card__t { margin-top: 0; font-size: 1rem; line-height: 1.25; }
  .vg-card__m, .vg-card__w { font-size: 0.8rem; }
  .vg-card__m { display: block; margin-top: 0.4rem; }
  .vg-spine { display: inline-block; width: 58px; height: 13px; margin-right: 0.4rem; vertical-align: -2px; }
  .vg-card__veil { font-size: 0.78rem; }
}

@media (prefers-reduced-motion: reduce) {
  .vg__plate, .vg-card__img, .vg-card__frame, .vg-card__mark, .vg-card__fill, .vg-card__t, .vg-card__clock { transition-duration: 0.01s !important; }
  .vg-card.is-graphic:hover .vg-card__img { transform: scale(1.15); }
}
