/* ───────────────────────────────────────────────────────────────
   Local Test — documentation page

   Layout only. Every color, font, and spacing token comes from
   styles.css so the page follows the light/dark theme system.

   1. Page frame   2. Contents list   3. Prose   4. Tables
   5. Code         6. Callouts        7. Errors  8. Wide layout
   ─────────────────────────────────────────────────────────────── */

/* ─── 1. Page frame ─────────────────────────────────────────── */
.doc {
  width: 100%;
  max-width: var(--col);
  margin-inline: auto;
  padding: clamp(2rem, 6vw, 3.4rem) var(--pad) 0;
}

.doc-head { margin-bottom: .4rem; }

.eyebrow {
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .55rem;
}

.doc-head h1 {
  font-size: clamp(2.1rem, 5.5vw, 2.8rem);
  margin-bottom: .55rem;
}

.doc-lede { font-size: 1.05rem; }

/* ─── 2. Contents list ──────────────────────────────────────── */
.toc {
  margin: 2rem 0 0;
  padding: 1rem 1.15rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
}

.toc-title {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .5rem;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
  display: flex;
  gap: .6rem;
  margin: 0;
}

.toc li::before {
  content: counter(toc, decimal-leading-zero);
  flex: none;
  padding-top: .35rem;
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--ink-3);
}

.toc a {
  display: block;
  padding: .35rem 0;
  min-height: 24px;
  font-size: .93rem;
  color: var(--ink-2);
  text-decoration: none;
}
.toc a:hover { color: var(--accent); }

/* ─── 3. Prose ──────────────────────────────────────────────── */
.doc-body section { padding-top: clamp(2.2rem, 5vw, 3.1rem); }

.doc-body h2,
.doc-body h3 { scroll-margin-top: calc(var(--nav-h, 3.6rem) + 1rem); }

.doc-body h2 { margin-top: 0; }

.doc-body h3 {
  font-size: 1.06rem;
  margin: 2.1rem 0 .5rem;
}

.doc-body h4 {
  font-family: var(--sans);
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  margin: 1.6rem 0 .4rem;
}

/* The permalink is small type by design, so the target is widened around it
   rather than by growing the glyph. */
.anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  margin-left: .1rem;
  vertical-align: middle;
  font-family: var(--mono);
  font-size: .68em;
  color: var(--ink-3);
  text-decoration: none;
  opacity: .6;
}
.anchor:hover,
.anchor:focus-visible { color: var(--accent); opacity: 1; }

.doc-body ul,
.doc-body ol {
  margin: 0 0 1.1em;
  padding-left: 1.25rem;
}
.doc-body li { margin-bottom: .45em; }
.doc-body li:last-child { margin-bottom: 0; }

.doc-body ol.steps-num {
  padding-left: 1.4rem;
}

.tight { margin-bottom: .5em; }

.aside {
  font-size: .93rem;
  color: var(--ink-3);
}

/* ─── 4. Tables ─────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.5rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dtable {
  width: 100%;
  min-width: 30rem;
  border-collapse: collapse;
  font-size: .92rem;
}

.dtable caption {
  caption-side: top;
  text-align: left;
  padding: .75rem .9rem .2rem;
  font-size: .86rem;
  color: var(--ink-3);
}

.dtable th,
.dtable td {
  padding: .58rem .9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.dtable thead th {
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.dtable tbody th {
  font-weight: 500;
  color: var(--ink);
  width: 32%;
}

.dtable tbody tr:last-child th,
.dtable tbody tr:last-child td { border-bottom: 0; }

.dtable td { color: var(--ink-2); }

.dtable .def {
  font-family: var(--mono);
  font-size: .84em;
  color: var(--ink);
  white-space: nowrap;
}

kbd {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink);
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: .1em .4em;
  white-space: nowrap;
}

/* ─── 5. Code ───────────────────────────────────────────────── */
.code {
  margin: 0 0 1.35rem;
  padding: .85rem 1rem;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .84rem;
  line-height: 1.75;
  color: var(--ink);
}
.code:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.code code {
  background: none;
  padding: 0;
  font-size: inherit;
}
.code .c { color: var(--ink-3); }

/* ─── 6. Callouts ───────────────────────────────────────────── */
/* The stripe uses --ink-3 rather than a pastel: the pastels are fills,
   and a 3px pastel stroke disappears against the dark palette. */
.callout {
  margin: 0 0 1.35rem;
  padding: .85rem 1.1rem;
  font-size: .95rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink-3);
  border-radius: 0 10px 10px 0;
}
.callout p:last-child { margin-bottom: 0; }

/* ─── 7. Troubleshooting entries ────────────────────────────── */
.entry { margin-bottom: 1.9rem; }
.entry:last-child { margin-bottom: 0; }

.err {
  margin: 0 0 .7rem;
  padding: .6rem .85rem;
  background: var(--code-bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-family: var(--mono);
  font-size: .85rem;
  line-height: 1.65;
  color: var(--ink);
  overflow-x: auto;
}

.entry p { margin-bottom: .6em; }
.entry p:last-child { margin-bottom: 0; }

.label {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ─── 8. Wide layout: sticky contents beside the column ─────── */
@media (min-width: 1100px) {
  .doc {
    max-width: calc(var(--col) + 14rem + 3rem + 2 * var(--pad));
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    column-gap: 3rem;
  }

  .doc-head { grid-column: 2; grid-row: 1; }
  .doc-body { grid-column: 2; grid-row: 2; }

  .toc {
    grid-column: 1;
    grid-row: 1 / span 2;
    position: sticky;
    top: calc(var(--nav-h, 3.6rem) + 1.4rem);
    align-self: start;
    max-height: calc(100vh - var(--nav-h, 3.6rem) - 3rem);
    overflow-y: auto;
    margin: 0;
    padding: .1rem 0 .1rem 1.05rem;
    background: none;
    border: 0;
    border-left: 1px solid var(--rule);
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toc a,
  .anchor { transition: none; }
}
