/* The information below a lesson is one fixed, fully readable block.
   The middle grid track gives up video height before it clips that block. */
.watch {
  container-type: inline-size;
  display: grid;
  grid-template-rows: auto minmax(0, max-content) auto;
  align-content: start;
}

.watch > .player {
  container: lesson-player / size;
  width: auto;
  height: min(46dvh, 56.25cqw);
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  justify-self: center;
  align-self: start;
}

.watch-detail {
  flex: none;
  min-height: auto;
  max-height: none;
  overflow: visible;
  overscroll-behavior: auto;
  padding: 12px 2px 0;
}

.watch-detail h2 {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  overflow-wrap: anywhere;
}

.watch-detail .video-meta,
.watch-detail .muted,
.watch-detail .warning {
  min-width: 0;
  overflow-wrap: anywhere;
}

.watch-detail .watch-actions {
  margin-bottom: 0;
}

@media (max-width: 960px) {
  .watch-detail .watch-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .watch-detail .watch-actions button {
    min-width: 0;
    margin-left: 0;
    padding-inline: 4px;
  }
}

@media (max-width: 600px) {
  .workspace > .watch {
    flex: 0 1 auto;
    max-height: calc(100% - clamp(110px, calc(50dvh - 165px), 240px) - 9px);
  }

  .watch > .player {
    height: min(26dvh, 56.25cqw);
  }

  .watch-detail {
    padding: 7px 1px 0;
  }

  .watch-detail h2 {
    margin: 5px 0;
  }

  .watch-detail .warning {
    padding: 7px 9px;
    margin: 7px 0;
    font-size: 11px;
    line-height: 1.55;
  }
}

/* Phones held sideways have less height than a full-width 16:9 player.
   Keep every fact and action, use tighter leading, then fit the video. */
@media (max-height: 550px) and (min-width: 601px) {
  .watch-detail {
    padding: 4px 1px 0;
  }

  .watch-detail .video-meta {
    gap: 4px 7px;
    font-size: 10px;
    line-height: 1.4;
  }

  .watch-detail .video-meta a {
    min-height: 16px;
    font-size: 10px;
  }

  .watch-detail .pill {
    padding: 2px 5px;
    font-size: 10px;
  }

  .watch-detail h2 {
    margin: 3px 0;
    font-size: 13px;
    line-height: 1.4;
  }

  .watch-detail .muted {
    margin: 3px 0;
    font-size: 11px;
    line-height: 1.4;
  }

  .watch-detail .warning {
    padding: 4px 7px;
    margin: 4px 0;
    font-size: 11px;
    line-height: 1.4;
  }

  .watch-detail .watch-actions {
    margin: 5px 0 0;
    gap: 5px;
  }

  .watch-detail .watch-actions button {
    min-height: 40px;
    font-size: 11px;
    padding: 6px 4px;
  }

  .watch > .player .play-overlay {
    gap: 4px;
  }

  .watch > .player .play-icon {
    width: clamp(24px, 7dvh, 36px);
    height: clamp(24px, 7dvh, 36px);
    font-size: 14px;
  }
}

/* A small fitted poster needs only its play symbol, not overlapping copy. */
@container lesson-player (max-height: 95px) {
  .watch > .player .play-overlay {
    gap: 0;
    font-size: 0;
  }

  .watch > .player .play-icon {
    width: 26px;
    height: 26px;
    font-size: 14px;
  }
}
