/* ==========================================================
   Estilos del sitio. Un solo archivo, sin dependencias externas.
   ========================================================== */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #111827;
  --muted: #5b6474;
  --border: #e2e5ea;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e8efff;
  --on-accent: #ffffff;
  --ok: #15803d;
  --ok-soft: #e6f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --err: #c62828;
  --err-soft: #fdecec;
  --meter-a: #22c55e;
  --meter-b: #eab308;
  --meter-c: #ef4444;
  --key: #ffffff;
  --key-border: #cfd5dd;
  --key-active: #2563eb;
  --key-tested: #d9f2e1;
  --key-tested-border: #6cc48a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --maxw: 1000px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161a21;
    --surface-2: #1d222b;
    --text: #e8ebf0;
    --muted: #9aa4b2;
    --border: #2a303b;
    --accent: #5b8cff;
    --accent-hover: #7aa2ff;
    --accent-soft: #1b2640;
    --on-accent: #0b1020;
    --ok: #4ade80;
    --ok-soft: #12291b;
    --warn: #fbbf24;
    --warn-soft: #2d2410;
    --err: #f87171;
    --err-soft: #321515;
    --key: #222833;
    --key-border: #353d4a;
    --key-active: #5b8cff;
    --key-tested: #173523;
    --key-tested-border: #3fa564;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
img, svg, video, canvas { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0 0 .4rem; }
h2 { font-size: 1.45rem; margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.1rem; margin: 1.6rem 0 .4rem; }
p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: .35rem; }
code, kbd {
  font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  font-size: .92em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .05em .35em;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1240px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; }

/* ---------- Cabecera ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex-wrap: wrap;
  min-height: 60px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
  font-size: 1.08rem;
  letter-spacing: -.01em;
  margin-right: auto;
}
.brand:hover { color: var(--text); }
.brand svg { width: 30px; height: 30px; flex: none; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 560;
  font-size: .95rem;
  padding: 6px 10px;
  border-radius: 8px;
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.lang-switch {
  font-size: .85rem;
  font-weight: 650;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 9px;
}
.lang-switch:hover { color: var(--text); border-color: var(--muted); }

/* ---------- Aviso de idioma (flotante, no desplaza el contenido) ---------- */
.lang-hint {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  z-index: 30;
  max-width: 520px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: .92rem;
}
.lang-hint .wrap { display: flex; gap: 8px 12px; align-items: center; padding: 10px 14px; flex-wrap: wrap; }
.lang-hint button { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.2rem; line-height: 1; }

/* ---------- Intro ---------- */
.hero { padding: 28px 0 8px; }
.hero p.lead { color: var(--muted); font-size: 1.08rem; max-width: 760px; margin: 0; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 18px 0 0; font-size: .92rem; font-weight: 600; }
.facts li { margin: 0; }
.facts li::before { content: "✓"; color: var(--ok); font-weight: 800; margin-right: 6px; }
.byline { color: var(--muted); font-size: .84rem; margin: 10px 0 0; }
.byline a { color: inherit; }
.callout {
  display: flex; gap: 12px; align-items: center;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 12px 0 0;
  color: var(--text);
  text-decoration: none;
}
.callout:hover { color: var(--text); border-color: var(--accent); }
.callout svg { width: 24px; height: 24px; color: var(--accent); flex: none; }
.callout strong { color: var(--accent); }

/* Tablas de contenido */
.table-wrap { overflow-x: auto; margin: 0 0 1rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { background: var(--surface-2); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.data-table tr:last-child td { border-bottom: 0; }

/* Prueba de videollamada */
.meet-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.meet-meter { margin-top: 10px; height: 12px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; background: var(--surface-2); border: 1px solid transparent; border-radius: 12px; padding: 12px 14px; margin: 0; }
.checklist .ci-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--muted); flex: none; }
.checklist .ci-icon svg { width: 20px; height: 20px; }
.checklist strong { display: block; }
.checklist .ci-text { display: block; color: var(--muted); font-size: .9rem; }
.checklist li[data-state="ok"] { background: var(--ok-soft); border-color: var(--key-tested-border); }
.checklist li[data-state="ok"] .ci-icon { color: var(--ok); }
.checklist li[data-state="warn"] { background: var(--warn-soft); }
.checklist li[data-state="warn"] .ci-icon, .checklist li[data-state="warn"] .ci-text { color: var(--warn); }
.checklist li[data-state="fail"] { background: var(--err-soft); }
.checklist li[data-state="fail"] .ci-icon, .checklist li[data-state="fail"] .ci-text { color: var(--err); }
.checklist li[data-state="busy"] .ci-icon { color: var(--accent); }
.ci-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ci-actions .btn { padding: 6px 10px; font-size: .85rem; }
@media (max-width: 760px) { .meet-grid { grid-template-columns: 1fr; } }

/* ---------- Tarjeta de herramienta ---------- */
.tool {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 20px 0 8px;
}
.tool.tool-wide { margin-left: auto; margin-right: auto; }

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--surface-2);
  color: var(--text);
  min-height: 48px;
}
.status::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.status[data-state="ok"] { background: var(--ok-soft); color: var(--ok); }
.status[data-state="ok"]::before { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); }
.status[data-state="warn"] { background: var(--warn-soft); color: var(--warn); }
.status[data-state="warn"]::before { background: var(--warn); }
.status[data-state="err"] { background: var(--err-soft); color: var(--err); }
.status[data-state="err"]::before { background: var(--err); }
.status[data-state="busy"]::before { background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-size: 1.02rem; padding: 12px 22px; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

.field { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 14px; font-size: .95rem; }
.field label { color: var(--muted); font-weight: 600; }
select, input[type="number"] {
  font: inherit;
  font-size: .95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  max-width: 100%;
}
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--text); font-size: .95rem; cursor: pointer; }
input[type="range"] { accent-color: var(--accent); width: min(360px, 100%); }

/* Medidor de nivel */
.meter {
  position: relative;
  height: 22px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.meter-fill {
  position: absolute; inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--meter-a) 0%, var(--meter-a) 60%, var(--meter-b) 80%, var(--meter-c) 100%);
  background-size: var(--meter-w, 100%) 100%;
  transition: width .06s linear;
}
.meter-peak {
  position: absolute; top: 0; bottom: 0;
  width: 3px; left: -4px;
  background: var(--text);
  opacity: .6;
}
.meter-scale { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: 4px; }

.viz {
  display: block;
  width: 100%;
  height: 160px;
  margin-top: 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.tool audio { display: block; width: 100%; margin-top: 14px; }
.privacy-mini { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .88rem; margin: 16px 0 0; }
.privacy-mini svg { width: 16px; height: 16px; flex: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.presets .btn { padding: 6px 10px; font-size: .85rem; }
.kb-log .placeholder { color: var(--muted); font-size: .92rem; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin: 16px 0 0;
}
.info-grid div {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}
.info-grid dt { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.info-grid dd { margin: 2px 0 0; font-weight: 650; overflow-wrap: anywhere; }

/* Cámara */
.video-box {
  position: relative;
  background: #0b0d12;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
}
.video-box video { width: 100%; height: 100%; object-fit: contain; display: block; }
.video-box video.mirror { transform: scaleX(-1); }
.video-box .placeholder { position: absolute; color: #9aa4b2; text-align: center; padding: 16px; font-weight: 600; }
.video-box .placeholder svg { width: 56px; height: 56px; display: block; margin: 0 auto 8px; opacity: .7; }
.snapshots { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.snapshots a { display: block; width: 160px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.snapshots img { display: block; width: 100%; }

/* Teclado */
.kb-wrap { container-type: inline-size; }
.kb {
  position: relative;
  width: 100%;
  aspect-ratio: 23 / 6.25;
  user-select: none;
  -webkit-user-select: none;
}
.key {
  position: absolute;
  padding: .18cqw;
}
.key span {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  border-radius: .55cqw;
  background: var(--key);
  border: 1px solid var(--key-border);
  border-bottom-width: .3cqw;
  font-size: 1.05cqw;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
  overflow: hidden;
  white-space: pre-line;
  transition: background-color .12s, border-color .12s, transform .05s;
}
.key.tested span { background: var(--key-tested); border-color: var(--key-tested-border); }
.key.active span { background: var(--key-active); border-color: var(--key-active); color: var(--on-accent); transform: translateY(.12cqw); }
.kb-stats { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 16px; align-items: baseline; }
.kb-stats .big { font-size: 1.6rem; font-weight: 750; }
.kb-stats .lbl { color: var(--muted); font-size: .85rem; font-weight: 600; }
.kb-log {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 12px;
  min-height: 34px;
}
.kb-log kbd { font-size: .85rem; padding: 3px 8px; }
.kb-narrow-note { display: none; color: var(--muted); font-size: .9rem; margin-top: 10px; }
@media (max-width: 640px) {
  .kb-narrow-note { display: block; }
}

/* Altavoces */
.lr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.lr-btn {
  appearance: none;
  font: inherit;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 12px;
  padding: 22px 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.lr-btn svg { width: 40px; height: 40px; }
.lr-btn:hover { border-color: var(--accent); }
.lr-btn.playing { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tone-readout { font-size: 2rem; font-weight: 750; font-variant-numeric: tabular-nums; margin: 6px 0; }
.subtool { border-top: 1px solid var(--border); margin-top: 22px; padding-top: 18px; }
.subtool h3 { margin-top: 0; }
.warning-note { font-size: .88rem; color: var(--muted); margin-top: 10px; }

/* Mando */
.pad-svg { display: block; width: 100%; max-width: 560px; margin: 4px auto 0; }
.pbody { fill: var(--surface-2); stroke: var(--border); stroke-width: 2; }
.pwell { fill: var(--surface); stroke: var(--border); stroke-width: 2; }
.pbtn .ps { fill: var(--key); stroke: var(--key-border); stroke-width: 2; transition: fill .1s, stroke .1s; }
.pbtn.tested .ps { fill: var(--key-tested); stroke: var(--key-tested-border); }
.pbtn.on .ps { fill: var(--key-active); stroke: var(--key-active); }
.pbtn .pfill { fill: var(--key-active); opacity: .5; }
.pbtn text { font: 650 13px system-ui, sans-serif; fill: var(--text); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.pbtn text.small { font-size: 10px; }
.pbtn.on text { fill: var(--on-accent); }
.drift-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.drift { margin: 0; background: var(--surface-2); border-radius: 12px; padding: 14px; text-align: center; }
.drift canvas { display: block; width: min(180px, 100%); aspect-ratio: 1; height: auto; margin: 0 auto 8px; }
.drift strong { display: block; }
.drift-txt { display: block; font-family: ui-monospace, Consolas, monospace; font-size: .82rem; color: var(--muted); }
.drift-txt[data-state="ok"] { color: var(--ok); }
.drift-txt[data-state="warn"] { color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; }
.chip { display: inline-flex; gap: 6px; align-items: baseline; border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 4px 9px; font-size: .88rem; }
.chip small { opacity: .75; font-family: ui-monospace, Consolas, monospace; }
.chip.tested { background: var(--key-tested); border-color: var(--key-tested-border); }
.chip.on { background: var(--key-active); border-color: var(--key-active); color: var(--on-accent); }
.axis-row { display: grid; grid-template-columns: 64px 1fr 76px; gap: 10px; align-items: center; font-size: .9rem; margin-top: 8px; }
.axis-row code { text-align: right; }
.axis-bar { position: relative; height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; }
.axis-bar::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--muted); opacity: .5; }
.axis-bar i { position: absolute; top: -5px; left: 50%; width: 4px; height: 16px; margin-left: -2px; background: var(--accent); border-radius: 2px; }

/* ---------- Contenido ---------- */
.content { padding-bottom: 24px; }
.content > section { max-width: 780px; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 42px; margin-bottom: 12px; }
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 750;
  display: grid; place-items: center;
  font-size: .9rem;
}
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 16px;
  margin-bottom: 10px;
}
.faq summary { cursor: pointer; font-weight: 650; padding: 14px 0; }
.faq details[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.faq details > *:last-child { margin-bottom: 14px; }
.note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ok);
  border-radius: 10px;
  padding: 14px 16px;
}

.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin: 12px 0 8px; }
.related a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-decoration: none;
  color: var(--text);
}
.related a:hover { border-color: var(--accent); }
.related strong { display: block; margin-bottom: 2px; }
.related span { color: var(--muted); font-size: .9rem; }

.legal { max-width: 780px; padding: 28px 0 40px; }

/* ---------- Pie ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .9rem;
  margin-top: 40px;
}
.site-footer .wrap { padding-top: 22px; padding-bottom: 28px; display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.site-footer .copy { margin-left: auto; }

@media (max-width: 640px) {
  .hero { padding-top: 18px; }
  .hero p.lead { font-size: 1rem; }
  .viz { height: 110px; }
  .header-inner { gap: 6px 10px; }
  .brand { width: 100%; margin-right: 0; }
  .main-nav { flex: 1; }
  .main-nav a { padding: 5px 7px; font-size: .9rem; }
  .tool { padding: 14px; }
  .lr-btn { padding: 16px 6px; font-size: .95rem; }
  .site-footer .copy { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
