.pane.fit { overflow: hidden; display: flex; flex-direction: column; container-type: inline-size; }
.pane.fit h1 { flex: none; margin-bottom: 14px; }
.loading { color: #888; }

.vgrid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 215px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "tabs player" "list player";
  column-gap: 34px;
}

.tabs { grid-area: tabs; margin-bottom: 14px; }
.tabs button {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  background: none; border: 0; padding: 0; font: inherit; font-size: 1.35rem; line-height: 1.22;
  letter-spacing: -.02em; text-align: left; color: #000; cursor: pointer;
}
.tabs button:hover { text-decoration: underline; text-underline-offset: 4px; }
.tabs button[aria-pressed="true"]::after { content: ""; flex: none; margin-right: 6px; border-style: solid; border-width: 6px 9px 6px 0; border-color: transparent #000 transparent transparent; }

.list { grid-area: list; overflow-y: auto; min-height: 0; padding-right: 8px; }
.thumb { position: relative; display: block; width: 100%; padding: 4px; margin: 0 0 4px; background: none; border: 0; cursor: pointer; }
.thumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 3px; background: #eee; }
.thumb:hover, .thumb[aria-current="true"] { background: #efefef; }
.thumb .dur { position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, .8); color: #fff; font-size: .72rem; padding: 1px 4px; border-radius: 3px; }

.player { grid-area: player; min-width: 0; min-height: 0; overflow-y: auto; padding-right: 6px; }
.frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player h2 { font-size: 2.3rem; font-weight: 400; letter-spacing: -.03em; line-height: 1.05; margin: 14px 0 6px; }
.player .when { color: #777; font-size: .85rem; margin: 0 0 8px; }
.desc { font-size: 1.1rem; line-height: 1.3; letter-spacing: -.01em; white-space: pre-line; overflow-wrap: anywhere; }
.desc.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.desc a, .rel a { color: #000; text-decoration: underline; text-underline-offset: 3px; }
.more { background: none; border: 0; padding: 0; margin-top: 4px; font: inherit; font-size: .9rem; color: #777; cursor: pointer; text-decoration: underline; }

.rel { display: flex; gap: 26px; align-items: flex-start; justify-content: flex-start; margin-top: 34px; padding-bottom: 24px; }
.rel > a { flex: none; display: block; width: min(260px, 38%); }
.rel > a img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #eee; }
.rel > div { flex: 0 1 auto; min-width: 0; }
.rel .from { font-size: 1.35rem; line-height: 1.22; letter-spacing: -.02em; }
.rel .from .l { display: block; }
.rel .links { margin-top: 22px; font-size: 1.35rem; line-height: 1.22; letter-spacing: -.02em; }
.rel .links a { display: block; width: fit-content; }
.rel.solo { margin-top: 24px; }


/* narrower pane: the video moves to the top at full width; categories + thumbnails (left) and
   title / description / release (right) sit underneath, and the whole area scrolls */
@container (max-width: 880px) {
  .vgrid {
    overflow-y: auto; align-content: start; padding-right: 6px;
    grid-template-rows: auto auto auto;
    grid-template-areas: "frame frame" "tabs info" "list info";
  }
  .player { display: contents; }
  /* 16:9 from padding rather than aspect-ratio, so the grid row is sized by it (aspect-ratio let the row collapse
     and the video overlapped the list) */
  .frame { grid-area: frame; margin-bottom: 18px; aspect-ratio: auto; height: 0; padding-bottom: 56.25%; }
  .info { grid-area: info; min-width: 0; }
  .tabs { margin-bottom: 14px; }
  /* the list's height comes from the info pane beside it (contain: size stops its own, much longer,
     content from stretching the row), and never drops below three thumbnails */
  .list { contain: size; min-height: 372px; max-height: none; align-self: stretch; }
  .info h2 { margin-top: 0; }
}

@media (max-width: 900px) {
  .pane.fit { overflow: visible; display: block; }
  .vgrid { display: flex; flex-direction: column; overflow: visible; padding-right: 0; }
  .tabs { order: 1; }
  .player { display: block; order: 2; overflow: visible; }
  .frame { margin-bottom: 0; height: auto; padding-bottom: 0; aspect-ratio: 16 / 9; }
  .info h2 { margin-top: 14px; }
  /* at least three thumbnails tall (each is 200px wide, ~120px high with its padding), the fourth peeking in */
  .list { order: 3; contain: none; min-height: 0; max-height: 424px; margin-top: 16px; }
  .thumb { width: 200px; max-width: 100%; }
  .player h2 { font-size: 1.8rem; }
  .rel { flex-wrap: wrap; align-items: flex-start; }
  .rel > a { width: 60%; }
}
