/* Documentación (/docs): navegación lateral, contenido de lectura cómoda e índice de la página a la derecha. */
.docs-body { background: var(--bg); }
.dtop { position: sticky; top: var(--banner-h); z-index: 40; display: flex; align-items: center; gap: var(--s3); min-height: 60px; padding: 0 var(--s4); background: rgba(8, 8, 13, 0.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.dtop .brand img { height: 22px; width: auto; }
.dtag { font: 600 var(--fs-xs) var(--font); color: var(--mw-morado-200); background: var(--accent-soft); border: 1px solid var(--mw-morado-900); padding: 3px 9px; border-radius: 999px; text-decoration: none; }
.dtop-links { margin-left: auto; display: none; gap: var(--s2); align-items: center; }
.dtop-links a:not(.btn) { color: var(--text-muted); text-decoration: none; font-size: var(--fs-sm); padding: 0 var(--s2); min-height: 44px; display: inline-flex; align-items: center; border-radius: 8px; }
.dtop-links a:not(.btn):hover { color: var(--text); background: var(--surface); }
.menu-btn { margin-left: auto; min-height: 44px; }
.dtop a:focus-visible, .dnav a:focus-visible, .dtoc a:focus-visible, .dcard:focus-visible, .pager a:focus-visible, .doc a:focus-visible, .copy:focus-visible { outline: 2px solid var(--mw-morado-400); outline-offset: 2px; }

.dlayout { max-width: 1320px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); }
.dnav { display: none; padding: var(--s4); border-bottom: 1px solid var(--border); background: var(--surface); }
.dnav.open { display: block; }
.dnav ul { list-style: none; margin: 0 0 var(--s3); padding: 0; }
.dnav a { display: flex; align-items: center; min-height: 44px; padding: 0 var(--s3); color: var(--text-muted); text-decoration: none; font-size: var(--fs-sm); border-radius: 8px; }
.dnav a:hover { color: var(--text); background: var(--surface-2); }
.dnav a[aria-current="page"] { color: var(--text); background: var(--surface-3); font-weight: 600; }
.dnav-sub { margin: 0 0 var(--s2) var(--s3) !important; border-left: 1px solid var(--border); }
.dnav-sub a { min-height: 44px; font-size: 0.85rem; border-radius: 0 8px 8px 0; }
.dnav-g { font: 600 0.75rem var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); margin: var(--s3) var(--s3) var(--s2); }

.doc { min-width: 0; max-width: 72ch; padding: var(--s6) var(--s4) var(--s8); outline: none; }
.doc h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); letter-spacing: -0.03em; line-height: 1.15; margin-bottom: var(--s4); }
.doc h2 { font-size: 1.45rem; margin: var(--s7) 0 var(--s3); padding-top: var(--s5); border-top: 1px solid var(--hairline); }
.doc h3 { font-size: 1.1rem; margin: var(--s6) 0 var(--s2); }
.doc h3 code { font-size: 0.95em; }
.doc h2, .doc h3 { position: relative; scroll-margin-top: 120px; }
.doc .anchor { position: absolute; left: -1.1em; color: var(--text-faint); text-decoration: none; opacity: 0; font-weight: 400; transition: opacity var(--t-fast); }
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc .anchor:focus-visible { opacity: 1; }
.doc p, .doc li { color: var(--mw-tinta-200); line-height: 1.7; }
.doc .lead { font-size: var(--fs-lg); color: var(--text-muted); }
.doc a { text-underline-offset: 3px; }
.doc ul, .doc ol { padding-left: 1.3em; margin: 0 0 var(--s4); }
.doc li + li { margin-top: 4px; }
.doc strong { color: var(--text); }
.doc :not(pre) > code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; font-size: 0.86em; color: var(--mw-morado-100); white-space: break-spaces; overflow-wrap: anywhere; }
.doc .codebox { position: relative; max-width: 100%; min-width: 0; margin: var(--s4) 0; }
.doc .codebox pre { max-width: 100%; overflow-x: auto; padding-right: 96px; -webkit-overflow-scrolling: touch; }
.doc .codebox .code-lang { position: absolute; top: 9px; left: var(--s4); font: 600 0.75rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.doc .codebox[data-lang] pre { padding-top: 48px; }
.doc .codebox .copy { position: absolute; top: 6px; right: 6px; z-index: 1; min-height: 36px; padding: 0 var(--s3); }
.doc .table-wrap { margin: var(--s4) 0; width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--border); }
.doc table { width: 100%; min-width: 30rem; border-collapse: collapse; }
.doc table td, .doc table th { vertical-align: top; padding: var(--s2) var(--s3); text-align: left; }
/* Identificadores dentro de celdas (btc, bc1q…, mw_sk_…): no se parten a mitad; la tabla hace scroll en su contenedor. */
.doc table td code, .doc table th code { white-space: nowrap; overflow-wrap: normal; }
.doc table td { color: var(--mw-tinta-200); }
.doc img, .doc table { max-width: 100%; }
.callout { margin: var(--s4) 0; padding: var(--s3) var(--s4); border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--mw-morado-800); }
.callout p { color: var(--mw-morado-100); margin: 0; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s8); }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: var(--s4); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); font-weight: 600; min-height: 44px; }
.pager a span { font: 500 var(--fs-xs) var(--font); color: var(--text-faint); }
.pager a:hover { border-color: var(--mw-morado-700); }
.pager .next { text-align: right; grid-column: 2; }
.dcards { display: grid; gap: var(--s3); margin: var(--s5) 0; }
.dcard { display: flex; flex-direction: column; gap: 4px; padding: var(--s4) var(--s5); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); text-decoration: none; color: var(--text); transition: border-color var(--t-fast) var(--ease); min-width: 0; }
.dcard .dnav-g { margin: 0; color: var(--brand-text); }
.dcard strong { font: 600 var(--fs-lg) var(--display); }
.dcard span:last-child { color: var(--text-muted); font-size: var(--fs-sm); }
.dcard:hover { border-color: var(--mw-morado-600); }
.dtoc { display: none; }
.docs-body .site-foot { max-width: 1320px; }

/* Portada de docs: 5 tarjetas en 3 + 2, cada fila ocupa el ancho completo (sin huecos). Descargas: 4 en 2 + 2. */
@media (min-width: 720px) {
  .dcards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dcards > .dcard { grid-column: span 2; }
  .dcards > .dcard:nth-child(n+4) { grid-column: span 3; }
  .dcards.dcards-4 > .dcard, .dcards.dcards-4 > .dcard:nth-child(n+4) { grid-column: span 3; }
}
@media (min-width: 960px) {
  .menu-btn { display: none; }
  .dtop-links { display: flex; }
  .dlayout { grid-template-columns: 250px minmax(0, 1fr); }
  .dnav { display: block; position: sticky; top: calc(var(--banner-h) + 60px); height: calc(100vh - var(--banner-h) - 60px); overflow-y: auto; border-bottom: 0; border-right: 1px solid var(--border); background: transparent; padding: var(--s5) var(--s3); }
  .doc { padding: var(--s7) var(--s7) var(--s8); }
  .pager a { min-height: 0; }
}
@media (min-width: 1240px) {
  .dlayout { grid-template-columns: 250px minmax(0, 1fr) 220px; }
  .dtoc { display: block; position: sticky; top: calc(var(--banner-h) + 60px); align-self: start; padding: var(--s7) var(--s4) 0 0; max-height: calc(100vh - 100px); overflow-y: auto; }
  .dtoc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
  .dtoc a { display: block; padding: 4px var(--s3); color: var(--text-muted); text-decoration: none; font-size: 0.8rem; line-height: 1.4; }
  .dtoc .l3 a { padding-left: var(--s5); }
  .dtoc a:hover, .dtoc a.on { color: var(--text); }
  .dtoc a.on { box-shadow: inset 2px 0 0 var(--mw-morado-400); }
  .dtoc .dnav-g { margin-left: var(--s3); }
}
