/* Developer docs layout. Requires tokens.css + components.css. */

body { font-size: var(--text-md); }

.docs-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; letter-spacing: -0.01em; }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); box-shadow: inset 0 0 0 5px color-mix(in srgb, var(--accent) 70%, #FFFFFF); }
.brand-name { font-size: var(--text-md); }
.header-spacer { flex: 1; }
.header-links { display: flex; gap: 20px; }
.header-links a { color: var(--text-secondary); text-decoration: none; font-size: var(--text-sm); font-weight: 550; }
.header-links a:hover { color: var(--text); }
.nav-toggle { display: none; }

.preview-banner {
  padding: 10px 24px; border-bottom: 1px solid var(--test-border);
  background: var(--test-soft); color: var(--test-ink); font-size: var(--text-sm);
}
.preview-banner a { color: inherit; }

.docs-layout {
  display: grid; grid-template-columns: 248px minmax(0, 1fr) 220px;
  max-width: 1360px; margin: 0 auto; align-items: start;
}
.docs-nav {
  position: sticky; top: 60px; max-height: calc(100vh - 60px); overflow-y: auto;
  padding: 28px 16px 40px 24px; border-right: 1px solid var(--border);
}
.nav-group + .nav-group { margin-top: 22px; }
.nav-title { margin: 0 0 8px; font-size: var(--text-xs); font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); }
.docs-nav ul, .docs-toc ul { list-style: none; margin: 0; padding: 0; }
.docs-nav a {
  display: block; padding: 6px 10px; margin: 1px 0; border-radius: var(--r-md);
  color: var(--text-secondary); text-decoration: none; font-size: var(--text-sm); font-weight: 500;
}
.docs-nav a:hover { background: var(--surface-hover); color: var(--text); }
.docs-nav a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }

.docs-main { min-width: 0; padding: 40px 48px 64px; }
.docs-main:focus { outline: none; }
.docs-toc { position: sticky; top: 60px; padding: 40px 24px 40px 8px; }
.docs-toc a { display: block; padding: 4px 0; color: var(--text-secondary); text-decoration: none; font-size: var(--text-sm); }
.docs-toc a:hover { color: var(--text); }

/* Prose ---------------------------------------------------------------------- */
.prose { max-width: 760px; }
.page-status { min-height: 22px; margin-bottom: 10px; }
.prose h1 { font-size: var(--text-3xl); letter-spacing: -0.02em; margin-bottom: 12px; }
.prose .lead { font-size: var(--text-lg); line-height: 1.6; color: var(--text-secondary); margin-bottom: 28px; }
.prose h2 { font-size: var(--text-xl); margin: 44px 0 12px; scroll-margin-top: 76px; }
.prose h3 { font-size: var(--text-md); margin: 28px 0 10px; scroll-margin-top: 76px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; line-height: 1.7; color: var(--text); }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.prose :not(pre) > code { padding: 1px 6px; border-radius: 5px; background: var(--surface-sunken); border: 1px solid var(--border); font-size: 0.88em; overflow-wrap: anywhere; }
.prose .callout { margin: 0 0 20px; font-size: var(--text-sm); }
.prose .table-wrap { margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.prose .table { font-size: var(--text-sm); }
.prose .table td { line-height: 1.55; }
.prose .table td p { margin: 0; }
.constraints { color: var(--text-tertiary); font-size: var(--text-xs); margin-top: 4px !important; }
.link-list li { margin-bottom: 4px; }
.muted { color: var(--text-secondary); }

/* Code ----------------------------------------------------------------------- */
.code-wrap { margin: 0 0 18px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--code-bg); overflow: hidden; }
.code-wrap .code { border: 0; border-radius: 0; }
.code-bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--border); }
.code-lang { font-size: var(--text-xs); font-weight: 600; color: var(--text-tertiary); letter-spacing: 0.02em; }
.copy-btn {
  min-height: 26px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--border-control);
  background: var(--surface); color: var(--text-secondary); font: inherit; font-size: var(--text-xs); font-weight: 600; cursor: pointer;
}
.copy-btn:hover { color: var(--text); background: var(--surface-hover); }
.code:focus-visible { outline-offset: -2px; }

.tabs { margin: 0 0 18px; }
.tablist { display: flex; gap: 4px; margin-bottom: 8px; }
.tablist [role="tab"] {
  min-height: 30px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid transparent;
  background: transparent; color: var(--text-secondary); font: inherit; font-size: var(--text-sm); font-weight: 550; cursor: pointer;
}
.tablist [role="tab"][aria-selected="true"] { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs .code-wrap { margin-bottom: 0; }
html:not(.js) .tablist { display: none; }
html:not(.js) [data-tabpanel] + [data-tabpanel] { margin-top: 10px; }

/* Reference ------------------------------------------------------------------ */
.op { padding-top: 8px; margin-top: 36px; border-top: 1px solid var(--border); }
.op:first-of-type { border-top: 0; margin-top: 8px; }
.op h2 { margin-top: 12px; }
.op-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.op-path { font-family: var(--font-mono); font-size: var(--text-md); font-weight: 600; overflow-wrap: anywhere; }
.method { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 6px; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.04em; }
.method-get { background: var(--success-soft); color: var(--success); }
.method-post { background: var(--accent-soft); color: var(--accent-text); }
.method-patch, .method-put { background: var(--warning-soft); color: var(--warning); }
.method-delete { background: var(--danger-soft); color: var(--danger); }
.op-status { margin: 0 0 12px !important; }
.responses { list-style: none; padding: 0 !important; }
.responses li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.status { display: inline-flex; min-width: 40px; justify-content: center; padding: 1px 6px; border-radius: 6px; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700; }
.status-2 { background: var(--success-soft); color: var(--success); }
.status-4 { background: var(--warning-soft); color: var(--warning); }
.status-5 { background: var(--danger-soft); color: var(--danger); }
.schema { margin: 8px 0 18px; }
.schema summary { cursor: pointer; font-weight: 600; font-size: var(--text-sm); color: var(--text-secondary); padding: 6px 0; }
.schema[open] summary { margin-bottom: 8px; }
.example-caption { font-size: var(--text-sm); color: var(--text-secondary); }

.docs-foot { max-width: 760px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-tertiary); font-size: var(--text-sm); }

/* Responsive ----------------------------------------------------------------- */
@media (max-width: 1180px) {
  .docs-layout { grid-template-columns: 232px minmax(0, 1fr); }
  .docs-toc, .docs-toc-empty { display: none; }
}
@media (max-width: 860px) {
  .docs-header { padding: 0 16px; }
  .header-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .preview-banner { padding: 10px 16px; }
  .docs-layout { display: block; }
  .docs-nav { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 16px 16px; background: var(--surface); }
  html.js .docs-nav:not(.is-open) { display: none; }
  .docs-main { padding: 28px 16px 48px; }
  .prose h1 { font-size: var(--text-2xl); }
  .prose .lead { font-size: var(--text-md); }
}
