/* Docs page — builds on styles.css tokens */
body.docs { background: var(--paper); }
.dnav { background: var(--amber); border-bottom: 1px solid var(--ink); padding: 4px 6px; align-items: center; pointer-events: auto; }
.dnav .box { padding: 6px 10px; }
.box-on { background: var(--ink); color: var(--paper); }
.docs-tag { background: var(--ink); color: var(--amber); font-size: 16px; padding: 0 5px; margin-left: 2px; }
.nav-logo:hover .docs-tag { background: var(--amber); color: var(--ink); }

.crumb { display: none; }

.dlayout { display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; padding-top: 44px; min-height: 100vh; }

/* sidebar */
.side { position: sticky; top: 44px; height: calc(100vh - 44px); overflow-y: auto; border-right: 1px solid var(--ink); background-color: var(--amber); background-image: radial-gradient(#16182133 .8px, transparent 1px); background-size: 6px 6px; padding: 18px 16px 24px; display: flex; flex-direction: column; }
.side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.side-head .term { background: var(--ink); color: var(--paper); padding: 1px 6px; font-size: 16px; }
.side-x { display: none; font: 18px/1 var(--term); background: var(--ink); color: var(--paper); width: 26px; height: 22px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); padding: 0 10px; margin-bottom: 18px; }
.search span { font-size: 12px; opacity: .6; }
.search input { flex: 1; border: 0; outline: 0; background: none; font: 14px var(--sans); padding: 9px 0; color: var(--ink); min-width: 0; }
.side-nav { display: grid; gap: 1px; }
.grp { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; margin: 16px 0 6px; opacity: .7; }
.grp:first-child { margin-top: 0; }
.side-nav a { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 6px 8px; border: 1px solid transparent; }
.side-nav a:hover { background: var(--paper); border-color: var(--ink); }
.side-nav a.on { background: var(--ink); color: var(--paper); }
.side-nav a.hide { display: none; }
.side-foot { margin-top: auto; padding-top: 20px; opacity: .7; }
.side-bg { display: none; }
.verb { font: 600 10px/1 var(--mono); padding: 3px 4px; border: 1px solid currentColor; letter-spacing: .03em; }
.verb.post { color: var(--violet); }
.verb.get { color: #138a5e; }
.side-nav a.on .verb { color: var(--amber); }

/* content */
.content { padding: 54px clamp(24px, 5vw, 72px) 80px; max-width: 860px; width: 100%; margin: 0 auto; }
.content section { padding-bottom: 56px; margin-bottom: 8px; border-bottom: 1px solid #16182122; scroll-margin-top: 64px; }
.content section:last-of-type { border-bottom: 0; }
.content p { font-size: 16px; line-height: 1.65; margin-bottom: 14px; color: #2a2c38; }
.dh1 { font-size: clamp(40px, 5vw, 60px); font-weight: 500; letter-spacing: -.045em; line-height: 1; margin-bottom: 20px; }
.leadp { font-size: 19px !important; line-height: 1.5 !important; max-width: 60ch; }
.dh2 { font-size: 32px; font-weight: 500; letter-spacing: -.035em; line-height: 1.1; margin: 8px 0 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dh2 .verb { font-size: 13px; padding: 5px 7px; }
.dh3 { font-size: 13px; font-family: var(--mono); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; margin: 26px 0 12px; }
code { font: 13px var(--mono); background: #16182110; border: 1px solid #16182122; padding: 1px 5px; }
.night code, .ptable td.mono { background: none; border: 0; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 26px; }
.dcard { display: block; transition: transform .15s, box-shadow .15s; }
a.dcard:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.dcard b { display: block; font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.dcard p { font-size: 13px !important; margin: 0 !important; }

.codebox { margin: 10px 0 22px; }
.codebox .code { max-height: 420px; }
.codebox .tab { cursor: pointer; }
.codebox span.tab { cursor: default; }

.note { margin: 18px 0 6px; }
.note .win-bar { background: var(--violet); }
.note .win-body { font-size: 14px; line-height: 1.55; background: #eef1ff; }
.note.warn .win-bar { background: var(--ink); }
.note.warn .win-body { background: #f4fbdf; }

.ptable { width: 100%; border-collapse: collapse; margin: 12px 0 22px; font-size: 14px; border: 1px solid var(--ink); }
.ptable th { text-align: left; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; background: var(--ink); color: var(--paper); padding: 8px 12px; }
.ptable td { padding: 10px 12px; border-top: 1px solid #16182126; vertical-align: top; }
.ptable td.mono { font-size: 12.5px; white-space: nowrap; }
.req { font: 500 10px var(--mono); color: #d23b1f; margin-left: 4px; }

.demo { margin: 18px 0 20px; }
.demo .win-body { background: var(--paper); }
.sim-bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; margin-bottom: 12px; border-bottom: 1px solid var(--ink); }
.sim-bars span { flex: 1; background: #c9c6bd; transition: background .15s; }
.sim-bars span.on { background: var(--ink); }
.demo input[type=range] { margin-bottom: 10px; }

.exlist { list-style: none; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--ink); }
.exlist li + li { border-left: 1px solid var(--ink); }
.exlist li:nth-child(3) { border-left: 0; }
.exlist li:nth-child(n+3) { border-top: 1px solid var(--ink); }
.exlist a { display: grid; gap: 4px; padding: 18px; height: 100%; transition: background .15s; }
.exlist a:hover { background: var(--amber); }
.exlist b { font-weight: 600; }
.exlist span { font-size: 14px; color: #44465a; }

.clog { list-style: none; border-left: 2px solid var(--ink); padding-left: 22px; display: grid; gap: 20px; }
.clog li { position: relative; }
.clog li::before { content: ""; position: absolute; left: -29px; top: 4px; width: 12px; height: 12px; background: var(--amber); border: 2px solid var(--ink); }
.clog b { display: block; font-size: 17px; font-weight: 600; }
.clog p { margin: 2px 0 0 !important; font-size: 14px !important; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 30px; }
.pager a { border: 1px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); padding: 14px 16px; display: grid; gap: 2px; background: var(--paper); transition: background .15s; }
.pager a:hover { background: var(--amber); }
.pager a span { font: 11px var(--mono); text-transform: uppercase; opacity: .6; }
.pager a b { font-weight: 500; font-size: 17px; }
.pager a.next { text-align: right; grid-column: 2; }
.edit { margin-top: 26px; opacity: .7; }

/* toc */
.toc { position: sticky; top: 44px; height: calc(100vh - 44px); padding: 54px 20px 20px 0; overflow-y: auto; }
.toc .term { font-size: 16px; margin-bottom: 10px; }
#toc a { display: block; font-size: 13px; padding: 4px 0 4px 10px; border-left: 2px solid #16182122; color: #55576a; }
#toc a.on { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.toc-win { margin-top: 26px; }
.okdot { display: inline-block; width: 7px; height: 7px; background: #22c55e; margin-right: 6px; }

.dfoot { display: flex; justify-content: space-between; gap: 16px; padding: 18px 24px; background: var(--night); color: var(--paper); }
.dfoot a:hover { text-decoration: underline; }

@media (max-width: 1180px) {
  .dlayout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 1000px) {
  .cards { grid-template-columns: 1fr 1fr 1fr; }
}

/* ===== mobile app ===== */
@media (max-width: 760px) {
  .dnav { padding: calc(env(safe-area-inset-top, 0px) + 4px) 6px 4px; }
  .crumb { display: flex; align-items: center; gap: 6px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 44px); z-index: 40; width: 100%; margin-top: 44px; padding: 11px 16px; background: var(--paper); border-bottom: 1px solid var(--ink); font-size: 12px; text-align: left; }
  .crumb span { opacity: .6; }
  .crumb b { font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .crumb i { font-style: normal; background: var(--ink); color: var(--paper); padding: 2px 7px; }

  .dlayout { display: block; padding-top: 0; }
  .side { position: fixed; top: auto; left: 8px; right: 8px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); height: auto; max-height: 72vh; z-index: 80; border: 1px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); transform: translateY(24px); opacity: 0; visibility: hidden; transition: .22s; }
  .side-x { display: block; }
  .side-foot { display: none; }
  body.side-open .side { transform: none; opacity: 1; visibility: visible; }
  .side-bg { display: block; position: fixed; inset: 0; z-index: 70; background: #16182166; opacity: 0; visibility: hidden; transition: .2s; }
  body.side-open .side-bg { opacity: 1; visibility: visible; }
  .side-nav a { padding: 10px 8px; font-size: 15px; }

  .content { padding: 28px 16px 40px; }
  .content section { padding-bottom: 40px; scroll-margin-top: 100px; }
  .dh1 { font-size: 40px; }
  .leadp { font-size: 17px !important; }
  .dh2 { font-size: 27px; }
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .codebox { margin-inline: -16px; box-shadow: none; }
  .codebox .code { font-size: 11.5px; }
  .ptable { display: block; overflow-x: auto; font-size: 13px; }
  .ptable td.mono { white-space: normal; }
  .exlist { grid-template-columns: 1fr; }
  .exlist li + li { border-left: 0; border-top: 1px solid var(--ink); }
  .pager { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pager a b { font-size: 15px; }
  .dfoot { flex-direction: column; padding-bottom: 20px; }
  .tabbar button.active { background: var(--ink); color: var(--amber); }
}
