/* Videos page, player. The recording opens out of the card that was clicked, moves between
   recordings like film advancing on a lightbox, and folds back into its card on close. Under the
   film sits a contact sheet of the list being browsed. Replaces the inline .player rules. */

.vp {
  --travel: cubic-bezier(0.28, 0.11, 0.32, 1);
  --settle: cubic-bezier(0.32, 0.72, 0, 1);
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 1rem; border: 0; background: transparent; color: var(--ink-2);
  overflow: hidden auto; overscroll-behavior: contain;
}
.vp[open] { display: flex; align-items: flex-start; }
.vp::backdrop { background: transparent; }
.vp__scrim { position: fixed; inset: 0; background: rgba(10, 13, 18, 0.58); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

.vp__panel {
  position: relative; z-index: 1; margin: auto;
  width: min(1100px, 100%, calc((100dvh - 25rem) * 16 / 9 + 20px));
  min-width: min(760px, 100%);
  padding: 10px 10px 0; background: var(--paper); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(10, 13, 18, 0.08), 0 40px 110px rgba(10, 13, 18, 0.38);
}

/* the ghost: the clicked thumbnail, flying between its card and the film frame */
.vp__ghost { position: fixed; z-index: 10; overflow: hidden; border-radius: 8px; background: var(--ink); pointer-events: none; transform-origin: 0 0; will-change: transform; }
.vp__ghost img { display: block; width: 100%; height: 100%; object-fit: cover; }
.vp__ghost.is-graphic img { filter: blur(16px) saturate(0.5); transform: scale(1.12); }
/* the card a recording came from shows an empty slot while it is open, like a print lifted off the sheet */
.vp-lifted { opacity: 0 !important; }

/* ---------- the film ---------- */
.vp__stage { position: relative; touch-action: pan-y; }
.vp__frame { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--ink); isolation: isolate; }
.vp__shot { position: absolute; inset: 0; }
.vp__shot.is-leaving { pointer-events: none; }
.vp__poster { position: absolute; inset: 0; display: block; overflow: hidden; color: #fff; text-decoration: none; }
.vp__poster img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease-out), filter 0.7s var(--ease-out); }
.vp__poster:hover img { transform: scale(1.025); }
.vp__poster::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(10, 13, 18, 0.5), rgba(10, 13, 18, 0) 36%); pointer-events: none; }
.vp__play {
  position: absolute; left: 50%; top: 50%; z-index: 1; width: 76px; height: 76px;
  display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 30px rgba(10, 13, 18, 0.3);
  transform: translate(calc(-50% + var(--mx, 0px)), calc(-50% + var(--my, 0px))) scale(var(--ps, 1));
  transition: transform 0.6s var(--settle), opacity 0.4s;
}
.vp__play::before { content: ''; margin-left: 6px; border-left: 21px solid var(--ink); border-top: 12px solid transparent; border-bottom: 12px solid transparent; }
.vp__poster:hover .vp__play { --ps: 1.08; }
.vp__out { position: absolute; left: 1.1rem; bottom: 0.95rem; z-index: 1; font-family: var(--label); font-weight: 600; font-size: 0.95rem; text-shadow: 0 1px 6px rgba(10, 13, 18, 0.5); }
.vp__shot iframe { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity 0.6s var(--travel); }
.vp__shot iframe.is-in { opacity: 1; }

/* surgical demonstrations stay blurred until the viewer asks */
.vp__shot.is-graphic .vp__poster img { filter: blur(18px) saturate(0.5); transform: scale(1.12); }
.vp__shot.is-graphic .vp__play { opacity: 0; }
.vp__veil {
  position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 0.9rem;
  font-family: var(--label); font-weight: 600; font-size: 1.02rem; color: #fff; text-shadow: 0 1px 8px rgba(10, 13, 18, 0.5);
  pointer-events: none; transition: opacity 0.45s var(--travel), filter 0.45s, transform 0.6s var(--travel), visibility 0s;
}
.vp__veil .btn { pointer-events: auto; background: rgba(255, 255, 255, 0.94); color: var(--ink); border-color: transparent; text-shadow: none; }
.vp__veil .btn:hover { background: #fff; }
.vp__shot.is-shown .vp__poster img { filter: none; transform: none; }
.vp__shot.is-shown .vp__play { opacity: 1; }
.vp__shot.is-shown .vp__veil { opacity: 0; filter: blur(6px); transform: scale(0.96); visibility: hidden; transition-delay: 0s, 0s, 0s, 0.45s; }

.vp__x, .vp__nav {
  position: absolute; z-index: 4; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: var(--ink); cursor: pointer;
  box-shadow: 0 6px 18px rgba(10, 13, 18, 0.22);
  transition: transform 0.45s var(--ease-spring), background 0.2s, opacity 0.3s, visibility 0s;
}
.vp__x { top: 0.75rem; right: 0.75rem; }
.vp__nav { top: 50%; margin-top: -22px; }
.vp__nav--prev { left: 0.75rem; }
.vp__nav--next { right: 0.75rem; }
.vp__x:hover, .vp__nav:hover { background: #fff; transform: scale(1.08); }
.vp__nav svg { transition: translate 0.35s var(--travel); }
.vp__nav--prev:hover svg { translate: -2px 0; }
.vp__nav--next:hover svg { translate: 2px 0; }
.vp__nav.is-off { opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0s 0.3s; }

/* ---------- what it is ---------- */
.vp__body { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 2rem; padding: 1.3rem 1.1rem 1.35rem; }
.vp__title { font-size: clamp(1.4rem, 2vw, 1.8rem); line-height: 1.15; text-wrap: pretty; }
.vp__meta { margin-top: 0.5rem; font-family: var(--label); font-weight: 500; font-size: 0.95rem; line-height: 1.5; color: var(--muted); }
.vp__actions { margin-top: 1.1rem; display: flex; gap: 0.7rem; flex-wrap: wrap; }
.vp__note { margin-top: 0.8rem; max-width: 46ch; font-size: 0.88rem; color: var(--muted); }
.vp__note:empty { display: none; }
.vp__copy { display: inline-grid; place-items: center; }
.vp__copy > span { grid-area: 1 / 1; transition: opacity 0.3s, transform 0.45s var(--travel), filter 0.3s; }
.vp__copy-b { opacity: 0; transform: translateY(7px); filter: blur(3px); }
.vp__copy.is-done { border-color: var(--accent); color: var(--accent); }
.vp__copy.is-done .vp__copy-a { opacity: 0; transform: translateY(-7px); filter: blur(3px); }
.vp__copy.is-done .vp__copy-b { opacity: 1; transform: none; filter: none; }

/* related: a mist plate glides to whichever one the pointer is on */
.vp__more { position: relative; }
.vp__more-h { font-family: var(--label); font-size: 0.95rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.vp__rel { position: relative; list-style: none; margin: 0.45rem -0.45rem 0; padding: 0; display: grid; gap: 0.1rem; }
.vp__rel-plate {
  position: absolute; left: 0; right: 0; top: 0; height: var(--h, 0px); border-radius: 12px; background: var(--mist);
  transform: translateY(var(--y, 0px)); opacity: 0; pointer-events: none;
  transition: transform 0.45s var(--travel), height 0.45s var(--travel), opacity 0.3s;
}
.vp__rel.is-hot .vp__rel-plate { opacity: 1; }
.vp__rel a { position: relative; display: grid; grid-template-columns: 5.6rem minmax(0, 1fr); gap: 0.8rem; align-items: center; padding: 0.35rem 0.45rem; border-radius: 12px; color: var(--ink); text-decoration: none; }
.vp__rel-th { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 5px; overflow: hidden; background: var(--mist-2); transition: transform 0.5s var(--settle), box-shadow 0.5s var(--settle); }
.vp__rel-th img { display: block; width: 100%; height: 100%; object-fit: cover; }
.vp__rel-th.is-graphic img { filter: blur(6px) saturate(0.5); transform: scale(1.12); }
.vp__rel a:hover .vp__rel-th, .vp__rel a:focus-visible .vp__rel-th { transform: translateY(-2px) scale(1.03); box-shadow: var(--shadow-1); }
.vp__rel-t { display: block; font-family: var(--display); font-weight: 600; font-size: 0.94rem; line-height: 1.22; transition: color 0.25s; }
.vp__rel-m { display: block; margin-top: 0.15rem; font-family: var(--label); font-weight: 500; font-size: 0.84rem; color: var(--muted); }
.vp__rel a:hover .vp__rel-t, .vp__rel a:focus-visible .vp__rel-t { color: var(--accent); }

/* ---------- the contact sheet: every recording in the list, the one playing lit on a white plate ---------- */
.vp__sheet { position: relative; z-index: 2; display: flex; align-items: center; gap: 1rem; margin: 0 -10px; padding: 0.55rem 1.1rem 0.6rem 1.4rem; background: var(--mist); border-radius: 0 0 18px 18px; }
.vp__sheet[hidden] { display: none; }
.vp__pos { flex: none; min-width: 5.2rem; font-family: var(--label); font-weight: 500; font-size: 0.95rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.vp__pos b { font-weight: 600; color: var(--ink); }
.vp__strip {
  position: relative; flex: 1 1 auto; min-width: 0; height: 54px; overflow: hidden; cursor: grab; touch-action: pan-y; user-select: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.vp__strip.is-drag { cursor: grabbing; }
.vp__plate { position: absolute; left: 50%; top: 50%; width: 86px; height: 54px; margin: -27px 0 0 -43px; border-radius: 9px; background: var(--paper); box-shadow: var(--shadow-1); transition: opacity 0.3s; }
.vp__track { position: absolute; left: 0; top: 0; bottom: 0; display: flex; align-items: center; gap: 12px; transition: transform 0.6s var(--travel); will-change: transform; }
.vp__strip.is-drag .vp__track { transition: none; }
.vp__cell { flex: none; width: 66px; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: 5px; overflow: hidden; background: var(--mist-2); cursor: pointer; opacity: 0.55; transition: opacity 0.3s, transform 0.55s var(--settle); }
.vp__strip.is-drag .vp__cell { cursor: grabbing; }
.vp__cell img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.vp__cell.is-graphic img { filter: blur(4px) saturate(0.5); transform: scale(1.15); }
.vp__cell:hover, .vp__cell.is-aim, .vp__cell:focus-visible { opacity: 1; }
.vp__cell.is-cur { opacity: 1; transform: scale(1.14); }
.vp__cell.is-aim:not(.is-cur) { transform: scale(1.06); }
.vp__peek {
  position: absolute; left: 0; bottom: calc(100% - 0.3rem); z-index: 5; width: max-content; max-width: 17rem;
  padding: 0.55rem 0.75rem 0.6rem; border-radius: 10px; background: var(--paper); box-shadow: var(--shadow-2);
  font-family: var(--display); font-weight: 600; font-size: 0.92rem; line-height: 1.25; color: var(--ink);
  pointer-events: none; opacity: 0; filter: blur(4px);
  transform: translate(calc(var(--px, 0px) - 50%), 6px);
  transition: opacity 0.25s, filter 0.3s, transform 0.45s var(--travel);
}
.vp__peek.is-on { opacity: 1; filter: none; transform: translate(calc(var(--px, 0px) - 50%), 0); }
.vp__peek small { display: block; margin-top: 0.15rem; font-family: var(--label); font-weight: 500; font-size: 0.8rem; color: var(--muted); }

/* a short laptop screen scrolls the panel; the contact sheet stays in reach at its foot */
@media (min-width: 601px) and (max-height: 820px) {
  .vp__sheet { position: sticky; bottom: 0; box-shadow: 0 -1px 0 var(--line); }
}
@media (max-width: 960px) {
  .vp__body { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
}
@media (max-width: 600px) {
  .vp { padding: 0; }
  .vp__panel { display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 100dvh; margin: 0; padding: 0; border-radius: 0; box-shadow: none; }
  .vp__frame { border-radius: 0; }
  .vp__nav { display: none; }
  .vp__x { top: 0.6rem; right: 0.6rem; width: 40px; height: 40px; }
  .vp__body { flex: 1 0 auto; align-content: start; padding: 1.2rem 1.1rem 1.5rem; }
  .vp__play { width: 60px; height: 60px; }
  .vp__play::before { border-left-width: 17px; border-top-width: 10px; border-bottom-width: 10px; margin-left: 5px; }
  .vp__sheet { position: sticky; bottom: 0; margin: 0; padding: 0.55rem 0.9rem calc(0.6rem + env(safe-area-inset-bottom)); border-radius: 0; box-shadow: 0 -1px 0 var(--line); gap: 0.7rem; }
  .vp__pos { min-width: 4.4rem; font-size: 0.88rem; }
  .vp__rel a { grid-template-columns: 6.2rem minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .vp *, .vp *::before, .vp *::after { transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}
