/* The dochouse panel: an in-SPA docs reader. Two columns — a sticky
 * section rail and the article (.docs-article, styled in docs.css).
 * dochouse.js fetches /docs fragments and fills both. Tokens from
 * themes/labrador.css; no hex literals. */

.dochouse {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  /* A little breathing room so the masthead / rail don't crash into the
     topbar on load. */
  padding-top: 16px;
}

/* The first heading of a freshly-swapped article shouldn't crash into
   the topbar on a deep-link load. */
.dochouse-article > :first-child,
.docs-article > :first-child {
  margin-top: 0;
}

/* --- section rail ------------------------------------------------------ */
.dochouse-rail {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 14px;
  background: linear-gradient(180deg, var(--surface-drawer-top), var(--surface-drawer-bot));
  border: 1px solid var(--line);
  border-radius: 14px;
}

.dochouse-rail-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
/* The little house-of-docs glyph — CSS, not an emoji asset. A stacked
   "book spine" mark in the brand gold. */
/* The little house-of-docs glyph — CSS, not an emoji asset. Banded
   purple -> cyan -> green as a nod to the Code Puppy wordmark we're
   riffing on. Blocky on purpose. */
.dochouse-rail-ico {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  flex: 0 0 auto;
  background: linear-gradient(
    180deg,
    #b3a8f0 0%,
    #b3a8f0 33%,
    #7ef0f5 33%,
    #7ef0f5 66%,
    #8ee6a0 66%,
    #8ee6a0 100%
  );
  box-shadow: 0 0 10px rgba(126, 240, 245, 0.35);
}

.dochouse-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dochouse-nav-item {
  padding: 8px 11px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  border-left: 2px solid transparent;
  transition:
    background 0.12s,
    color 0.12s;
}
.dochouse-nav-item:hover {
  background: rgba(var(--slate-rgb), 0.18);
  color: var(--text);
}
.dochouse-nav-item.current {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent-bright);
  border-left-color: var(--accent);
}

/* Skeleton bars shown before the first fetch resolves. */
.dochouse-nav-skel {
  height: 32px;
  border-radius: 8px;
  background: rgba(var(--slate-rgb), 0.12);
  opacity: 0.6;
}

.dochouse-rail-foot {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-soft);
}
.dochouse-rail-foot code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(var(--accent-rgb), 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent);
}

/* --- article column ---------------------------------------------------- */
.dochouse-main {
  min-width: 0;
}

/* ASCII masthead — the Code Puppy wordmark riff. Banded purple -> cyan ->
   green via background-clip text so the glyphs carry the lineage gradient.
   Scrolls horizontally on narrow screens rather than wrapping (wrapping
   box-drawing art is a war crime). */
.dochouse-banner {
  margin: 0 0 2px;
  font-family: var(--font-mono);
  font-size: clamp(5px, 1.05vw, 11px);
  line-height: 1.15;
  font-weight: 700;
  white-space: pre;
  overflow-x: auto;
  background: linear-gradient(180deg, #b3a8f0 0%, #7ef0f5 52%, #8ee6a0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.dochouse-banner-sub {
  margin: 0 0 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.dochouse-loading {
  color: var(--text-soft);
  font-size: 14px;
}

/* --- narrow screens: rail collapses above the article ------------------ */
@media (max-width: 760px) {
  .dochouse {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .dochouse-rail {
    position: static;
  }
  .dochouse-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
