/*
  OneRouter — Documentation Styles (Mintlify-inspired)
  Three-column layout: sidebar + content + TOC
  Loaded on all /docs/* pages via DocsLayout.
  Depends on global.css (reset, Inter font, buttons, animations).
*/

/* ===== DESIGN TOKENS ===== */
:root {
  --site-max-width: 92rem;
  --docs-primary: #5568f0;
  --docs-primary-weak: rgba(85, 104, 240, 0.08);
  --docs-primary-hover: rgba(85, 104, 240, 0.12);
  --docs-sidebar-width: 16rem;
  --docs-toc-width: 18rem;

  /* Stacking layers — cumulative offsets from viewport top */
  --docs-header-height: 4rem;
  --docs-header-gap:    1rem;
  --docs-topnav-height: 3.25rem;
  --stack-topnav:  calc(var(--docs-header-height) + var(--docs-header-gap));                         /* 5rem   — top of topnav */
  --stack-content: calc(var(--stack-topnav) + var(--docs-topnav-height) + 1.5rem);                   /* 9.75rem — top of sidebar/TOC */
  --stack-scroll:  calc(var(--stack-topnav) + var(--docs-topnav-height) + 2rem);                     /* 10.25rem — scroll-padding */

  --docs-bg: #ffffff;
  --docs-surface: #f9f9fb;
  --docs-border: #f4f4f4;
  --docs-text: #0f0f14;
  --docs-text-secondary: #4a4a55;
  --docs-text-muted: #848496;
  --docs-code-bg: #f3f5f8;
  --docs-scrollbar: rgba(0,0,0,.12);
  --docs-card-shadow: 0 0 0 1px rgba(0,0,0,.03), 0 2px 8px rgba(0,0,0,.04);
  --docs-radius-lg: 1rem;
  --docs-radius-md: 0.75rem;
  --docs-radius-sm: 0.5rem;
}

.dark {
  --docs-bg: #0a0a0d;
  --docs-surface: #131318;
  --docs-border: #22222d;
  --docs-text: #e8e8ed;
  --docs-text-secondary: #a0a0ad;
  --docs-text-muted: #626262;
  --docs-code-bg: #181821;
  --docs-card-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 2px 8px rgba(0,0,0,.2);
  --docs-primary-weak: rgba(85, 104, 240, 0.12);
  --docs-primary-hover: rgba(85, 104, 240, 0.18);
}

/* ===== DOCS TOP NAVBAR ===== */
.docs-topnav {
  position: sticky;
  top: var(--stack-topnav);
  z-index: 19;
  background: var(--docs-bg);
  border-bottom: 1px solid var(--docs-border);
  height: var(--docs-topnav-height);
}

.docs-topnav__inner {
  max-width: 92rem;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  height: 100%;
  padding: 0 1.25rem;
}

.docs-topnav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--docs-text);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.12s;
  white-space: nowrap;
}

.docs-topnav__icon {
  display: inline-flex;
  align-items: center;
}

.docs-topnav__icon svg,
.docs-topnav__link svg {
  width: 15px; height: 15px;
  flex-shrink: 0;
}

.docs-topnav__link:hover {
  color: var(--docs-text-secondary);
}

.docs-topnav__link:hover svg {
  opacity: 0.9;
}

.docs-topnav__link.is-active {
  color: var(--docs-primary);
  border-bottom-color: var(--docs-primary);
}

.docs-topnav__link.is-active svg {
  opacity: 1;
}

/* ===== DOCS LAYOUT ===== */
.docs-page {
  background: var(--docs-bg);
  min-height: 100svh;
  scroll-padding-top: var(--stack-scroll);
}

.docs-container {
  display: flex;
  max-width: 92rem;
  margin: 0 auto;
  padding-top: 3rem;
}

/* ===== LEFT SIDEBAR ===== */
.docs-sidebar {
  width: var(--docs-sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: var(--stack-content);
  align-self: flex-start;
  height: calc(100vh - var(--stack-content));
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--docs-bg);
  padding: 1rem 1rem 4rem;
  scrollbar-width: thin;
  scrollbar-color: var(--docs-scrollbar) transparent;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--docs-scrollbar); border-radius: 4px; }

/* Sidebar Group */
.docs-sidebar__group {
  margin-bottom: 0.25rem;
}

.docs-sidebar__group-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.375rem 0.625rem;
  margin-bottom: 0.25rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--docs-text);
  border-radius: var(--docs-radius-sm);
  transition: color 0.15s;
}

button.docs-sidebar__group-label {
  cursor: pointer;
}

.docs-sidebar__group-label:hover {
  color: var(--docs-text-secondary);
}

.docs-sidebar__group-label svg {
  width: 14px; height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

.docs-sidebar__group-label .chevron {
  margin-left: auto;
  transition: transform 0.2s ease;
}

.docs-sidebar__group-label[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
}

/* Sidebar Item */
.docs-sidebar__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  margin: 0.125rem 0;
  border-radius: var(--docs-radius-md);
  font-size: 0.825rem;
  font-weight: 450;
  color: var(--docs-text-secondary);
  text-decoration: none;
  line-height: 1.5;
  transition: all 0.12s ease;
  position: relative;
}

.docs-sidebar__item:hover {
  color: var(--docs-text);
  background: rgba(128, 128, 140, 0.06);
}

.docs-sidebar__item.is-filtered {
  display: none !important;
}

.docs-sidebar__item[aria-current="page"] {
  color: var(--docs-primary);
  background: var(--docs-primary-weak);
  font-weight: 550;
}

.docs-sidebar__item[aria-current="page"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 1.25rem;
  background: var(--docs-primary);
  border-radius: 0 2px 2px 0;
}

.docs-sidebar__item-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
  display: flex; align-items: center; justify-content: center;
}

.docs-sidebar__item[aria-current="page"] .docs-sidebar__item-icon {
  opacity: 1;
}

.docs-sidebar__item-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.125rem 0.4rem;
  border-radius: 999px;
  background: var(--docs-primary-weak);
  color: var(--docs-primary);
  letter-spacing: 0.02em;
}

/* Collapsible children */
.docs-sidebar__children {
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.docs-sidebar__children[aria-hidden="true"] {
  max-height: 0;
  opacity: 0;
}

.docs-sidebar__children[aria-hidden="false"] {
  max-height: 600px;
  opacity: 1;
}

/* ===== MOBILE SIDEBAR ===== */
.docs-sidebar__mobile-toggle {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 50;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--docs-border);
  background: var(--docs-bg);
  color: var(--docs-text);
  box-shadow: var(--docs-card-shadow);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.docs-sidebar__overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0,0,0,.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s;
}

/* ===== MAIN CONTENT ===== */
.docs-content {
  flex: 1;
  min-width: 0;
  padding: 4rem 1.5rem 4rem;
}

/* Page Header */
.docs-page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--docs-border);
}

.docs-page-header__eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--docs-primary);
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.docs-page-header h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--docs-text);
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.docs-page-header__desc {
  font-size: 1.05rem;
  color: var(--docs-text-secondary);
  margin: 0;
  line-height: 1.6;
  max-width: 48rem;
}

/* Prose Content */
.docs-prose {
  color: var(--docs-text);
  line-height: 1.75;
  font-size: 0.9375rem;
  max-width: 48rem;
}

.docs-prose h2 {
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--docs-text);
  margin: 3rem 0 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--docs-border);
  line-height: 1.3;
  position: relative;
}

.docs-prose h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.docs-prose h2 .anchor-link {
  opacity: 0;
  position: absolute;
  left: -1.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  color: var(--docs-text-muted);
  transition: opacity 0.15s;
}

.docs-prose h2:hover .anchor-link { opacity: 1; }

.docs-prose h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--docs-text);
  margin: 2rem 0 0.5rem;
  line-height: 1.35;
}

.docs-prose h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--docs-text);
  margin: 1.5rem 0 0.375rem;
}

.docs-prose p {
  margin: 0 0 1rem;
  color: var(--docs-text-secondary);
}

.docs-prose a {
  color: var(--docs-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 500;
  transition: opacity 0.15s;
}
.docs-prose a:hover { opacity: 0.8; }

.docs-prose strong {
  color: var(--docs-text);
  font-weight: 600;
}

.docs-prose ul, .docs-prose ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
  color: var(--docs-text-secondary);
}

.docs-prose li {
  margin-bottom: 0.35rem;
  padding-left: 0.25rem;
}

.docs-prose li::marker {
  color: var(--docs-text-muted);
}

.docs-prose hr {
  border: none;
  border-top: 1px solid var(--docs-border);
  margin: 2.5rem 0;
}

.docs-prose img {
  border-radius: var(--docs-radius-md);
  max-width: 100%;
}

/* Inline code */
.docs-prose :not(pre) > code {
  background: var(--docs-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 0.35rem;
  font-family: 'Inconsolata', 'Cascadia Code', Consolas, monospace;
  font-size: 0.85em;
  color: var(--docs-text);
  border: 0.5px solid var(--docs-border);
  word-break: break-word;
}

/* ===== CODE BLOCK ===== */
.code-block {
  position: relative;
  margin: 1px 0 2rem;
  border-radius: 12px;
  border: 1px solid #21262d;
  background: #0d1117;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.06);
}

.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  background: #161b22;
  border-bottom: 1px solid #21262d;
}

.code-block__lang {
  font-size: 0.7rem;
  font-weight: 550;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.code-block__actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.code-block__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  background: none;
  color: #8b949e;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.code-block__btn:hover {
  color: #e6edf3;
  background: rgba(255,255,255,.08);
}
.code-block__btn svg {
  width: 14px; height: 14px;
}

.code-block__btn--copied {
  color: #3fb950 !important;
  background: rgba(63,185,80,.12);
}

/* Shiki pre block inside .code-block */
.code-block .shiki {
  background-color: transparent !important;
  margin: 0;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-family: 'Inconsolata', 'Cascadia Code', Consolas, monospace;
  font-size: 0.825rem;
  line-height: 1.7;
  tab-size: 4;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}
.code-block .shiki::-webkit-scrollbar { height: 5px; }
.code-block .shiki::-webkit-scrollbar-track { background: transparent; }
.code-block .shiki::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }
.code-block .shiki::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* Shiki code element */
.code-block .shiki code {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  tab-size: inherit;
  white-space: pre;
  counter-reset: none;
}

/* Code tab panel: remove top border-radius when stacked under tabs */
.code-tab-panel.is-active .code-block {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: none;
}

/* ===== TABS (Code Group) ===== */
.code-tabs {
  display: flex;
  gap: 0;
  background: #161b22;
  border: 1px solid #21262d;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  margin: 1.25rem 0 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.code-tabs::-webkit-scrollbar { display: none; }

.code-tabs__tab {
  position: relative;
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: #8b949e;
  cursor: pointer;
  transition: color 0.15s;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.code-tabs__tab::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  border-radius: 1px 1px 0 0;
  transition: background 0.15s;
}

.code-tabs__tab:hover {
  color: #e6edf3;
}

.code-tabs__tab.is-active {
  color: #f0f6fc;
}
.code-tabs__tab.is-active::after {
  background: #f78166;
}

.code-tab-panel {
  display: none;
}
.code-tab-panel.is-active {
  display: block;
}

/* Code tab panel: remove top border-radius when stacked under tabs */
.code-tab-panel.is-active .code-block {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: 1px solid #21262d;
}

/* Tabs + code-block: seamless connection */
.code-tabs + .code-tab-panel.is-active .code-block {
  border-top: none;
}

/* ===== CALLOUTS ===== */
.callout {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0 1.75rem;
  border-radius: var(--docs-radius-lg);
  border: 1px solid;
  font-size: 0.9rem;
  line-height: 1.6;
}

.callout__icon {
  width: 1.25rem; height: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.callout__body {
  flex: 1;
  min-width: 0;
}

.callout__body p {
  margin: 0;
}

/* Note — Blue */
.callout--note {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}
.callout--note .callout__body { color: #1e3a5f; }
.dark .callout--note { background: #0f1d32; border-color: #1e3a5f; color: #93b4f0; }
.dark .callout--note .callout__body { color: #a0bce0; }

/* Tip — Green */
.callout--tip {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
.callout--tip .callout__body { color: #14532d; }
.dark .callout--tip { background: #0a1f14; border-color: #14532d; color: #6ee7a7; }
.dark .callout--tip .callout__body { color: #86d9a8; }

/* Warning — Amber */
.callout--warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
.callout--warning .callout__body { color: #78350f; }
.dark .callout--warning { background: #1f150a; border-color: #78350f; color: #fbbf24; }
.dark .callout--warning .callout__body { color: #e0a820; }

/* ===== TABLE ===== */
.docs-table-wrapper {
  overflow-x: auto;
  margin: 1.25rem 0 2rem;
  border-radius: var(--docs-radius-md);
  border: 1px solid var(--docs-border);
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.6;
}

.docs-table thead {
  background: var(--docs-surface);
  border-bottom: 1px solid var(--docs-border);
}

.docs-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--docs-text);
  letter-spacing: 0.02em;
}

.docs-table td {
  padding: 0.75rem 1rem;
  color: var(--docs-text-secondary);
  border-top: 1px solid var(--docs-border);
}

.docs-table tbody tr:hover {
  background: rgba(128,128,140,.03);
}

/* ===== RIGHT TOC ===== */
.docs-toc {
  width: var(--docs-toc-width);
  flex-shrink: 0;
  position: sticky;
  top: var(--stack-content);
  align-self: flex-start;
  max-height: calc(100vh - var(--stack-content));
  overflow-y: auto;
  padding: 1rem 0.5rem 4rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--docs-scrollbar) transparent;
}
.docs-toc::-webkit-scrollbar { width: 4px; }
.docs-toc::-webkit-scrollbar-track { background: transparent; }
.docs-toc::-webkit-scrollbar-thumb { background: var(--docs-scrollbar); border-radius: 4px; }

.docs-toc__title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--docs-text-secondary);
  margin: 0 0 0.75rem 0.625rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.docs-toc__title svg {
  width: 14px; height: 14px;
}

.docs-toc__list {
  list-style: none;
  margin: 0; padding: 0;
  border-left: 1.5px solid var(--docs-border);
}

.docs-toc__item {
  display: block;
  padding: 0.25rem 0 0.25rem 0.875rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--docs-text-muted);
  text-decoration: none;
  border-left: 1.5px solid transparent;
  margin-left: -1.5px;
  transition: all 0.12s;
}

.docs-toc__item:hover {
  color: var(--docs-text-secondary);
}

.docs-toc__item.is-active {
  color: var(--docs-primary);
  border-left-color: var(--docs-primary);
  font-weight: 500;
}

.docs-toc__item--sub {
  padding-left: 1.5rem;
  font-size: 0.775rem;
}

/* ===== PAGE PAGINATION ===== */
.docs-pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--docs-border);
}

.docs-pagination__link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 1rem;
  border-radius: var(--docs-radius-md);
  border: 1px solid var(--docs-border);
  text-decoration: none;
  transition: all 0.12s;
  max-width: 48%;
}

.docs-pagination__link:hover {
  border-color: var(--docs-primary);
  background: var(--docs-primary-weak);
}

.docs-pagination__link--next {
  text-align: right;
  margin-left: auto;
}

.docs-pagination__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--docs-text-muted);
}

.docs-pagination__title {
  font-size: 0.9rem;
  font-weight: 550;
  color: var(--docs-text);
}

/* Search results dropdown — appended to body, positioned by JS */
.docs-search-results {
  display: none;
  position: fixed;
  z-index: 100;
  background: var(--docs-bg);
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius-md);
  box-shadow: 0 12px 32px rgba(0,0,0,.1), 0 0 0 1px rgba(0,0,0,.04);
  overflow: hidden;
  max-height: 20rem;
  overflow-y: auto;
}
.docs-search-results.is-visible { display: block; }

.docs-search-result {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.625rem 0.875rem;
  text-decoration: none;
  border-bottom: 0.5px solid var(--docs-border);
  transition: background 0.1s;
  cursor: pointer;
}
.docs-search-result:last-child { border-bottom: none; }
.docs-search-result:hover,
.docs-search-result.is-active {
  background: var(--docs-primary-weak);
}

.docs-search-result__title {
  font-size: 0.825rem;
  font-weight: 525;
  color: var(--docs-text);
  line-height: 1.35;
}
.docs-search-result__group {
  font-size: 0.675rem;
  font-weight: 500;
  color: var(--docs-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Search in TOC area */
.docs-search--toc {
  padding: 0 0 2rem;
  position: relative;
}

.docs-search__input {
  width: 100%;
  height: 2.25rem;
  padding: 0 0.75rem 0 2rem;
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius-sm);
  font-size: 0.8rem;
  font-family: inherit;
  background: var(--docs-surface);
  color: var(--docs-text);
  outline: none;
  transition: border-color 0.15s;
}
.docs-search__input:focus {
  border-color: var(--docs-primary);
}
.docs-search__input::placeholder {
  color: var(--docs-text-muted);
}

.docs-search__wrap {
  position: relative;
}
.docs-search__icon {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--docs-text-muted);
  pointer-events: none;
}

/* ===== CTA SECTION (in docs content) ===== */
.docs-cta {
  margin: 2.5rem 0;
  padding: 1.5rem 2rem;
  border-radius: var(--docs-radius-lg);
  background: linear-gradient(135deg, var(--docs-primary-weak), transparent);
  border: 1px solid rgba(85, 104, 240, 0.25);
}

.docs-cta h3 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  color: var(--docs-text);
}

.docs-cta p {
  margin: 0 0 1rem;
  color: var(--docs-text-secondary);
}

.docs-cta .btn-primary {
  background: var(--docs-primary);
  color: #fff;
  border: none;
}

/* ===== FAQ ACCORDION ===== */
.faq-item {
  margin-bottom: 0.5rem;
  border-radius: var(--docs-radius-lg);
  border: 1px solid var(--docs-border);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.faq-item[open] {
  background: var(--docs-bg);
  border-color: var(--docs-border);
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
}

.faq-q {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--docs-text);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: color 0.2s ease;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::marker { display: none; content: ''; }

.faq-q:hover { color: var(--docs-primary); }
.faq-item[open] .faq-q {
  color: var(--docs-text);
  padding-bottom: 0.625rem;
}

.faq-q::after {
  content: '';
  width: 1.25rem; height: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
  background: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  opacity: 0.3;
  transition: transform 0.25s cubic-bezier(.16,1,.3,1), opacity 0.2s ease;
}
.faq-q:hover::after { opacity: 0.5; }
.faq-item[open] .faq-q::after {
  transform: rotate(180deg);
  opacity: 0.35;
}

.faq-a {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.875rem;
  line-height: 1.72;
  color: var(--docs-text-secondary);
}
.faq-a p { margin: 0 0 0.75rem; }
.faq-a p:last-child { margin-bottom: 0; }
.faq-a ul, .faq-a ol { margin: 0 0 0.75rem; padding-left: 1.375rem; }
.faq-a ul:last-child, .faq-a ol:last-child { margin-bottom: 0; }
.faq-a li { margin-bottom: 0.3rem; }
.faq-a li::marker { color: var(--docs-text-muted); }
.faq-a a {
  color: var(--docs-primary);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s;
}
.faq-a a:hover { opacity: 0.75; }
.faq-a strong { color: var(--docs-text); font-weight: 600; }
.faq-a code {
  background: var(--docs-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 0.3rem;
  font-family: 'Inconsolata', 'Cascadia Code', Consolas, monospace;
  font-size: 0.875em;
  color: var(--docs-text);
}

/* FAQ: category heading breathing room */
.docs-prose h2 + .faq-item { margin-top: 0.25rem; }
.faq-item + h2 { margin-top: 3rem; }

/* ===== RESPONSIVE ===== */

/* Hide TOC below 1280px */
@media (max-width: 1279px) {
  .docs-toc { display: none; }
  .docs-topnav__inner { padding: 0 1rem; }
}

/* Tablet + Phone: overlay sidebar + compact topnav */
@media (max-width: 1023px) {
  .docs-container { flex-direction: column; padding-top: 1.25rem; }

  /* Sidebar as slide-in overlay */
  .docs-sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: min(18rem, 85vw);
    height: 100dvh; height: 100vh;
    padding-top: 7rem;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 45;
    box-shadow: 2px 0 24px rgba(0,0,0,.12);
    background: var(--docs-bg);
  }
  .docs-sidebar.is-open { transform: translateX(0); }

  .docs-sidebar__mobile-toggle { display: flex; }
  .docs-sidebar__overlay.is-visible { display: block; opacity: 1; }

  /* Content area */
  .docs-content { padding: 4rem 1rem 3rem; min-width: 0; }
  .docs-prose { max-width: 100%; }

  /* Topnav: horizontal scroll on mobile */
  .docs-topnav { position: sticky; top: var(--stack-topnav); }
  .docs-topnav__inner {
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 0.5rem;
    gap: 0;
  }
  .docs-topnav__inner::-webkit-scrollbar { display: none; }
  .docs-topnav__link { padding: 0 0.625rem; font-size: 0.73rem; white-space: nowrap; flex-shrink: 0; }
  .docs-topnav__link .docs-topnav__icon { display: none; }
}

/* Phone: optimize for small screens */
@media (max-width: 767px) {
  .docs-content { padding: 4rem 0.75rem 3.5rem; }

  /* Header */
  .docs-page-header { margin-bottom: 1.25rem; padding-bottom: 1rem; }
  .docs-page-header h1 { font-size: 1.3rem; letter-spacing: -0.02em; }
  .docs-page-header__desc { font-size: 0.85rem; line-height: 1.55; }
  .docs-page-header__eyebrow { font-size: 0.7rem; margin-bottom: 0.5rem; }

  /* Prose */
  .docs-prose { font-size: 0.875rem; line-height: 1.7; }
  .docs-prose h2 { font-size: 1.05rem; margin-top: 2rem; padding-top: 1rem; }
  .docs-prose h3 { font-size: 0.95rem; margin-top: 1.5rem; }
  .docs-prose p { margin-bottom: 0.75rem; }
  .docs-prose ul, .docs-prose ol { padding-left: 1.25rem; }

  /* Inline code — make touch-friendly */
  .docs-prose :not(pre) > code {
    font-size: 0.82em; padding: 0.12em 0.35em; word-break: break-all;
  }

  /* Code blocks: full-width on phone */
  .code-block {
    margin: 1px -0.75rem 1.25rem;
    border-radius: 0; border-left: none; border-right: none;
  }
  .code-block__header { padding: 0.4rem 0.75rem; }
  .code-block__lang { font-size: 0.65rem; }
  .code-block .shiki { padding: 0.75rem 0.875rem; font-size: 0.72rem; line-height: 1.5; }
  .code-block__btn { width: 1.75rem; height: 1.75rem; }
  .code-block__btn svg { width: 12px; height: 12px; }

  /* Code tabs: horizontal scroll */
  .code-tabs {
    margin-left: -0.75rem; margin-right: -0.75rem;
    border-radius: 0;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .code-tabs__tab { font-size: 0.7rem; padding: 0.4rem 0.65rem; flex-shrink: 0; }

  /* Tables */
  .docs-table-wrapper {
    margin: 1rem -0.75rem 1.25rem; border-radius: 0; border-left: none; border-right: none;
  }
  .docs-table { font-size: 0.75rem; }
  .docs-table th, .docs-table td { padding: 0.45rem 0.6rem; }

  /* Pagination */
  .docs-pagination { flex-direction: column; gap: 0.5rem; margin-top: 2rem; padding-top: 1.25rem; }
  .docs-pagination__link { max-width: 100%; padding: 0.6rem 0.875rem; }
  .docs-pagination__link--next { margin-left: 0; text-align: left; }
  .docs-pagination__title { font-size: 0.82rem; }

  /* FAQ */
  .faq-item { margin-bottom: 0.375rem; }
  .faq-q { font-size: 0.82rem; padding: 0.75rem 0.875rem; }
  .faq-a { padding: 0 0.875rem 0.875rem; font-size: 0.8rem; line-height: 1.65; }

  /* Callout */
  .callout { padding: 0.75rem 0.875rem; margin: 1rem 0 1.25rem; font-size: 0.8rem; border-radius: 0.75rem; }
  .callout__icon { width: 1.1rem; height: 1.1rem; }

  /* Sidebar mobile toggle FAB — give more breathing room */
  .docs-sidebar__mobile-toggle {
    bottom: 1.25rem; left: 1.25rem;
    width: 3rem; height: 3rem;
  }
}

