/* Developers documentation, shared styles.
   Loaded only on pages with `docs: true`. Built on the marketing design tokens
   in base.css (navy #112246, electric blue #15baff, Geist / Geist Mono / Archivo,
   hairlines, cool near-monochrome). No warm accents, no motion on text. */

/* ─── Layout: sidebar · article · on-this-page ─────────────────────────── */
.docs { padding-block: 0; }
.docs-grid {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 200px;
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
  padding-block: clamp(28px, 4vw, 52px) clamp(56px, 8vw, 104px);
}
@media (max-width: 1080px) { .docs-grid { grid-template-columns: 220px minmax(0, 1fr); } .docs-toc { display: none; } }
@media (max-width: 820px) { .docs-grid { grid-template-columns: 1fr; gap: 20px; } }

/* ─── Sidebar navigation ───────────────────────────────────────────────── */
.docs-side { position: sticky; top: 84px; align-self: start; }
@media (max-width: 820px) {
  .docs-side { position: static; top: auto; margin: 0 -24px; padding: 0 24px 4px; border-bottom: 1px solid var(--line); }
}
.docs-side > summary {
  display: none;
  align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 0; cursor: pointer; list-style: none;
  font-size: 0.9375rem; font-weight: 600; color: var(--ink);
}
.docs-side > summary::-webkit-details-marker { display: none; }
.docs-side > summary .chev { width: 16px; height: 16px; color: var(--ink-3); transition: transform 0.2s var(--ease); }
/* Desktop: the sidebar is always open. A closed <details> hides its content via
   content-visibility in modern engines, so reveal it explicitly (older engines
   fall back to the author display:block below, which beats the UA rule). */
.docs-side::details-content { content-visibility: visible; }
.docs-nav { display: block; }
/* Mobile: real <details> toggle. Desktop: force open, hide the summary. */
@media (max-width: 820px) {
  .docs-side > summary { display: flex; }
  .docs-side:not([open]) .docs-nav { display: none; }
  .docs-side[open] > summary .chev { transform: rotate(180deg); }
  .docs-nav { padding-bottom: 12px; }
}
.docs-nav h2 {
  margin: 22px 0 8px; font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3);
}
.docs-nav h2:first-child { margin-top: 4px; }
.docs-nav ul { margin: 0 0 2px; padding: 0; list-style: none; display: grid; gap: 1px; }
.docs-nav a {
  display: block; padding: 5px 10px; margin-left: -10px; border-radius: 7px;
  font-size: 0.90625rem; line-height: 1.35; color: var(--ink-2); text-decoration: none;
  transition: background-color 0.12s, color 0.12s;
}
.docs-nav a:hover { background: var(--bg-2); color: var(--ink); }
.docs-nav a[aria-current="page"] {
  background: var(--tint-2); color: var(--navy); font-weight: 550;
  box-shadow: inset 2px 0 0 var(--blue);
}

/* ─── Article ──────────────────────────────────────────────────────────── */
.docs-body { min-width: 0; max-width: 46rem; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; font-size: 0.8125rem; color: var(--ink-3); }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--ink-2); }
.crumbs .sep { color: var(--line-2); }
.docs-head { margin-bottom: 8px; }
.docs-head h1 {
  margin-top: 10px; font-size: clamp(2rem, 3.6vw, 2.75rem); line-height: 1.06;
  letter-spacing: -0.022em; font-weight: 640;
}
.docs-head .lede { max-width: none; color: var(--ink-2); }

.docs-body h2 {
  margin: 52px 0 0; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 1.4375rem; letter-spacing: -0.012em; scroll-margin-top: 88px;
}
.docs-body h3 { margin: 30px 0 0; font-size: 1.125rem; font-weight: 600; scroll-margin-top: 88px; }
.docs-body p { margin: 14px 0 0; color: var(--ink-2); line-height: 1.65; }
.docs-body ul, .docs-body ol { margin: 14px 0 0; padding-left: 20px; color: var(--ink-2); line-height: 1.62; }
.docs-body li { margin-top: 6px; }
.docs-body li > code, .docs-body p > code, .docs-body td > code, .docs-body h3 > code {
  font-family: var(--mono); font-size: 0.84em; padding: 1.5px 5px; border-radius: 5px;
  background: var(--tint-2); border: 1px solid var(--tint-line); color: var(--navy);
  white-space: nowrap;
}
.docs-body a.text-link { color: var(--blue-ink); text-decoration: none; border-bottom: 1px solid var(--tint-line); }
.docs-body a.text-link:hover { border-bottom-color: var(--blue-ink); }
.anchor { color: inherit; text-decoration: none; }
.anchor:hover::after { content: "#"; margin-left: 8px; color: var(--blue-ink); font-weight: 400; }

/* ─── Code blocks (built from <!--code lang--> … <!--/code-->) ──────────── */
figure.code {
  position: relative; margin: 20px 0 0; border-radius: 12px; overflow: hidden;
  background: #282c34; border: 1px solid #3a4149;
  box-shadow: 0 1px 2px oklch(0.13 0.03 264 / 0.4), 0 18px 40px -28px oklch(0.13 0.03 264 / 0.6);
}
figure.code::before {
  content: attr(data-lang); position: absolute; top: 0; right: 0;
  padding: 5px 12px; font-family: var(--mono); font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: #7f8796; background: #21252b; border-bottom-left-radius: 10px;
}
figure.code pre { margin: 0; padding: 18px 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
figure.code code {
  font-family: var(--mono); font-size: 0.84375rem; line-height: 1.7;
  color: #abb2bf; tab-size: 2; white-space: pre;
}
/* Atom One Dark syntax palette (emitted by the build highlighter) */
figure.code .hl-comment  { color: #7f848e; font-style: italic; }
figure.code .hl-keyword  { color: #c678dd; }
figure.code .hl-string   { color: #98c379; }
figure.code .hl-number   { color: #d19a66; }
figure.code .hl-function { color: #61afef; }
figure.code .hl-tag      { color: #e06c75; }
figure.code .hl-attr     { color: #d19a66; }
figure.code .hl-tagpunct { color: #828997; }
figure.code .hl-delim    { color: #56b6c2; }
figure.code .hl-operator { color: #56b6c2; }
figure.code .hl-property { color: #e06c75; }
figure.code.inline-note { margin-top: 8px; }
.code-cap { margin: 10px 0 0; font-size: 0.8125rem; color: var(--ink-3); }
.code-cap code { font-family: var(--mono); color: var(--ink-2); }

/* ─── Callouts (note / standard / compat / warning) ────────────────────── */
.note {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start;
  margin: 22px 0 0; padding: 14px 16px; border-radius: 10px;
  background: var(--tint-2); border: 1px solid var(--tint-line); color: var(--ink);
}
.note .i { width: 18px; height: 18px; margin-top: 2px; color: var(--blue-ink); flex: none; }
.note p { margin: 0; color: var(--ink); font-size: 0.9375rem; line-height: 1.55; }
.note p + p { margin-top: 8px; }
.note strong { font-weight: 600; }
.note.warn { background: oklch(0.958 0.028 18); border-color: oklch(0.86 0.055 18); }
.note.warn .i { color: oklch(0.55 0.16 22); }
.note.compat { background: var(--bg-2); border-color: var(--line); }
.note.compat .i { color: var(--ink-3); }

/* Mode pills: mark a behaviour as standard-only / compat-only */
.pill {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: middle;
  padding: 1px 8px; border-radius: 99px; font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.02em; text-transform: uppercase; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.pill.standard { background: var(--tint-2); color: var(--blue-ink); }
.pill.standard::before { background: var(--blue); }
.pill.compat { background: var(--bg-2); color: var(--ink-2); }
.pill.compat::before { background: var(--ink-3); }
.pill.soon { background: oklch(0.95 0.035 300); color: oklch(0.5 0.15 300); }
.pill.soon::before { background: oklch(0.6 0.17 300); }

/* ─── Reference tables ─────────────────────────────────────────────────── */
.docs-body .table-wrap { margin: 20px 0 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.docs-body table { width: 100%; border-collapse: collapse; font-size: 0.90625rem; }
.docs-body thead th {
  position: sticky; top: 0; text-align: left; padding: 10px 14px; background: var(--bg-2);
  border-bottom: 1px solid var(--line); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap;
}
.docs-body tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; line-height: 1.5; }
.docs-body tbody tr:last-child td { border-bottom: 0; }
.docs-body tbody td:first-child { color: var(--ink); white-space: nowrap; }
.docs-body td code { white-space: nowrap; }

/* ─── Section cards (overview grid of doc areas) ───────────────────────── */
.doc-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 24px 0 0; padding: 0; list-style: none; }
@media (max-width: 620px) { .doc-cards { grid-template-columns: 1fr; } }
.doc-cards a {
  display: block; height: 100%; padding: 18px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.doc-cards a:hover { border-color: var(--line-2); box-shadow: var(--lift); transform: translateY(-2px); }
.doc-cards h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.0625rem; color: var(--ink); }
.doc-cards h3 .i { width: 17px; height: 17px; color: var(--blue-ink); }
.doc-cards p { margin: 6px 0 0; font-size: 0.90625rem; color: var(--ink-2); line-height: 1.5; }

/* ─── On this page ─────────────────────────────────────────────────────── */
.docs-toc { position: sticky; top: 84px; align-self: start; font-size: 0.84375rem; }
.docs-toc p { margin: 0 0 10px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); }
.docs-toc ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; border-left: 1px solid var(--line); }
.docs-toc a { display: block; padding: 2px 0 2px 14px; margin-left: -1px; color: var(--ink-3); text-decoration: none; border-left: 1px solid transparent; line-height: 1.4; }
.docs-toc a:hover { color: var(--ink); }
.docs-toc a.sub { padding-left: 26px; font-size: 0.8125rem; }

/* ─── Prev / next footer ───────────────────────────────────────────────── */
.docs-more { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--line); }
@media (max-width: 560px) { .docs-more { grid-template-columns: 1fr; } }
.docs-more a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.docs-more a:hover { border-color: var(--line-2); box-shadow: var(--lift); }
.docs-more span { display: block; font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.docs-more b { display: block; margin-top: 3px; font-weight: 600; color: var(--ink); }
.docs-more .next { text-align: right; }
