/* 工具官方标识：图片 URL 来自 shared/course-tools.json，缺失时模板不会输出占位元素。 */
.course-tool-brand {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}

.course-tool-logo {
  display: block;
  box-sizing: border-box;
  width: auto;
  max-width: min(170px, 100%);
  height: auto;
  max-height: 42px;
  object-fit: contain;
  object-position: left center;
  flex: 0 1 auto;
}

.course-tool-brand-cover {
  margin: 0 0 12px;
  min-height: 0;
}

.course-tool-brand-cover .course-tool-logo {
  max-height: 48px;
  max-width: min(190px, 100%);
}

.course-tool-brand-sidebar {
  margin: 8px 0 4px;
}

.course-tool-brand-sidebar .course-tool-logo {
  max-height: 32px;
  max-width: min(145px, 100%);
}

.course-tool-brand-textbook {
  margin: 0 0 10px;
}

.course-tool-brand-directory {
  margin: 0 10px 0 0;
}

.chapter-banner .course-tool-brand-directory {
  display: inline-flex;
  vertical-align: middle;
}

.chapter-banner .course-tool-logo {
  max-height: 30px;
  max-width: 130px;
}

.course-start-hint {
  max-width: 62ch;
}

.course-start-hint a,
.sidebar-start {
  color: inherit;
  font-weight: 700;
  text-underline-offset: 3px;
}

.sidebar-start {
  display: inline-block;
  margin: 4px 0 8px;
}

@media (max-width: 540px) {
  .course-tool-brand {
    gap: 6px;
  }

  .course-tool-brand-cover .course-tool-logo {
    max-height: 38px;
    max-width: min(156px, calc(100vw - 48px));
  }

  .course-tool-brand-sidebar .course-tool-logo,
  .chapter-banner .course-tool-logo {
    max-height: 28px;
    max-width: min(126px, calc(100vw - 64px));
  }

  .course-tool-brand-directory {
    margin: 0 8px 6px 0;
  }

  .chapter-banner .course-tool-brand-directory {
    display: flex;
  }
}

@media (max-width: 375px) {
  .course-tool-brand {
    width: 100%;
    gap: 5px;
  }

  .course-tool-logo,
  .course-tool-brand-cover .course-tool-logo,
  .course-tool-brand-sidebar .course-tool-logo,
  .chapter-banner .course-tool-logo {
    width: auto;
    height: auto;
    max-width: min(132px, calc(100vw - 44px));
    max-height: 34px;
  }

  .course-tool-brand-sidebar .course-tool-logo,
  .chapter-banner .course-tool-logo {
    max-width: 112px;
    max-height: 26px;
  }
}

/* 移动端目录折叠后不得继承桌面侧栏的视窗高度。 */
@media (max-width: 800px) {
  .reader-sidebar {
    height: auto;
    max-height: none;
    overflow: visible;
  }
}
