/* PopDEX Creators Docs — documentation layout (GitBook-style) on top of popdex-ui.css + site.css */

body { overflow-x: hidden; }
.docs-shell { position: relative; z-index: 1; display: grid; grid-template-columns: 264px minmax(0, 1fr) 220px; gap: 0; max-width: 1360px; margin: 0 auto; padding: 0 24px; }

/* top bar — shared .site-top chrome; docs adds the search in the middle */
.docs-top { max-width: none; }
.docs-top .search { flex: 1; max-width: 420px; }
.menu-btn { display: none; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer; place-items: center; margin-right: 2px; }
.search { position: relative; }
.search input { width: 100%; background: rgba(14,14,18,0.6); border: 1px solid rgba(255,255,255,0.10); border-radius: 12px; padding: 10px 36px 10px 38px; font-size: 14px; font-weight: 500; color: var(--text); outline: none; transition: border-color 160ms ease, box-shadow 160ms ease; }
.search input::placeholder { color: var(--dim); font-weight: 400; }
.search input:focus { border-color: var(--brand-soft); box-shadow: var(--ring); }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--dim); pointer-events: none; }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: inherit; font-size: 11px; color: var(--dim); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; background: var(--panel-2); }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: 60vh; overflow: auto; background: rgba(20,21,24,0.97); border: 1px solid rgba(128,119,255,0.3); border-radius: 14px; padding: 6px; box-shadow: 0 20px 50px -20px rgba(0,0,0,0.9); backdrop-filter: blur(14px); display: none; }
.search-results.is-on { display: block; }
.search-results a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); font-size: 14px; font-weight: 600; }
.search-results a small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.4; }
.search-results a small mark { background: rgba(128,119,255,0.28); color: #fff; border-radius: 3px; padding: 0 2px; }
.search-results a:hover, .search-results a.is-active { background: rgba(77,66,252,0.16); }
.search-results .empty { padding: 12px; color: var(--dim); font-size: 13px; }

/* sidebar */
.sidebar { position: sticky; top: 76px; align-self: start; height: calc(100vh - 76px); overflow-y: auto; padding: 8px 20px 40px 0; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.sidebar .group { margin-top: 22px; }
.sidebar .group:first-child { margin-top: 6px; }
.sidebar .group > .pd-caption { padding: 0 12px 8px; }
.sidebar a { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--muted); transition: background 140ms ease, color 140ms ease; border-left: 2px solid transparent; }
.sidebar a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.sidebar a.is-active { color: #fff; background: rgba(77,66,252,0.16); border-left-color: var(--brand-soft); font-weight: 700; }
.sidebar a .pd-pill { margin-left: auto; font-size: 9.5px; padding: 2px 5px; }
.sidebar .back { margin-bottom: 8px; font-size: 13px; color: var(--brand-tint); }

/* content */
.content { padding: 8px 40px 80px; min-width: 0; }
.doc { display: none; }
.doc.is-active { display: block; animation: pd-rise 500ms var(--ease) both; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--dim); letter-spacing: 0.04em; margin-bottom: 14px; }
.crumbs span + span::before { content: "/"; margin-right: 8px; color: var(--line-2); }
.doc h1 { font-size: clamp(28px, 3.4vw, 38px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 12px; }
.doc h1 em { font-style: normal; color: var(--brand-soft); }
.doc .lead { font-size: 17px; line-height: 1.6; color: var(--muted); margin: 0 0 28px; max-width: 680px; }
.doc h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; margin: 44px 0 12px; padding-top: 12px; scroll-margin-top: 90px; position: relative; }
.doc h2:first-of-type { margin-top: 28px; }
.doc h2 a.anchor { position: absolute; left: -22px; top: 12px; color: var(--dim); opacity: 0; font-weight: 400; transition: opacity 140ms ease; }
.doc h2:hover a.anchor { opacity: 1; }
.doc h3 { font-size: 16.5px; font-weight: 700; margin: 26px 0 8px; scroll-margin-top: 90px; }
.doc p, .doc li { font-size: 15px; line-height: 1.65; color: var(--muted); }
.doc p { margin: 0 0 14px; }
.doc p strong, .doc li strong { color: var(--text); font-weight: 600; }
.doc ul, .doc ol { padding-left: 22px; margin: 0 0 16px; }
.doc li { margin: 6px 0; }
.doc li::marker { color: var(--brand-soft); }
.doc a:not(.pd-btn):not(.anchor):not(.card-link) { color: var(--brand-tint); border-bottom: 1px solid rgba(189,185,255,0.3); }
.doc a:not(.pd-btn):not(.anchor):not(.card-link):hover { color: #fff; border-bottom-color: #fff; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.doc code:not(.pd-code) { font-family: var(--font-mono); font-size: 0.88em; color: var(--brand-tint); background: rgba(128,119,255,0.12); border: 1px solid rgba(128,119,255,0.25); border-radius: 6px; padding: 1px 6px; }

/* tables */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; margin: 12px 0 22px; font-size: 14px; border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; overflow: hidden; background: rgba(14,14,18,0.45); }
.tbl th { text-align: left; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); background: rgba(20,21,26,0.5); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,0.05); color: var(--muted); vertical-align: top; line-height: 1.5; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child { color: var(--text); font-weight: 600; }
.tbl .num, .tbl td.num, .tbl th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tbl tr.total td { color: var(--text); font-weight: 700; background: rgba(77,66,252,0.10); }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* callouts */
.callout { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 14px 16px; border-radius: 14px; margin: 18px 0; border: 1px solid rgba(128,119,255,0.3); background: rgba(77,66,252,0.10); }
.callout svg { width: 18px; height: 18px; margin-top: 2px; color: var(--brand-tint); }
.callout p { margin: 0; font-size: 14px; }
.callout p + p { margin-top: 8px; }
.callout b { color: var(--text); }
.callout--warn { border-color: rgba(245,196,107,0.35); background: rgba(245,196,107,0.08); }
.callout--warn svg { color: var(--warning); }
.callout--ok { border-color: rgba(23,167,129,0.4); background: rgba(23,167,129,0.10); }
.callout--ok svg { color: var(--success-light); }
.callout--err { border-color: rgba(240,50,119,0.35); background: rgba(240,50,119,0.08); }
.callout--err svg { color: #ff7aa8; }

/* formula & code */
.fx { font-family: var(--font-mono); font-size: 14px; line-height: 1.8; padding: 16px 18px; border-radius: 14px; background: rgba(14,14,18,0.65); border: 1px solid rgba(255,255,255,0.08); color: var(--text); margin: 14px 0 18px; overflow-x: auto; }
.fx b { color: var(--brand-tint); font-weight: 600; }
.fx .c { color: var(--dim); }
.fx sub { font-size: 0.7em; color: var(--muted); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 16px; font-size: 14px; margin: 10px 0 18px; }
.kv dt { font-family: var(--font-mono); color: var(--brand-tint); font-size: 13px; }
.kv dd { margin: 0; color: var(--muted); }

/* stat row & cards */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 24px; }
.stat-row .tile .pd-caption { font-size: 10.5px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.card-link { display: block; padding: 16px 18px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.08); background: rgba(14,14,18,0.45); color: var(--text); transition: border-color 160ms ease, background 160ms ease, transform 200ms var(--ease); }
.card-link:hover { border-color: var(--brand-soft); background: rgba(77,66,252,0.12); transform: translateY(-2px); }
.card-link b { display: block; font-size: 15px; margin-bottom: 4px; }
.card-link span { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* timeline */
.tl { list-style: none; padding: 0; margin: 14px 0 22px; display: grid; gap: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 9px; top: 12px; bottom: 12px; width: 2px; background: linear-gradient(180deg, var(--brand-soft), rgba(128,119,255,0.1)); }
.tl li { position: relative; padding: 8px 0 14px 34px; margin: 0; }
.tl li::before { content: ""; position: absolute; left: 3px; top: 15px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 3px solid var(--brand-soft); box-shadow: 0 0 12px rgba(128,119,255,0.6); }
.tl li.done::before { border-color: var(--success); box-shadow: 0 0 12px rgba(23,167,129,0.6); }
.tl li b { display: block; color: var(--text); font-size: 15px; }
.tl li .when { font-family: var(--font-mono); font-size: 12px; color: var(--brand-tint); }
.tl li p { margin: 4px 0 0; font-size: 14px; }

/* band table tag */
.tagc { display: inline-grid; place-items: center; min-width: 40px; height: 26px; padding: 0 8px; border-radius: 7px; font-weight: 800; font-size: 12px; color: #fff; }
.tagc.star { background: linear-gradient(180deg, #8077ff, #4d42fc); } .tagc.a { background: #5b52e6; } .tagc.b { background: #4b45b8; } .tagc.c { background: #3d3a8e; } .tagc.d { background: #322f6a; } .tagc.e { background: transparent; border: 1px dashed var(--line-2); color: var(--muted); }

/* prev / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { display: grid; gap: 4px; padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.08); background: rgba(14,14,18,0.45); color: var(--text); transition: border-color 160ms ease, background 160ms ease; }
.pager a:hover { border-color: var(--brand-soft); background: rgba(77,66,252,0.12); }
.pager a.next { text-align: right; }
.pager a small { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.pager a b { font-size: 15px; }
.pager a:empty { visibility: hidden; }

/* right toc */
.toc { position: sticky; top: 76px; align-self: start; padding: 14px 0 0 24px; font-size: 13px; max-height: calc(100vh - 76px); overflow: auto; }
.toc .pd-caption { margin-bottom: 10px; }
.toc a { display: block; padding: 5px 0 5px 12px; color: var(--dim); border-left: 1px solid var(--line); line-height: 1.4; transition: color 140ms ease, border-color 140ms ease; }
.toc a:hover { color: var(--text); }
.toc a.is-active { color: var(--brand-tint); border-left-color: var(--brand-soft); }
.toc .meta { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; line-height: 1.6; }


/* responsive */
@media (max-width: 1180px) { .docs-shell { grid-template-columns: 240px minmax(0, 1fr); } .toc { display: none; } .content { padding: 8px 0 80px 32px; } }
@media (max-width: 860px) {
  .docs-shell { grid-template-columns: 1fr; padding: 0 16px; }
  .menu-btn { display: grid; }
  .search { max-width: none; }
  .search kbd { display: none; }
  .docs-top .site-top-right { display: none; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); height: 100vh; z-index: 40; background: rgba(13,13,16,0.98); border-right: 1px solid var(--line); padding: 20px 16px 40px; transform: translateX(-104%); transition: transform 300ms var(--ease); }
  .sidebar.is-open { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 39; background: rgba(0,0,0,0.5); display: none; }
  .scrim.is-on { display: block; }
  .content { padding: 8px 0 60px; }
  .stat-row, .cards, .pager { grid-template-columns: 1fr; }
  .pager a.next { text-align: left; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .doc h2 a.anchor { display: none; }
}
@media (prefers-reduced-motion: reduce) { .doc.is-active { animation: none; } .sidebar { transition: none; } }
