/* Reading layout shared by the guide and policies. Brand tokens live in theme.css. */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 108px; background: var(--page); }
body { margin: 0; color: var(--ink); background: var(--page); font: 15px/1.85 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; text-underline-offset: 4px; }
a:hover { text-decoration: underline; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 5px; }
::selection { background: #abd2ff; color: #0b1320; }
.icon { width: 20px; height: 20px; flex: none; fill: currentColor; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 10px; left: 16px; padding: 10px 20px; border-radius: 14px; color: var(--ink); background: var(--surface); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.doc-header { position: sticky; z-index: 40; top: 0; border-bottom: 1px solid var(--line); background: var(--header); backdrop-filter: blur(18px); }
.doc-header-inner { display: flex; align-items: center; gap: 18px; width: min(1280px, calc(100% - 96px)); height: 80px; margin-inline: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 23px; font-weight: 700; letter-spacing: -1px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 9px; }
.brand-dot { color: var(--brand); }
.doc-brand-label { padding-left: 18px; border-left: 1px solid var(--line-strong); color: var(--muted); font-size: 13px; }
.doc-nav { display: flex; align-items: center; gap: 28px; margin-left: auto; font-size: 13px; }
.doc-nav a { color: var(--muted); padding: 10px 0; }
.doc-nav a[aria-current], .doc-nav a:hover { color: var(--blue); text-decoration: none; }
.doc-actions { display: flex; align-items: center; gap: 15px; margin-left: 20px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; color: var(--ink); background: transparent; }
.icon-button:hover { background: var(--surface-soft); }
.theme-toggle .sun { display: none; }
html[data-theme='dark'] .theme-toggle .moon { display: none; }
html[data-theme='dark'] .theme-toggle .sun { display: block; }
.doc-console { display: inline-flex; align-items: center; gap: 14px; padding: 8px 17px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); font-size: 13px; white-space: nowrap; }
.doc-console:hover { text-decoration: none; border-color: var(--blue); }
.doc-console .icon { width: 16px; height: 16px; }

.doc-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: 72px; width: min(1200px, calc(100% - 96px)); margin: 0 auto; padding: 48px 0 80px; }
.sidebar { position: sticky; top: 112px; min-width: 0; max-height: calc(100dvh - 140px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.doc-toc > summary { display: none; }
.doc-toc:not([open]) > .sidebar-content { display: block; }
.sidebar-content { padding: 4px 12px 16px 0; }
.sidebar-label { margin: 0 0 10px 12px; color: var(--ink); font-size: 12px; font-weight: 600; }
.nav-link { display: block; padding: 7px 12px; border-left: 2px solid transparent; border-radius: 0 8px 8px 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.nav-link:hover { color: var(--ink); text-decoration: none; }
.nav-link.active { color: var(--blue); border-left-color: var(--brand); background: var(--wash); }
.sidebar-pages { display: grid; gap: 10px; margin: 28px 10px 0 12px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 12px; }
.sidebar-pages a { color: var(--muted); }
.sidebar-pages a[aria-current], .sidebar-pages a:hover { color: var(--blue); }
.doc-main { min-width: 0; max-width: 820px; }
.hero, .doc-intro { padding: 10px 0 46px; }
.eyebrow { margin: 0 0 22px; color: var(--muted); font: 11px/1.8 var(--mono); letter-spacing: .08em; }
h1 { margin: 0 0 24px; font-family: var(--serif); font-size: clamp(42px, 4.8vw, 66px); font-weight: 400; line-height: 1.23; letter-spacing: -.045em; }
.accent-text { color: var(--blue); }
.lead, .summary { max-width: 650px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.95; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 26px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 9px 20px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); background: transparent; font-size: 13px; font-weight: 500; white-space: nowrap; }
.button:hover { background: var(--surface-soft); border-color: var(--blue); text-decoration: none; }
.button.primary { color: #fff; background: #1265df; border-color: #1265df; }
.button.primary:hover { background: #0d52bd; }
.endpoint { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 30px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.endpoint > div { min-width: 0; }
.endpoint small { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.endpoint code { padding: 0; color: var(--ink); background: transparent; font-size: 15px; font-weight: 500; }
.endpoint .button { min-height: 36px; padding: 6px 14px; font-size: 12px; }

.doc-main > section { margin-top: 20px; padding: 40px 0 26px; border-top: 1px solid var(--line); scroll-margin-top: 12px; }
h2 { margin: 0 0 18px; font: 400 clamp(27px, 3vw, 34px)/1.4 var(--serif); letter-spacing: -.025em; }
h3 { margin: 28px 0 12px; font-size: 16px; line-height: 1.6; font-weight: 600; }
p { margin: 0 0 16px; }
ul, ol { padding-left: 1.4rem; }
li + li { margin-top: 8px; }
strong { font-weight: 600; }
.muted { color: var(--muted); }
code, pre { font-family: var(--mono); }
code:not(pre code) { padding: .12em .36em; border-radius: 5px; color: var(--blue); background: var(--wash); font-size: .9em; overflow-wrap: anywhere; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 22px 0; }
.card { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.card strong { display: block; margin-bottom: 8px; font-size: 14px; }
.card .muted { font-size: 13px; }
.steps { counter-reset: steps; display: grid; gap: 22px; margin: 24px 0; }
.step { counter-increment: steps; display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: start; gap: 15px; }
.step::before { content: counter(steps, decimal-leading-zero); display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--blue); font: 11px var(--mono); }
.step p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.step strong { font-size: 14px; }
.note { margin: 24px 0; padding: 17px 20px; border-left: 3px solid var(--brand); border-radius: 0 14px 14px 0; background: var(--wash); font-size: 13px; line-height: 1.9; }
.note.warning { border-left-color: #b9791a; background: #fff5e3; color: #6a471b; }
html[data-theme='dark'] .note.warning { color: #e7c99e; border-left-color: #c18a39; background: #2d251a; }
.code-wrap { min-width: 0; overflow: hidden; margin: 16px 0 26px; border: 1px solid #26364e; border-radius: 14px; background: #0d1726; color: #d4e0f3; }
.code-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid #263447; }
.code-toolbar > span { font: 11px/1.6 var(--mono); color: #a6b7cf; }
.copy { flex: none; min-width: 46px; padding: 5px 9px; border: 1px solid #41546e; border-radius: 7px; color: #d5e0f1; background: transparent; font-size: 11px; }
.copy:hover { color: #fff; background: #23344b; }
.copy:focus-visible { outline-color: #83b4ff; }
pre { max-width: 100%; overflow: auto; margin: 0; padding: 24px; font-size: 12px; line-height: 1.9; tab-size: 4; scrollbar-width: thin; scrollbar-color: #41546e #0d1726; }
pre code { font-size: inherit; }
table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 13px; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--surface-soft); color: var(--muted); font-weight: 500; white-space: nowrap; }
td:first-child { color: var(--ink); }
section > details { margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
section > details > summary { cursor: pointer; padding: 18px 20px; font-size: 14px; font-weight: 500; }
section > details[open] > summary { color: var(--blue); }
section > details > div { padding: 0 20px 20px; color: var(--muted); font-size: 13px; }
.doc-footer { margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.doc-footer p { margin: 0 0 12px; }
.doc-footer nav { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.doc-footer a { color: var(--muted); }
.doc-footer a:hover { color: var(--blue); }

@media (max-width: 1023px) {
  html { scroll-padding-top: 148px; }
  .doc-header-inner { width: calc(100% - 48px); height: 72px; }
  .doc-shell { display: block; width: min(820px, calc(100% - 48px)); padding-top: 0; }
  .sidebar { position: sticky; z-index: 30; top: 72px; max-height: none; overflow: visible; margin: 0 -24px 36px; background: var(--page); border-bottom: 1px solid var(--line); }
  .doc-toc > summary { display: flex; align-items: center; gap: 15px; min-height: 52px; padding: 12px 24px; color: var(--ink); cursor: pointer; font-size: 12px; list-style: none; }
  .doc-toc > summary::-webkit-details-marker { display: none; }
  .doc-toc > summary [data-current-section] { margin-left: auto; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .doc-toc > summary .icon { width: 15px; height: 15px; color: var(--muted); }
  .doc-toc[open] > summary .icon { transform: rotate(180deg); }
  .doc-toc:not([open]) > .sidebar-content { display: none; }
  .sidebar-content { max-height: 60dvh; overflow: auto; padding: 12px 24px 28px; border-top: 1px solid var(--line); }
  .hero, .doc-intro { padding-top: 6px; }
}
@media (max-width: 767px) {
  .doc-nav { display: none; }
  .doc-actions { margin-left: auto; gap: 8px; }
  .doc-header-inner { gap: 12px; }
  .doc-brand-label { padding-left: 12px; }
  .doc-main > section { padding-top: 32px; }
  h1 { font-size: clamp(36px, 7.5vw, 54px); }
  .grid { grid-template-columns: 1fr; }
  .lead, .summary { font-size: 14px; }
  table { display: block; overflow-x: auto; }
  th, td { min-width: 110px; }
  pre { padding: 20px; font-size: 11px; }
}
@media (max-width: 420px) {
  body { font-size: 14px; }
  .doc-header-inner { width: calc(100% - 32px); gap: 10px; }
  .brand { gap: 7px; font-size: 21px; }
  .brand img { width: 30px; height: 30px; }
  .doc-brand-label { display: none; }
  .doc-console { padding: 7px 12px; gap: 8px; font-size: 12px; }
  .doc-shell { width: calc(100% - 36px); }
  .sidebar { margin-inline: -18px; }
  .doc-toc > summary { padding-inline: 18px; gap: 10px; }
  .endpoint { flex-wrap: wrap; padding: 16px; gap: 12px; }
  .endpoint code { font-size: 12px; }
  .hero-actions { gap: 8px; }
  .hero-actions .button { padding-inline: 15px; font-size: 12px; }
  .note { padding: 15px; }
  .code-toolbar { padding-inline: 14px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print {
  :root, html[data-theme='dark'] { --page: #fff; --ink: #111; --muted: #444; --line: #ddd; --blue: #174ca6; }
  .doc-header, .sidebar, .copy, [data-copy], .doc-footer nav, .hero-actions { display: none; }
  .doc-shell { display: block; width: 100%; padding: 0; }
  .doc-main { max-width: none; }
  h1 { font-size: 36px; }
  h2 { break-after: avoid; }
  .doc-main > section { padding-top: 24px; }
  .code-wrap, .card, .note { break-inside: avoid; }
  pre { white-space: pre-wrap; overflow-wrap: anywhere; }
}
