/*
 * Portal publico de documentacion (/docs).
 * Sidebar con el indice + contenido renderizado desde los .md publicos.
 */

.docs-body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

.docs-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.docs-header__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.docs-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
}

.docs-brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.docs-brand__text strong {
  font-family: var(--font-display);
  font-size: 0.98rem;
}

.docs-brand__text small {
  color: var(--text-3);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.docs-header__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.docs-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: calc(100vh - 96px);
}

.docs-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-3);
}

.docs-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  outline: none;
}

.docs-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-right: 0.25rem;
}

.docs-list__item {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.85rem;
  line-height: 1.3;
  border-left: 2px solid transparent;
}

.docs-list__item small {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-3);
  font-size: 0.74rem;
}

.docs-list__item:hover {
  background: var(--hover);
  color: var(--text);
}

.docs-list__item.is-active {
  background: var(--accent-bg);
  border-left-color: var(--accent);
  color: var(--text);
}

.docs-list__item strong {
  font-weight: 600;
}

.docs-main {
  min-width: 0;
}

.docs-main .md-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-card);
}

/* El header del portal es sticky: sin este margen el titulo de destino queda
 * escondido detras al usar el indice o un enlace con ancla. */
#md-content h2,
#md-content h3 {
  scroll-margin-top: 84px;
}

/* ---------- Indice de secciones ("En esta pagina") ---------- */

/*
 * Los documentos del portal son largos; sin indice solo se recorren con la
 * barra de desplazamiento. Va dentro de la tarjeta del documento, arriba, para
 * que se lea antes del primer parrafo.
 */
.docs-toc {
  margin: 0 0 1.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.docs-toc__titulo {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  color: var(--text-2);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.docs-toc__titulo svg {
  width: 15px;
  height: 15px;
}

/*
 * Multicolumna en vez de grid: con grid, una fila entera crece hasta el alto
 * del titulo mas largo y el indice se llena de huecos. En columnas cada entrada
 * ocupa solo su alto.
 */
.docs-toc__lista {
  columns: 3 220px;
  column-gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-toc__lista li {
  break-inside: avoid;
}

.docs-toc__lista a {
  display: block;
  padding: 0.2rem 0 0.2rem 0.85rem;
  position: relative;
  color: var(--text-2);
  font-size: 0.82rem;
  line-height: 1.35;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

/* Guion discreto: los titulos del proyecto ya traen su propia numeracion
 * ("5. El set de pruebas"), asi que el indice no numera otra vez. */
.docs-toc__lista a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.62rem;
  width: 5px;
  height: 1px;
  background: var(--border-strong);
}

.docs-toc__lista a:hover {
  color: var(--accent);
  border-bottom-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.docs-toc__lista a:hover::before {
  background: var(--accent);
}

/* ---------- Fin del indice de secciones ---------- */

.docs-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1.25rem;
  color: var(--text-3);
  font-size: 0.78rem;
}

.docs-footer a {
  color: var(--text-2);
}

@media (max-width: 900px) {
  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .docs-sidebar {
    position: static;
    max-height: none;
  }

  .docs-list {
    max-height: 260px;
  }

  .docs-main .md-content {
    padding: 1.25rem 1rem;
  }
}
