/* /docs/ - component reference. Builds on /style.css tokens (dark site). */

.docs-main { padding: 28px 0 64px; }
.docs-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* ---------- sidebar ---------- */
.docs-side {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.docs-search { position: relative; }
.docs-search input {
  width: 100%;
  padding: 9px 12px;
  padding-right: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.docs-search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.docs-count {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.docs-side-toggle { display: none; }
.docs-nav { overflow-y: auto; padding-right: 4px; min-height: 0; }
.docs-nav h3 {
  margin: 18px 0 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.docs-nav h3:first-child { margin-top: 4px; }
.docs-nav h3 a { color: inherit; }
.docs-nav h3 a:hover { color: var(--text); }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav li a {
  display: block;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docs-nav li a:hover { background: rgba(148, 163, 184, 0.08); }
.docs-nav li a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-hover); }
.docs-nav .docs-empty { color: var(--muted); font-size: 13px; padding: 8px 10px; }

/* ---------- content ---------- */
.docs-content { min-width: 0; }
.docs-content h1 {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.2;
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}
.docs-content h1 .docs-lib { font-size: 15px; vertical-align: middle; margin-left: 10px; }
.docs-content h2 { margin: 32px 0 12px; font-size: 19px; }
.docs-content .docs-lead { margin: 6px 0 0; color: var(--text); font-size: 16px; max-width: 72ch; }
.docs-lib {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}
.docs-crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.docs-crumbs a { color: var(--muted); }
.docs-crumbs a:hover { color: var(--text); }

.docs-note {
  margin: 14px 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-size: 14px;
}

/* code */
.docs-code { position: relative; margin: 10px 0 0; }
.docs-code pre {
  margin: 0;
  padding: 14px 16px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
}
.docs-code .copy {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}
.docs-code:hover .copy, .docs-code .copy:focus-visible { opacity: 1; }
.tok-tag { color: #7dd3fc; }
.tok-attr { color: #c4b5fd; }
.tok-str { color: #86efac; }
.tok-num { color: #fca5a5; }
.tok-punct { color: var(--muted); }

/* live preview */
.docs-preview {
  margin-top: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: #05080d;
}
.docs-preview-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.docs-preview-bar strong { color: var(--text); font-weight: 600; }
.docs-preview-frame { position: relative; aspect-ratio: 16 / 9; }
.docs-preview-frame.fit { aspect-ratio: auto; height: 220px; transition: height .2s; }
.docs-preview-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.docs-preview-start {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

/* props table */
.docs-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.docs-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.docs-table th, .docs-table td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.docs-table tr:last-child td { border-bottom: 0; }
.docs-table th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; background: var(--bg-elev); }
.docs-table td:first-child { font-family: var(--font-mono); white-space: nowrap; }
.docs-table td.type { font-family: var(--font-mono); font-size: 12.5px; color: #c4b5fd; overflow-wrap: anywhere; min-width: 160px; }
.docs-table .req { color: var(--warn); font-size: 12px; margin-left: 6px; font-family: var(--font-sans); }
.docs-table tr.base td { color: var(--muted); }
.docs-table tr.hit td { background: var(--accent-soft); }

/* overview cards */
.docs-libs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 20px; }
.docs-libcard {
  display: block;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}
.docs-libcard:hover { border-color: var(--accent); color: var(--text); }
.docs-libcard strong { font-family: var(--font-mono); font-size: 16px; }
.docs-libcard p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.docs-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.docs-grid a {
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}
.docs-grid a:hover { border-color: var(--accent); }
.docs-grid a.inherited { color: var(--muted); }

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .docs-side { position: static; max-height: none; }
  .docs-side-toggle { display: inline-flex; align-self: flex-start; }
  .docs-nav { display: none; max-height: 60vh; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; }
  .docs-side.open .docs-nav { display: block; }
  .docs-content h1 { font-size: 24px; }
}
@media (max-width: 600px) {
  .docs-main { padding-top: 16px; }
  .docs-preview-frame { aspect-ratio: 4 / 3; }
  .docs-preview-frame.fit { aspect-ratio: auto; }
}

/* ---------- sandbox ---------- */
.docs-hint { font-size: 14px; margin: -4px 0 12px; }
.docs-sandbox-tools { display: flex; gap: 8px; align-items: center; }
.docs-sandbox-tools select, .docs-knobs input, .docs-knobs select, .docs-knobs textarea {
  font: inherit; font-size: 13px; color: var(--text); background: var(--bg-elev);
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 4px 8px; min-width: 0;
}
.docs-knobs .docs-table { margin: 0; }
.docs-knobs td:first-child { width: 1%; white-space: nowrap; font-family: ui-monospace, monospace; font-size: 13px; }
.docs-knobs label { cursor: help; }
.docs-knobs input[type="text"], .docs-knobs input[type="number"], .docs-knobs select, .docs-knobs textarea { width: 100%; }
.docs-knobs textarea { font-family: ui-monospace, monospace; resize: vertical; }
.docs-knobs textarea.bad { border-color: #ef4444; }
.docs-color { display: flex; gap: 6px; align-items: center; }
.docs-color input[type="color"] { width: 32px; height: 28px; padding: 0 2px; flex: 0 0 auto; }
.docs-fixed { font-size: 12px; word-break: break-all; }
@media (max-width: 1100px) {
    }

/* ---------- sandbox: the editor (a textarea over its highlighted copy) ---------- */
.docs-knobs.off { opacity: .45; pointer-events: none; }
.docs-knobs-note { font-size: 13px; padding: 12px 14px; margin: 0; }
.docs-editor { display: grid; grid-template-columns: minmax(100%, max-content); overflow-x: auto; }
.docs-editor > pre, .docs-editor > textarea {
  grid-area: 1 / 1; margin: 0; padding: 14px 16px; border: 0; min-width: 0;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6; tab-size: 2;
  white-space: pre; overflow-wrap: normal; letter-spacing: normal;
}
.docs-editor > pre { pointer-events: none; color: var(--text); background: transparent; }
.docs-editor > textarea {
  resize: none; overflow: hidden; outline: none; background: transparent;
  color: transparent; caret-color: var(--text); -webkit-text-fill-color: transparent;
}
.docs-editor > textarea::selection { background: rgba(0, 188, 151, .3); -webkit-text-fill-color: transparent; }
.docs-error {
  margin: 0; padding: 10px 14px; border-top: 1px solid #7f1d1d; background: rgba(239, 68, 68, .1);
  color: #fca5a5; font-family: var(--font-mono); font-size: 12.5px; white-space: pre-wrap;
}
.docs-editor code { background: none; border: 0; padding: 0; font: inherit; color: inherit; }

/* ---------- sandbox: one frame, three tabs (code / props / preview) ---------- */
.docs-play { border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: var(--bg-code); }
.docs-play.bad { border-color: #7f1d1d; }
.docs-play-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 8px; border-bottom: 1px solid var(--border); background: #05080d; }
.docs-tabs { display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--bg-elev); }
.docs-tabs button {
  font: inherit; font-size: 13px; padding: 5px 14px; border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--muted);
}
.docs-tabs button:hover { color: var(--text); }
.docs-tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.docs-play.bad .docs-tabs button[data-tab-btn="code"]::after { content: " ●"; color: #ef4444; }
.docs-play-state { flex: 1 1 auto; font-size: 12.5px; color: var(--muted); }
.docs-play.bad .docs-play-state { color: #fca5a5; }
.docs-play .docs-tab { display: none; }
.docs-play[data-tab="code"] [data-tab-panel="code"],
.docs-play[data-tab="props"] [data-tab-panel="props"],
.docs-play[data-tab="preview"] [data-tab-panel="preview"] { display: block; }
.docs-play [data-tab-panel="preview"] { background: #05080d; }
.docs-play .docs-preview-frame { height: 260px; }
.docs-play .docs-preview-frame iframe.loading { visibility: hidden; }
.docs-play .docs-knobs { max-height: 560px; overflow: auto; }
.docs-play .docs-knobs .docs-table { margin: 0; border: 0; border-radius: 0; }
.docs-play .docs-editor { min-height: 160px; }
