/* mac4dstem.com — the documentation pages (docs/). Loaded after site.css and built on its tokens.
   The pages are generated by tools/build_docs.py from docs-src/. */

.docs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 2.5rem;
  padding-bottom: 3rem;
}

@media (min-width: 54rem) {
  .docs { grid-template-columns: 14rem minmax(0, 1fr); align-items: start; }
}

/* ---- sidebar: a source list ---- */

.docs-nav {
  padding-top: clamp(1.25rem, 4vw, 2rem);
  font-size: 0.9rem;
}

@media (min-width: 54rem) {
  .docs-nav {
    position: sticky;
    top: 3.4rem;
    padding-top: clamp(2.25rem, 6vw, 4rem);
    max-height: calc(100vh - 3.4rem);
    overflow-y: auto;
  }
}

.docs-nav ul { list-style: none; margin: 0 0 0.9rem; padding: 0; }

.docs-nav a {
  display: block;
  padding: 0.28rem 0.6rem;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
}

.docs-nav a:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }

.docs-nav a[aria-current="page"] {
  background: var(--accent);
  color: var(--on-accent);
}

.docs-nav a[aria-current="true"] { color: var(--accent); font-weight: 600; }

.docs-sections { padding-bottom: 0.75rem !important; border-bottom: 1px solid var(--hair); }
.docs-sections:last-child { padding-bottom: 0 !important; border-bottom: 0; }

.docs-group, .docs-version {
  padding-inline: 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.25rem;
}

.docs-version { font-weight: 400; margin-top: 1.25rem; }

/* On a phone the sidebar is a wrapping row above the page. */
@media (max-width: 53.99rem) {
  .docs-nav { border-bottom: 1px solid var(--hair); padding-bottom: 0.75rem; }
  .docs-nav ul { display: flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; margin-bottom: 0.5rem; }
  .docs-version { margin-top: 0.5rem; }
}

/* ---- the page ---- */

.docs .doc { max-width: 46rem; }
.docs .doc h2 { font-size: 1.25rem; margin-top: 2.6rem; scroll-margin-top: 4.5rem; }
.docs .doc h2:first-of-type { margin-top: 2.6rem; }
.docs .doc h3 { font-size: 1rem; font-weight: 600; margin: 1.6rem 0 0.4rem; }
.docs .doc p, .docs .doc ul, .docs .doc ol { max-width: 66ch; }
.docs .doc ol { margin: 0 0 1rem; padding-left: 1.3rem; color: var(--muted); }
.docs .doc ol li { margin-bottom: 0.55rem; padding-left: 0.2rem; }
.docs .doc ol li::marker { color: var(--ink); font-weight: 600; }

.docs .doc .kicker {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.35rem;
}

/* The name of a control, as the app writes it. */
.docs .ui { color: var(--ink); font-weight: 600; white-space: nowrap; }
/* A long control name (a Settings path) may break on a phone instead of widening the page. */
@media (max-width: 40rem) { .docs p .ui, .docs li .ui { white-space: normal; } }

.docs kbd {
  font-family: var(--sans);
  font-size: 0.85em;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: 5px;
  padding: 0.05rem 0.35rem;
  white-space: nowrap;
}

.docs code {
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--ink);
}

/* What a tutorial needs and gives, at its top. */
.docs .facts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 2rem;
}

.docs .facts-row div { background: var(--panel); padding: 0.7rem 0.9rem; }
.docs .facts-row dt { font-size: 0.75rem; color: var(--muted); margin: 0; }
.docs .facts-row dd { margin: 0.1rem 0 0; font-size: 0.92rem; color: var(--ink); }
.docs dl.facts-row { padding: 0; }

.docs .callout p { color: var(--muted); max-width: none; }
.docs .callout strong:first-child { display: block; margin-bottom: 0.15rem; }

/* ---- tables: grouped panels ---- */

.docs .tablewrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  margin: 0 0 1.5rem;
}

.docs table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.docs th, .docs td { text-align: left; vertical-align: top; padding: 0.6rem 0.9rem; }
.docs th { font-size: 0.75rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--hair); white-space: nowrap; }
.docs td { color: var(--muted); border-top: 1px solid var(--hair); }
.docs tbody tr:first-child td { border-top: 0; }
.docs td:first-child { color: var(--ink); font-weight: 600; }
.docs td.plain:first-child { font-weight: 400; }

/* ---- overview cards ---- */

.docs .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
  max-width: none;
}

.docs .cards li { margin: 0; }

.docs .cards a {
  display: block;
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.docs .cards a:hover { border-color: var(--accent); }
.docs .cards strong { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 0.2rem; }

/* ---- previous / next ---- */

.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hair);
}

.docs-pager a { text-decoration: none; font-weight: 600; }
.docs-pager a span { display: block; font-size: 0.75rem; font-weight: 400; color: var(--muted); }
.docs-pager .next { margin-left: auto; text-align: right; }

/* ---- the version a page applies to ---- */

.docs .docs-applies {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 0.1rem 0.65rem;
  margin: 0 0 1.25rem;
}

/* ---- Markdown's own elements ---- */

.docs .doc h1 { margin-bottom: 0.6rem; }
.docs .doc h3, .docs .doc h4 { scroll-margin-top: 4.5rem; }
.docs .doc .lede { margin-bottom: 1.75rem; }
.docs .doc img { max-width: 100%; height: auto; border-radius: 6px; }
.docs .doc hr { border: 0; border-top: 1px solid var(--hair); margin: 2rem 0; }
.docs .doc li > ul, .docs .doc li > ol { margin-top: 0.45rem; }
.docs .doc ol li > p { margin-bottom: 0.5rem; }

.docs .doc blockquote {
  margin: 0 0 1rem;
  padding-left: 1rem;
  border-left: 3px solid var(--hair);
}

.docs pre {
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin: 0 0 1.25rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

.docs pre code { font-size: inherit; }

.docs .doc figure { margin: 0 0 1.5rem; }
.docs .doc figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }

/* A note, a tip or a warning (Markdown: `!!! note "Title"`). */
.docs .admonition {
  background: var(--panel);
  border: 1px solid var(--hair);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin: 0 0 1.25rem;
  max-width: 66ch;
}

.docs .admonition.warning { border-left-color: #FF9F0A; }
.docs .admonition p { margin-bottom: 0.4rem; max-width: none; }
.docs .admonition p:last-child { margin-bottom: 0; }
.docs .admonition-title { color: var(--ink); font-weight: 600; }

.docs td code, .docs td .ui { white-space: nowrap; }
