/* The developers' page: the application's tokens (static/ui.css), the
   application's header, and a document underneath — one column of prose
   with the page's headings listed beside it. Light or dark as the browser
   says: this page keeps no preference, and runs no script. */
:root {
  --navy: #101e29;
  --paper: #f6f5ef;
  --mint: #b5efc8;
  --bg: #f6f5ef;
  --surface: #fffefa;
  --surface-2: #eef1e8;
  --text: #152a33;
  --muted: #5d6e6a;
  --border: #d8ddd4;
  --accent: #2e794b;
  --frame: var(--surface);
  --frame-text: var(--text);
  --frame-muted: var(--muted);
  --frame-accent: var(--accent);
  --frame-line: var(--border);
  --code: #0f3b2a;
  --radius: 4px;
  --gap: 16px;
  --font: Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1922;
    --surface: #101e29;
    --surface-2: #162934;
    --text: #eef0e8;
    --muted: #a3b5b8;
    --border: #2a3f48;
    --accent: #b5efc8;
    --frame: #08131b;
    --frame-text: var(--paper);
    --frame-muted: #a7b7bd;
    --frame-accent: var(--mint);
    --frame-line: #ffffff17;
    --code: #cfeedd;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

/* ------------------------------------------------------------ the header */
.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--gap);
  background: var(--frame);
  color: var(--frame-text);
  border-bottom: 1px solid var(--frame-line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--frame-text); text-decoration: none; flex: none; }
.brand .logo { width: 30px; height: 30px; }
.brand:hover .brand-copy strong { color: var(--frame-accent); }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-size: 1rem; font-weight: 600; letter-spacing: -0.02em; }
.brand-copy small {
  color: var(--frame-muted); font-family: var(--mono); font-size: 0.56rem;
  letter-spacing: 0.16em; text-transform: uppercase; margin-top: 3px;
}
.version-tag { align-self: flex-end; margin-bottom: 3px; color: var(--frame-muted); font-family: var(--mono); font-size: 0.64rem; white-space: nowrap; }
.spacer { flex: 1; }
.top-link { color: var(--frame-muted); font-size: 0.85rem; text-decoration: none; padding: 6px 10px; border-radius: var(--radius); }
.top-link:hover { color: var(--frame-accent); text-decoration: none; }

/* ------------------------------------------------------------- the frame */
.frame {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 48px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px var(--gap) 64px;
}
.overline {
  margin: 0 0 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* The headings beside the text, kept in view as it scrolls. */
.sidebar { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow-y: auto; }
.contents { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.contents li { margin: 0; }
.contents a {
  display: block;
  padding: 5px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
}
.contents a:hover { color: var(--accent); border-left-color: var(--accent); }

/* ----------------------------------------------------------- the article */
.article { min-width: 0; max-width: 760px; }
.article h1 { margin: 0 0 12px; font-size: 2.2rem; line-height: 1.1; letter-spacing: -0.03em; font-weight: 650; }
.lead { margin: 0 0 36px; font-size: 1.15rem; color: var(--muted); line-height: 1.5; }
.article h2 {
  margin: 44px 0 12px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  font-size: 1.45rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 650;
  scroll-margin-top: 84px;
}
.article h3 { margin: 28px 0 8px; font-size: 1.1rem; font-weight: 650; scroll-margin-top: 84px; }
.article p { margin: 0 0 14px; }
.article ul, .article ol { margin: 0 0 14px; padding-left: 26px; }
.article li { margin: 4px 0; }
.article li > ul, .article li > ol { margin: 4px 0 0; }
.article strong { font-weight: 650; }
.article hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.article blockquote { margin: 0 0 14px; padding: 2px 16px; border-left: 3px solid var(--border); color: var(--muted); }
.article code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--code);
  background: var(--surface-2);
  border-radius: 3px;
  padding: 1px 5px;
  word-break: break-word;
}
.article pre {
  margin: 0 0 18px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.5;
}
.article pre code { display: block; padding: 0; background: none; font-size: 0.82rem; color: var(--text); white-space: pre; word-break: normal; }

/* A table scrolls sideways on a narrow screen rather than widen the page. */
.article table {
  display: block;
  width: 100%;
  max-width: max-content;
  overflow-x: auto;
  margin: 0 0 18px;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.article th, .article td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.article th { background: var(--surface-2); font-weight: 650; white-space: nowrap; }
.article td code { white-space: nowrap; }

.foot { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.82rem; }

/* ------------------------------------------------------------ the screens */
@media (max-width: 900px) {
  .frame { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 24px; }
  .sidebar { position: static; max-height: none; }
  .contents { border-left: none; display: flex; flex-wrap: wrap; gap: 4px 6px; }
  .contents a { border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; margin: 0; font-size: 0.8rem; }
  .contents a:hover { border-color: var(--accent); }
  .article h1 { font-size: 1.8rem; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .version-tag { display: none; }
  .frame { padding: 20px 12px 48px; }
  .article h2 { margin-top: 36px; padding-top: 22px; font-size: 1.3rem; }
}
