/* ------------------------------------------------------------------ *
   Nodez wiki - getnodez.app/wiki
   Layers on styles.css and uses its tokens. No new palette.
   Generated pages; see nodez-app/scripts/build-wiki.mjs.
 * ------------------------------------------------------------------ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Sidebar + column. The reading column is capped near --text-col: long-form
   prose stays readable, while tables and code blocks may exceed it. */
.wiki-shell {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 3.5rem;
  align-items: start;
  padding-top: 3rem;
  padding-bottom: 5rem;
}

.wiki-side {
  position: sticky;
  top: 5.5rem;
  max-height: calc(100dvh - 7rem);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.wiki-search input {
  width: 100%;
  padding: 0.5rem 0.7rem;
  color: var(--fg);
  font: inherit;
  font-size: 0.875rem;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
}

.wiki-search input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.wiki-nav {
  margin-top: 1.5rem;
}

.wiki-nav-group + .wiki-nav-group {
  margin-top: 1.5rem;
}

.wiki-nav-group h2 {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wiki-nav ul,
.wiki-results {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wiki-nav a {
  display: block;
  padding: 0.3rem 0.7rem;
  margin-left: -0.7rem;
  color: var(--fg-dim);
  font-size: 0.9375rem;
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.wiki-nav a:hover {
  color: var(--fg);
  background: var(--accent-wash);
}

.wiki-nav a[aria-current="page"] {
  color: var(--fg);
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-wash);
}

.wiki-results {
  margin-top: 1.5rem;
}

.wiki-results a {
  display: block;
  padding: 0.5rem 0;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.wiki-results strong {
  display: block;
  color: var(--fg);
  font-size: 0.9375rem;
}

.wiki-results span {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.wiki-empty {
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------------------------------------------------------------- Index */

.wiki-hero {
  max-width: var(--text-col);
  margin-bottom: 3.5rem;
}

.wiki-hero h1 {
  margin: 0.5rem 0 0.75rem;
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.1;
}

.wiki-lede {
  max-width: var(--text-col);
  color: var(--fg-dim);
  font-size: 1.0625rem;
  line-height: 1.65;
}

/* styles.css gives every <section> a page-band padding of up to 5.5rem top and
   bottom, which is right for the landing page's full-width bands and far too
   much between list sections in a document column. Spacing is set here instead. */
.wiki-section {
  padding: 0;
}

.wiki-section + .wiki-section {
  margin-top: 2.75rem;
}

.wiki-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.wiki-cards a {
  display: block;
  height: 100%;
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.wiki-cards a:hover {
  border-color: var(--rule-strong);
  transform: translateY(-2px);
}

.wiki-cards h3 {
  margin: 0 0 0.35rem;
  color: var(--fg);
  font-family: var(--display);
  font-size: 1.0625rem;
}

.wiki-cards p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.wiki-note {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  color: var(--muted);
  font-size: 0.9375rem;
  border-top: 1px solid var(--rule);
}

/* --------------------------------------------------------------- Article */

.wiki-crumb {
  color: var(--muted);
  font-size: 0.8125rem;
}

.wiki-crumb a {
  color: var(--muted);
}

.wiki-article h1 {
  margin: 0.4rem 0 0.6rem;
  font-family: var(--display);
  font-size: clamp(1.75rem, 3.5vw, 2.4rem);
  line-height: 1.15;
}

.wiki-toc {
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}

.wiki-toc h2 {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wiki-toc ul {
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 2rem;
  list-style: none;
}

.wiki-toc li {
  break-inside: avoid;
}

.wiki-toc a {
  display: block;
  padding: 0.15rem 0;
  color: var(--fg-dim);
  font-size: 0.875rem;
  text-decoration: none;
}

.wiki-toc a:hover {
  color: var(--fg);
}

.wiki-body {
  max-width: var(--text-col);
}

.wiki-body > * {
  margin-top: 0;
  margin-bottom: 1.1rem;
}

.wiki-body h2 {
  margin: 2.5rem 0 0.9rem;
  font-family: var(--display);
  font-size: 1.4rem;
  line-height: 1.25;
  scroll-margin-top: 5.5rem;
}

.wiki-body h3 {
  margin: 2rem 0 0.6rem;
  font-family: var(--display);
  font-size: 1.0625rem;
}

/* Anchor stays out of the way until the heading is hovered or it is focused. */
.wiki-body .anchor {
  margin-left: 0.4rem;
  color: var(--muted);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}

.wiki-body h2:hover .anchor,
.wiki-body .anchor:focus-visible {
  opacity: 1;
}

.wiki-body p,
.wiki-body li {
  color: var(--fg-dim);
}

.wiki-body ul,
.wiki-body ol {
  padding-left: 1.25rem;
}

.wiki-body li + li {
  margin-top: 0.35rem;
}

.wiki-body strong {
  color: var(--fg);
}

.wiki-body code {
  padding: 0.12em 0.36em;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: 5px;
}

/* Code and tables may exceed the reading column; they scroll inside
   themselves rather than pushing the page sideways. */
.wiki-body pre {
  max-width: min(100%, 46rem);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}

.wiki-body pre code {
  padding: 0;
  color: var(--fg-dim);
  font-size: 0.8125rem;
  line-height: 1.6;
  background: none;
  border: 0;
}

.wiki-table-scroll,
.wiki-body table {
  display: block;
  max-width: min(100%, 52rem);
  overflow-x: auto;
}

.wiki-body table {
  width: max-content;
  min-width: min(100%, 30rem);
  border-collapse: collapse;
  font-size: 0.875rem;
}

.wiki-body th,
.wiki-body td {
  padding: 0.55rem 0.9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.wiki-body th {
  color: var(--fg);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.wiki-body td {
  color: var(--fg-dim);
}

.wiki-body blockquote {
  margin-left: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  border-left: 2px solid var(--rule-strong);
}

.wiki-body hr {
  height: 1px;
  margin: 2.5rem 0;
  background: var(--rule);
  border: 0;
}

.wiki-updated {
  margin-top: 3rem;
  padding-top: 1.25rem;
  color: var(--muted);
  font-size: 0.8125rem;
  border-top: 1px solid var(--rule);
}

.wiki-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 2rem;
}

.wiki-pager a {
  padding: 0.9rem 1.1rem;
  color: var(--fg);
  text-decoration: none;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  transition: border-color 0.2s var(--ease);
}

.wiki-pager a:hover {
  border-color: var(--rule-strong);
}

.wiki-pager .next {
  text-align: right;
}

.wiki-pager span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (max-width: 60rem) {
  .wiki-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    /* The long index no longer sits under the bar, so the band tightens. */
    padding-top: 1.25rem;
  }

  /* The sidebar's parts are separated on mobile rather than stacked as one
     block: search is a single compact row and stays at the top, but the index
     is ten links tall and would push the article off the first screen, so it
     moves below it. display:contents promotes the three children into the
     page grid, where order can place them independently. */
  .wiki-side {
    display: contents;
  }

  .wiki-search {
    order: 1;
  }

  .wiki-results {
    order: 2;
    margin-top: 0;
  }

  .wiki-main {
    order: 3;
  }

  .wiki-nav {
    order: 4;
    display: grid;
    /* Two columns wherever they fit, so the index is not a ten-row wall. */
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: 1.5rem 1rem;
    margin-top: 0;
    padding-top: 1.75rem;
    border-top: 1px solid var(--rule);
  }

  .wiki-nav-group + .wiki-nav-group {
    margin-top: 0;
  }

  .wiki-toc ul {
    columns: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wiki-cards a,
  .wiki-body .anchor,
  .wiki-pager a {
    transition: none;
  }

  .wiki-cards a:hover {
    transform: none;
  }
}
