/* Documentación FOSS — bicolor, escala de grises */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #171717;
  --surface-2: #242424;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --accent: #e0e0e0;
  --accent-dim: #b8b8b8;
  --border: #333333;
  --emphasis: #ffffff;
  --inverse: #0d0d0d;
  --link: #d4d4d4;
  --link-hover: #ffffff;
  --link-visited: #b0b0b0;
  --code-bg: #242424;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  --radius: 8px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-2: #ececec;
  --text: #141414;
  --muted: #5c5c5c;
  --accent: #1a1a1a;
  --accent-dim: #3d3d3d;
  --border: #d6d6d6;
  --emphasis: #000000;
  --inverse: #ffffff;
  --link: #2a2a2a;
  --link-hover: #000000;
  --link-visited: #4a4a4a;
  --code-bg: #ececec;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a:link { color: var(--link); }
a:visited { color: var(--link-visited); }
a:hover { color: var(--link-hover); }

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  padding: 1.35rem 1rem 1rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.brand {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  display: block;
  margin-bottom: 0.2rem;
  letter-spacing: -0.02em;
}

.tag {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.sidebar nav a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 0.38rem 0;
  font-size: 0.92rem;
  transition: color 0.15s;
}

.sidebar nav a:hover { color: var(--link-hover); }
.sidebar nav a.nav-external { color: var(--link); margin-top: 0.15rem; }

.sidebar hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.85rem 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1.25rem;
}

.theme-toggle {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.theme-toggle:hover {
  border-color: var(--accent-dim);
}

main {
  padding: 2rem 2.5rem 3rem;
  max-width: 820px;
}

h1 {
  font-size: 1.65rem;
  margin-top: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.05rem;
  margin-top: 2rem;
  margin-bottom: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
  font-weight: 600;
}

.lead {
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.doc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.55rem;
  box-shadow: var(--shadow);
}

.doc-list a {
  font-weight: 600;
  text-decoration: none;
}

.doc-list a:hover { text-decoration: underline; }

.doc-list .desc {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.2rem;
  font-weight: 400;
}

.card-grid {
  display: grid;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
}

.card p {
  margin: 0.25rem 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.card-actions {
  margin-top: 0.65rem;
  font-size: 0.88rem;
}

.card-actions a {
  margin-right: 1rem;
  text-decoration: none;
  font-weight: 500;
}

.card-actions a:hover { text-decoration: underline; }
.card-actions a.ext::after {
  content: " ↗";
  font-size: 0.75em;
  opacity: 0.75;
}

.path-hint {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

.btn {
  display: inline-block;
  background: var(--emphasis);
  color: var(--inverse) !important;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  margin-top: 0.5rem;
}

.btn:hover {
  opacity: 0.88;
  color: var(--inverse) !important;
}

.btn-secondary {
  background: transparent;
  color: var(--link) !important;
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent-dim);
  color: var(--link-hover) !important;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

th, td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  text-align: left;
}

tr:last-child td { border-bottom: none; }

th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

pre {
  background: var(--surface);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border-radius: var(--radius);
  font-size: 0.84rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

pre.license {
  white-space: pre-wrap;
  font-size: 0.75rem;
  max-height: 70vh;
  overflow-y: auto;
}

code {
  background: var(--code-bg);
  padding: 0.12em 0.38em;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: ui-monospace, "Cascadia Code", monospace;
}

ol, ul { padding-left: 1.25rem; }
li { margin-bottom: 0.35rem; }

.note {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  color: var(--muted);
  margin: 1rem 0;
}

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  main { padding: 1.5rem 1.25rem 2.5rem; }
}

/* —— Documentos markdown renderizados —— */
main { max-width: 980px; }
.sidebar nav .nav-h {
  margin: 0.6rem 0 0.15rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.sidebar nav a.active { color: var(--emphasis); font-weight: 600; }
.badge {
  display: inline-block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.08em 0.5em;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  vertical-align: middle;
  margin-left: 0.3em;
}
.badge-latest { border-color: var(--emphasis); color: var(--emphasis); }
.doc-head { margin-bottom: 1rem; }
.doc-head h1 { margin-bottom: 0.25rem; }
.doc-links { font-size: 0.85rem; color: var(--muted); margin: 0 0 1rem; }
.doc-links a { margin-right: 0.9rem; text-decoration: none; }
.doc-links a:hover { text-decoration: underline; }
.doc-links code { font-size: 0.78rem; }
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0 0 1.5rem;
  font-size: 0.86rem;
}
.toc p { margin: 0 0 0.35rem; font-weight: 600; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0.15rem 0; }
.toc li.n3 { padding-left: 1rem; }
.toc a { text-decoration: none; color: var(--link); }
.toc a:hover { text-decoration: underline; }
article.md h2 { text-transform: none; letter-spacing: 0; color: var(--text); font-size: 1.25rem; margin-top: 2.2rem; }
article.md h3 { font-size: 1.05rem; }
article.md h4 { font-size: 0.98rem; margin: 1.1rem 0 0.4rem; }
article.md p, article.md li { font-size: 0.95rem; }
article.md blockquote {
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}
article.md hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
article.md img { max-width: 100%; }
article.md details { border: 1px dashed var(--border); border-radius: var(--radius); padding: 0.5rem 0.9rem; margin: 1rem 0; }
article.md summary { cursor: pointer; font-weight: 600; }
.table-wrap { overflow-x: auto; margin: 1rem 0; }
.table-wrap table { min-width: 100%; width: max-content; max-width: none; }
.table-wrap td, .table-wrap th { vertical-align: top; max-width: 42rem; }
.table-wrap td p { margin: 0; }
th { text-transform: none; letter-spacing: 0; font-size: 0.8rem; }
.meta-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  margin: 0 0 1.5rem;
  font-size: 0.88rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem 1.5rem;
}
.meta-box dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.meta-box dd { margin: 0.1rem 0 0; }
.op-grid { display: grid; gap: 0.75rem; margin: 0.75rem 0 1.5rem; }
.op-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1.1rem; box-shadow: var(--shadow); }
.op-card h3 { margin: 0 0 0.3rem; font-size: 0.98rem; }
.op-card p { margin: 0.25rem 0; font-size: 0.9rem; color: var(--muted); }
.op-card .badge { float: right; }
.tabla-head { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; margin-top: 2rem; }
.tabla-head h3 { margin: 0; }
.tabla-head .seccion { font-size: 0.82rem; color: var(--muted); }
.resumen { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: 0.88rem; margin: 0.5rem 0 1rem; color: var(--muted); }
.resumen strong { color: var(--text); }
.aviso { font-size: 0.78rem; color: var(--muted); font-style: italic; }
.badge-pausa { border-style: dashed; }
