:root {
  --bg: #ffffff; --surface: #f6f7f9; --text: #1a1f2b; --muted: #5b6474; --line: #e2e6ec;
  --brand: #0f4c81; --brand-dark: #0a3a63; --accent: #e8f1fa;
  --max: 860px; --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419; --surface: #171d25; --text: #e7ebf0; --muted: #a4adbb; --line: #2a323d;
    --brand: #6fb0e8; --brand-dark: #9dc9f0; --accent: #1b2a3a;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1419; --surface: #171d25; --text: #e7ebf0; --muted: #a4adbb; --line: #2a323d;
  --brand: #6fb0e8; --brand-dark: #9dc9f0; --accent: #1b2a3a;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top {
  border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 2;
}
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; color: var(--text); }
.logo .mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff;
  display: inline-grid; place-items: center; font-size: 15px; font-weight: 800;
}
.logo small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: 0; }
nav { display: flex; gap: 4px 16px; flex-wrap: wrap; align-items: center; font-size: 14px; }
nav a { color: var(--muted); }
nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-left: 8px; }
.lang button {
  border: 0; background: transparent; color: var(--muted); padding: 5px 11px; cursor: pointer; font: inherit; font-size: 13px;
}
.lang button[aria-pressed="true"] { background: var(--brand); color: #fff; }
main { padding: 44px 0 56px; }
.hero { padding: 24px 0 8px; }
.hero h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.15; margin: 0 0 12px; }
.hero p.lead { font-size: 19px; color: var(--muted); max-width: 640px; margin: 0 0 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 28px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.btn {
  display: inline-block; background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 8px; font-weight: 600;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
article h1 { font-size: clamp(26px, 4.5vw, 34px); margin: 0 0 6px; line-height: 1.2; }
article .meta { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
article h2 { font-size: 20px; margin: 30px 0 8px; padding-top: 6px; scroll-margin-top: 90px; }
article h3 { font-size: 17px; margin: 20px 0 6px; }
article p, article li { max-width: 72ch; }
article ul { padding-left: 22px; }
article table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 10px 0 16px; display: block; overflow-x: auto; }
a, code { overflow-wrap: anywhere; }
article th, article td { text-align: left; border-bottom: 1px solid var(--line); padding: 8px 10px 8px 0; vertical-align: top; }
article th { color: var(--muted); font-weight: 600; }
.note { background: var(--accent); border-left: 4px solid var(--brand); padding: 12px 16px; border-radius: 6px; margin: 16px 0; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 0 0 24px; font-size: 15px; }
.toc ol { margin: 6px 0 0; padding-left: 20px; columns: 2; column-gap: 24px; }
@media (max-width: 600px) { .toc ol { columns: 1; } }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; padding: 22px 0 36px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: space-between; }
footer a { color: var(--muted); }
/* language sections: JS hides the one not selected; without JS both show, in order */
html[data-lang="es"] [data-lang="en"] { display: none; }
html[data-lang="en"] [data-lang="es"] { display: none; }
.lang-sep { border: 0; border-top: 2px dashed var(--line); margin: 40px 0; }
html[data-lang] .lang-sep { display: none; }
