/* Per-component page styles. Loaded only by /docs/ pages. */

.docs-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  align-items: stretch;
}
.docs-aside-toggle { display: none; }
.docs-aside-backdrop { display: none; }

@media (max-width: 880px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-aside {
    position: fixed; top: 52px; left: 0; bottom: 0;
    width: 280px; max-width: 86vw; z-index: 90;
    background: var(--bg-0);
    border-right: 1px solid var(--border-1) !important;
    border-bottom: none !important;
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(0.25,1,0.5,1);
    box-shadow: 0 12px 28px rgba(0,0,0,0.18);
  }
  .docs-aside.open { transform: translateX(0); }
  .docs-aside-backdrop {
    display: block;
    position: fixed; inset: 52px 0 0 0; z-index: 85;
    background: color-mix(in srgb, var(--bg-0) 60%, transparent);
    opacity: 0; pointer-events: none;
    transition: opacity 220ms cubic-bezier(0.25,1,0.5,1);
  }
  .docs-aside-backdrop.open { opacity: 1; pointer-events: auto; }
  .docs-aside-toggle {
    display: inline-flex; align-items: center; gap: 10px;
    position: sticky; top: 52px; z-index: 80;
    padding: 0 16px; height: 44px;
    background: var(--bg-0); border: none;
    border-bottom: 1px solid var(--border-1);
    color: var(--fg-1); font-family: var(--font-mono); font-size: 11.5px;
    letter-spacing: 0.04em; text-transform: uppercase;
    cursor: pointer; width: 100%; justify-content: flex-start;
  }
  .docs-aside-toggle .hb-stack {
    display: inline-flex; flex-direction: column; gap: 3px;
  }
  .docs-aside-toggle .hb {
    display: block; width: 16px; height: 1.5px; background: var(--fg-2);
  }
}
.docs-aside {
  position: sticky; top: 52px; height: calc(100vh - 52px); overflow-y: auto;
  border-right: 1px solid var(--border-1); padding: 24px 18px 64px;
  font-size: 13px;
}
.docs-aside .filter {
  margin-bottom: 16px; padding: 0 0 16px; border-bottom: 1px solid var(--border-1);
}
.docs-aside .filter input {
  width: 100%; box-sizing: border-box;
  background: var(--bg-2); color: var(--fg-1);
  border: 1px solid var(--border-1); border-radius: 4px;
  padding: 6px 10px; font-family: var(--font-mono); font-size: 12px;
  outline: none; transition: border-color 140ms;
}
.docs-aside .filter input:focus { border-color: var(--accent); }

.docs-aside .nav { list-style: none; margin: 0; padding: 0; }
.docs-aside .nav .cat { margin-bottom: 18px; }
.docs-aside .nav .cat-label {
  display: block; padding: 4px 0;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--fg-2); font-weight: 600;
}
.docs-aside .nav ul { list-style: none; margin: 4px 0 0; padding: 0; }
.docs-aside .nav ul li a {
  display: block; padding: 4px 0 4px 12px; color: var(--fg-3);
  font-size: 12.5px; border-left: 1px solid var(--border-1); text-decoration: none;
  transition: color 140ms, border-color 140ms;
}
.docs-aside .nav ul li a:hover { color: var(--fg-1); border-left-color: var(--accent); opacity: 1; }
.docs-aside .nav ul li a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }

.docs-main { padding: 48px 56px 96px; max-width: 920px; min-width: 0; }
@media (max-width: 880px) { .docs-main { padding: 32px 20px 64px; } }

.page-head { margin: 0 0 40px; }
.page-head .crumbs {
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); letter-spacing: 0.04em;
  margin-bottom: 12px;
}
.page-head .crumbs a { color: var(--fg-3); text-decoration: none; }
.page-head .crumbs a:hover { color: var(--fg-1); opacity: 1; }
.page-head .crumbs .sep { color: var(--fg-4); padding: 0 4px; }
.page-head .kind {
  display: inline-block;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3); padding: 2px 6px; border: 1px solid var(--border-1); border-radius: 2px;
  margin-bottom: 12px;
}
.page-head h1 {
  font-size: 32px; font-weight: 600; letter-spacing: -0.022em; margin: 0 0 8px;
  font-family: var(--font-mono); color: var(--fg-1);
}
.page-head h1 .generics { color: var(--fg-3); font-weight: 400; font-size: 20px; }
.page-head .src { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-3); margin: 0; }

.block { margin: 0 0 36px; }
.block > h2 {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3); margin: 0 0 12px;
}
.snippet {
  background: var(--bg-2); border: 1px solid var(--border-1); border-radius: 4px;
  padding: 14px 16px; margin: 0; overflow-x: auto;
}
.snippet code { font-size: 12.5px; line-height: 1.55; color: var(--fg-1); }

/* ── Per-demo cards (render area + meta bar + collapsible code) ───────── */
.block.demos { margin-bottom: 48px; }
.block.demos > h2 { margin-bottom: 16px; }
.demo {
  border: 1px solid var(--border-1); border-radius: 4px;
  background: var(--bg-1);
  margin: 0 0 20px;
  overflow: hidden;
  transition: border-color 140ms;
}
.demo:hover { border-color: var(--border-2); }
.demo-render {
  padding: 36px 32px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-1);
  position: relative;
  min-height: 80px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  overflow-x: auto;
}
@media (max-width: 720px) { .demo-render { padding: 24px 16px; } }
.demo-meta {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 14px 18px;
  background: var(--bg-1);
}
@media (max-width: 720px) {
  .demo-meta { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
}
.demo-meta-text { flex: 1; min-width: 0; }
.demo-meta-text h3 {
  margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--fg-1);
  font-family: var(--font-sans); letter-spacing: -0.005em;
}
.demo-meta-text p { margin: 0; color: var(--fg-3); font-size: 12px; line-height: 1.5; }
.demo-meta-actions {
  display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap;
}
.demo-action {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; color: var(--fg-3);
  border: 1px solid var(--border-1); border-radius: 4px;
  padding: 4px 10px; font-family: var(--font-mono); font-size: 11px;
  cursor: pointer; text-decoration: none;
  transition: background 140ms cubic-bezier(0.25,1,0.5,1), color 140ms, border-color 140ms;
}
.demo-action:hover {
  background: var(--bg-2); color: var(--fg-1);
  border-color: var(--border-2); opacity: 1;
}
.demo-code {
  border-top: 1px solid var(--border-1);
  background: var(--bg-2);
  padding: 16px 20px;
  overflow-x: auto;
}
.demo-code[hidden] { display: none; }
.demo-code pre { margin: 0; }
.demo-code code {
  font-family: var(--font-mono); font-size: 12.5px;
  color: var(--fg-1); line-height: 1.55; white-space: pre;
}

/* Charts: peer-dep list (live preview now renders via window.RCSCharts). */
ul.peer-deps {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
ul.peer-deps li code {
  font-family: var(--font-mono); font-size: 12px; color: var(--fg-2);
  padding: 6px 10px; background: var(--bg-2); border: 1px solid var(--border-1); border-radius: 4px;
  display: inline-block;
}

table.props { width: 100%; border-collapse: collapse; border: 1px solid var(--border-1); border-radius: 4px; overflow: hidden; }
table.props th, table.props td {
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border-1);
  font-size: 13px; vertical-align: top;
}
table.props thead th {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--fg-3); font-weight: 500; background: var(--bg-2);
}
table.props tr:last-child td { border-bottom: none; }
table.props td code { font-family: var(--font-mono); font-size: 12.5px; }
table.props td:first-child { width: 38%; white-space: nowrap; }
table.props td:first-child code { color: var(--accent); }
table.props .req {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 2px;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase;
}

.inherits { margin: 0 0 12px; font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-3); }
.inherits code { color: var(--fg-2); }

.empty, .muted {
  color: var(--fg-3); font-size: 13px; margin: 0;
  padding: 14px 16px; background: var(--bg-2); border: 1px solid var(--border-1); border-radius: 4px;
}

.related { margin: 48px 0 0; }
.related > h2 { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3); margin: 0 0 16px; }
.type-card { margin: 0 0 16px; border: 1px solid var(--border-1); border-radius: 4px; background: var(--bg-1); overflow: hidden; }
.type-card header { padding: 10px 14px; background: var(--bg-2); border-bottom: 1px solid var(--border-1); display: flex; align-items: baseline; gap: 10px; }
.type-card header .kind {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3); padding: 2px 6px; border: 1px solid var(--border-1); border-radius: 2px;
}
.type-card header h3 { margin: 0; font-size: 14px; font-weight: 600; font-family: var(--font-mono); color: var(--fg-1); }
.err { color: #FF5A5F; padding: 14px; font-family: var(--font-mono); font-size: 12px; background: var(--bg-2); border-radius: 4px; white-space: pre-wrap; }

html { scroll-behavior: smooth; }
