.dochub-reader {
  --dochub-border: var(--bs-border-color, #d9dee3);
  --dochub-muted: var(--bs-secondary-color, #697a8d);
  max-width: 1440px;
  min-height: 60vh;
}

.dochub-reader__header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 0 1.25rem;
  border-bottom: 1px solid var(--dochub-border);
}

.dochub-reader__brand {
  color: var(--bs-heading-color, #384551);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.dochub-reader__header-current,
.dochub-reader__breadcrumbs {
  color: var(--dochub-muted);
  font-size: 0.875rem;
}

.dochub-reader__layout {
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(0, 1fr) minmax(180px, 220px);
  gap: 2rem;
  align-items: start;
  padding-top: 1.75rem;
}

.dochub-reader__navigation,
.dochub-reader__toc {
  position: sticky;
  top: 6rem;
  max-height: calc(100vh - 7rem);
  overflow: auto;
  scrollbar-width: thin;
}

.dochub-reader__panel {
  padding: 0.75rem;
  border: 1px solid var(--dochub-border);
  border-radius: 0.5rem;
  background: var(--bs-body-bg, #fff);
}

.dochub-reader__home-link,
.dochub-reader__tree a,
.dochub-reader__toc-list a {
  display: block;
  padding: 0.35rem 0.5rem;
  color: var(--bs-secondary-color, #566a7f);
  line-height: 1.45;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.dochub-reader__home-link.is-active,
.dochub-reader__tree-item.is-active > a,
.dochub-reader__tree a[aria-current="page"],
.dochub-reader__toc-list a.is-active,
.dochub-reader__toc-list a[aria-current="location"] {
  color: var(--bs-primary, #696cff);
  font-weight: 600;
}

.dochub-reader__tree,
.dochub-reader__tree ul,
.dochub-reader__toc-list {
  margin: 0;
  padding-left: 1rem;
  list-style: none;
}

.dochub-reader__tree {
  padding-left: 0;
}

.dochub-reader__breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.dochub-reader__breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.dochub-reader__article {
  min-width: 0;
  padding: clamp(1rem, 3vw, 2.25rem);
  border: 1px solid var(--dochub-border);
  border-radius: 0.75rem;
  background: var(--bs-body-bg, #fff);
}

.dochub-reader__article > h1 {
  margin-bottom: 1.25rem;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  overflow-wrap: anywhere;
}

.dochub-reader__lead {
  color: var(--dochub-muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

.dochub-reader__content {
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.dochub-reader__content img,
.dochub-reader__content video {
  max-width: 100%;
  height: auto;
}

.dochub-reader__content img {
  cursor: zoom-in;
}

.dochub-reader__content pre {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  border-radius: 0.5rem;
}

.dochub-reader__copy-button {
  position: absolute;
  top: 0.35rem;
  right: 0.5rem;
  z-index: 1;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--dochub-border);
  border-radius: 0.35rem;
  color: var(--bs-body-color, #384551);
  background: var(--bs-body-bg, #fff);
  font-size: 0.75rem;
  cursor: pointer;
}

.dochub-reader__content :is(h2, h3, h4) {
  scroll-margin-top: 6rem;
}

.dochub-reader__image-dialog {
  position: fixed;
  inset: 0;
  width: min(96vw, 1440px);
  max-width: none;
  max-height: 96vh;
  padding: 3rem 1rem 1rem;
  border: 0;
  border-radius: 0.75rem;
  background: var(--bs-body-bg, #fff);
}

.dochub-reader__image-dialog::backdrop {
  background: rgb(0 0 0 / 78%);
}

.dochub-reader__image-dialog img {
  display: block;
  width: 100%;
  max-height: calc(96vh - 4rem);
  object-fit: contain;
}

.dochub-reader__image-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--dochub-border);
  border-radius: 0.4rem;
  color: var(--bs-body-color, #384551);
  background: var(--bs-body-bg, #fff);
  cursor: pointer;
}

.dochub-reader__toggle {
  padding: 0.75rem;
  border: 1px solid var(--dochub-border);
  border-radius: 0.5rem;
  color: var(--bs-heading-color, #384551);
  font-weight: 600;
  cursor: pointer;
}

.dochub-reader__navigation summary,
.dochub-reader__toc summary {
  list-style: none;
}

.dochub-reader__navigation summary::-webkit-details-marker,
.dochub-reader__toc summary::-webkit-details-marker {
  display: none;
}

.dochub-reader__toc-list {
  padding: 0;
}

.dochub-reader__toc-level-3 {
  padding-left: 0.75rem;
}

.dochub-reader__toc-level-4 {
  padding-left: 1.5rem;
}

@media (min-width: 992px) {
  .dochub-reader__toggle {
    display: none;
  }
}

.dochub-reader__chapter-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.dochub-reader__chapter-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--dochub-border);
  border-radius: 0.5rem;
  color: inherit;
  text-decoration: none;
}

.dochub-reader__chapter-card:hover,
.dochub-reader__tree a:hover,
.dochub-reader__toc-list a:hover {
  color: var(--bs-primary, #696cff);
  background: var(--bs-primary-bg-subtle, #f0f0ff);
}

@media (max-width: 991.98px) {
  .dochub-reader__layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .dochub-reader__navigation,
  .dochub-reader__toc {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .dochub-reader__header-current {
    display: none;
  }
}
