/* mango docs: layout modeled on onorca.dev/docs (sidebar + one reading column), mango tokens from styles.css */
.docs-body { background: var(--bg); }
.docs-body .nav { background: rgba(7,7,10,.92); border-bottom-color: var(--line); }
.nav .links a[aria-current="page"] { color: var(--text); }

.docs { display: grid; grid-template-columns: 300px minmax(0, 1fr); max-width: 1240px; margin: 0 auto; padding-top: 68px; min-height: 100vh; }

/* sidebar */
.dside { position: sticky; top: 68px; align-self: start; height: calc(100vh - 68px); overflow-y: auto; padding: 22px 18px 40px 24px; border-right: 1px solid var(--line); scrollbar-width: thin; }
.dsearch { position: relative; margin-bottom: 18px; }
.dsearch input { width: 100%; height: 40px; padding: 0 52px 0 36px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); background: var(--bg2); color: var(--text); font: 14px var(--sans); outline: none; }
.dsearch input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,29,0,.18); }
.dsearch svg { position: absolute; left: 12px; top: 12px; width: 16px; height: 16px; color: var(--muted); }
.dsearch kbd { position: absolute; right: 10px; top: 9px; }
kbd { font: 500 11.5px var(--mono); color: var(--text); background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-bottom-width: 2px; border-radius: 6px; padding: 2px 6px; white-space: nowrap; }

.dgroup { margin-bottom: 4px; }
.dgroup > button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 11px 14px; font: 400 15px var(--sans); color: rgba(244,244,246,.92); border-radius: 12px; transition: background .2s; }
.dgroup > button:hover { background: rgba(255,255,255,.04); }
.dgroup.has-on > button { background: rgba(255,255,255,.07); }
.dgroup > button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.dgroup > button svg { width: 15px; height: 15px; color: rgba(244,244,246,.7); transition: transform .2s; }
.dgroup.closed > button svg { transform: rotate(-90deg); }
.dgroup ul { list-style: none; margin: 4px 0 10px 16px; padding: 0 0 0 8px; border-left: 1px solid rgba(255,255,255,.12); }
.dgroup.closed ul { display: none; }
.dgroup a { display: block; padding: 9px 12px; border-radius: 10px; font-size: 15px; line-height: 1.35; color: rgba(244,244,246,.66); transition: color .15s, background .15s; }
.dgroup a:hover { color: var(--text); }
.dgroup a.on { color: var(--text); background: rgba(255,255,255,.07); }
.dside .nohit { color: var(--muted); font-size: 13px; padding: 8px 10px; display: none; }

/* reading column */
.dmain { padding: 40px 56px 96px; max-width: 860px; }
.doc { display: none; }
.doc.on { display: block; animation: docIn .25s ease; }
@keyframes docIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dcrumb { font: 500 13px var(--sans); color: var(--muted); margin-bottom: 10px; }
.doc h1 { font: 700 38px/1.12 var(--display); letter-spacing: -.02em; margin: 0 0 12px; }
.doc .lead { font-size: 19px; color: var(--muted); margin: 0 0 30px; }
.doc h2 { font: 650 21px/1.3 var(--sans); margin: 40px 0 12px; letter-spacing: -.01em; scroll-margin-top: 90px; }
.doc h3 { font: 600 16px var(--sans); margin: 26px 0 8px; }
.doc p, .doc li { font-size: 16.5px; line-height: 1.75; color: rgba(244,244,246,.78); }
.doc p { margin: 0 0 14px; max-width: 70ch; }
.doc ul, .doc ol { padding-left: 22px; margin: 0 0 16px; }
.doc li { margin: 4px 0; }
.doc a { color: var(--accent2); border-bottom: 1px solid rgba(255,106,61,.35); }
.doc a:hover { border-bottom-color: var(--accent2); }
.doc strong { color: var(--text); font-weight: 600; }
.doc pre { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; margin: 0 0 18px; }
.doc pre code { background: none; padding: 0; font-size: 13.5px; line-height: 1.6; color: #e7e7ee; }
.doc figure { margin: 22px 0 26px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg2); }
.doc figure img { width: 100%; height: auto; }
.doc figcaption { padding: 10px 16px; font-size: 13.5px; color: var(--muted); border-top: 1px solid var(--line); }
.doc table { width: 100%; border-collapse: collapse; margin: 6px 0 22px; font-size: 14.5px; }
.doc th { text-align: left; font-weight: 600; color: var(--text); padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,.14); }
.doc td { padding: 9px 12px; border-bottom: 1px solid var(--line); color: rgba(244,244,246,.78); vertical-align: top; }
.doc td:first-child { white-space: nowrap; }
.callout { margin: 24px 0; padding: 16px 18px; border-radius: 12px; border: 1px solid rgba(255,29,0,.35); background: rgba(255,29,0,.06); }
.callout p { margin: 0; font-size: 15.5px; }
.callout b { display: block; margin-bottom: 4px; color: var(--text); font-size: 14px; }

.dpager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--line); }
.dpager a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; transition: border-color .2s, background .2s; }
.dpager a:hover { border-color: rgba(255,29,0,.5); background: rgba(255,29,0,.04); }
.dpager span { display: block; font: 600 11.5px var(--mono); letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.dpager b { font: 600 15px var(--sans); }
.dpager .next { text-align: right; grid-column: 2; }

.dtoggle { display: none; }

@media (max-width: 900px) {
  .docs { grid-template-columns: 1fr; }
  .dside { position: fixed; z-index: 40; left: 0; top: 64px; width: min(320px, 86vw); height: calc(100vh - 64px); background: var(--bg); transform: translateX(-100%); transition: transform .25s; }
  .docs.side-open .dside { transform: none; box-shadow: 30px 0 60px rgba(0,0,0,.6); }
  .dmain { padding: 28px 16px 80px; }
  .doc h1 { font-size: 30px; }
  .dtoggle { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: 500 14px var(--sans); cursor: pointer; }
  .doc td:first-child { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .doc.on { animation: none; } }

/* ---------- docs day theme ---------- */
[data-theme="light"] .docs-body .nav { background: rgba(227,227,227,.94); }
[data-theme="light"] .dside { border-right-color: rgba(14,14,14,.09); }
[data-theme="light"] .dsearch input { background: #fafafa; border-color: rgba(14,14,14,.1); }
[data-theme="light"] .dsearch input:focus { box-shadow: 0 0 0 3px rgba(255,29,0,.18); }
[data-theme="light"] kbd { color: #0e0e0e; background: #fafafa; border-color: rgba(14,14,14,.16); }
[data-theme="light"] .dgroup > button { color: #0e0e0e; }
[data-theme="light"] .dgroup > button:hover { background: rgba(14,14,14,.04); }
[data-theme="light"] .dgroup.has-on > button { background: #fafafa; }
[data-theme="light"] .dgroup > button svg { color: #5c5c63; }
[data-theme="light"] .dgroup ul { border-left-color: rgba(14,14,14,.14); }
[data-theme="light"] .dgroup a { color: #4a4a50; }
[data-theme="light"] .dgroup a:hover { color: #0e0e0e; }
[data-theme="light"] .dgroup a.on { color: #fafafa; background: var(--accent); }
[data-theme="light"] .doc p, [data-theme="light"] .doc li, [data-theme="light"] .doc td { color: #33333a; }
[data-theme="light"] .doc a { color: var(--accent2); border-bottom-color: rgba(196,21,0,.35); }
[data-theme="light"] .doc pre { background: #fafafa; border-color: rgba(14,14,14,.09); }
[data-theme="light"] .doc pre code { color: #1e1e24; }
[data-theme="light"] .doc figure { background: #fafafa; border-color: rgba(14,14,14,.09); }
[data-theme="light"] .doc th { border-bottom-color: rgba(14,14,14,.16); }
[data-theme="light"] .callout { background: rgba(255,29,0,.07); border-color: rgba(255,29,0,.35); }
[data-theme="light"] .dpager a { background: #fafafa; border-color: rgba(14,14,14,.09); }
[data-theme="light"] .dpager a:hover { border-color: rgba(255,29,0,.5); }
[data-theme="light"] .dtoggle { background: #fafafa; border-color: rgba(14,14,14,.1); color: #0e0e0e; }
@media (max-width: 900px) { [data-theme="light"] .dside { background: var(--bg); } }
