/* public/css/docs.css
 *
 * Documentation Center (public, unauthenticated). Self-contained — does
 * NOT depend on portal.css being loaded, since /docs is reachable without
 * ever visiting the Client Portal. Token values below are copied directly
 * from the real portal.css :root block so the two stay visually identical;
 * if the Client Portal's palette changes, update both.
 */

:root {
  --p-bg: #ffffff;
  --p-surface: #ffffff;
  --p-text: #111111;
  --p-text-secondary: #4a4a4a;
  --p-text-tertiary: #6b6b6b;
  --p-border: #d4d4d4;
  --p-border-light: #ececec;
  --p-focus: #111111;
  --p-danger: #b91c1c;
  --p-danger-bg: #fdecec;
  --p-success-text: #1a1a1a;
  --p-success-bg: #f0f0f0;
  --p-radius-sm: 6px;
  --p-radius-md: 10px;
  --p-radius-lg: 14px;
  --p-font-display: 'Space Grotesk', system-ui, sans-serif;
  --p-font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { height: 100%; }

body.docs-public {
  font-family: var(--p-font-body);
  background: var(--p-bg);
  color: var(--p-text);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

/* Same accessibility-first focus rule as the Client Portal — non-negotiable
 * for an accessibility company's own public-facing product. */
.docs-public a:focus-visible,
.docs-public button:focus-visible,
.docs-public input:focus-visible {
  outline: 3px solid var(--p-focus);
  outline-offset: 2px;
}

/* --- Top nav --- */
.docs-topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--p-border);
  background: var(--p-surface);
}
.docs-topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--p-text);
  font-family: var(--p-font-display);
  font-weight: 700;
  font-size: 16px;
}
.docs-topnav-brand i { font-size: 20px; }
.docs-brand-logo { height: 28px; width: auto; object-fit: contain; }
.docs-topnav-links {
  display: flex;
  gap: 24px;
}
.docs-topnav-links a {
  color: var(--p-text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.docs-topnav-links a:hover,
.docs-topnav-links a.active {
  color: var(--p-text);
  border-bottom-color: var(--p-text);
}

/* --- Layout shell --- */
.docs-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 32px 80px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 48px;
  align-items: start;
}
@media (max-width: 780px) {
  .docs-shell { grid-template-columns: 1fr; }
}

/* --- Sidebar (category list) --- */
.docs-sidebar {
  position: sticky;
  top: 24px;
}
.docs-sidebar-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--p-text-tertiary);
  margin-bottom: 10px;
}
.docs-sidebar-category {
  margin-bottom: 18px;
}
.docs-sidebar-category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}
.docs-sidebar-category-title i { font-size: 16px; }
.docs-sidebar-page-link {
  display: block;
  padding: 5px 0 5px 24px;
  font-size: 13.5px;
  color: var(--p-text-secondary);
  text-decoration: none;
  border-radius: var(--p-radius-sm);
}
.docs-sidebar-page-link:hover { color: var(--p-text); }
.docs-sidebar-page-link.active { color: var(--p-text); font-weight: 600; }

/* --- Main content --- */
.docs-content h1 {
  font-family: var(--p-font-display);
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 24px;
}
.docs-content h2 { font-size: 22px; margin: 32px 0 12px; }
.docs-content h3 { font-size: 18px; margin: 24px 0 10px; }
.docs-content p { margin: 0 0 16px; color: var(--p-text-secondary); }
.docs-content ul, .docs-content ol { margin: 0 0 16px; padding-left: 24px; }
.docs-content li { margin-bottom: 6px; }
.docs-content img { max-width: 100%; border-radius: var(--p-radius-md); }
.docs-content table { border-collapse: collapse; width: 100%; margin: 0 0 16px; }
.docs-content table td, .docs-content table th {
  border: 1px solid var(--p-border);
  padding: 8px 12px;
  text-align: left;
}
.docs-content code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  background: var(--p-border-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.docs-content a { color: var(--p-text); text-decoration: underline; }

/* --- Category cards (section index page) --- */
.docs-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.docs-category-card {
  display: block;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  padding: 20px;
  text-decoration: none;
  color: var(--p-text);
  transition: border-color 0.12s;
}
.docs-category-card:hover { border-color: var(--p-text); }
.docs-category-card i { font-size: 24px; margin-bottom: 10px; display: block; }
.docs-category-card-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.docs-category-card-count { font-size: 12.5px; color: var(--p-text-tertiary); }

.docs-empty-state {
  color: var(--p-text-tertiary);
  font-size: 14px;
  padding: 24px 0;
}

/* --- Footer --- */
.docs-footer {
  border-top: 1px solid var(--p-border);
  padding: 24px 32px;
  text-align: center;
  font-size: 12.5px;
  color: var(--p-text-tertiary);
}

/* ==========================================================
   Nested tree restructure — added in the Documentation
   Center rebuild. Sidebar tree, breadcrumbs, category
   listings, and the "In this article" rail.
   ========================================================== */

/* --- Breadcrumbs --- */
.docs-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--p-border-light);
  font-size: 13px;
  background: var(--p-surface);
  flex-wrap: wrap;
}
.docs-breadcrumbs a { color: var(--p-text-secondary); text-decoration: none; }
.docs-breadcrumbs a:hover { color: var(--p-text); text-decoration: underline; }
.docs-crumb-sep { font-size: 11px; color: var(--p-text-tertiary); }
.docs-crumb-current { color: var(--p-text); font-weight: 500; }

/* --- Sidebar tree --- */
.docs-nav, .docs-nav-children { list-style: none; margin: 0; padding: 0; }
.docs-nav-item { margin: 0; }
.docs-nav-children.collapsed { display: none; }

.docs-nav-cat { display: flex; align-items: center; gap: 2px; padding-top: 3px; padding-bottom: 3px; }
.docs-nav-cat > a {
  flex: 1;
  padding: 4px 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--p-text);
  text-decoration: none;
  border-radius: var(--p-radius-sm);
}
.docs-nav-cat > a:hover { background: var(--p-border-light); }
.docs-nav-cat.active > a { background: var(--p-border-light); }

.docs-nav-toggle {
  width: 20px; height: 20px; flex-shrink: 0;
  border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--p-text-tertiary); padding: 0; border-radius: 4px;
}
.docs-nav-toggle i { font-size: 13px; transition: transform 0.15s ease; }
.docs-nav-toggle.open i { transform: rotate(90deg); }
.docs-nav-toggle:hover { background: var(--p-border-light); color: var(--p-text); }
.docs-nav-toggle-spacer { width: 20px; flex-shrink: 0; }

.docs-nav-page { margin: 0; }
.docs-nav-page a {
  display: block; padding: 4px 6px; font-size: 13px;
  color: var(--p-text-secondary); text-decoration: none;
  border-radius: var(--p-radius-sm);
}
.docs-nav-page a:hover { color: var(--p-text); background: var(--p-border-light); }
.docs-nav-page a.active { color: var(--p-text); font-weight: 600; background: var(--p-border-light); }

/* --- Category landing --- */
.docs-cat-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.docs-cat-header h1 { margin: 0; }
.docs-cat-header-icon { font-size: 28px; color: var(--p-text-tertiary); }

.docs-cat-counts {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--p-text-tertiary);
  margin-bottom: 28px; flex-wrap: wrap;
}
.docs-cat-counts i { font-size: 14px; vertical-align: -1px; }
.docs-count-sep { color: var(--p-border); }

.docs-listing-item { padding: 18px 0; border-bottom: 1px solid var(--p-border-light); }
.docs-listing-item:last-child { border-bottom: none; }
.docs-listing-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; text-decoration: none; color: var(--p-text);
}
.docs-listing-title:hover { text-decoration: underline; }
.docs-listing-title i { font-size: 16px; }
.docs-listing-cat i { color: var(--p-text-secondary); }
.docs-listing-article i { color: var(--p-text-tertiary); }

.docs-listing-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--p-text-tertiary);
  margin-top: 6px; flex-wrap: wrap;
}
.docs-listing-excerpt {
  font-size: 13.5px; color: var(--p-text-secondary);
  margin: 8px 0 0; line-height: 1.6;
}

/* --- Article --- */
.docs-article-dates {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.docs-article-updated {
  font-size: 13px;
  color: var(--p-text-secondary);
}
.docs-article-date-sep {
  font-size: 11px;
  color: var(--p-text-tertiary);
}
.docs-article-published {
  font-size: 13px;
  color: var(--p-text-secondary);
}
.docs-article-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--p-text-tertiary);
  margin: -12px 0 0; flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--p-border);
  margin-bottom: 28px;
}
.docs-article-readtime { margin-left: auto; }
.docs-article-readtime i { font-size: 13px; vertical-align: -1px; }

/* Bookmarked headings carry data-toc from the editor; scroll-margin keeps
   them clear of the top edge when jumped to from the rail. */
.docs-article-body h2,
.docs-article-body h3,
.docs-article-body [data-toc] { scroll-margin-top: 24px; }

/* --- "In this article" rail --- */
.docs-toc {
  position: sticky; top: 24px; align-self: start;
  max-height: calc(100vh - 48px); overflow-y: auto;
  padding-left: 20px; border-left: 1px solid var(--p-border-light);
}
.docs-toc-heading {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--p-text-tertiary); margin-bottom: 12px;
}
.docs-toc-list { list-style: none; margin: 0; padding: 0; }
.docs-toc-item { margin: 0; }
.docs-toc-item a {
  display: block; padding: 5px 0; font-size: 13px; line-height: 1.45;
  color: var(--p-text-secondary); text-decoration: none;
  border-left: 2px solid transparent; margin-left: -22px; padding-left: 20px;
}
.docs-toc-item a:hover { color: var(--p-text); }
.docs-toc-item a.active { color: var(--p-text); font-weight: 600; border-left-color: var(--p-text); }
.docs-toc-h3 a { padding-left: 32px; font-size: 12.5px; }
.docs-toc-h4 a { padding-left: 44px; font-size: 12px; }
.docs-toc-h5 a { padding-left: 56px; font-size: 12px; }
.docs-toc-h6 a { padding-left: 68px; font-size: 12px; }

/* --- Shell: three columns on article pages, two elsewhere --- */
.docs-shell { grid-template-columns: 250px minmax(0, 1fr); }
.docs-shell:has(.docs-toc:not([hidden])) {
  grid-template-columns: 250px minmax(0, 1fr) 220px;
  max-width: 1320px;
}
@media (max-width: 1100px) {
  .docs-shell:has(.docs-toc:not([hidden])) { grid-template-columns: 250px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 780px) {
  .docs-shell, .docs-shell:has(.docs-toc:not([hidden])) { grid-template-columns: 1fr; }
  .docs-sidebar { position: static; }
}

/* ==========================================================
   Full-width layout + collapsible sidebar rail.
   These override the earlier centered .docs-shell rules by
   cascade order, so they must stay at the end of this file.
   ========================================================== */

.docs-shell {
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
  grid-template-columns: 280px minmax(0, 1fr);
  align-items: stretch;
}
.docs-shell:has(.docs-toc:not([hidden])) {
  max-width: none;
  grid-template-columns: 280px minmax(0, 1fr) 240px;
}

/* Collapsed state is driven by a class on <body> so the grid columns and
   the sidebar internals can both react to it. */
body.docs-nav-collapsed .docs-shell {
  grid-template-columns: 54px minmax(0, 1fr);
}
body.docs-nav-collapsed .docs-shell:has(.docs-toc:not([hidden])) {
  grid-template-columns: 54px minmax(0, 1fr) 240px;
}

/* --- Sidebar --- */
.docs-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--p-border);
  padding: 28px 18px 40px;
  min-height: 60vh;
}
body.docs-nav-collapsed .docs-sidebar {
  padding: 28px 0 40px;
  overflow: visible;
}
body.docs-nav-collapsed .docs-sidebar-inner { display: none; }

/* Vertical "Explore articles" label, shown only when collapsed. */
.docs-sidebar-collapsed-label {
  display: none;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin: 64px auto 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--p-text-tertiary);
  white-space: nowrap;
  user-select: none;
}
body.docs-nav-collapsed .docs-sidebar-collapsed-label { display: block; }

/* Toggle sits centred on the divider line itself. */
.docs-sidebar-toggle {
  position: absolute;
  top: 20vh;
  right: 0;
  transform: translateX(50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  color: var(--p-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 5;
}
.docs-sidebar-toggle:hover {
  border-color: var(--p-text);
  color: var(--p-text);
}
.docs-sidebar-toggle i { font-size: 12px; line-height: 1; }

/* --- Content gets its own breathing room now the shell is full-width --- */
.docs-content {
  padding: 32px 44px 72px;
  max-width: 920px;
}
.docs-toc { padding-top: 32px; }

@media (max-width: 780px) {
  .docs-sidebar {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--p-border);
  }
  .docs-sidebar-toggle { display: none; }
  body.docs-nav-collapsed .docs-sidebar-inner { display: block; }
  .docs-sidebar-collapsed-label { display: none !important; }
  .docs-content { padding: 24px 20px 56px; }
}

/* ==========================================================
   Fixes: clipped toggle button + page-transition loading state.
   Appended last so these win by cascade order.
   ========================================================== */

/* The toggle sits half-outside the sidebar's right edge, so the sidebar
   itself can no longer clip overflow. Move scrolling to the inner wrapper. */
.docs-sidebar {
  overflow: visible;
  max-height: none;
}
.docs-sidebar-inner {
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* --- Page transition progress bar --- */
.docs-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--p-text);
  z-index: 9999;
  opacity: 0;
  transition: width 0.25s ease, opacity 0.2s ease;
  pointer-events: none;
}
.docs-progress.active { opacity: 1; }

/* Content dims slightly while the next page is on its way, so the click
   registers visually even on a fast connection. */
.docs-shell { transition: opacity 0.15s ease; }
body.docs-navigating .docs-shell {
  opacity: 0.45;
  pointer-events: none;
}
body.docs-navigating { cursor: progress; }

@media (prefers-reduced-motion: reduce) {
  .docs-progress { transition: none; }
  .docs-shell { transition: none; }
  body.docs-navigating .docs-shell { opacity: 1; }
}

/* ==========================================================
   Skeleton loading state shown while the next page loads.
   Replaces the earlier dim-the-content approach.
   ========================================================== */

/* Content is swapped for a skeleton now, so dimming it is redundant. */
body.docs-navigating .docs-shell {
  opacity: 1;
  pointer-events: none;
}

.docs-skeleton { padding-top: 6px; }

.docs-skel-line {
  height: 13px;
  border-radius: 7px;
  background: var(--p-border-light);
  margin-bottom: 12px;
}
.docs-skel-block {
  border-radius: 8px;
  background: var(--p-border-light);
  min-height: 190px;
}
.docs-skel-group { margin-bottom: 34px; }
.docs-skel-row {
  display: grid;
  gap: 42px;
  margin-bottom: 34px;
  align-items: start;
}
.docs-skel-row.left-block { grid-template-columns: 0.85fr 1.15fr; }
.docs-skel-row.right-block { grid-template-columns: 1.15fr 0.85fr; }

.docs-skel-line,
.docs-skel-block {
  animation: docsSkelPulse 1.5s ease-in-out infinite;
}
@keyframes docsSkelPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@media (max-width: 780px) {
  .docs-skel-row.left-block,
  .docs-skel-row.right-block { grid-template-columns: 1fr; }
  .docs-skel-block { min-height: 140px; }
}
@media (prefers-reduced-motion: reduce) {
  .docs-skel-line, .docs-skel-block { animation: none; }
}

/* ==========================================================
   Full-width content + collapsible "In this article" rail.
   Appended last so these override earlier rules.
   ========================================================== */

/* Content fills its column rather than being capped. */
.docs-content { max-width: none; }

/* --- Grid: all four nav/toc collapse combinations --- */
.docs-shell:has(.docs-toc:not([hidden])) {
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  max-width: none;
}
body.docs-nav-collapsed .docs-shell:has(.docs-toc:not([hidden])) {
  grid-template-columns: 54px minmax(0, 1fr) 300px;
}
body.docs-toc-collapsed .docs-shell:has(.docs-toc:not([hidden])) {
  grid-template-columns: 280px minmax(0, 1fr) 54px;
}
body.docs-nav-collapsed.docs-toc-collapsed .docs-shell:has(.docs-toc:not([hidden])) {
  grid-template-columns: 54px minmax(0, 1fr) 54px;
}

/* --- The rail itself --- */
/* Scrolling moves to the inner wrapper so the toggle, which sits half
   outside the left edge, is not clipped. Same fix as the left sidebar. */
.docs-toc {
  position: sticky;
  top: 0;
  align-self: start;
  overflow: visible;
  max-height: none;
  padding: 32px 20px 40px 26px;
  border-left: 1px solid var(--p-border);
  min-height: 60vh;
}
.docs-toc-inner {
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  overflow-x: hidden;
}
body.docs-toc-collapsed .docs-toc { padding: 32px 0 40px; }
body.docs-toc-collapsed .docs-toc-inner { display: none; }

/* More breathing room between entries now the column is wider. */
.docs-toc-heading { margin-bottom: 14px; }
.docs-toc-item a {
  padding: 7px 0 7px 22px;
  margin-left: -26px;
  font-size: 13.5px;
}
.docs-toc-h3 a { padding-left: 38px; font-size: 12.5px; }

/* Vertical label, shown only when collapsed. */
.docs-toc-collapsed-label {
  display: none;
  writing-mode: vertical-rl;
  margin: 60px auto 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--p-text-tertiary);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}
body.docs-toc-collapsed .docs-toc-collapsed-label { display: block; }

/* Toggle sits centred on the rail's own divider line. */
.docs-toc-toggle {
  position: absolute;
  top: 20vh;
  left: 0;
  transform: translateX(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  color: var(--p-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 5;
}
.docs-toc-toggle:hover { border-color: var(--p-text); color: var(--p-text); }
.docs-toc-toggle i { font-size: 12px; line-height: 1; }

@media (max-width: 1100px) {
  .docs-toc-toggle, .docs-toc-collapsed-label { display: none; }
}

/* ==========================================================
   Fix: TOC entries were clipped at their left edge.
   The negative margin-left overhung .docs-toc-inner, which has
   overflow-x:hidden, so the first characters were cut off. Keep
   the active indicator inside the scroll box instead.
   ========================================================== */
.docs-toc-item a {
  margin-left: 0;
  padding: 7px 0 7px 14px;
}
.docs-toc-h3 a { padding-left: 28px; }

/* ==========================================================
   Public topbar: brand left, auth state right.
   ========================================================== */
.docs-topnav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.docs-topnav-login {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border: 1px solid var(--p-text);
  border-radius: var(--p-radius-sm);
  background: var(--p-text);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.docs-topnav-login:hover { background: #000; border-color: #000; }

.docs-topnav-user {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--p-border);
  border-radius: 99px;
  text-decoration: none;
  color: var(--p-text);
  font-size: 13px;
  max-width: 320px;
}
.docs-topnav-user:hover { border-color: var(--p-text); }
.docs-topnav-user > i { font-size: 14px; color: var(--p-text-tertiary); }

.docs-topnav-avatar {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--p-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
}
.docs-topnav-avatar img { width: 100%; height: 100%; object-fit: cover; }

.docs-topnav-username {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docs-topnav-backlabel {
  font-size: 12.5px;
  color: var(--p-text-tertiary);
  font-weight: 500;
}

@media (max-width: 640px) {
  .docs-topnav-brand span { display: none; }
  .docs-topnav-username, .docs-topnav-backlabel { display: none; }
  .docs-topnav-user { padding: 5px; border-radius: 50%; }
  .docs-topnav-user > i { display: none; }
}

/* [hidden] must win over the explicit display values on these two, or a
   logged-in visitor sees the login button and the user chip together. */
.docs-topnav-login[hidden],
.docs-topnav-user[hidden] { display: none !important; }

/* ==========================================================
   Home page category cards.
   ========================================================== */
.docs-category-grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.docs-category-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  text-decoration: none;
  color: var(--p-text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.docs-category-card:hover {
  border-color: var(--p-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.docs-cat-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--p-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.docs-cat-icon i {
  font-size: 21px;
  color: var(--p-text);
  margin: 0;
  display: block;
}

.docs-cat-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.docs-cat-title {
  font-family: var(--p-font-display);
  font-size: 15.5px;
  font-weight: 600;
  /* The generic .docs-content a rule underlines links; card titles are
     whole-card click targets, so the underline reads as noise here. */
  text-decoration: none;
}
.docs-cat-meta {
  font-size: 12.5px;
  color: var(--p-text-tertiary);
}

.docs-cat-arrow {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 15px;
  color: var(--p-text-tertiary);
  transform: translateX(-3px);
  opacity: 0;
  transition: transform 0.14s, opacity 0.14s;
}
.docs-category-card:hover .docs-cat-arrow {
  transform: translateX(0);
  opacity: 1;
}

/* The card is the link, so nothing inside it should underline. */
.docs-content .docs-category-card,
.docs-content .docs-category-card:hover { text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .docs-cat-arrow { transition: none; }
}

/* While navigating, the real article stays in the DOM (so the back/forward
   cache can restore it) and is simply hidden behind the skeleton. */
.docs-content-loading > *:not(#docs-skeleton) { display: none; }

/* ==========================================================
   Sticky header, minimum page height, back-to-top control.
   Header height lives in one variable because the sidebar
   offset, the rail offset, the heading scroll-margin and the
   min-height calc all derive from it.
   ========================================================== */
:root {
  --docs-header-h: 57px;
  --docs-crumbs-h: 46px;
  --docs-footer-h: 71px;
}

.docs-topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  /* Opaque, or scrolled content shows through as it passes under. */
  background: var(--p-surface);
}

/* Both sticky columns start below the header rather than under it. */
.docs-sidebar {
  top: var(--docs-header-h);
}
.docs-sidebar-inner {
  max-height: calc(100vh - var(--docs-header-h) - 72px);
}
.docs-toc {
  top: var(--docs-header-h);
}
.docs-toc-inner {
  max-height: calc(100vh - var(--docs-header-h) - 90px);
}

/* Jumping to a heading must clear the sticky header, otherwise the
   target lands hidden behind it. */
.docs-article-body h1,
.docs-article-body h2,
.docs-article-body h3,
.docs-article-body h4,
.docs-article-body [data-toc] {
  scroll-margin-top: calc(var(--docs-header-h) + 22px);
}

/* Short pages still fill the viewport, so the footer sits at the bottom
   and the sidebar divider runs the full height instead of stopping
   abruptly under a two-line article. */
.docs-shell {
  min-height: calc(100vh - var(--docs-header-h) - var(--docs-crumbs-h) - var(--docs-footer-h));
}
.docs-content {
  min-height: calc(100vh - var(--docs-header-h) - var(--docs-crumbs-h) - var(--docs-footer-h) - 104px);
}

/* --- Back to top --- */
.docs-to-top {
  position: fixed;
  bottom: 26px;
  right: 26px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  color: var(--p-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 90;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.docs-to-top.visible { opacity: 1; transform: translateY(0); }
.docs-to-top:hover { border-color: var(--p-text); }
.docs-to-top i { font-size: 17px; line-height: 1; }

/* [hidden] has to beat the flex display above. */
.docs-to-top[hidden] { display: none !important; }

@media (max-width: 780px) {
  .docs-shell, .docs-content { min-height: 0; }
  .docs-sidebar { top: 0; }
  .docs-to-top { bottom: 18px; right: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .docs-to-top { transition: none; }
}

/* Reserve the scrollbar track always, so navigating from a long article
   to a short one does not shift the layout horizontally as the scrollbar
   disappears. */
html { scrollbar-gutter: stable; }

/* ==========================================================
   Layout-shift fixes, from PerformanceObserver measurements.
   ========================================================== */

/* The auth area renders with both states hidden and is then filled in by
   JS. Without a reserved height the topbar started ~58px tall and grew to
   ~72px when the user chip appeared, pushing the entire page down 14px.
   Reserving the chip's height keeps the header a fixed size either way. */
.docs-topnav-right {
  min-height: 40px;
  align-items: center;
}

/* Measured settled heights, replacing the earlier estimates. Everything
   sticky derives from these, so being wrong here offsets the sidebar and
   the rail underneath the header. */
:root {
  --docs-header-h: 73px;
  --docs-crumbs-h: 46px;
  --docs-footer-h: 55px;
}

/* Footer height was also moving as the body font swapped in; an explicit
   line-height stops the text box resizing under it. */
.docs-footer {
  line-height: 1.5;
  min-height: 55px;
  box-sizing: border-box;
}

/* ==========================================================
   Search: sidebar trigger + Ctrl+K palette.
   ========================================================== */
.docs-search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 18px;
  padding: 9px 11px;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-sm);
  background: var(--p-surface);
  color: var(--p-text-tertiary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.docs-search-trigger:hover { border-color: var(--p-text); color: var(--p-text); }
.docs-search-trigger span { flex: 1; }
.docs-search-trigger kbd,
.docs-search-hint kbd {
  font-family: inherit;
  font-size: 10.5px;
  padding: 2px 6px;
  border: 1px solid var(--p-border);
  border-radius: 4px;
  color: var(--p-text-tertiary);
  background: var(--p-bg);
}

.docs-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(17, 17, 17, 0.34);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
}
.docs-search-overlay[hidden] { display: none !important; }

.docs-search-panel {
  width: 100%;
  max-width: 640px;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  overflow: hidden;
}

.docs-search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--p-border-light);
  flex-shrink: 0;
}
.docs-search-field > i { font-size: 17px; color: var(--p-text-tertiary); }
#docs-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  background: transparent;
  color: var(--p-text);
}
.docs-search-close {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--p-text-tertiary);
  padding: 4px;
  display: flex;
}
.docs-search-close:hover { color: var(--p-text); }

.docs-search-results { overflow-y: auto; flex: 1; padding: 6px; }

.docs-search-result {
  display: flex;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--p-radius-sm);
  text-decoration: none;
  color: var(--p-text);
}
.docs-search-result > i { font-size: 15px; color: var(--p-text-tertiary); margin-top: 2px; flex-shrink: 0; }
.docs-search-result.active { background: var(--p-border-light); }
.docs-search-result-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.docs-search-result-title { font-size: 13.5px; font-weight: 600; }
.docs-search-result-trail { font-size: 11.5px; color: var(--p-text-tertiary); }
.docs-search-result-snippet {
  font-size: 12.5px;
  color: var(--p-text-secondary);
  line-height: 1.5;
  margin-top: 2px;
}
.docs-search-result mark {
  background: #fff2ab;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

.docs-search-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--p-text-tertiary);
}

.docs-search-hint {
  display: flex;
  gap: 16px;
  padding: 9px 16px;
  border-top: 1px solid var(--p-border-light);
  font-size: 11.5px;
  color: var(--p-text-tertiary);
  flex-shrink: 0;
}
.docs-search-hint span { display: flex; align-items: center; gap: 5px; }

@media (max-width: 640px) {
  .docs-search-overlay { padding: 8vh 12px 12px; }
  .docs-search-hint { display: none; }
}

/* ==========================================================
   Article footer: helpful widget + prev/next pager.
   ========================================================== */
.docs-helpful {
  margin-top: 48px;
  padding: 20px 22px;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.docs-helpful-q { font-size: 13.5px; font-weight: 600; }
.docs-helpful-actions { display: flex; gap: 8px; }
.docs-helpful-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-sm);
  background: var(--p-surface);
  font-size: 13px;
  font-family: inherit;
  color: var(--p-text);
  cursor: pointer;
}
.docs-helpful-btn:hover { border-color: var(--p-text); }
.docs-helpful-btn[disabled] { opacity: 0.45; cursor: default; }
.docs-helpful-btn.chosen { border-color: var(--p-text); background: var(--p-border-light); font-weight: 600; }

.docs-helpful-followup { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.docs-helpful-followup[hidden] { display: none; }
.docs-helpful-followup label { font-size: 12.5px; color: var(--p-text-secondary); }
#docs-helpful-comment {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 9px 11px;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-sm);
  resize: vertical;
}
.docs-helpful-send {
  align-self: flex-start;
  padding: 7px 16px;
  border: 1px solid var(--p-text);
  border-radius: var(--p-radius-sm);
  background: var(--p-text);
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.docs-helpful-thanks { font-size: 13px; color: var(--p-text-secondary); margin: 0; }
.docs-helpful-thanks[hidden] { display: none; }

/* --- Pager --- */
.docs-pager {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.docs-pager-link {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 18px;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  text-decoration: none;
  color: var(--p-text);
}
.docs-pager-link:hover { border-color: var(--p-text); }
.docs-pager-next { text-align: right; }
.docs-pager-dir {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--p-text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.docs-pager-next .docs-pager-dir { justify-content: flex-end; }
.docs-pager-title { font-size: 14px; font-weight: 600; }

/* The card is the link; the generic underline rule reads as noise here. */
.docs-content .docs-pager-link,
.docs-content .docs-pager-link:hover { text-decoration: none; }

@media (max-width: 640px) {
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager-next { text-align: left; }
  .docs-pager-next .docs-pager-dir { justify-content: flex-start; }
}

/* Sidebar and rail run the full viewport height below the header, so
   their divider lines do not stop short on a page with little content. */
.docs-sidebar,
.docs-toc {
  min-height: calc(100vh - var(--docs-header-h));
}

/* The thanks line is a <p> in a flex row; default paragraph margins push
   it off the buttons' baseline. */
.docs-helpful-thanks {
  margin: 0;
  align-self: center;
  line-height: 1.2;
}

/* `.docs-content p` (class + element) outranks a bare class selector, so
   its 16px bottom margin survived and flexbox counted it, lifting the
   text ~8px above the buttons. Matching that specificity fixes it. */
.docs-content p.docs-helpful-thanks {
  margin: 0;
  align-self: center;
  line-height: 1.2;
}
