/* Developer centre /docs/api (brief §6). Author: Smarketer.
   Desktop ≥ 1024px: sticky sidebar 256px · main (prose max 760px) · code panel; each operation is a
   two-column row (prose | code) so the example always sits next to what it explains. < 1024px: the
   code goes inline under the prose and the sidebar becomes a drawer. Code scrolls only inside its
   own block (never the page). Colours/type come from tokens.css; no inline styles (CSP). */

body.layout-docs { background: var(--surface); overflow-x: clip; }

/* ---- Header ------------------------------------------------------------------------------------ */
.dc-header { position: sticky; top: 0; z-index: var(--z-header); border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.dc-header__inner { display: flex; align-items: center; gap: var(--s-2); min-height: 64px; padding-inline: var(--s-3); }
.dc-header__menu { display: none; }
.dc-header__brand { display: inline-flex; align-items: center; min-height: var(--touch); }
.dc-header__brand img { height: 32px; width: auto; }
.dc-header__title { display: inline-flex; align-items: center; gap: 8px; padding-inline-start: var(--s-2); border-inline-start: 1px solid var(--border); color: var(--heading); font-weight: var(--fw-title, 600); white-space: nowrap; }
.dc-header__ver { font-variant-numeric: tabular-nums; }
.dc-header__nav { display: flex; gap: 4px; margin-inline-start: auto; }
.dc-header__nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--muted-strong); font-size: var(--fs-sm); font-weight: var(--fw-medium); text-decoration: none; }
.dc-header__nav a:hover { background: var(--canvas); color: var(--heading); }
.dc-header__nav a[aria-current="page"] { color: var(--brand-ink); background: var(--brand-50); }
.dc-header__cta { flex: none; }

/* ---- Layout ------------------------------------------------------------------------------------ */
.dc-layout { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: calc(100dvh - 64px); }
.dc-sidebar { position: sticky; top: 64px; display: flex; flex-direction: column; height: calc(100dvh - 64px); border-inline-end: 1px solid var(--border); background: var(--surface); }
.dc-sidebar__head { display: flex; align-items: center; gap: var(--s-1); padding: var(--s-1-5); border-bottom: 1px solid var(--divider); }
.dc-sidebar__head .input-group { flex: 1; min-width: 0; }
.dc-sidebar__close { display: none; }
.dc-toc { flex: 1; overflow-y: auto; padding: var(--s-1) var(--s-1) var(--s-3); list-style: none; margin: 0; overscroll-behavior: contain; }
.dc-toc__group + .dc-toc__group { margin-top: var(--s-1); }
.dc-toc__title { display: flex; align-items: center; min-height: var(--touch); padding: 0 10px; border-radius: var(--radius-sm); color: var(--heading); font-size: var(--fs-sm); font-weight: var(--fw-semibold); text-decoration: none; }
.dc-toc__title:hover { background: var(--canvas); color: var(--brand-ink); }
.dc-toc__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1px; }
.dc-toc__item { display: flex; align-items: center; gap: 8px; min-height: var(--touch); padding: 6px 10px 6px 14px; border-radius: var(--radius-sm); color: var(--muted-strong); font-size: var(--fs-xs); line-height: 1.35; text-decoration: none; }
.dc-toc__item:hover { background: var(--canvas); color: var(--heading); }
.dc-toc__item[aria-current="true"], .dc-toc__title[aria-current="true"] { background: var(--brand-100); color: var(--brand-ink); }
.dc-toc__item .method { flex: none; min-width: 46px; }
.dc-toc__label { min-width: 0; }
.dc-toc__empty { padding: var(--s-2); }
.dc-toc [data-dc-hidden] { display: none; }

.dc-main { min-width: 0; padding: var(--s-4) var(--s-4) var(--s-10); }
.dc-intro { max-width: 760px; margin-bottom: var(--s-5); }
.dc-h1 { margin-top: var(--s-1-5); font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem); line-height: var(--lh-section, 1.25); font-weight: var(--fw-heading, 700); color: var(--heading); }
.dc-lead { margin-top: var(--s-1-5); font-size: var(--fs-md); line-height: var(--lh-lead, 1.65); color: var(--muted-strong); }
.dc-group { padding-top: var(--s-4); margin-top: var(--s-4); border-top: 1px solid var(--border); scroll-margin-top: 80px; }
.dc-group:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.dc-h2 { position: relative; font-size: var(--fs-xl); line-height: var(--lh-section, 1.25); font-weight: var(--fw-heading, 700); color: var(--heading); margin-bottom: var(--s-2); }
.dc-h3 { position: relative; font-size: var(--fs-lg); line-height: var(--lh-title, 1.35); font-weight: var(--fw-title, 600); color: var(--heading); scroll-margin-top: 80px; }
.dc-h4 { margin-top: var(--s-2-5); font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--heading); }
.dc-h4__meta { margin-inline-start: 6px; font-weight: var(--fw-regular); color: var(--muted); }
.dc-anchor { position: absolute; inset-inline-start: -1.1em; color: var(--brand-300); text-decoration: none; opacity: 0; font-weight: var(--fw-regular); }
.dc-h2:hover .dc-anchor, .dc-h3:hover .dc-anchor, .dc-anchor:focus-visible { opacity: 1; }
.dc-prose { max-width: 760px; }
.dc-prose > * + * { margin-top: var(--s-1-5); }
.dc-prose ul, .dc-prose ol { padding-inline-start: 1.3em; display: grid; gap: 6px; }
.dc-prose p, .dc-prose li { line-height: var(--lh-body); }
.dc-prose .dc-h3 { margin-top: var(--s-4); }
.dc-prose .dc-h3 + p, .dc-prose .dc-h3 + ul, .dc-prose .dc-h3 + ol, .dc-prose .dc-h3 + .table-wrap { margin-top: var(--s-1-5); }
.dc-steps { counter-reset: step; list-style: none; padding: 0 !important; }
.dc-steps li { position: relative; padding-inline-start: 40px; min-height: 30px; }
.dc-steps li::before { content: counter(step); counter-increment: step; position: absolute; inset-inline-start: 0; top: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-100); color: var(--brand-ink); font-size: var(--fs-xs); font-weight: var(--fw-semibold); }
.dc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s-1-5); margin-top: var(--s-2) !important; }
.dc-card { display: flex; gap: 12px; align-items: flex-start; padding: var(--s-2); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--ink); font-size: var(--fs-sm); line-height: 1.4; text-decoration: none; transition: border-color var(--dur-fast), transform var(--dur-fast); }
.dc-card:hover { border-color: var(--brand-300); color: var(--ink); transform: translateY(-2px); }
.dc-card .icon { flex: none; width: 22px; height: 22px; color: var(--brand); margin-top: 2px; }

/* ---- Operation row: prose | code ------------------------------------------------------------- */
.dc-op { display: grid; grid-template-columns: minmax(0, 7fr) minmax(360px, 5fr); gap: var(--s-4); align-items: start; padding-top: var(--s-4); margin-top: var(--s-4); border-top: 1px dashed var(--border); scroll-margin-top: 80px; }
.dc-group > .dc-op:first-of-type, .dc-prose + .dc-op { border-top: 0; }
.dc-op__main { min-width: 0; max-width: 760px; }
.dc-op__main > * + * { margin-top: var(--s-1-5); }
.dc-op__title { margin: 0; }
.dc-op__desc { color: var(--muted-strong); line-height: var(--lh-body); }
.dc-op__code { position: sticky; top: 80px; display: grid; gap: var(--s-1-5); min-width: 0; }
.dc-route { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dc-route__path { padding: 4px 8px; border-radius: var(--radius-xs); background: var(--surface-sunken); border: 1px solid var(--border); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.method { display: inline-flex; align-items: center; justify-content: center; min-width: 54px; padding: 2px 8px; border-radius: var(--radius-xs); font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 700; line-height: 1.5; letter-spacing: 0; }
.method--get { background: #eaf1ff; color: #1d4bb0; }
.method--post { background: #eafbea; color: #176a29; }
.method--patch, .method--put { background: #fff3db; color: #835400; }
.method--delete { background: #fef0ef; color: #9b1c13; }
.dc-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted-strong); }
.dc-scope__k { color: var(--muted); }
.dc-scope__or { color: var(--muted); font-size: var(--fs-xs); }
.dc-scope__code { text-decoration: none; }
.dc-scope__code code, code.dc-scope__code { padding: 2px 8px; border-radius: var(--radius-pill); background: var(--brand-100); color: var(--brand-tone-ink); font-size: var(--fs-2xs); }
.dc-scope__code:hover code { background: var(--brand-200); }

.dc-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.dc-table th { padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-sunken); color: var(--muted-strong); font-size: var(--fs-xs); font-weight: var(--fw-medium); text-align: start; }
.dc-table td { padding: 10px; border-bottom: 1px solid var(--divider); vertical-align: top; line-height: 1.45; }
.dc-table tr:last-child td { border-bottom: 0; }
.dc-table code { font-size: 0.92em; overflow-wrap: anywhere; }
.dc-table__list { display: flex; flex-wrap: wrap; gap: 4px; }
.dc-table__list code { padding: 1px 6px; border-radius: 4px; background: var(--surface-sunken); font-size: var(--fs-2xs); }
.dc-type { color: var(--muted-strong); font-family: var(--font-mono); font-size: var(--fs-xs); white-space: nowrap; }
.dc-enum { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; white-space: normal; }
.dc-enum code { padding: 1px 6px; border-radius: 4px; background: var(--surface-sunken); font-size: var(--fs-2xs); }
.dc-req { color: var(--danger-ink); font-size: var(--fs-2xs); font-weight: var(--fw-medium); white-space: nowrap; }
.dc-opt { color: var(--muted); font-size: var(--fs-2xs); white-space: nowrap; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.dc-responses { display: grid; gap: 6px; list-style: none; padding: 0; margin: 0; }
.dc-responses li { display: flex; gap: 10px; align-items: baseline; font-size: var(--fs-sm); line-height: 1.45; }
.dc-status { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 40px; padding: 1px 6px; border-radius: var(--radius-xs); font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.dc-status--success { background: var(--success-bg); color: var(--success-ink); }
.dc-status--danger { background: var(--danger-bg); color: var(--danger-ink); }
.dc-status--warning { background: var(--warning-bg); color: var(--warning-ink); }
.dc-status--neutral { background: var(--neutral-bg); color: var(--neutral-ink); }
.dc-fields { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.dc-fields summary { display: flex; align-items: center; min-height: var(--touch); padding: 0 12px; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--heading); }
.dc-fields[open] summary { border-bottom: 1px solid var(--divider); }

/* ---- Code blocks (dark, own horizontal scroll) ------------------------------------------------ */
.dc-code { min-width: 0; border-radius: var(--radius-md); background: #0f0e2e; color: #e9e6ff; box-shadow: var(--shadow-sm); }
.dc-code__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px 6px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); color: #b9b5d9; font-size: var(--fs-xs); }
.dc-code__label { display: inline-flex; align-items: center; gap: 8px; }
.dc-code__link { position: relative; color: #c6a6ff; }
.dc-code__link::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: var(--touch); transform: translateY(-50%); } /* 44px hit area inside the bar */
.dc-code__tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.dc-code__tab { position: relative; min-width: var(--touch); min-height: 32px; padding: 0 10px; border-radius: 6px; color: #b9b5d9; font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.dc-code__tab::before { content: ""; position: absolute; inset: -6px 0; } /* 32px visual → 44px hit area (desktop); phones get a 44px box */
.dc-code__tab:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.dc-code__tab[aria-selected="true"] { background: rgba(255, 255, 255, 0.14); color: #fff; }
.dc-code__tab:focus-visible { outline-color: var(--focus-on-dark); outline-offset: -2px; }
.dc-code .copy-btn { color: #d9d5f5; background: transparent; border-color: rgba(255, 255, 255, 0.18); min-height: 32px; font-size: var(--fs-xs); }
.dc-code .copy-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.dc-code .copy-btn--icon { width: 32px; padding: 0; }
.copy-btn--icon { width: 36px; min-height: 36px; padding: 0; justify-content: center; }
/* Desktop keeps the compact code bar; hit areas reach 44px (insets start inside the 1px border). */
.dc-code .copy-btn::before { inset: -7px 0; }
.dc-code .copy-btn--icon::before, .copy-btn--icon::before { inset: -7px; }
.dc-code pre { margin: 0; padding: 12px 14px; overflow: auto; max-height: 520px; font-family: var(--font-mono); font-size: 13px; line-height: 1.55; tab-size: 2; overscroll-behavior: contain; }
.dc-code pre:focus-visible { outline: 3px solid var(--focus-on-dark); outline-offset: -3px; }
.dc-code code { font-family: inherit; font-size: inherit; color: inherit; white-space: pre; }
.dc-code--response pre { max-height: 360px; }
.dc-code--wide { margin-top: var(--s-2); max-width: 980px; }
.dc-code--wide pre { max-height: 640px; }
.dc-examples { display: grid; gap: var(--s-2); max-width: 980px; margin-top: var(--s-2); }

/* ---- Changelog, Try-it ------------------------------------------------------------------------- */
.dc-changelog { list-style: none; padding: 0 !important; display: grid; gap: var(--s-2) !important; }
.dc-changelog > li { padding-inline-start: var(--s-2); border-inline-start: 3px solid var(--brand-200); }
.dc-changelog__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dc-changelog__head time { color: var(--muted); font-variant-numeric: tabular-nums; }
.dc-changelog ul { margin-top: 6px; }
.dc-try { max-width: 980px; margin-top: var(--s-5); padding: var(--s-3); border: 1px solid var(--warning-border); border-radius: var(--radius-lg); background: #fffdf7; scroll-margin-top: 80px; }
.dc-try__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1-5); }
.dc-try__terms { margin-top: var(--s-1-5); padding: var(--s-1-5) var(--s-2); border-radius: var(--radius-sm); background: var(--warning-bg); color: var(--warning-ink); font-size: var(--fs-sm); line-height: 1.5; }
.dc-try__form { display: grid; gap: var(--s-2); margin-top: var(--s-2-5); max-width: 720px; }
.dc-try__params { display: grid; gap: var(--s-1-5); }
.dc-try__params:empty { display: none; }
.dc-try__result { margin-top: var(--s-2); }
.dc-try__form .btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1-5); }
.dc-try__form .field__error[hidden] { display: none; }

.dc-footer { padding: var(--s-3); border-top: 1px solid var(--border); text-align: center; }
.dc-scrim { display: none; }

/* ---- Responsive --------------------------------------------------------------------------------- */
@media (max-width: 1279.98px) {
  .dc-op { grid-template-columns: minmax(0, 1fr) minmax(320px, 46%); gap: var(--s-3); }
  .dc-header__nav a { padding-inline: 8px; }
}
@media (max-width: 1023.98px) {
  .dc-layout { grid-template-columns: minmax(0, 1fr); }
  .dc-header__menu { display: inline-flex; }
  .dc-header__title { display: none; }
  .dc-sidebar { position: fixed; inset: 0 auto 0 0; z-index: var(--z-drawer); width: min(320px, 88vw); height: 100dvh; box-shadow: var(--shadow-lg); transform: translateX(-100%); visibility: hidden; transition: transform var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow); }
  .dc-sidebar.is-open { transform: none; visibility: visible; transition: transform var(--dur-slow) var(--ease-out); }
  .dc-sidebar__close { display: inline-flex; }
  .dc-scrim { display: block; position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1); background: var(--overlay); opacity: 0; visibility: hidden; transition: opacity var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow); }
  .dc-scrim.is-open { opacity: 1; visibility: visible; transition: opacity var(--dur-slow) var(--ease-out); }
  .dc-op { grid-template-columns: minmax(0, 1fr); }
  .dc-op__code { position: static; }
  .dc-main { padding: var(--s-3) var(--s-3) var(--s-8); }
}
@media (max-width: 767.98px) {
  .dc-header__nav { display: none; }
  .dc-header__cta span { display: none; }
  .dc-header__cta { width: 44px; padding: 0; justify-content: center; }
  .dc-main { padding-inline: var(--gutter); }
  .dc-anchor { display: none; }
  .dc-op { gap: var(--s-2); }
  .dc-code pre { font-size: 12.5px; }
  .dc-try { padding: var(--s-2); }
  .dc-table th, .dc-table td { padding: 8px; }
  /* 44px touch targets (brief §3) */
  .dc-code__tab { min-height: 44px; padding-inline: 12px; }
  .dc-code .copy-btn, .copy-btn--icon { min-height: 44px; }
  .copy-btn--icon, .dc-code .copy-btn--icon { width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .dc-card, .dc-sidebar, .dc-scrim { transition: none; }
  .dc-card:hover { transform: none; }
}
