/* ============================================================
   MITIGAION — Módulo de Inclusión y Accesibilidad
   · Avatar en Lengua de Señas Mexicana (LSM)
   · Barra de accesibilidad (contraste · texto · subtítulos · teclado)
   · Pictogramas flat, geométricos, sin rostro
   Integrado al sistema de diseño dark (ember/contain). Se autoinyecta vía a11y.js
   ============================================================ */

/* ---------- Saltar al contenido (navegación por teclado) ---------- */
.a11y-skip {
  position: fixed; top: 10px; left: 50%; transform: translate(-50%, -160%);
  z-index: 400; background: var(--ember); color: #160a00; font-weight: 700;
  font-family: var(--f-body); font-size: 15px; padding: 12px 22px; border-radius: 100px;
  box-shadow: 0 14px 30px -10px rgba(0,0,0,.7); transition: transform .25s var(--ease);
}
.a11y-skip:focus { transform: translate(-50%, 0); outline: 3px solid var(--contain); outline-offset: 3px; }

/* ---------- Foco visible para teclado (sin afectar mouse) ---------- */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible,
.seg button:focus-visible, .nav-toggle:focus-visible, input[type=range]:focus-visible {
  outline: 3px solid var(--contain); outline-offset: 3px; border-radius: 6px;
}
form.lead input:focus-visible, form.lead select:focus-visible, form.lead textarea:focus-visible {
  outline: 3px solid var(--contain); outline-offset: 2px; border-color: var(--contain);
}

/* ============================================================
   FABs (botones flotantes) — esquinas inferiores, discretos
   ============================================================ */
.a11y-fab {
  position: fixed; bottom: 22px; z-index: 300;
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-2);
  color: var(--text);
  box-shadow: 0 18px 40px -16px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.02);
  backdrop-filter: blur(10px) saturate(140%); -webkit-backdrop-filter: blur(10px) saturate(140%);
  transition: transform .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease);
}
.a11y-fab:hover { transform: translateY(-3px); border-color: var(--ember); box-shadow: 0 22px 48px -18px rgba(0,0,0,.9), 0 0 30px -10px rgba(255,106,44,.35); }
.a11y-fab svg { width: 26px; height: 26px; }
.a11y-fab--lsm { right: 22px; }
.a11y-fab--lsm { border-color: rgba(33,224,182,.4); color: var(--contain); }
.a11y-fab--lsm::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid var(--contain); opacity: .55;
  animation: a11y-ring 2.8s var(--ease) infinite;
}
@keyframes a11y-ring { 0% { transform: scale(.92); opacity: .55; } 70% { transform: scale(1.18); opacity: 0; } 100% { opacity: 0; } }
.a11y-fab--acc { left: 22px; color: var(--text); }
.a11y-fab--acc:hover { color: var(--ember); }

/* etiqueta accesible al hover (tooltip) */
.a11y-fab .a11y-tip {
  position: absolute; bottom: 50%; transform: translateY(50%);
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text-dim); padding: 7px 11px; border-radius: 8px; pointer-events: none;
  opacity: 0; transition: opacity .25s; box-shadow: 0 10px 24px -12px rgba(0,0,0,.8);
}
.a11y-fab--lsm .a11y-tip { right: 70px; }
.a11y-fab--acc .a11y-tip { left: 70px; }
.a11y-fab:hover .a11y-tip, .a11y-fab:focus-visible .a11y-tip { opacity: 1; }

@media (prefers-reduced-motion: reduce) { .a11y-fab--lsm::after { animation: none; } }

/* ============================================================
   Paneles emergentes (popover sobre cada FAB)
   ============================================================ */
.a11y-pop {
  position: fixed; bottom: 92px; z-index: 320;
  width: min(360px, calc(100vw - 32px));
  background: linear-gradient(180deg, rgba(18,25,34,.94), rgba(12,16,22,.96));
  border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.03);
  backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
  opacity: 0; transform: translateY(14px) scale(.98); pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.a11y-pop.open { opacity: 1; transform: none; pointer-events: auto; }
.a11y-pop--lsm { right: 22px; }
.a11y-pop--acc { left: 22px; }

.a11y-pop-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.a11y-pop-head .ttl { font-family: var(--f-display); font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.a11y-pop-head .sub { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-mute); margin-top: 3px; }
.a11y-close {
  flex: none; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid var(--line); color: var(--text-dim); transition: all .25s var(--ease);
}
.a11y-close:hover { border-color: var(--ember); color: var(--ember); }
.a11y-close svg { width: 15px; height: 15px; }
.a11y-pop-body { padding: 18px; }

/* ============================================================
   Panel LSM — Avatar en Lengua de Señas Mexicana
   ============================================================ */
.a11y-lsm-media {
  position: relative; aspect-ratio: 16/10; border-radius: var(--r-sm); overflow: hidden;
  background: radial-gradient(120% 120% at 50% 0%, rgba(33,224,182,.12), transparent 60%), var(--bg-2);
  border: 1px solid var(--line); display: grid; place-items: center;
}
.a11y-lsm-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.a11y-lsm-ph { text-align: center; padding: 18px; }
.a11y-lsm-ph .hands { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--contain); }
.a11y-lsm-ph .t { font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--contain); }
.a11y-lsm-ph .d { font-size: 12.5px; color: var(--text-mute); margin-top: 6px; }
.a11y-lsm-cap {
  margin-top: 14px; padding: 14px 15px; background: var(--bg-2);
  border: 1px solid var(--line); border-left: 3px solid var(--contain); border-radius: var(--r-sm);
}
.a11y-lsm-cap .lbl { font-family: var(--f-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-mute); display: block; margin-bottom: 7px; }
.a11y-lsm-cap p { font-size: 13.5px; color: var(--text-dim); line-height: 1.55; }
.a11y-lsm-cta {
  display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%;
  margin-top: 14px; padding: 12px; border-radius: 100px;
  background: var(--grad-cool); color: #04201a; font-weight: 700; font-size: 14px;
  transition: filter .3s var(--ease), transform .3s var(--ease);
}
.a11y-lsm-cta:hover { filter: brightness(1.08); transform: translateY(-2px); }
.a11y-lsm-cta svg { width: 16px; height: 16px; }

/* ============================================================
   Panel de accesibilidad — controles
   ============================================================ */
.a11y-group + .a11y-group { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.a11y-group > .glbl {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-mute); margin-bottom: 12px;
}
.a11y-group > .glbl svg { width: 16px; height: 16px; color: var(--ember); flex: none; }

/* Toggle (switch) */
.a11y-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.a11y-toggle .lab { font-size: 14px; color: var(--text); font-weight: 600; }
.a11y-toggle .lab small { display: block; font-weight: 400; font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.a11y-switch {
  position: relative; flex: none; width: 48px; height: 28px; border-radius: 100px;
  background: var(--bg-2); border: 1px solid var(--line-2); transition: background .3s var(--ease), border-color .3s var(--ease);
}
.a11y-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--text-dim); transition: transform .3s var(--ease), background .3s var(--ease);
}
.a11y-switch[aria-pressed="true"] { background: rgba(33,224,182,.25); border-color: var(--contain); }
.a11y-switch[aria-pressed="true"]::after { transform: translateX(20px); background: var(--contain); }

/* Stepper de tamaño de texto */
.a11y-step { display: flex; align-items: center; gap: 10px; }
.a11y-step button {
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line-2);
  display: grid; place-items: center; color: var(--text); font-family: var(--f-display); font-weight: 700;
  transition: all .25s var(--ease);
}
.a11y-step button:hover:not(:disabled) { border-color: var(--ember); color: var(--ember); }
.a11y-step button:disabled { opacity: .35; cursor: not-allowed; }
.a11y-step button .sm { font-size: 14px; } .a11y-step button .lg { font-size: 22px; }
.a11y-step .meter { flex: 1; }
.a11y-step .meter .bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.a11y-step .meter .bar i { display: block; height: 100%; background: var(--grad-heat); transition: width .3s var(--ease); }
.a11y-step .meter .pct { font-family: var(--f-mono); font-size: 12px; color: var(--text-dim); margin-top: 7px; text-align: center; }

.a11y-reset {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 16px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-mute); transition: color .25s;
}
.a11y-reset:hover { color: var(--ember); }
.a11y-reset svg { width: 13px; height: 13px; }

/* ============================================================
   ESTADO: Alto contraste  (html.a11y-hc)
   ============================================================ */
html.a11y-hc {
  --text: #ffffff;
  --text-dim: #e8eef4;
  --text-mute: #c2ccd6;
  --line: rgba(255,255,255,.28);
  --line-2: rgba(255,255,255,.55);
  --panel: #0a0e13;
  --panel-2: #0d131a;
  --bg-2: #04070a;
}
html.a11y-hc body {
  background: #04070a;
}
/* texto con relleno de gradiente → color sólido legible */
html.a11y-hc .stat .n,
html.a11y-hc .hero h1 .hl {
  background: none !important; -webkit-background-clip: border-box; background-clip: border-box;
  -webkit-text-fill-color: var(--ember); color: var(--ember) !important;
}
html.a11y-hc .text-contain { color: var(--contain) !important; }
/* subraya enlaces de navegación y contenido para distinguirlos */
html.a11y-hc .nav-links a,
html.a11y-hc .foot ul a,
html.a11y-hc .auth-cell a.link { text-decoration: underline; text-underline-offset: 3px; }
/* atenúa capas decorativas que bajan contraste */
html.a11y-hc .fx-aurora, html.a11y-hc .fx-grain, html.a11y-hc .hero-photo,
html.a11y-hc .assist::before, html.a11y-hc .fx-spotlight { opacity: .04 !important; }
html.a11y-hc .pillar, html.a11y-hc .sector, html.a11y-hc .auth-cell,
html.a11y-hc .stat, html.a11y-hc .instr-row, html.a11y-hc form.lead input,
html.a11y-hc form.lead select, html.a11y-hc form.lead textarea { border-color: var(--line-2); }

/* ============================================================
   ESTADO: Subtítulos activos (body.a11y-cc)
   ============================================================ */
body.a11y-cc video::cue { background: rgba(4,7,10,.82); color: #fff; font-family: var(--f-body); }
.a11y-cc-note {
  display: none; margin-top: 10px; font-size: 12px; color: var(--text-mute);
  font-family: var(--f-mono); letter-spacing: .04em;
}
body.a11y-cc .a11y-cc-note { display: block; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 600px) {
  .a11y-fab { width: 50px; height: 50px; bottom: 16px; }
  .a11y-fab svg { width: 23px; height: 23px; }
  .a11y-fab--lsm { right: 14px; } .a11y-fab--acc { left: 14px; }
  .a11y-pop { bottom: 78px; }
  .a11y-pop--lsm { right: 14px; } .a11y-pop--acc { left: 14px; }
  .a11y-fab .a11y-tip { display: none; }
}
