/*
 * Styles exclusive to the shared learning course layouts. Loaded *after*
 * /learning/assets/learning-common.css so specificity works naturally.
 *
 * Currently covers only the mobile TOC drawer — the desktop sidebar and
 * other course chrome still comes from learning-common.css.
 */

.mobile-toc-trigger {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 15;
  min-width: 56px;
  height: 56px;
  padding: 0 1.1rem;
  border: none;
  border-radius: 999px;
  background: var(--accent, #2563eb);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.35);
}

.mobile-toc-trigger:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.45);
  outline-offset: 3px;
}

.mobile-toc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 13;
  display: none;
  background: rgba(15, 23, 42, 0.65);
}

.mobile-toc-panel {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 14;
  max-height: 78vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -14px 34px rgba(15, 23, 42, 0.18);
  padding: 1rem 1rem 1.25rem;
  display: none;
}

.mobile-toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border, #dbe4ef);
}

.mobile-toc-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.mobile-toc-close {
  appearance: none;
  border: 1px solid var(--border, #dbe4ef);
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--text, #0f172a);
}

.mobile-toc-body .course-nav {
  margin-top: 0.25rem;
}

.mobile-toc-panel.is-open,
.mobile-toc-backdrop.is-open {
  display: block;
}

body.toc-drawer-open {
  overflow: hidden;
}

@media (max-width: 920px) {
  /*
   * learning-common.css keeps the desktop .sidebar visible at mobile widths
   * (it only reorders + unsticks it). Now that the floating TOC drawer covers
   * the same content, hide the inline sidebar to avoid rendering two copies.
   *
   * Gate on `html.drawer-ready` instead of merely "JS enabled": that class is
   * added by initMobileTocDrawer() AFTER every click/Escape/resize handler is
   * bound. If learning-course.js never loads, crashes, or bails out because
   * the drawer markup is absent, the class stays off and the inline sidebar
   * remains accessible as a fallback.
   */
  html.drawer-ready .mobile-toc-trigger {
    display: inline-flex;
  }
  html.drawer-ready .page > .sidebar {
    display: none;
  }
}
