/* Doc/manual 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 .usermanual-shell — only single-doc.php + usermanual.php use it,
   and usermanual.css only loads on those pages, so marketing pages are unaffected. */
.usermanual-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) */
.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-grp-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-muted);
  font-weight: 700;
  margin: 0.7rem 0 0.3rem;
}
.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 0.4rem 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: 600;
  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;
  }
}