/* Entropix documentation pages (site/docs/, built by tools/site/docs/build.py).
   Loaded after site.css, which holds the fonts, tokens, header and footer.
   Pages are class-based: no inline styles. Component guide: tools/site/docs/STYLE.md. */

.docs {
  --doc-ink: var(--ink);
  --doc-muted: var(--muted);
  --doc-line: var(--line);
  --doc-paper: #ffffff;
  --doc-soft: #eef0f4;
  --doc-accent-soft: #eceffe;
  --doc-ok: #157347;
  --doc-ok-soft: #e7f5ee;
  --doc-no: #b42318;
  --doc-no-soft: #fdeceb;
  --doc-warn: #8a5a00;
  --doc-warn-soft: #fff4dc;
  --doc-code: #f1f2f5;
}

/* ---- Layout: side nav, page, "On this page" ---- */
.docs-shell {
  max-width: 1280px; margin: 0 auto; padding-inline: 24px;
  display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 48px;
  align-items: start;
}
.docs-side { position: sticky; top: env(safe-area-inset-top, 0px); max-height: 100vh; overflow-y: auto; padding-block: 32px 48px; }
.docs-main { min-width: 0; max-width: 780px; padding-block: 40px 72px; }

.docs-nav-phone { display: none; }
.dn-sections, .dn-sections ol { list-style: none; margin: 0; padding: 0; }
.dn-sections { display: flex; flex-direction: column; gap: 18px; font-size: 14px; }
.dn-home a { font-weight: 600; }
.dn-title { display: flex; align-items: baseline; gap: 8px; font-weight: 600; color: var(--doc-ink); margin-bottom: 6px; }
.dn-num { font: 500 11px "IBM Plex Mono", monospace; color: var(--doc-muted); letter-spacing: 0.04em; }
.dn-section ol { display: flex; flex-direction: column; gap: 1px; border-left: 1px solid var(--doc-line); margin-left: 4px; }
.dn-sections a { display: block; padding: 5px 10px 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--doc-muted); line-height: 1.35; }
.dn-sections a:hover { color: var(--doc-ink); }
.dn-sections a[aria-current="page"] { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.dn-home a { padding-left: 0; margin-left: 0; border-left: 0; }

/* ---- Page head ---- */
.docs-crumbs { font: 500 12px "IBM Plex Mono", monospace; letter-spacing: 0.04em; text-transform: uppercase; color: var(--doc-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.docs-crumbs a { color: var(--doc-muted); }
.docs-crumbs a:hover { color: var(--accent); }
.docs-main h1 {
  margin: 14px 0 0; font-family: "Space Grotesk", sans-serif; font-weight: 600;
  font-size: clamp(32px, 4.2vw, 44px); line-height: 1.08; letter-spacing: -0.025em; text-wrap: balance;
}
.docs-lede { margin: 16px 0 0; font-size: 19px; line-height: 1.55; color: var(--doc-muted); max-width: 64ch; }

.docs-toc { margin: 28px 0 0; padding: 16px 20px; background: var(--doc-paper); border: 1px solid var(--doc-line); border-radius: 12px; }
.toc-h { font: 500 11px "IBM Plex Mono", monospace; letter-spacing: 0.08em; text-transform: uppercase; color: var(--doc-muted); }
.docs-toc ol { margin: 10px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 24px; font-size: 14px; }
.docs-toc a { color: var(--doc-ink); }
.docs-toc a:hover { color: var(--accent); }

/* ---- Body text ---- */
.docs-body { margin-top: 36px; font-size: 16.5px; line-height: 1.7; color: var(--doc-ink); }
.docs-body > * + * { margin-top: 16px; }
.docs-body > *:first-child { margin-top: 0; }
.docs-body h2 {
  margin: 52px 0 0; padding-top: 4px; font-family: "Space Grotesk", sans-serif; font-weight: 600;
  font-size: 26px; line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; scroll-margin-top: 16px;
}
.docs-body h3 { margin: 32px 0 0; font-size: 18px; font-weight: 600; line-height: 1.35; scroll-margin-top: 16px; }
.docs-body h2 + *, .docs-body h3 + * { margin-top: 10px; }
.docs-body p, .docs-body li { max-width: 68ch; }
.docs-body ul, .docs-body ol { padding-left: 22px; }
.docs-body li + li { margin-top: 6px; }
.docs-body a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.docs-body a:hover { text-decoration-thickness: 2px; }
.docs-body strong { font-weight: 600; }
.docs-body code { font-size: 0.88em; background: var(--doc-code); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }
.docs-body pre { background: #12151c; color: #e7e9ee; border-radius: 10px; padding: 16px 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; }
.docs-body pre code { background: none; padding: 0; color: inherit; font-size: inherit; overflow-wrap: normal; }
.docs-body kbd { font: 500 0.85em "IBM Plex Mono", monospace; border: 1px solid var(--doc-line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--doc-paper); }

/* Term lists: the glossary, troubleshooting messages, field references. */
.docs-body dl { margin-top: 16px; }
.docs-body dt { font-weight: 600; margin-top: 18px; scroll-margin-top: 16px; }
.docs-body dt:first-child { margin-top: 0; }
.docs-body dd { margin: 4px 0 0; padding-left: 16px; border-left: 2px solid var(--doc-line); max-width: 68ch; }
.docs-body dd > * + * { margin-top: 8px; }

/* A button or label exactly as the portal shows it. */
.docs-body .ui { font-weight: 600; white-space: nowrap; }

/* ---- Where it is in the portal ---- */
.where {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline;
  padding: 12px 16px; background: var(--doc-paper); border: 1px solid var(--doc-line); border-left: 3px solid var(--accent); border-radius: 10px;
  font-size: 15px;
}
.where-h { font: 500 11px "IBM Plex Mono", monospace; letter-spacing: 0.08em; text-transform: uppercase; color: var(--doc-muted); }
.where .who { margin-left: auto; }

/* ---- Who may do it ---- */
.role {
  display: inline-block; font: 600 11px "IBM Plex Sans", sans-serif; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; background: var(--doc-soft); color: var(--doc-ink); vertical-align: 2px; white-space: nowrap;
}
.role-admin { background: var(--doc-accent-soft); color: var(--accent); }
.role-operator { background: #12151c; color: #fff; }

/* ---- Steps ---- */
.docs-body ol.steps { list-style: none; padding: 0; counter-reset: step; display: flex; flex-direction: column; gap: 14px; }
.docs-body ol.steps > li { counter-increment: step; position: relative; padding-left: 44px; margin: 0; }
.docs-body ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 1px; width: 28px; height: 28px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; font: 600 13px "IBM Plex Sans", sans-serif;
  background: var(--doc-ink); color: #fff;
}

/* ---- Callouts ---- */
.callout { padding: 14px 18px; border-radius: 10px; background: var(--doc-soft); font-size: 15.5px; line-height: 1.6; }
.callout > * + * { margin-top: 8px; }
.callout > :first-child { margin-top: 0; }
.callout-h { display: block; font: 600 12px "IBM Plex Sans", sans-serif; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; }
.callout.tip { background: var(--doc-accent-soft); }
.callout.tip .callout-h { color: var(--accent); }
.callout.warn { background: var(--doc-warn-soft); }
.callout.warn .callout-h { color: var(--doc-warn); }
.callout.admin { background: var(--doc-paper); border: 1px dashed #b9c0ce; }

/* ---- Can and can't ---- */
.can-cannot { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.can-cannot > div { padding: 16px 18px; border-radius: 12px; border: 1px solid var(--doc-line); background: var(--doc-paper); min-width: 0; }
.can-cannot h3, .can-cannot .cc-h { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: 0.02em; }
.can-cannot .can .cc-h { color: var(--doc-ok); }
.can-cannot .cannot .cc-h { color: var(--doc-no); }
.can-cannot ul { list-style: none; padding: 0; margin: 10px 0 0; font-size: 15px; line-height: 1.55; }
.can-cannot li { position: relative; padding-left: 22px; }
.can-cannot li + li { margin-top: 8px; }
.can-cannot .can li::before { content: "✓"; position: absolute; left: 0; color: var(--doc-ok); font-weight: 700; }
.can-cannot .cannot li::before { content: "✕"; position: absolute; left: 0; color: var(--doc-no); font-weight: 700; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--doc-line); border-radius: 12px; background: var(--doc-paper); }
.docs-body table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.docs-body th { text-align: left; font-weight: 600; background: var(--doc-soft); }
.docs-body th, .docs-body td { padding: 10px 14px; border-bottom: 1px solid var(--doc-line); vertical-align: top; }
.docs-body tr:last-child td { border-bottom: 0; }
.docs-body td code { overflow-wrap: anywhere; word-break: normal; }
.docs-body .yes { color: var(--doc-ok); font-weight: 600; }
.docs-body .no { color: var(--doc-muted); }

/* ---- Cards (overview pages) ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.docs-body .card {
  display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 12px; min-width: 0;
  background: var(--doc-paper); border: 1px solid var(--doc-line); color: var(--doc-ink); text-decoration: none;
}
.docs-body a.card:hover { border-color: var(--accent); color: var(--doc-ink); }
.card .card-n { font: 500 11px "IBM Plex Mono", monospace; letter-spacing: 0.06em; color: var(--doc-muted); }
.card .card-t { font: 600 17px "Space Grotesk", sans-serif; letter-spacing: -0.01em; }
.card .card-d { font-size: 14px; line-height: 1.5; color: var(--doc-muted); }

/* A numbered reading path (the docs home). */
.path { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.docs-body .path > li { margin: 0; max-width: none; }

.docs-todo { color: var(--doc-muted); font-style: italic; }

/* ---- Previous / next ---- */
.docs-pager { margin-top: 64px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.docs-pager a {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; border-radius: 12px;
  border: 1px solid var(--doc-line); background: var(--doc-paper); font-weight: 600; min-width: 0;
}
.docs-pager a:hover { border-color: var(--accent); }
.docs-pager a span { font: 500 11px "IBM Plex Mono", monospace; letter-spacing: 0.06em; text-transform: uppercase; color: var(--doc-muted); }
.docs-pager .pg-next { text-align: right; grid-column: 2; }

/* ---- Phone and tablet ---- */
@media (max-width: 960px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 0; padding-inline: 16px; }
  .docs-side { position: static; max-height: none; overflow: visible; padding-block: 16px 0; }
  .docs-nav { display: none; }
  .docs-nav-phone { display: block; border: 1px solid var(--doc-line); border-radius: 12px; background: var(--doc-paper); }
  .docs-nav-phone summary { cursor: pointer; padding: 12px 16px; font-weight: 600; min-height: 44px; }
  .docs-nav-phone nav { padding: 4px 16px 16px; }
  .docs-main { padding-block: 24px 56px; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager .pg-next { grid-column: 1; }
  .where .who { margin-left: 0; }
}
