/* ═══════════════════════════════════════════════════════════════
   Yggdrasil — concepts / docs layout
   Reuses tokens + components from ../styles.css. Vanilla, zero build.
   ═══════════════════════════════════════════════════════════════ */

.doc-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 52px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 100px;
  align-items: start;
}

/* ─── Sidebar ─────────────────────────────────────────── */
.doc-side { position: sticky; top: 84px; }
.doc-side__inner { max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 8px; }
.doc-side__group {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-mut); margin: 22px 0 10px; padding-left: 12px;
}
.doc-side__group:first-child { margin-top: 0; }
.doc-side a {
  display: block; color: var(--text-dim); font-size: 14.5px; padding: 8px 12px;
  border-radius: 8px; border-left: 2px solid transparent; transition: color .15s, background .15s, border-color .15s;
}
.doc-side a:hover { color: var(--text); background: var(--bg-card); }
.doc-side a[aria-current="page"] {
  color: var(--brand); background: rgba(79,209,197,.07); border-left-color: var(--brand); font-weight: 500;
}

/* ─── Mobile sidebar toggle ───────────────────────────── */
.doc-side__toggle { display: none; }

/* ─── Article ─────────────────────────────────────────── */
.doc { max-width: 768px; min-width: 0; }
.doc .crumb { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-mut); margin-bottom: 14px; }
.doc .crumb a { color: var(--text-dim); }
.doc .crumb a:hover { color: var(--brand); }
.doc h1 { font-size: clamp(30px, 4.4vw, 44px); letter-spacing: -.02em; }
.doc .doc__lede { font-size: 18px; color: var(--text-dim); margin-top: 16px; line-height: 1.6; }
.doc h2 {
  font-size: 25px; margin: 56px 0 0; padding-top: 26px; border-top: 1px solid var(--border);
  scroll-margin-top: 88px;
}
.doc h3 { font-size: 18.5px; margin: 32px 0 0; scroll-margin-top: 88px; }
.doc p { color: var(--text-dim); margin-top: 16px; line-height: 1.72; font-size: 16px; }
.doc strong { color: var(--text); font-weight: 600; }
.doc em { color: var(--text); font-style: italic; }
.doc a.link, .doc p a, .doc li a { color: var(--brand); border-bottom: 1px solid rgba(79,209,197,.3); }
.doc p a:hover, .doc li a:hover { border-color: var(--brand); }
.doc ul, .doc ol { margin: 16px 0 0; padding-left: 4px; list-style: none; }
.doc ul li, .doc ol li { color: var(--text-dim); font-size: 16px; line-height: 1.7; padding-left: 26px; position: relative; margin-top: 9px; }
.doc ul li::before { content: ""; position: absolute; left: 7px; top: 11px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); opacity: .7; }
.doc ol { counter-reset: s; }
.doc ol li { counter-increment: s; }
.doc ol li::before { content: counter(s); position: absolute; left: 2px; top: 1px; font-family: var(--font-mono); font-size: 12px; color: var(--brand); }
.doc li strong { color: var(--text); }

/* inline code + code blocks */
.doc :not(pre) > code { color: var(--brand); font-size: 13.5px; background: rgba(79,209,197,.08); padding: 1.5px 6px; border-radius: 5px; }
.codeblock {
  margin: 20px 0 0; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden;
}
.codeblock__bar { display: flex; align-items: center; gap: 7px; padding: 9px 14px; background: rgba(255,255,255,.02); border-bottom: 1px solid var(--border); }
.codeblock__bar .terminal__title { margin-left: 0; }
.codeblock pre { padding: 16px 18px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; color: var(--text); }
.codeblock pre code { color: inherit; background: none; padding: 0; font-size: inherit; }
/* yaml-ish syntax tints (reuse c-* from styles.css too) */
.t-key { color: var(--brand); } .t-str { color: var(--violet); } .t-num { color: var(--yellow); } .t-com { color: var(--text-mut); } .t-punc { color: var(--text-dim); }

/* callouts */
.callout {
  margin: 22px 0 0; padding: 14px 18px; border-radius: var(--r-sm); font-size: 14.5px; color: var(--text-dim);
  background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--brand);
}
.callout strong { color: var(--text); }
.callout--tip { border-left-color: var(--teal); }
.callout--warn { border-left-color: var(--yellow); }
.callout--note { border-left-color: var(--violet); }
.callout code { color: var(--brand); }

/* small definition grid */
.deflist { display: grid; gap: 12px; margin-top: 20px; }
.deflist__row { display: grid; grid-template-columns: 180px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.deflist__row:last-child { border-bottom: 0; }
.deflist dt { font-family: var(--font-mono); font-size: 13.5px; color: var(--brand); }
.deflist dd { color: var(--text-dim); font-size: 14.5px; margin: 0; }

/* doc tables */
.doc .table-wrap { margin-top: 22px; }
.doc table { width: 100%; border-collapse: collapse; min-width: 480px; }
.doc table th, .doc table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.doc table thead th { font-family: var(--font-head); color: var(--text); background: rgba(255,255,255,.02); }
.doc table td { color: var(--text-dim); }
.doc table code { white-space: nowrap; }

/* mini pieces grid (architecture pieces, etc.) */
.pieces { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.piece { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r); padding: 18px 18px; }
.piece h4 { font-size: 16px; }
.piece p { margin-top: 6px; font-size: 14px; }
.piece code { color: var(--brand); font-size: 12.5px; }

/* prev / next */
.doc-nav { display: flex; gap: 16px; margin-top: 60px; padding-top: 26px; border-top: 1px solid var(--border); }
.doc-nav a {
  flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 16px 18px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r); transition: border-color .2s, transform .2s, background .2s;
}
.doc-nav a:hover { border-color: var(--border-h); background: var(--bg-card-h); transform: translateY(-2px); }
.doc-nav a.is-next { text-align: right; }
.doc-nav span { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-mut); text-transform: uppercase; letter-spacing: .08em; }
.doc-nav strong { font-family: var(--font-head); font-size: 16px; color: var(--text); font-weight: 600; }
.doc-nav .spacer { flex: 1; background: none; border: 0; }
.doc-nav .spacer:hover { transform: none; }

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 880px) {
  .doc-shell { grid-template-columns: 1fr; gap: 0; padding-top: 20px; }
  .doc-side { position: static; top: auto; margin-bottom: 8px; }
  .doc-side__inner { max-height: none; padding-right: 0; }
  .doc-side__toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    font-family: var(--font-head); font-size: 15px; color: var(--text); cursor: pointer;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 16px;
  }
  .doc-side__toggle::after { content: "▾"; color: var(--text-mut); transition: transform .2s; }
  .doc-side.is-open .doc-side__toggle::after { transform: rotate(180deg); }
  .doc-side__nav { display: none; padding: 10px 4px 0; }
  .doc-side.is-open .doc-side__nav { display: block; }
  .doc { max-width: 100%; }
  .pieces { grid-template-columns: 1fr; }
  .deflist__row { grid-template-columns: 1fr; gap: 4px; }
  .doc-nav { flex-direction: column; }
}
