/* TCPlayer injects a per-video dimensions rule (for example 1920 x 1080).
   Keep both the SDK wrapper and media fitted to the responsive lesson frame,
   including when the lesson frame or the SDK player enters fullscreen. */
.tcplayer.video-js {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  padding-top: 0 !important;
}

.tcplayer.video-js .vjs-tech {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  object-position: center;
}

/* One document scroll on phones: no capped/nested scroll area for lessons.
   Keep desktop navigation nearby without trapping the main content. */
html:has(.lesson-page),
body:has(.lesson-page),
#root > div:has(.lesson-page) {
  background-color: #0f0b1a;
}

.site-main:has(> .lesson-page) {
  background-color: inherit;
}

#root > div:has(.lesson-page) > .mobile-bottom-space { display: none; }

.lesson-page {
  --lesson-space: 12px;
  --lesson-radius: 12px;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

.lesson-video { scroll-margin-top: 80px; }
.lesson-mobile-directory { overflow: hidden; }
.lesson-page :is(button, select):focus-visible {
  outline: 2px solid #f9a8d4;
  outline-offset: 3px;
}

@media (min-width: 768px) {
  .lesson-desktop-directory {
    position: sticky;
    top: 80px;
    height: calc(100dvh - 104px);
  }
}

@media (max-width: 767px) {
  .lesson-layout {
    height: auto;
    padding: var(--lesson-space);
    padding-bottom: 16px;
  }
  .lesson-main { overflow: visible; }
  .lesson-main { display: flex; flex-direction: column; }
  .lesson-video { order: 0; flex: none; }
  .lesson-playback-controls { order: 1; }
  .lesson-navigation { order: 2; }
  .lesson-directory-toggle { order: 3; }
  .lesson-mobile-directory { order: 4; flex: none; }
  .lesson-description { order: 5; }
  .lesson-toolbar {
    flex-wrap: nowrap;
    padding: 6px var(--lesson-space);
    border-radius: var(--lesson-radius);
  }
  .lesson-toolbar > span { font-size: 11px; line-height: 1.5; }
  .lesson-toolbar > div > span { display: none; }
  .lesson-toolbar button { padding-inline: 12px; font-size: 12px; white-space: nowrap; }
  .lesson-playback-controls { gap: 4px; margin-top: 8px; padding: 4px 8px; }
  .lesson-playback-controls > span { font-variant-numeric: tabular-nums; font-size: 11px; }
  .lesson-playback-controls > div { flex-wrap: nowrap; gap: 4px; }
  .lesson-navigation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
  }
  .lesson-navigation > div { display: flex; justify-content: space-between; gap: 8px; }
  .lesson-navigation > div:first-child > button { flex: 1; justify-content: center; }
  .lesson-navigation button { padding-inline: 12px; font-size: 12px; }
  .lesson-navigation > div:last-child { justify-content: flex-end; }
  .lesson-navigation > div:last-child > span { max-width: 6.5rem; font-size: 11px; }
  .lesson-directory-toggle { margin-top: 8px; }
  .lesson-description { padding: 14px; }
  .lesson-description > div { margin-bottom: 4px; }
  .lesson-description p { line-height: 1.8; }
  .lesson-description p:empty { display: none; }
  .lesson-directory-toggle { scroll-margin-top: 80px; }
  .lesson-mobile-directory { max-height: none; }
  .lesson-mobile-directory button { min-height: 60px; }
}
