/* Videos page, controls: 100x pass (2026-09-28). A white console lifted off the page: search and
   sort on top, the kind of video as one segmented control with a white plate that glides, then two
   instruments side by side, WHERE (the shared spine picker) and WHEN (a year histogram you brush).
   Pointing at any choice previews what it would do in the other instruments before you commit.
   Below it, a live readout: the count rolls, the filters in use sit there as removable tokens.
   Loaded after the page's inline <style>; new class names only, tokens from site.css :root. */

.vctl {
  --settle: cubic-bezier(0.32, 0.72, 0, 1);
  --travel: cubic-bezier(0.28, 0.11, 0.32, 1);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.85rem 1rem; align-items: center;
  padding: 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-2);
}
.vctl__more, .vctl__more-in { display: contents; }

/* Search: a mist well in the white console, turning white and ringed when it has focus */
.vctl__search { grid-column: 1; grid-row: 1; max-width: none; }
.vctl__search input {
  height: 48px; padding-right: 3rem; border-radius: 12px; background: var(--mist); border-color: transparent;
  transition: background 0.3s var(--travel), border-color 0.2s, box-shadow 0.3s var(--travel);
}
.vctl__search input:hover { border-color: var(--line-2); }
.vctl__search input:focus { background: var(--paper); }
.vctl__search input::-webkit-search-cancel-button { display: none; }
.vctl .search__key { background: var(--paper); }
.vctl__clear {
  position: absolute; right: 0.6rem; top: 50%; translate: 0 -50%; width: 30px; height: 30px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: var(--mist-2); color: var(--ink); cursor: pointer;
  animation: vctl-pop 0.35s var(--settle);
  transition: background 0.2s, transform 0.35s var(--settle);
}
.vctl__clear:hover { background: var(--line-2); }
.vctl__clear:active { transform: scale(0.9); }
.vctl__clear[hidden] { display: none; }
@keyframes vctl-pop { from { opacity: 0; scale: 0.6; } }

/* Segmented controls: one white plate glides to the chosen option (placed by JS in x and y, so it
   also works when the options wrap to two rows) */
.vseg {
  position: relative; isolation: isolate; display: flex; flex-wrap: wrap; gap: 2px; padding: 4px;
  background: var(--mist); border-radius: 12px;
}
.vseg__plate {
  position: absolute; left: 0; top: 0; z-index: -1; border-radius: 9px; background: var(--paper);
  box-shadow: 0 1px 2px rgba(10, 13, 18, 0.08), 0 4px 14px rgba(10, 13, 18, 0.07);
  transition: transform 0.5s var(--settle), width 0.5s var(--settle), height 0.5s var(--settle), opacity 0.25s;
}
.vseg.is-still .vseg__plate { transition: none; }
.vseg__opt {
  flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  height: 40px; padding: 0 1rem; border: 0; border-radius: 9px; background: none; white-space: nowrap;
  font-family: var(--label); font-weight: 600; font-size: 0.95rem; color: var(--muted); cursor: pointer;
  transition: color 0.3s var(--travel), background 0.3s, transform 0.35s var(--settle);
}
.vseg__opt:hover:not([aria-pressed="true"]):not(:disabled) { color: var(--ink); background: rgba(255, 255, 255, 0.55); }
.vseg__opt[aria-pressed="true"] { color: var(--ink); }
.vseg__opt:active:not(:disabled) { transform: scale(0.97); }
.vseg__opt:disabled { opacity: 0.38; cursor: default; }
.vseg__opt .n { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--muted); transition: color 0.3s; }
.vseg__opt .n.is-peek { color: var(--accent); }
.vseg--sort { grid-column: 2; grid-row: 1; flex-wrap: nowrap; }
.vseg--sort .vseg__opt { padding: 0 0.95rem; font-size: 0.9rem; }
.vseg--kind { grid-column: 1 / -1; }

/* The two instruments: where in the spine, and when */
.vctl__pair { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 0.85rem; }
.vctl__tile { min-width: 0; padding: 1rem 1.15rem 1.1rem; background: var(--mist); border-radius: 12px; }

/* the shared spine picker, framed only: drawing on top, its toggles beneath, stacked in the tile */
.vctl__tile--spine .spine-pick { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0.2rem; }
.vctl__tile--spine .spine-pick__figure { order: -1; flex: none; max-width: none; }
.vctl__tile--spine .spine-pick__toggles { flex: none; }
.vctl__tile--spine .spine-pick .toggle .n { transition: color 0.3s, opacity 0.3s; }
.vctl__tile--spine.is-peek .spine-pick__toggles .n { color: var(--accent); opacity: 1; }
.vctl__tile--spine.is-peek .spine-pick__toggles [aria-pressed="true"] .n { color: var(--lightbox); }

.vctl__tile--years { display: flex; flex-direction: column; gap: 0.7rem; }
.vyears__head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.3rem 1rem; flex-wrap: wrap; }
.vyears__read { font-family: var(--display); font-weight: 600; font-size: 1.3rem; line-height: 1.2; color: var(--ink); }
.vyears__hint { font-family: var(--label); font-weight: 500; font-size: 0.86rem; color: var(--muted); }

/* the histogram: a faint ghost bar is the whole archive in that year, the solid bar is what your
   other filters leave; the number rides the top of the solid bar. A white plate marks the years
   you picked and stretches as you drag. */
.vyears {
  position: relative; flex: 1 1 auto; min-height: 170px; display: grid;
  grid-template-columns: repeat(var(--n, 12), minmax(0, 1fr)); gap: 4px;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.vyears__band {
  position: absolute; left: 0; top: 0; bottom: 0; width: var(--w, 0px); transform: translateX(var(--x, 0px));
  background: var(--paper); border-radius: 10px; box-shadow: var(--shadow-1); opacity: 0; pointer-events: none;
  transition: transform 0.5s var(--settle), width 0.5s var(--settle), opacity 0.3s;
}
.vyears__band.is-on { opacity: 1; }
.vyears__band.is-still { transition: opacity 0.3s; }
.vyears.is-drag .vyears__band { transition-duration: 0.22s, 0.22s, 0.3s; }
.vyears__col {
  position: relative; z-index: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px;
  padding: 8px 0 9px; border: 0; border-radius: 10px; background: none; font: inherit; cursor: pointer;
}
.vyears__col[aria-disabled="true"] { cursor: default; }
.vyears__stack { position: relative; flex: 1 1 auto; margin-inline: 16%; }
.vyears__ghost, .vyears__bar { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 4px 4px 2px 2px; }
.vyears__ghost { height: calc(var(--g, 0) * 1%); background: var(--mist-2); }
.vyears__bar {
  height: max(var(--m, 0px), calc(var(--h, 0) * 1%)); background: var(--accent); transform-origin: bottom;
  transition: height 0.6s var(--settle), background-color 0.3s, opacity 0.3s;
}
.vyears__n {
  position: absolute; left: 50%; bottom: calc(var(--h, 0) * 1% + 5px); translate: -50% 0;
  font-family: var(--label); font-weight: 600; font-size: 0.8rem; line-height: 1; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
  transition: bottom 0.6s var(--settle), color 0.3s;
}
.vyears__yr { font-family: var(--label); font-weight: 600; font-size: 0.8rem; line-height: 1; color: var(--muted); text-align: center; transition: color 0.3s; }
.vyears__tick { display: none; }
.vyears__col:hover .vyears__bar { background: var(--accent-deep); }
.vyears__col:hover .vyears__yr, .vyears__col:hover .vyears__n { color: var(--ink); }
.vyears.has-span .vyears__col:not(.in) .vyears__bar { background: var(--ink); opacity: 0.16; }
.vyears.has-span .vyears__col:not(.in):hover .vyears__bar { opacity: 0.4; }
.vyears__col.in .vyears__yr, .vyears__col.in .vyears__n { color: var(--ink); }
.vyears.is-peek .vyears__bar { opacity: 0.6; }
.vyears.is-peek .vyears__n { color: var(--accent); }
.vyears__col:focus-visible { outline-offset: -2px; }

/* The readout between the controls and the grid: the count is the focal point */
.vread { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem 1.1rem; margin: 1.6rem 0 0.4rem; min-height: 2.6rem; }
.vread__count { font-family: var(--label); font-weight: 600; font-size: 1.05rem; color: var(--muted); }
.vread__n { display: inline-block; margin-right: 0.3rem; font-family: var(--display); font-weight: 600; font-size: 2.2rem; line-height: 1; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; vertical-align: -0.12em; }
.vread__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.vread__tokens { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.vread__tokens:empty { display: none; }
.vtoken {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 32px; padding: 0 0.6rem 0 0.75rem;
  border: 0; border-radius: 6px; background: var(--accent-tint); color: var(--accent-deep);
  font-family: var(--label); font-weight: 600; font-size: 0.9rem; cursor: pointer;
  transition: background 0.25s, color 0.25s, opacity 0.3s, filter 0.3s, transform 0.35s var(--settle);
}
.vtoken svg { transition: transform 0.35s var(--settle); }
.vtoken:hover { background: var(--lightbox); color: var(--ink); }
.vtoken:hover svg { transform: rotate(90deg); }
.vtoken:active { transform: scale(0.95); }
.vtoken.is-new { animation: vtoken-in 0.45s var(--travel) backwards; }
@keyframes vtoken-in { from { opacity: 0; translate: 0 6px; filter: blur(4px); } }
.vtoken.is-out { opacity: 0; transform: scale(0.92); filter: blur(3px); pointer-events: none; }
.vread__reset {
  margin-left: auto; padding: 0; border: 0; background: none; cursor: pointer;
  font-family: var(--label); font-weight: 600; font-size: 0.95rem; color: var(--accent);
  background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-position: 0 100%; background-repeat: no-repeat;
  transition: background-size 0.35s var(--travel), color 0.2s; animation: vtoken-in 0.45s var(--travel);
}
.vread__reset:hover { color: var(--accent-deep); background-size: 100% 1px; }
.vread__reset[hidden] { display: none; }

.vctl__fold { display: none; }

@media (max-width: 960px) {
  .vctl__pair { grid-template-columns: minmax(0, 1fr); }
  .vyears { min-height: 150px; }
}

/* Phone: search and a Filters button on the first line; the rest unfolds beneath with a height
   glide and a staggered rise. The filters in use stay readable below at rest as tokens. */
@media (max-width: 600px) {
  .vctl { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0; padding: 0.65rem; gap: 0 0.55rem; }
  .vctl__search input { height: 46px; }
  .vctl__fold { display: inline-flex; height: 46px; padding: 0 0.85rem; border-radius: 12px; border-color: transparent; background: var(--mist); }
  .vctl__chev { transition: transform 0.45s var(--settle); }
  .vctl.is-open .vctl__fold { background: var(--ink); border-color: var(--ink); color: #fff; }
  .vctl.is-open .vctl__chev { transform: rotate(180deg); }
  .vctl__more {
    display: grid; grid-column: 1 / -1; grid-template-rows: 0fr; visibility: hidden;
    transition: grid-template-rows 0.55s var(--settle), visibility 0s 0.55s;
  }
  .vctl.is-open .vctl__more { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows 0.55s var(--settle); }
  .vctl__more-in { display: grid; gap: 0.6rem; min-height: 0; overflow: hidden; padding-top: 0.65rem; }
  .vctl__more-in > * { opacity: 0; translate: 0 10px; filter: blur(4px); transition: opacity 0.35s var(--travel), translate 0.5s var(--travel), filter 0.35s var(--travel); }
  .vctl.is-open .vctl__more-in > * { opacity: 1; translate: 0 0; filter: blur(0); }
  .vctl.is-open .vctl__more-in > :nth-child(2) { transition-delay: 0.08s; }
  .vctl.is-open .vctl__more-in > :nth-child(1) { transition-delay: 0.12s; }
  .vctl.is-open .vctl__more-in > :nth-child(3) { transition-delay: 0.16s; }
  .vseg--kind { order: -1; display: grid; grid-template-columns: 1fr 1fr; }
  .vseg--sort { grid-column: auto; grid-row: auto; }
  .vseg--sort .vseg__opt { flex: 1 1 0; padding: 0 0.4rem; }
  .vyears__cent { display: none; }
  .vyears__tick { display: inline; }
  .vseg__opt { height: 38px; font-size: 0.9rem; }
  .vctl__tile { padding: 0.85rem 0.75rem 0.9rem; }
  .vyears { min-height: 132px; gap: 2px; }
  .vyears__stack { margin-inline: 10%; }
  .vyears__yr { font-size: 0.62rem; }
  .vyears__n { font-size: 0.68rem; }
  .vyears__read { font-size: 1.15rem; }
  .vread { margin-top: 1.2rem; gap: 0.5rem 0.8rem; }
  .vread__n { font-size: 1.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .vctl *, .vread * { transition: none !important; animation: none !important; }
  .vctl__more-in > * { opacity: 1 !important; translate: none !important; filter: none !important; }
}
