/* ============================================================
   docs.css — Superficie documental de V4
   Se apoya en main.css (tokens, nav, footer). Solo Lato 400/700
   en el contenido; la mono se queda en las micro-etiquetas del sitio.
   ============================================================ */

.docs [hidden] { display: none !important; }

/* nav sólido: en documentación no hay hero detrás */
.docs .nav { background: var(--bg); border-bottom-color: var(--border); }

:root { --dbar-h: 52px; --dside-w: 264px; --dtext: 720px; }

/* ---------- controles de la maqueta (no son parte del diseño) ---------- */
.dmock {
  margin-top: var(--nav-h);
  background: var(--ink-bg); color: var(--ink-muted);
  font-size: .8rem; padding: 10px 0;
}
.dmock .container { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; max-width: 1440px; }
.dmock b { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-text); font-weight: 600; }
.dmock .grp { display: inline-flex; align-items: center; gap: 4px; }
.dmock .grp > span { margin-right: 4px; }
.dmock button { padding: 5px 11px; border-radius: 6px; border: 1px solid var(--ink-border); color: var(--ink-text); font-size: .78rem; font-weight: 700; }
.dmock button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.dmock button:disabled { opacity: .4; cursor: not-allowed; }
.dmock code { font-family: var(--font-mono); color: #fff; font-size: .78rem; background: var(--ink-surface); padding: 3px 8px; border-radius: 5px; overflow-wrap: anywhere; }
.dmock a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- barra documental ---------- */
.dbar {
  position: sticky; top: var(--nav-h); z-index: 60;
  height: var(--dbar-h);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.dbar .container { max-width: 1440px; height: 100%; display: flex; align-items: center; gap: 14px; }
.dcrumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: .86rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.dcrumbs a { color: var(--text-muted); }
.dcrumbs a:hover { color: var(--accent); }
.dcrumbs .sep { color: var(--text-dim); }
.dcrumbs [aria-current] { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.dbar-open { display: none; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r-sm); font-weight: 700; font-size: .88rem; flex: none; }
.dbar-open svg { width: 17px; height: 17px; }
.dbar-now { display: none; min-width: 0; font-weight: 700; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlangs { margin-left: auto; display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px; flex: none; }
.dlangs button { height: 28px; padding: 0 10px; border-radius: 5px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; color: var(--text-muted); }
.dlangs button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

/* ---------- retícula ---------- */
.dwrap {
  max-width: 1440px;
  display: grid; grid-template-columns: var(--dside-w) minmax(0, 1fr);
  gap: clamp(32px, 4vw, 56px);
  align-items: start;
}

/* ---------- barra lateral ---------- */
.dside {
  position: sticky; top: calc(var(--nav-h) + var(--dbar-h));
  max-height: calc(100vh - var(--nav-h) - var(--dbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 28px 6px 48px 0;
  scrollbar-width: thin;
}
.dside-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 16px; }
.dside-kicker { width: 100%; font-size: .78rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .1em; }
.dprod-one { font-weight: 700; font-size: 1.12rem; letter-spacing: -.01em; }
.dprod { position: relative; }
.dprod summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.12rem; letter-spacing: -.01em; cursor: pointer; padding: 2px 0; }
.dprod summary::-webkit-details-marker { display: none; }
.dprod summary svg { width: 15px; height: 15px; transform: rotate(90deg); color: var(--text-dim); transition: transform .2s; }
.dprod[open] summary svg { transform: rotate(-90deg); }
.dprod ul { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; min-width: 220px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: var(--shadow); padding: 6px; }
.dprod li a { display: block; padding: 9px 12px; border-radius: 6px; font-weight: 700; font-size: .95rem; }
.dprod li a:hover { background: var(--surface); }
.dprod li a[aria-current] { color: var(--accent); }
.dside-close { display: none; margin-left: auto; }

.dside-filter input {
  width: 100%; height: 40px; padding: 0 12px; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg);
  font: inherit; font-size: .9rem; color: var(--text);
}
.dside-filter input::placeholder { color: var(--text-dim); }
.dside-filter input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

/* árbol — REGLA: sangría 14 px por nivel hasta el 3.º; desde ahí la profundidad la dice la guía */
.dt-home, .dt-link { display: block; padding: 7px 10px; border-radius: 6px; font-size: .93rem; line-height: 1.35; color: var(--text-muted); }
.dt-home { font-weight: 700; margin-bottom: 2px; }
.dt-home:hover, .dt-link:hover { color: var(--text); background: var(--surface); }
.dtree, .dt-kids { list-style: none; padding: 0; }
.dt-row { position: relative; display: flex; align-items: flex-start; border-radius: 6px; }
.dt-link { flex: 1; min-width: 0; }
.dt[data-depth="1"] > .dt-row > .dt-link { color: var(--text); }
.dt.has-kids > .dt-row > .dt-link { font-weight: 700; }  /* una sección con subpáginas se distingue de una hoja */
.dt-kids { margin: 2px 0 6px 10px; padding-left: 4px; border-left: 1px solid var(--border); }
.dt-kids .dt-kids .dt-kids { margin-left: 0; }  /* tope de sangría */
.dt-tog { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: var(--text-dim); }
.dt-tog:hover { background: var(--surface); color: var(--text); }
.dt-tog svg { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.dt-tog[aria-expanded="true"] svg { transform: rotate(90deg); }
.dt-row.is-current > .dt-link, .dt-home.is-current { color: var(--text); background: var(--accent-soft); font-weight: 700; }
.dt-row.is-current::before, .dt-home.is-current { box-shadow: inset 3px 0 0 var(--accent); }
.dt-row.is-current::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); border-radius: 3px 0 0 3px; z-index: 1; }
.dt-none { font-size: .9rem; color: var(--text-dim); padding: 8px 10px; }

/* ---------- contenido ---------- */
.dcontent { min-width: 0; padding: 40px 0 96px; }
.dhead { max-width: var(--dtext); margin-bottom: 28px; }
.dhead h1 { font-size: clamp(2rem, 4.2vw, 2.85rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.08; }
.draw { display: inline-block; margin-top: 12px; font-family: var(--font-mono); font-size: .74rem; color: var(--text-dim); background: var(--surface); border: 1px dashed var(--border); padding: 3px 8px; border-radius: 5px; }
.draw::before { content: "wiki: "; color: var(--accent); }
.dlead { margin-top: 14px; font-size: 1.18rem; line-height: 1.6; color: var(--text-muted); }

/* En esta página */
.dtoc { max-width: var(--dtext); margin: 0 0 36px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.dtoc summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-weight: 700; font-size: .92rem; }
.dtoc summary::-webkit-details-marker { display: none; }
.dtoc summary::before { content: ""; width: 8px; height: 8px; background: var(--accent); border-radius: 2px; }
.dtoc summary svg { width: 14px; height: 14px; margin-left: auto; color: var(--text-dim); transform: rotate(90deg); transition: transform .2s; }
.dtoc[open] summary svg { transform: rotate(-90deg); }
.dtoc ol { list-style: none; padding: 0 16px 14px 34px; display: flex; flex-direction: column; gap: 6px; }
.dtoc a { font-size: .93rem; color: var(--text-muted); }
.dtoc a:hover { color: var(--accent); }

/* ---------- prosa: fiel a la semántica del wiki ---------- */
.dprose { font-size: 1.06rem; line-height: 1.72; color: var(--text); }
.dprose > :not(.dfig):not(.dtable-box) { max-width: var(--dtext); }
.dprose > * + * { margin-top: 1.1em; }
.dprose h1, .dprose h2, .dprose h3, .dprose h4, .dprose h5, .dprose h6 { font-weight: 700; letter-spacing: -.015em; line-height: 1.2; scroll-margin-top: calc(var(--nav-h) + var(--dbar-h) + 20px); }
.dprose h1 { font-size: 2rem; letter-spacing: -.025em; margin-top: 2.2em; }
.dprose h2 { font-size: 1.6rem; letter-spacing: -.02em; margin-top: 2.3em; }
.dprose h3 { font-size: 1.28rem; margin-top: 1.9em; }
.dprose h4 { font-size: 1.08rem; margin-top: 1.7em; }
.dprose h5 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-muted); margin-top: 1.7em; }
.dprose h6 { font-size: .95rem; color: var(--text-muted); letter-spacing: 0; margin-top: 1.5em; }
.dprose h1 + *, .dprose h2 + *, .dprose h3 + *, .dprose h4 + *, .dprose h5 + *, .dprose h6 + * { margin-top: .6em; }
.dprose strong, .dprose b { font-weight: 700; }
.dprose em { font-style: italic; }
.dprose small { font-size: .88em; color: var(--text-muted); }
.dprose a { color: var(--accent); font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.dprose a:hover { text-decoration-thickness: 2px; }
.dprose ul, .dprose ol { padding-left: 1.35em; }
.dprose li + li { margin-top: .45em; }
.dprose li > ul, .dprose li > ol { margin-top: .45em; }
.dprose ul { list-style: square; }
.dprose ul ul { list-style: circle; }
.dprose li::marker { color: var(--accent); }
.dprose ol li::marker { font-weight: 700; }
.dprose hr { border: 0; height: 1px; background: var(--border); margin: 2.6em 0; }

/* ---------- IMAGEN CON PIE ---------- */
.dfig { margin: 2em 0 2.2em; width: var(--fig-w, 100%); max-width: 100%; }
.dfig-frame { position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.dfig-scroll { overflow: hidden; }
.dfig-img { display: block; width: 100%; height: auto; aspect-ratio: var(--fig-ratio, auto); }
.dfig[data-mode="fit"] .dfig-img { cursor: zoom-in; }
.dfig-open {
  position: absolute; right: 10px; bottom: 10px;
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px; border-radius: 7px;
  background: color-mix(in srgb, var(--text) 82%, transparent); color: var(--bg);
  font-size: .8rem; font-weight: 700;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.dfig-open svg { width: 15px; height: 15px; }
.dfig-pan { display: none; align-items: center; gap: 12px; margin-top: 10px; font-size: .85rem; color: var(--text-muted); }
.dfig-mini {
  position: relative; flex: none; width: 76px; aspect-ratio: var(--fig-ratio, 16 / 9);
  border: 1px solid var(--border); border-radius: 4px; background-size: 100% 100%; background-color: var(--surface);
}
.dfig-mini i { position: absolute; top: -1px; bottom: -1px; left: 0; width: 30%; border: 2px solid var(--accent); border-radius: 3px; background: rgba(216,67,50,.08); }
.dfig-pan svg { width: 18px; height: 18px; color: var(--accent); flex: none; }

/* panorámica: la captura a escala de lectura, se recorre en horizontal */
.dfig[data-mode="pan"] { width: 100%; }
.dfig[data-mode="pan"] .dfig-scroll { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.dfig[data-mode="pan"] .dfig-img { width: var(--fig-w); max-width: none; }
.dfig[data-mode="pan"] .dfig-pan { display: flex; }
.dfig[data-mode="pan"] .dfig-frame::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 28px; pointer-events: none; background: linear-gradient(90deg, transparent, rgba(17,17,17,.14)); }

/* pie: el elemento más repetido de la superficie */
.dfig figcaption {
  display: flex; gap: 10px; align-items: baseline;
  max-width: var(--dtext); margin-top: 12px;
  font-size: .93rem; line-height: 1.5; color: var(--text-muted);
}
.dfig figcaption::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); transform: translateY(-1px); }
.dfig-num { color: var(--text); font-weight: 700; margin-right: .2em; }

/* ---------- la tabla ---------- */
.dtable-box { position: relative; margin: 1.8em 0; }
.dtable { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; scrollbar-width: thin; }
.dtable table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: .95rem; line-height: 1.5; }
.dtable th, .dtable td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 1px solid var(--border); max-width: 24em; }
.dtable th { background: var(--surface); font-weight: 700; white-space: nowrap; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable th:first-child, .dtable td:first-child { position: sticky; left: 0; background: var(--bg); font-weight: 700; }
.dtable th:first-child { background: var(--surface); }
.dtable-box.is-scroll .dtable th:first-child, .dtable-box.is-scroll .dtable td:first-child { box-shadow: 1px 0 0 var(--border); }
.dtable-box.is-scroll:not(.is-end)::after { content: ""; position: absolute; top: 1px; right: 1px; bottom: 1px; width: 32px; border-radius: 0 10px 10px 0; pointer-events: none; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 10%, transparent)); }

/* ---------- anterior / siguiente ---------- */
.dpager { max-width: var(--dtext); display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--border); }
.dpg { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-sm); transition: border-color .2s, background .2s; }
.dpg:hover { border-color: var(--accent); background: var(--surface); }
.dpg--next { text-align: right; grid-column: 2; }
.dpg-lbl { font-size: .8rem; color: var(--text-dim); font-weight: 700; }
.dpg--prev .dpg-lbl::before { content: "← "; }
.dpg--next .dpg-lbl::after { content: " →"; }
.dpg-t { font-weight: 700; color: var(--text); line-height: 1.3; }

/* ---------- inicio de producto: índice ---------- */
.dindex { list-style: none; padding: 0; max-width: 860px; border-top: 1px solid var(--border); }
.dix-a { display: grid; grid-template-columns: 1fr auto 20px; grid-template-areas: "t n c" "k k c"; gap: 2px 16px; align-items: center; padding: 18px 6px; border-bottom: 1px solid var(--border); }
.dix-a:hover { background: var(--surface); }
.dix-t { grid-area: t; font-weight: 700; font-size: 1.1rem; }
.dix-kids { grid-area: k; font-size: .9rem; color: var(--text-muted); }
.dix-n { grid-area: n; font-size: .8rem; color: var(--text-dim); white-space: nowrap; }
.dix-a svg { grid-area: c; width: 18px; height: 18px; color: var(--accent); }

/* ---------- visor a tamaño real ---------- */
.dview { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(13,13,13,.96); color: #fff; }
.dview::backdrop { background: rgba(0,0,0,.6); }
.dview[open] { display: flex; flex-direction: column; }
.dview-bar { flex: none; display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.12); }
.dview-cap { flex: 1; min-width: 0; font-size: .9rem; line-height: 1.4; color: rgba(255,255,255,.78); }
.dview-cap .dfig-num { color: #fff; }
.dview-close { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; border: 1px solid rgba(255,255,255,.22); color: #fff; }
.dview-close svg { width: 18px; height: 18px; }
.dview-stage { flex: 1; overflow: auto; overscroll-behavior: contain; display: grid; place-items: start; padding: 16px; }
.dview-img { width: auto; max-width: none; height: auto; border-radius: 4px; }
.dview-hint { flex: none; padding: 8px 16px 14px; font-size: .78rem; color: rgba(255,255,255,.55); }

/* ---------- aviso de ruta (maqueta) ---------- */
.dtoast { position: fixed; z-index: 200; left: 50%; bottom: 20px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .25s var(--ease); display: flex; flex-direction: column; gap: 2px; background: var(--ink-bg); color: var(--ink-muted); padding: 10px 16px; border-radius: 10px; font-size: .74rem; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }
.dtoast code { font-family: var(--font-mono); color: #fff; font-size: .85rem; overflow-wrap: anywhere; }
.dtoast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- hub /docs ---------- */
.dhub { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.dhub-card { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 26px 24px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); transition: border-color .2s, transform .25s var(--ease), box-shadow .25s; }
.dhub-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.dhub-card h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.015em; }
.dhub-card p { color: var(--text-muted); font-size: .97rem; }
.dhub-meta { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.dhub-meta span { font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 100px; background: var(--surface-2); color: var(--text-muted); }
.dhub-go { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent); }
.dhub-go svg { width: 17px; height: 17px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 999px) {
  .dwrap { grid-template-columns: minmax(0, 1fr); }
  .dcrumbs { display: none; }
  .dbar-open { display: inline-flex; }
  .dbar-now { display: block; }
  .dcontent { padding-top: 28px; }
  /* la barra lateral pasa a ser una hoja a pantalla completa */
  .dside {
    position: fixed; z-index: 130; inset: 0; max-height: none;
    background: var(--bg); padding: 16px var(--gutter) 40px;
    transform: translateX(-102%); visibility: hidden;
    transition: transform .3s var(--ease), visibility .3s;
  }
  .dside.is-open { transform: none; visibility: visible; }
  .dside-close { display: grid; }
  .dside-head { position: sticky; top: -16px; background: var(--bg); padding: 8px 0 12px; margin: -8px 0 8px; z-index: 2; border-bottom: 1px solid var(--border); }
  .dt-link, .dt-home { padding-block: 11px; font-size: 1rem; }  /* objetivo táctil ≥ 44 px */
  .dt-tog { width: 44px; height: 44px; }
  .dsheet-open { overflow: hidden; }
}
@media (max-width: 759px) {
  /* captura que no cabe a su tamaño: rompe el margen y usa todo el ancho del teléfono */
  .dfig[data-mode="fit"], .dfig[data-mode="pan"] { width: auto; margin-inline: calc(-1 * var(--gutter)); max-width: none; }
  .dfig[data-mode="fit"] .dfig-frame, .dfig[data-mode="pan"] .dfig-frame { border-radius: 0; border-inline: 0; box-shadow: none; }
  .dfig[data-mode="fit"] .dfig-pan, .dfig[data-mode="pan"] .dfig-pan,
  .dfig[data-mode="fit"] figcaption, .dfig[data-mode="pan"] figcaption { padding-inline: var(--gutter); }
  .dfig-open-l { display: none; }
  .dfig-open { width: 38px; padding: 0; justify-content: center; }
  .dtable-box { margin-inline: calc(-1 * var(--gutter)); }
  .dtable { border-radius: 0; border-inline: 0; }
  .dtable-box.is-scroll:not(.is-end)::after { border-radius: 0; right: 0; }
  .dtable th, .dtable td { padding: 11px 14px; }
  .dtable th:first-child, .dtable td:first-child { padding-left: var(--gutter); }
  .dpager { grid-template-columns: 1fr; }
  .dpg--next { grid-column: auto; }
  .dprose h1 { font-size: 1.7rem; }
  .dprose h2 { font-size: 1.42rem; }
  .dprose h3 { font-size: 1.2rem; }
  .dix-a { grid-template-areas: "t c" "k c" "n c"; grid-template-columns: 1fr 20px; }
}
@media (prefers-reduced-motion: reduce) { .dside, .dtoast { transition: none; } }

/* en documentación el idioma lo cambia la barra documental, que sabe a qué página ir */
/* (regla retirada en la adaptacion a V4: ver el bloque del final) */

/* ══════════════════════════════════════════════════════════════════════════
   ADAPTACION A V4 — lo unico que se separa de la propuesta, y por que.
   La maqueta es un sitio suelto; aqui convive con el resto de V4.
   ══════════════════════════════════════════════════════════════════════════ */

/* 1 · El nav de V4 es `position: fixed`, y en las paginas normales quien baja el
       contenido por debajo de el es `.page-header`. Las paginas documentales no
       lo llevan: en la maqueta ese papel lo hacia `.dmock`, que es andamiaje de
       la maqueta y no se trajo. Sin esto, el <h1> queda debajo de la barra. */
.docs .dbar { margin-top: var(--nav-h); }

/* 2 · La superficie documental de la maqueta mide 1440 px. En V4 el nav, el pie y
       todas las secciones miden --container (1180), asi que a 1440 el bloque
       sobresale del resto de la pagina. Se alinea con el sitio. */
.docs .dwrap,
.docs .dbar > .container { max-width: var(--container); }

/* 3 · Un solo conmutador de idioma. La maqueta ocultaba el de la barra de
       navegacion y ponia el suyo en la barra documental; V4 ya tiene uno que
       funciona en las 51 paginas y es el que se usa. */
