/* Knowledge-base layout (shared by How-To `doc`, Reference `reference`, Guides `guide`).
   These pages get a much wider container than the 1280px marketing default, so the
   3-column layout (sidebar · content · TOC) has room to breathe on large screens.
   Scoped to .kb-shell; kb.css only loads on kb pages, so marketing pages are unaffected. */
.kb-shell .container-main {
  max-width: 1920px;
}

/* User Manual Layout Structure */
.doc-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 280px;
  gap: 3rem;
}

/* Keep prose readable even on an ultra-wide layout: the content column can grow,
   but the text block itself caps so lines don't get fatiguing to read. */
.doc-content {
  max-width: 70rem;
}

/* Left Sidebar Navigation */
.doc-sidebar {
  position: sticky;
  top: 96px;
  height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Manual sidebar: collapsible, context-aware tree (modules > groups > articles) */
/* Restore mask: hide the tree for the brief moment the persistence script restores expanded
   sections + scroll, so the corrected scroll position never paints as a flicker. The pre-nav
   script adds .cby-restoring; the main script removes it once restore is done (800ms safety
   timeout, so the tree always reveals even if JS fails). */
.doc-tree--manual {
  transition: opacity 0.12s ease;
}
.doc-sidebar.cby-restoring .doc-tree--manual {
  opacity: 0;
}
.doc-tree--manual .doc-sec {
  border-bottom: 1px solid var(--brand-line);
}
.doc-sec-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: none;
  border: 0;
  padding: 0.6rem 0;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--brand-secondary);
  text-align: left;
  cursor: pointer;
}
.doc-sec-toggle:hover {
  color: var(--brand-primary);
}
.doc-sec-caret {
  font-size: 0.7rem;
  color: var(--brand-muted);
  transition: transform 0.15s ease;
  transform: rotate(90deg); /* open by default (no-JS shows everything) */
}
.doc-sec.collapsed .doc-sec-caret {
  transform: rotate(0deg);
}
.doc-sec-body {
  padding-bottom: 0.5rem;
}
.doc-sec.collapsed .doc-sec-body {
  display: none;
}
.doc-sec-loading {
  font-size: 0.8rem;
  color: var(--brand-muted);
  padding: 0.4rem 0.75rem;
}
.doc-grp-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-muted);
  font-weight: 700;
  margin: 0.5rem 0 0.2rem;
}
.doc-grp .doc-menu-list {
  margin-bottom: 0.25rem;
}

.doc-category-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-secondary);
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.doc-menu-list {
  border-left: 1px solid var(--brand-line);
  margin-left: 4px;
}

.doc-menu-link {
  display: block;
  text-decoration: none;
  color: var(--brand-muted);
  font-size: 0.92rem;
  padding: 0.4rem 0 0rem 1rem;
  margin-left: -1px;
  border-left: 1px solid transparent;
  transition: all 0.15s ease;
}

.doc-menu-link:hover {
  color: var(--brand-primary);
  border-left-color: var(--brand-line);
}

.doc-menu-link.active-doc {
  color: var(--brand-primary);
  font-weight: 700;
  /* light tint derived from the brand colour (no hardcoded hex) */
  background: color-mix(in srgb, var(--brand-primary) 9%, transparent);
  /* thicker accent bar; trim left padding by the extra 2px so text stays aligned */
  border-left-width: 3px;
  border-left-color: var(--brand-primary);
  padding-left: calc(1rem - 2px);
  padding-block: 0.2em;
  margin-bottom: -0.2rem;
  border-radius: 0 6px 6px 0;
}
.doc-menu-link.active-doc:hover {
  color: var(--brand-primary);
  border-left-color: var(--brand-primary);
}

/* Right Rail Table of Contents */
.doc-right-rail {
  position: sticky;
  top: 96px;
  height: calc(100vh - 120px);
  overflow-y: auto;
}

.right-rail-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-muted);
  font-weight: 700;
}

.right-rail-toc a {
  display: block;
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  transition: color 0.15s ease;
}

.right-rail-toc a:hover {
  color: var(--brand-primary) !important;
}

/* Document Body Content Area */
.doc-content {
  padding-bottom: 4rem;
}

.doc-title {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.doc-body-text h2 {
  font-size: 1.75rem;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--brand-line);
  padding-bottom: 0.5rem;
}

.doc-body-text h3 {
  font-size: 1.35rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.doc-body-text p {
  margin-bottom: 1.25rem;
  color: #334155;
  font-size: 1.05rem;
}

/* Anchor offset: keep the sticky header from covering a jumped-to heading.
   (Used by the right-rail TOC links.) Tuned per site to the header height. */
.doc-body-text h2,
.doc-body-text h3,
.doc-body-text h4 {
  scroll-margin-top: 90px;
}
.site-hub .doc-body-text h2,
.site-hub .doc-body-text h3,
.site-hub .doc-body-text h4 {
  scroll-margin-top: 72px;
}
/* On hub the header is slimmer, so tuck the sticky rails up to match */
.site-hub .doc-sidebar,
.site-hub .doc-right-rail {
  top: 72px;
  height: calc(100vh - 96px);
}

/* Responsive Adaptations */
@media (max-width: 1399.98px) {
  .doc-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .doc-right-rail {
    display: none;
  }
}

@media (max-width: 991.98px) {
  .doc-layout {
    grid-template-columns: 1fr;
  }
  .doc-sidebar {
    position: relative;
    top: auto;
    height: auto;
    overflow-y: visible;
    border-bottom: 1px solid var(--brand-line);
    padding-bottom: 1.5rem;
  }
}
/* Right-rail enhancements (reference + manual): scrollspy active item, heading deep-link
   anchors, and a back-to-top button. Classes are added by the template TOC script, so these
   rules only apply where that script runs. */
.right-rail-toc a.toc-active {
  color: var(--brand-primary) !important;
  font-weight: 700;
}
.doc-body-text h2 .doc-anchor,
.doc-body-text h3 .doc-anchor {
  opacity: 0;
  margin-left: 0.35rem;
  font-size: 0.78em;
  font-weight: 400;
  color: var(--brand-muted);
  text-decoration: none;
  transition: opacity 0.12s ease;
}
.doc-body-text h2:hover .doc-anchor,
.doc-body-text h3:hover .doc-anchor {
  opacity: 0.6;
}
.doc-body-text h2 .doc-anchor:hover,
.doc-body-text h3 .doc-anchor:hover {
  opacity: 1;
  color: var(--brand-primary);
}
.doc-btt {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--brand-line);
  background: #fff;
  color: var(--brand-primary);
  font-size: 1.2rem;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(16, 82, 162, 0.12);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 1040;
}
.doc-btt.show {
  opacity: 1;
  pointer-events: auto;
}
