:root {
  --bg:#F7F8FA; --surface:#FFFFFF; --surface-2:#F0F2F5; --ink:#14181F; --ink-2:#3A4250; --muted:#687182;
  --line:#E2E5EA; --accent:#1F5FBF; --accent-soft:#E7EFFB; --good:#1C7C54; --good-soft:#E3F3EB;
  --warn:#B4532A; --warn-soft:#FBEDE6; --shadow:0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg:#0F1216; --surface:#161A20; --surface-2:#1C2129; --ink:#E8EBF0; --ink-2:#C2C8D2; --muted:#8C95A3;
  --line:#272D36; --accent:#6EA1F0; --accent-soft:#1A2638; --good:#55C08E; --good-soft:#15291F;
  --warn:#E8946C; --warn-soft:#2E1E17; --shadow:none; } }
:root[data-theme="dark"] {
  --bg:#0F1216; --surface:#161A20; --surface-2:#1C2129; --ink:#E8EBF0; --ink-2:#C2C8D2; --muted:#8C95A3;
  --line:#272D36; --accent:#6EA1F0; --accent-soft:#1A2638; --good:#55C08E; --good-soft:#15291F;
  --warn:#E8946C; --warn-soft:#2E1E17; --shadow:none; }

* { box-sizing:border-box; }
html { scroll-behavior:smooth; scroll-padding-top:72px; }
body { margin:0; background:var(--bg); color:var(--ink-2);
  font:16px/1.7 "Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility; }
a { color:var(--accent); text-decoration:none; }
a:hover { text-decoration:underline; }
b, strong { color:var(--ink); font-weight:600; }
code { background:var(--surface-2); border:1px solid var(--line); border-radius:4px; padding:1px 5px;
  font:.85em ui-monospace,SFMono-Regular,Consolas,monospace; color:var(--ink); }

/* barra superior */
.topbar { position:sticky; top:0; z-index:10; background:color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter:saturate(1.4) blur(10px); border-bottom:1px solid var(--line); }
.topbar .in { max-width:1080px; margin:0 auto; padding:0 16px; height:56px; display:flex; align-items:center; gap:20px; }
.brand { font-weight:700; color:var(--ink); font-size:.95rem; white-space:nowrap; }
.brand:hover { text-decoration:none; }
.nav { display:flex; gap:18px; overflow-x:auto; scrollbar-width:none; flex:1; }
.nav::-webkit-scrollbar { display:none; }
.nav a { color:var(--muted); font-size:.86rem; white-space:nowrap; }
.nav a:hover { color:var(--ink); text-decoration:none; }
.lang { display:flex; border:1px solid var(--line); border-radius:7px; overflow:hidden; flex-shrink:0; }
.lang a, .lang span { padding:4px 10px; font-size:.78rem; font-weight:600; letter-spacing:.04em; }
.lang span { background:var(--ink); color:var(--bg); }
.lang a { color:var(--muted); }
.lang a:hover { color:var(--ink); text-decoration:none; background:var(--surface-2); }
@media (max-width:760px) { .nav { display:none; } .topbar .in { justify-content:space-between; } }

/* cabecera */
.wrap { max-width:1080px; margin:0 auto; padding:0 16px; }
.hero { padding:64px 0 40px; }
.eyebrow { display:inline-block; font-size:.76rem; font-weight:600; letter-spacing:.08em; text-transform:uppercase;
  color:var(--accent); background:var(--accent-soft); padding:4px 10px; border-radius:999px; margin:0 0 18px; }
h1 { font-size:clamp(1.9rem,4.6vw,3rem); line-height:1.1; letter-spacing:-.025em; color:var(--ink); margin:0 0 20px; max-width:22ch; }
.lede { font-size:clamp(1.02rem,2vw,1.18rem); color:var(--ink-2); margin:0 0 28px; max-width:66ch; }
.meta { font-size:.88rem; color:var(--muted); margin:0 0 26px; }
.btns { display:flex; flex-wrap:wrap; gap:10px; }
.btn { display:inline-flex; align-items:center; gap:8px; padding:10px 16px; border-radius:8px; font-size:.9rem; font-weight:500;
  border:1px solid var(--line); background:var(--surface); color:var(--ink); box-shadow:var(--shadow); }
.btn:hover { border-color:var(--accent); text-decoration:none; }
.btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
:root[data-theme="dark"] .btn.primary { color:#0F1216; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color:#0F1216; } }
.btn svg { width:16px; height:16px; }

.kpis { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin:40px 0 0; }
@media (max-width:820px) { .kpis { grid-template-columns:repeat(2,1fr); } }
.kpi { background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:18px; box-shadow:var(--shadow); }
.kpi .v { display:block; font-size:clamp(1.4rem,3vw,1.9rem); font-weight:700; color:var(--ink); letter-spacing:-.02em;
  font-variant-numeric:tabular-nums; line-height:1.15; }
.kpi .l { display:block; font-size:.84rem; color:var(--muted); margin-top:6px; line-height:1.4; }
.kpi.hl { border-color:var(--good); background:var(--good-soft); }
.kpi.hl .v { color:var(--good); }

/* secciones */
section { padding:56px 0 8px; border-top:1px solid var(--line); }
.sec-num { font-size:.78rem; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); margin:0 0 6px; }
h2 { font-size:clamp(1.4rem,3vw,1.85rem); letter-spacing:-.02em; color:var(--ink); margin:0 0 16px; line-height:1.2; }
h3 { font-size:1.05rem; color:var(--ink); margin:30px 0 10px; }
p { margin:0 0 16px; max-width:72ch; }
ul, ol { padding-left:20px; margin:0 0 16px; max-width:72ch; }
li { margin-bottom:8px; }
li::marker { color:var(--muted); }

.cols { display:grid; grid-template-columns:1fr 1fr; gap:18px; margin:18px 0; }
.cols3 { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin:18px 0; }
.cols > *, .cols3 > * { min-width:0; }
@media (max-width:820px) { .cols, .cols3 { grid-template-columns:1fr; } }
.card { background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:20px 22px; box-shadow:var(--shadow); }
.card h3 { margin-top:0; }
.card p:last-child, .card ul:last-child { margin-bottom:0; }
.card .tag { display:inline-block; font-size:.72rem; font-weight:600; letter-spacing:.06em; text-transform:uppercase;
  padding:3px 8px; border-radius:999px; margin-bottom:10px; }
.tag.good { color:var(--good); background:var(--good-soft); }
.tag.warn { color:var(--warn); background:var(--warn-soft); }
.tag.info { color:var(--accent); background:var(--accent-soft); }
.callout { border-left:3px solid var(--accent); background:var(--accent-soft); padding:16px 20px; border-radius:0 10px 10px 0; margin:20px 0; }
.callout p { margin:0; color:var(--ink); }
.formula { font:500 .95rem ui-monospace,SFMono-Regular,Consolas,monospace; color:var(--ink); background:var(--surface-2);
  border-radius:8px; padding:10px 14px; margin:10px 0 0; }

/* definiciones */
.defs { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:14px; margin:18px 0; }
.def { background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:16px 18px; }
.def h4 { margin:0 0 4px; font-size:.95rem; color:var(--ink); }
.def span { font-size:.92rem; }

/* pasos */
.steps { list-style:none; padding:0; counter-reset:s; max-width:none; }
.steps li { counter-increment:s; position:relative; padding:0 0 18px 48px; margin:0; }
.steps li::before { content:counter(s); position:absolute; left:0; top:0; width:30px; height:30px; border-radius:50%;
  background:var(--accent-soft); color:var(--accent); font-weight:700; font-size:.85rem; display:grid; place-items:center; }
.steps li::after { content:""; position:absolute; left:14.5px; top:34px; bottom:4px; width:1px; background:var(--line); }
.steps li:last-child::after { display:none; }

/* tablas */
.tbl { overflow-x:auto; margin:18px 0 10px; border:1px solid var(--line); border-radius:12px; background:var(--surface); box-shadow:var(--shadow); }
table { border-collapse:collapse; width:100%; font-size:.9rem; font-variant-numeric:tabular-nums; }
th, td { padding:11px 16px; text-align:right; border-bottom:1px solid var(--line); white-space:nowrap; }
th:first-child, td:first-child { text-align:left; white-space:normal; }
thead th { font-weight:600; color:var(--muted); font-size:.76rem; letter-spacing:.05em; text-transform:uppercase; background:var(--surface-2); }
tbody tr:last-child td { border-bottom:0; }
td.win { color:var(--good); font-weight:600; }
tr.hl td { background:color-mix(in srgb, var(--good) 7%, transparent); }
tr.grp td { background:var(--surface-2); font-size:.74rem; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); padding:7px 16px; }
.tbl.left td, .tbl.left th { text-align:left; white-space:normal; }
.note { font-size:.84rem; color:var(--muted); }

/* barras de latencia */
.bars { background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:22px; box-shadow:var(--shadow); margin:18px 0; }
.bars h4 { margin:0 0 4px; color:var(--ink); font-size:.95rem; }
.bars .sub { font-size:.84rem; color:var(--muted); margin:0 0 18px; }
.bgroup { margin-bottom:18px; }
.bgroup:last-child { margin-bottom:0; }
.bgroup .gl { font-size:.8rem; font-weight:600; color:var(--ink); margin-bottom:6px; }
.brow { display:grid; grid-template-columns:96px 1fr 112px; gap:10px; align-items:center; margin-bottom:5px; font-size:.82rem; }
.brow .n { color:var(--muted); }
.brow .t { height:14px; background:var(--surface-2); border-radius:4px; overflow:hidden; }
.brow .f { height:100%; border-radius:4px; background:var(--muted); }
.brow .f.c { background:#8A94A6; }
.brow .f.s { background:var(--accent); }
.brow .x { text-align:right; color:var(--ink); font-variant-numeric:tabular-nums; }
@media (max-width:520px) { .brow { grid-template-columns:72px 1fr 92px; } }

/* figuras */
figure { margin:22px 0; }
figure img { width:100%; height:auto; display:block; border:1px solid var(--line); border-radius:12px; background:#fff; }
figcaption { font-size:.85rem; color:var(--muted); margin-top:10px; max-width:76ch; }
figcaption b { color:var(--ink-2); }

footer { margin-top:64px; border-top:1px solid var(--line); padding:32px 0 56px; font-size:.86rem; color:var(--muted); }
footer .fg { display:flex; flex-wrap:wrap; justify-content:space-between; gap:20px; }
footer p { margin:0 0 6px; }
