/* Pledgr docs. Builds on /styles.css tokens. */
.docs-body { background: var(--bg); }

/* ---------------------------------------------------------------- top nav */
.dnav { position: sticky; top: 0; z-index: 60; background: var(--nav-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.dnav-in { display: flex; align-items: center; gap: 18px; height: 60px; padding: 0 24px; }
.dnav .brand { gap: 8px; }
.dnav-sep { color: var(--line-2); font-weight: 400; margin: 0 2px; }
.dnav-docs { font-weight: 500; color: var(--text-2); }
.ver { font: 500 11px/1 var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 7px; margin-left: 6px; }
.dsearch { display: inline-flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); color: var(--muted); font: 500 13px/1 var(--sans); cursor: pointer; width: 300px; margin-left: 12px; }
.dsearch:hover { border-color: var(--text-2); color: var(--text-2); }
.dsearch span { flex: 1; text-align: left; }
.dsearch kbd, .dsearch-foot kbd { font: 500 11px/1 var(--mono); border: 1px solid var(--line-2); border-radius: 5px; padding: 3px 6px; color: var(--muted); background: var(--bg-2); }
.dnav-links { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.dnav-links > a:not(.btn) { font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.dnav-links > a:not(.btn):hover { color: var(--text); }
.dmenu { display: none; width: 38px; height: 38px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--card); cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 5px; margin-left: auto; }
.dmenu span { width: 15px; height: 1.5px; background: var(--ink); display: block; }

/* ---------------------------------------------------------------- search modal */
.dsearch-modal { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 0; }
.dsearch-box { width: min(640px, 100%); background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.6); overflow: hidden; }
.dsearch-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: 500 16px/1 var(--sans); padding: 18px 20px; border-bottom: 1px solid var(--line); }
#search-results { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow: auto; }
#search-results li { padding: 10px 12px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
#search-results li.on, #search-results li:hover { background: var(--bg-2); }
#search-results b { font-size: 14px; }
#search-results span { font-size: 12.5px; color: var(--muted); }
#search-results .crumb { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--green); }
#search-results .empty { color: var(--muted); font-size: 13.5px; cursor: default; }
.dsearch-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.dsearch-foot span { display: inline-flex; gap: 4px; align-items: center; }

/* ---------------------------------------------------------------- layout */
.dlayout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 220px; gap: 0 48px; max-width: 1380px; margin: 0 auto; padding: 0 24px; }
.dside { position: sticky; top: 60px; height: calc(100vh - 60px); overflow: auto; padding: 28px 0 40px; border-right: 1px solid var(--line); scrollbar-width: thin; }
.drail { position: sticky; top: 60px; height: calc(100vh - 60px); overflow: auto; padding: 28px 0 40px; scrollbar-width: thin; }
.dgroup { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; }
.dgroup:first-child { margin-top: 0; }
.dtree a { display: block; padding: 6px 12px 6px 10px; margin-right: 16px; border-radius: 8px; font-size: 13.5px; color: var(--text-2); border-left: 2px solid transparent; }
.dtree a:hover { color: var(--text); background: var(--bg-2); }
.dtree a.on { color: var(--text); font-weight: 600; background: var(--bg-2); border-left-color: var(--green); border-radius: 0 8px 8px 0; }
#toc a { display: block; font-size: 12.5px; color: var(--muted); padding: 4px 0 4px 12px; border-left: 1px solid var(--line); }
#toc a.on { color: var(--text); border-left-color: var(--ink); }
#toc a.h3 { padding-left: 22px; }
.drail-links { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.drail-links a { font-size: 12.5px; color: var(--text-2); }
.drail-links a:hover { color: var(--text); }

/* ---------------------------------------------------------------- content */
.dmain { padding: 40px 0 80px; min-width: 0; }
.dsec { padding: 24px 0 56px; border-bottom: 1px solid var(--line); }
.dsec:last-of-type { border-bottom: 0; }
.dsec h1 { font-size: 34px; letter-spacing: -0.03em; margin: 4px 0 14px; }
.dsec h2 { font-size: 21px; letter-spacing: -0.02em; margin: 40px 0 12px; padding-top: 8px; scroll-margin-top: 84px; position: relative; }
.dsec h2 a.anchor { position: absolute; left: -22px; top: 8px; color: var(--line-2); font-weight: 400; opacity: 0; }
.dsec h2:hover a.anchor { opacity: 1; }
.dsec h3 { font-size: 16px; margin: 24px 0 8px; }
.dsec p { font-size: 15.5px; color: var(--text-2); line-height: 1.65; margin: 0 0 14px; max-width: 72ch; }
.dsec p b { color: var(--text); }
.dsec a:not(.btn):not(.dcard) { color: var(--text); border-bottom: 1px solid var(--line-2); }
.dsec a:not(.btn):not(.dcard):hover { border-color: var(--text); }
.dlede { font-size: 18px; color: var(--text-2); max-width: 66ch; }
.dsmall { font-size: 13px; color: var(--muted); }
.dsec code { font: 500 0.86em/1.5 var(--mono); background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--text); white-space: nowrap; }
.dsec pre code { background: none; border: 0; padding: 0; white-space: pre; color: inherit; font-size: 12.5px; }
.dsec { scroll-margin-top: 70px; }

.dcards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 22px 0 10px; }
.dcard { display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
.dcard:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: 0 20px 40px -30px var(--shadow); }
.dcard b { font-size: 15px; }
.dcard span { font-size: 13.5px; color: var(--text-2); }

.dnote { border: 1px solid var(--line-2); border-left: 3px solid var(--ink); border-radius: 10px; padding: 14px 16px; font-size: 14.5px; color: var(--text-2); background: var(--card); margin: 18px 0; max-width: none; }
.dnote b { color: var(--text); }
.dnote.ok { border-left-color: var(--green); background: var(--green-bg); }
.dnote.warn { border-left-color: var(--amber); background: var(--amber-bg); }

.dtable { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 14px; margin: 16px 0 22px; background: var(--card); }
.dtable th { text-align: left; font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); padding: 10px 14px; border-bottom: 1px solid var(--line); }
.dtable td { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--text-2); vertical-align: top; line-height: 1.5; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable td:first-child { color: var(--text); white-space: nowrap; }
.dtable code { white-space: nowrap; }

.ddefs { margin: 18px 0; display: grid; grid-template-columns: 1fr; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.ddefs > div { display: grid; grid-template-columns: 160px 1fr; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ddefs > div:last-child { border-bottom: 0; }
.ddefs dt { font-weight: 600; font-size: 14.5px; }
.ddefs dd { margin: 0; font-size: 14.5px; color: var(--text-2); line-height: 1.55; }

.dlist { margin: 0 0 16px; padding-left: 20px; color: var(--text-2); font-size: 15px; line-height: 1.65; }
.dlist li { margin: 4px 0; }

/* code */
.dcode { border: 1px solid #1f2430; border-radius: 14px; overflow: hidden; background: #0f1218; margin: 14px 0 20px; box-shadow: 0 30px 60px -50px rgba(0, 0, 0, 0.6); position: relative; }
.dcode.single { padding: 18px 20px; font: 12.5px/1.7 var(--mono); color: #e6e9f2; overflow-x: auto; }
.dcode pre { margin: 0; padding: 18px 20px; font: 12.5px/1.7 var(--mono); color: #e6e9f2; overflow-x: auto; }
.dtabs { display: flex; gap: 2px; padding: 8px 10px; border-bottom: 1px solid #1f2430; }
.dtabs button { padding: 6px 12px; border-radius: 8px; border: 0; background: transparent; color: #8b93a7; font: 500 12.5px/1 var(--sans); cursor: pointer; }
.dtabs button.on { background: #1b2030; color: #fff; }
.dcode .k { color: #c792ea; } .dcode .s { color: #9ccc65; } .dcode .c { color: #6b7389; } .dcode .n { color: #f5b942; } .dcode .t { color: #82aaff; } .dcode .p { color: #e6e9f2; }
.dcopy { position: absolute; top: 8px; right: 8px; border: 1px solid #2a3040; background: #151925; color: #aab2c4; font: 600 11px/1 var(--sans); padding: 6px 9px; border-radius: 7px; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.dcode:hover .dcopy { opacity: 1; }
.dcopy.done { color: #9ccc65; border-color: #2f6b45; }
.dcode[data-tabs] .dcopy { top: 7px; }

/* endpoints */
.dendpoint { display: flex; align-items: center; gap: 10px; margin: 26px 0 8px; }
.dendpoint code { font-size: 14px; white-space: nowrap; }
.dm { font: 700 11px/1 var(--mono); padding: 5px 8px; border-radius: 6px; letter-spacing: 0.04em; }
.dm.get { background: var(--green-bg); color: var(--green); }
.dm.post { background: #e8f1ff; color: #2563eb; }
.dm.del { background: var(--red-bg); color: var(--red); }

/* figures */
.dfig { margin: 18px 0 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 18px 18px 12px; }
.dfig figcaption { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.dsvg { width: 100%; height: auto; font-family: var(--sans); }
.dsvg text { font-size: 13px; font-weight: 600; fill: var(--text); text-anchor: middle; }
.dsvg text.sub { font-size: 11px; font-weight: 400; fill: var(--muted); }
.dsvg .dlabel { font-size: 12px; font-weight: 500; fill: var(--muted); }
.dnode rect { fill: var(--bg-2); stroke: var(--line-2); stroke-width: 1; }
.dnode.ink rect { fill: var(--ink-surface); stroke: var(--ink-surface); }
.dnode.ink text { fill: var(--on-ink); }
.dnode.ink text.sub { fill: var(--on-ink); opacity: 0.7; }
.dnode.green rect { fill: var(--green-bg); stroke: var(--green-line); }
.dedge { fill: none; stroke: var(--muted); stroke-width: 1.4; }
.dedge.dashed { stroke-dasharray: 4 4; }
.dtrack rect { fill: var(--line); }
.dstep circle { fill: var(--card); stroke: var(--ink); stroke-width: 2; }
.dstate rect { fill: var(--card); stroke: var(--line-2); stroke-width: 1.2; transition: stroke 0.15s, fill 0.15s; cursor: default; }
.dstate.green rect { fill: var(--green-bg); stroke: var(--green-line); }
.dstate.red rect { fill: var(--red-bg); stroke: var(--red); }
.dstate.amber rect { fill: var(--amber-bg); stroke: var(--amber-line); }
.dstate.ink rect { fill: var(--ink-surface); stroke: var(--ink-surface); }
.dstate.ink text { fill: var(--on-ink); }
.dstate.ink text.sub { fill: var(--on-ink); opacity: 0.7; }
.dsm.focus .dedge { opacity: 0.15; }
.dsm.focus .dedge.lit { opacity: 1; stroke: var(--green); stroke-width: 2.2; }
.dsm.focus .dstate { opacity: 0.35; }
.dsm.focus .dstate.lit { opacity: 1; }
.dsm.focus .dstate.lit rect { stroke: var(--green); stroke-width: 2; }

/* calculator */
.dcalc { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; margin: 16px 0 8px; }
.dcalc-in { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.dcalc-in label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.dcalc-in input[type="number"] { font: 500 14px/1 var(--mono); padding: 9px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); color: var(--text); }
.dcalc-in input[type="range"] { accent-color: var(--green); }
.dcalc-in output { font: 600 13px/1 var(--mono); color: var(--text); }
.dcalc-in .dcheck { flex-direction: row; align-items: center; gap: 8px; color: var(--text-2); }
.dcalc-out { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 18px; }
.dcalc-kind { display: inline-block; font: 700 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 10px; border-radius: 999px; background: var(--green-bg); color: var(--green); }
.dcalc-kind.partial { background: var(--amber-bg); color: var(--amber); }
.dcalc-kind.fail { background: var(--red-bg); color: var(--red); }
.dcalc-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line); margin: 16px 0; }
.dcalc-bar i { display: block; height: 100%; transition: width 0.25s ease; }
.dcalc-bar .rel { background: var(--green); }
.dcalc-bar .ref { background: var(--amber); }
.dcalc-out dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dcalc-out dl div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg-2); }
.dcalc-out dt { font-size: 11.5px; color: var(--muted); }
.dcalc-out dd { margin: 2px 0 0; font: 600 18px/1.2 var(--sans); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* contract address */
.dca { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); margin: 16px 0 18px; }
.dca > span { font-size: 12px; color: var(--muted); flex-basis: 100%; }
.dca code { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dca .copy { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font: 600 12px/1 var(--sans); cursor: pointer; }
.dca .copy.done { border-color: var(--green); color: var(--green); }
.dca .btn { margin-left: auto; padding: 8px 14px; font-size: 13px; }

/* faq, changelog, pager */
.dfaq details { border-top: 1px solid var(--line); }
.dfaq details:last-child { border-bottom: 1px solid var(--line); }
.dfaq summary { cursor: pointer; list-style: none; padding: 14px 32px 14px 0; font-weight: 600; font-size: 15.5px; position: relative; }
.dfaq summary::-webkit-details-marker { display: none; }
.dfaq summary::after { content: '+'; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 400; font-size: 18px; }
.dfaq details[open] summary::after { content: '\2212'; }
.dfaq p { padding-bottom: 14px; }
.dlog > div { display: grid; grid-template-columns: 70px 110px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.dver { font: 600 13px/1.4 var(--mono); }
.dlog time { font-size: 13px; color: var(--muted); }
.dlog ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 14.5px; line-height: 1.6; }
.dpager { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; }
.dpager a { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; background: var(--card); }
.dpager a:hover { border-color: var(--line-2); }
.dpager a span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.dpager a b { font-size: 14.5px; }
.dpager #next { text-align: right; align-items: flex-end; }
.dpager a[hidden] { display: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) { .dlayout { grid-template-columns: 230px minmax(0, 1fr); } .drail { display: none; } }
@media (max-width: 900px) {
  .dlayout { grid-template-columns: 1fr; padding: 0 16px; }
  .dside { position: fixed; top: 60px; left: 0; right: 0; height: auto; max-height: calc(100vh - 60px); background: var(--card); border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px 20px; display: none; z-index: 55; }
  .dside.open { display: block; }
  .dtree a { margin-right: 0; }
  .dnav-links { display: none; }
  .dmenu { display: flex; }
  .dsearch { width: auto; flex: 1; margin-left: 4px; }
  .dsearch span { display: none; }
  .dsearch kbd { display: none; }
  .dsearch { justify-content: center; padding: 0 10px; }
  .dcards, .dcalc { grid-template-columns: 1fr; }
  .ddefs > div { grid-template-columns: 1fr; gap: 4px; }
  .dlog > div { grid-template-columns: 1fr; gap: 4px; }
  .dsec h1 { font-size: 28px; }
  .dtable { display: block; overflow-x: auto; }
  .dsec h2 a.anchor { display: none; }
}
.dsearch-modal[hidden] { display: none; }
html { scroll-behavior: auto; }
.dnote code, .ddefs code, .dsec p code { white-space: normal; overflow-wrap: anywhere; }
html { scroll-padding-top: 0; }
