/* ============================================================
   User docs (/docs/) — layered on top of ../styles.css, reusing its tokens.
   ============================================================ */

.docs {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 3rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

.docs-side {
  position: sticky;
  top: 5rem;
  align-self: start;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  font-size: 0.92rem;
}

.docs-side h4 {
  margin: 1.4rem 0 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs-side h4:first-child {
  margin-top: 0;
}

.docs-side ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-side li a {
  display: block;
  padding: 0.22rem 0.6rem;
  border-left: 2px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.docs-side li a:hover {
  border-left-color: var(--accent-dim);
  color: var(--accent);
}

.docs-side li a[aria-current='page'] {
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.docs-body {
  min-width: 0;
  line-height: 1.65;
}

.docs-body > section,
.docs-body section {
  max-width: none;
  margin: 0;
  padding: 0;
}

.docs-body h1 {
  font-size: clamp(2rem, 4vw, 2.6rem);
  margin: 0 0 0.6rem;
}

.docs-body h2 {
  font-size: 1.55rem;
  margin: 2.8rem 0 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 5rem;
}

.docs-body h3 {
  font-size: 1.1rem;
  margin: 1.8rem 0 0.4rem;
  scroll-margin-top: 5rem;
}

.docs-body [id] {
  scroll-margin-top: 5rem;
}

.docs-body p,
.docs-body li {
  max-width: 46rem;
}

.docs-body a {
  color: var(--accent);
}

.docs-lede {
  font-size: 1.12rem;
  color: var(--muted);
  max-width: 44rem;
}

/* Cards on the hub page */
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.8rem 0;
}

.docs-card {
  display: block;
  padding: 1.1rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text) !important;
  text-decoration: none;
}

.docs-card:hover {
  border-color: var(--accent-dim);
}

.docs-card strong {
  display: block;
  margin-bottom: 0.3rem;
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--accent);
}

.docs-card span {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Tables: node lists and "their name → our node" maps */
.docs-table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.6rem;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.docs-table th,
.docs-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.docs-table th {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg-raised);
}

.docs-table tr:target td {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.docs-table td:first-child {
  min-width: 11rem;
  font-weight: 600;
}

.docs-table code {
  font-size: 0.85em;
}

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

.docs-note {
  padding: 0.8rem 1rem;
  margin: 1.2rem 0;
  border-left: 3px solid var(--amber);
  background: var(--bg-card);
  border-radius: 0 8px 8px 0;
  max-width: 46rem;
}

@media (max-width: 820px) {
  .docs {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem 1rem 4rem;
  }

  .docs-side {
    position: static;
    max-height: none;
  }

  .docs-table td:first-child {
    min-width: 8rem;
  }
}

/* Node pages: one page per node type (generated from the registry) */
.docs-aka {
  color: var(--muted);
}

.docs-ports {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 2rem;
  max-width: 46rem;
}

.docs-ports h3 {
  margin-top: 0.4rem;
}

.docs-ports ul {
  padding-left: 1.2rem;
}

.docs-code {
  max-width: 46rem;
  overflow-x: auto;
  padding: 0.8rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.docs-code code {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: inherit;
}

.docs-shape {
  max-width: 46rem;
  margin: 1rem 0 1.4rem;
}

.docs-shape summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.92rem;
}

.docs-settings-note {
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 46rem;
}

.docs-figure {
  margin: 1rem 0 1.4rem;
  max-width: 24rem;
}

.docs-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

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

/* The live Attributes panel (docs/panel-embed.js): the app's own panel in a frame sized to it. */
.docs-panel {
  margin: 1rem 0 1.4rem;
}

.docs-panel iframe {
  display: block;
  width: 320px;
  max-width: 100%;
  border: 0;
  overflow: hidden;
}

.docs-panel .docs-figure {
  margin-top: 0;
}

.docs-panel-caption {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.docs-related {
  padding-left: 1.2rem;
  max-width: 46rem;
}

.docs-related li {
  margin: 0.3rem 0;
}

@media (max-width: 820px) {
  .docs-ports {
    grid-template-columns: 1fr;
  }
}
