/* Developer docs page. Tokens come from styles.css. */
.docs-hero .wrap { gap: 20px; }
.docs-hero .ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.verchip { display: inline-flex; gap: 8px; align-items: center; font: 500 12px var(--f-mono); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); width: fit-content; max-width: 100%; }
.verchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }

.docs { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 48px; padding-block: 40px 40px; align-items: start; }

/* sidebar toc */
.toc { position: sticky; top: calc(76px + env(safe-area-inset-top, 0px)); align-self: start; max-height: calc(100vh - 100px); overflow: auto; font-size: 14px; }
.toc-toggle { display: none; }
.toc h2 { font: 600 11px var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 6px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-foot { margin-top: 16px; font: 400 11.5px/1.5 var(--f-mono); color: var(--ink-2); }
.toc-foot b { color: var(--collapse); }

@media (max-width: 900px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 0; }
  .toc { position: sticky; top: calc(60px + env(safe-area-inset-top, 0px)); z-index: 15; max-height: none; overflow: visible; margin-inline: calc(-1 * var(--gutter-l)) calc(-1 * var(--gutter-r)); padding-inline: var(--gutter-l) var(--gutter-r); background: var(--bg); border-bottom: 1px solid var(--line); }
  .toc-toggle { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 12px 0; background: none; border: 0; cursor: pointer; font: 600 13px var(--f-mono); }
  .toc-toggle::after { content: "+"; color: var(--accent); }
  .toc-toggle[aria-expanded="true"]::after { content: "−"; }
  .toc-panel { display: none; max-height: 60vh; overflow: auto; padding-bottom: 14px; }
  .toc.open .toc-panel { display: block; }
  .toc h2 { display: none; }
}

/* main column */
.docs-main { min-width: 0; }
.docs-main > section { padding-block: 0; margin-bottom: 80px; scroll-margin-top: 120px; display: grid; gap: 20px; }
.docs-main > section > h2 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); display: flex; align-items: baseline; gap: 10px; }
.docs-main h2 .anc { font: 400 .6em var(--f-mono); color: var(--ink-2); text-decoration: none; opacity: 0; transition: opacity .15s; }
.docs-main h2:hover .anc, .docs-main h2 .anc:focus-visible { opacity: 1; }
.docs-main h3 { scroll-margin-top: 120px; }
.docs-main p, .docs-main li { color: var(--ink-2); }
.docs-main p { max-width: 70ch; }
.docs-main strong { color: var(--ink); }
.docs-main code { font: 400 .88em var(--f-mono); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; color: var(--ink); overflow-wrap: anywhere; }
.docs-main .eyebrow { display: block; }
.docs-main ul.plain, .docs-main ol.steps { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; max-width: 70ch; }

/* code boxes */
.code { background: #0b1220; color: #d8e1f5; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; min-width: 0; }
.code-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #1f2a44; font: 500 12px var(--f-mono); color: #8a98b8; min-height: 40px; }
.code-head .m { font-weight: 600; padding: 2px 7px; border-radius: 5px; background: #1b2744; color: #9fb1ff; margin-right: 8px; }
.code-head .m.post { color: #7ee2b0; }
.code pre { margin: 0; padding: 14px 16px; font: 400 12.5px/1.65 var(--f-mono); overflow-x: auto; tab-size: 2; }
.code .k { color: #9fb1ff; } .code .s { color: #ffd27a; } .code .n { color: #7ee2b0; } .code .c { color: #6b7896; }
.code button.cp { font: 600 11px var(--f-mono); background: transparent; color: #9fb1ff; border: 1px solid #2a3860; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.code button.cp:hover { background: #1b2744; }
.code :focus-visible { outline-color: #9fb1ff; }

/* tabs */
.ctabs { display: flex; gap: 2px; }
.ctab { font: 600 12px var(--f-mono); background: transparent; color: #8a98b8; border: 0; border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.ctab:hover { color: #d8e1f5; }
.ctab[aria-selected="true"] { background: #1b2744; color: #fff; }
.tabnote { font: 400 12px/1.5 var(--f-mono); color: var(--ink-2); }

/* concepts */
.concepts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.concept { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 10px; align-content: start; }
.concept:last-child:nth-child(odd) { grid-column: 1 / -1; }
.concept svg { width: 100%; height: auto; display: block; background: var(--surface-2); border-radius: 10px; }
.concept .tag { font: 500 12px var(--f-mono); color: var(--ink-2); }
.dg-line { stroke: var(--ink-2); fill: none; stroke-width: 1.5; }
.dg-acc { stroke: var(--accent); fill: none; stroke-width: 2; }
.dg-accf { fill: var(--accent); fill-opacity: .22; stroke: var(--accent); stroke-width: 1.5; }
.dg-col { fill: var(--collapse); }
.dg-dash { stroke-dasharray: 4 4; }
.dg-t { font: 500 10.5px var(--f-mono); fill: var(--ink-2); }
.dg-tb { font: 600 11px var(--f-mono); fill: var(--ink); }
.dg-pulse { animation: dgp 2.4s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes dgp { 50% { opacity: .35; } }
@media (max-width: 700px) { .concepts { grid-template-columns: minmax(0, 1fr); } }

/* ledger */
.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 12px; }
.ledger-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ledger-total { font: 800 28px var(--f-display); letter-spacing: -0.02em; }
.ledger-rows { font: 400 12.5px/1.5 var(--f-mono); max-height: 180px; overflow: auto; display: grid; gap: 4px; }
.ledger-rows div { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 4px; }
.ledger-rows div span:first-child { color: var(--ink-2); }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
.tbl th { text-align: left; font: 600 11px var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); padding: 10px 14px; background: var(--surface-2); }
.tbl td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.tbl td:first-child { color: var(--ink); white-space: nowrap; }
.tbl tr:hover td { background: color-mix(in srgb, var(--collapse) 7%, transparent); }
.req { font: 600 10px var(--f-mono); color: var(--bad); margin-left: 6px; }
.opt { font: 500 10px var(--f-mono); color: var(--ink-2); margin-left: 6px; }

/* api endpoints */
.eps { display: grid; gap: 28px; }
.ep { border-top: 1px solid var(--line); padding-top: 28px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; scroll-margin-top: 120px; }
.ep-l { display: grid; gap: 14px; align-content: start; min-width: 0; }
.ep-r { display: grid; gap: 14px; align-content: start; min-width: 0; }
.ep h3 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 1.1rem; }
.ep h3 code { font-size: .85em; }
.mth { font: 700 11px var(--f-mono); padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--accent); }
.mth.post { color: var(--good); }
.ep .tbl { min-width: 0; font-size: 13px; }
.ep .tbl td:first-child { white-space: normal; overflow-wrap: anywhere; }
.ep .tbl-wrap { overflow-x: auto; }
@media (max-width: 1100px) { .ep { grid-template-columns: minmax(0, 1fr); } }

/* playground */
.pg { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.pg-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pg-bar label { font: 600 11px var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.pg-bar select { font: 500 13px var(--f-mono); padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); flex: 1; min-width: 0; max-width: 100%; }
.pg-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.pg-status { display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: center; font: 500 12.5px var(--f-mono); padding: 10px 14px; border-bottom: 1px solid #1f2a44; }
.pg-status .code-s { font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.code-s.ok { background: #12392a; color: #7ee2b0; } .code-s.mid { background: #3a2e0c; color: #ffd27a; } .code-s.err { background: #3d1a15; color: #ff9b8a; }
.pg-status .ms { color: #8a98b8; }
.pg-status .ms.neg { color: #ff9b8a; }
.pg-hdrs { color: #8a98b8; border-bottom: 1px solid #1f2a44; }
.pg-hdrs b { color: #9fb1ff; font-weight: 400; }
.pg-out pre { min-height: 230px; max-height: 420px; overflow: auto; }
.pg-hist { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.pg-hist h4 { margin: 0; padding: 10px 12px; font: 600 11px var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.pg-hist ul { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow: auto; }
.pg-hist li button { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; text-align: left; padding: 9px 12px; background: none; border: 0; border-top: 1px solid var(--line); cursor: pointer; font: 400 12px var(--f-mono); }
.pg-hist li:first-child button { border-top: 0; }
.pg-hist li button:hover { background: var(--surface); }
.pg-hist li .p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.pg-hist .st { font-weight: 700; }
.pg-hist .st.ok { color: var(--good); } .pg-hist .st.mid { color: var(--warn); } .pg-hist .st.err { color: var(--bad); }
.pg-hist .empty { padding: 14px 12px; font-size: 13px; color: var(--ink-2); }
.pg-hint { font: 400 12px/1.5 var(--f-mono); color: var(--ink-2); padding: 8px 12px; border-top: 1px solid var(--line); }
@media (max-width: 860px) { .pg-grid { grid-template-columns: minmax(0, 1fr); } }

/* mini demos */
.demo-box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 12px; }
.demo-box .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.out-line { font: 400 13px/1.55 var(--f-mono); color: var(--ink); overflow-wrap: anywhere; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font: 400 12.5px/1.5 var(--f-mono); }
.feed li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; border-left: 2px solid var(--collapse); padding-left: 10px; color: var(--ink-2); }
.feed li b { color: var(--ink); font-weight: 600; }
.feed .neg { color: var(--bad); }

.docs-main .callout { max-width: 70ch; }
.docs-end { border-top: 1px solid var(--line); padding-top: 24px; font: 400 13px/1.6 var(--f-mono); color: var(--ink-2); }
