/* Docs section (/docs, /es/docs). Loaded after styles.css; uses only the
   custom properties declared in its :root. */

.docs-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 40px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 24px 64px;
  align-items: start;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.docs-nav {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  font-size: 14px;
}
.docs-nav a {
  display: block;
  padding: 5px 10px;
  border-left: 2px solid var(--line-soft);
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.12s, border-color 0.12s;
}
.docs-nav a:hover { color: #fff; }
.docs-nav a[aria-current="page"] {
  color: var(--indigo-light);
  border-left-color: var(--indigo);
  font-weight: 600;
}
.docs-overview { margin-bottom: 14px; font-weight: 600; }
.docs-group { margin-bottom: 18px; }
.docs-group h2 {
  margin: 0 0 6px;
  padding-left: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.docs-group ul { list-style: none; margin: 0; padding: 0; }

/* ─── Article ───────────────────────────────────────────────── */
.docs-main { min-width: 0; }
.docs-article {
  max-width: 76ch;
  color: var(--text-dim);
  line-height: 1.65;
}
.docs-article h1 { margin: 0 0 20px; color: var(--text); font-size: 34px; line-height: 1.2; }
.docs-article h2 { margin: 40px 0 12px; color: var(--text); font-size: 24px; }
.docs-article h3 { margin: 28px 0 10px; color: var(--text); font-size: 18px; }
.docs-article a { color: var(--indigo-light); }
.docs-article a:hover { color: #fff; }
.docs-article code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}
.docs-article pre {
  position: relative;
  overflow-x: auto;
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}
.docs-article pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.docs-article pre.has-copy { padding-right: 5.5rem; }
.has-copy .copy-btn { position: absolute; top: 8px; right: 8px; background: var(--bg-1); }

.docs-article table {
  width: 100%;
  margin: 16px 0;
  border-collapse: collapse;
  font-size: 14px;
}
.docs-article th,
.docs-article td {
  padding: 8px 12px;
  border: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}
.docs-article th {
  background: var(--bg-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* Heading anchors appear on hover/focus only. */
.docs-article :is(h1, h2, h3, h4) { position: relative; }
.docs-article .anchor {
  position: absolute;
  left: -1.1em;
  color: var(--indigo);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.12s;
}
.docs-article :is(h1, h2, h3, h4):hover .anchor,
.docs-article .anchor:focus { opacity: 1; }

/* ─── Pager ─────────────────────────────────────────────────── */
.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 76ch;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}
.docs-prev,
.docs-next {
  display: block;
  padding: 10px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.12s;
}
.docs-prev:hover,
.docs-next:hover { border-color: var(--indigo); }
.docs-next { text-align: right; margin-left: auto; }
.docs-prev span,
.docs-next span {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* ─── Language switch: links instead of buttons ─────────────── */
.lang a {
  padding: 4px 10px;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  line-height: 1;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.lang a:hover { color: #fff; }
.lang a[aria-current="true"] {
  background: var(--grad-core);
  color: #fff;
}

/* ─── Narrow screens: sidebar becomes a block above the article ─ */
@media (max-width: 860px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 16px; }
  .docs-nav { position: static; max-height: none; overflow: visible; }
  .docs-article h1 { font-size: 28px; }
  .docs-article .anchor { display: none; }
}

/* Skip link: off-screen until it receives keyboard focus. */
.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 10;
  padding: 8px 14px;
  background: var(--bg-2);
  border: 1px solid var(--indigo);
  border-radius: var(--radius-sm);
  color: #fff;
  text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* Long paths and table cells wrap instead of widening the page on phones. */
.docs-article code { overflow-wrap: break-word; }
.docs-article td,
.docs-article th,
.docs-article td code,
.docs-article th code { overflow-wrap: anywhere; }
