/* =========================================================
   Panel de accesibilidad — botón flotante + opciones
   ========================================================= */

/* ---------- Botón flotante: al costado derecho, siempre visible al hacer scroll ---------- */
.acc-flotante {
  position: fixed; z-index: 2500;
  right: max(14px, env(safe-area-inset-right, 0px));
  top: 50%; transform: translateY(-50%);
  width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--rojo-texto); color: #fff;
  border: 3px solid var(--papel);
  box-shadow: 0 0 0 1.5px var(--rojo-texto), 0 14px 30px -10px rgba(28,27,26,.55);
  cursor: pointer;
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), background .2s ease, box-shadow .2s ease;
}
.acc-flotante .icono { width: 32px; height: 32px; stroke-width: 2; }
.acc-flotante:hover { transform: translateY(-50%) scale(1.08) rotate(-6deg); background: var(--tinta); box-shadow: 0 0 0 1.5px var(--tinta), 0 18px 36px -10px rgba(28,27,26,.6); }
.acc-flotante[aria-expanded="true"] { background: var(--tinta); box-shadow: 0 0 0 1.5px var(--tinta), 0 18px 36px -10px rgba(28,27,26,.6); }
.acc-flotante:focus-visible { outline: 3px solid var(--foco); outline-offset: 4px; border-radius: 50%; }
/* punto que avisa que hay opciones activas */
.acc-flotante.acc-activo::after {
  content: ""; position: absolute; top: -2px; right: -2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #1B7F4B; border: 3px solid var(--papel);
}
/* aparece después de la pantalla de carga */
.precargando .acc-flotante { opacity: 0; pointer-events: none; }
.acc-flotante { animation: acc-entrar .6s cubic-bezier(.34,1.56,.64,1) .3s both; }
@keyframes acc-entrar { from { opacity: 0; transform: translate(30px, -50%); } }

/* ---------- Panel ---------- */
.acc-panel[hidden] { display: none !important; }
.acc-panel {
  position: fixed; z-index: 2500;
  right: calc(max(14px, env(safe-area-inset-right, 0px)) + 76px);
  top: 50%; transform: translateY(-50%);
  width: min(400px, calc(100vw - 120px));
  max-height: calc(100vh - 32px); max-height: calc(100svh - 32px);
  display: flex; flex-direction: column;
  background: var(--papel-claro); color: var(--tinta);
  border: 1.5px solid var(--tinta); border-radius: var(--radio);
  box-shadow: 0 30px 60px -20px rgba(28,27,26,.45);
  font-family: var(--sans); font-size: 1rem; line-height: 1.4;
  animation: acc-abrir .35s cubic-bezier(.2,.8,.2,1);
}
@keyframes acc-abrir { from { opacity: 0; transform: translate(16px, -50%); } }

.acc-cab {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 14px 12px 18px; border-bottom: 1.5px solid var(--tinta);
  background: var(--rojo-texto); color: #fff; border-radius: 4px 4px 0 0;
}
.acc-cab h2 {
  margin: 0; font-family: var(--display); font-weight: 900; font-stretch: 78%; font-variation-settings: "wdth" 78;
  text-transform: uppercase; font-size: 1.6rem; line-height: 1;
}
.acc-cerrar {
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  background: none; color: #fff; border: 1.5px solid rgba(255,255,255,.7); border-radius: 50%;
}
.acc-cerrar:hover { background: #fff; color: var(--rojo-texto); }
.acc-cerrar .icono { width: 18px; height: 18px; }

.acc-cuerpo { overflow-y: auto; padding: 16px 18px 18px; display: grid; gap: 10px; overscroll-behavior: contain; }

.acc-tamano { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--linea); border-radius: var(--radio); background: var(--papel); }
.acc-tamano > span { font-weight: 700; }
.acc-tamano-control { display: flex; align-items: center; gap: 6px; }
.acc-tamano-control button {
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 1rem;
  background: none; color: var(--tinta); border: 1.5px solid var(--tinta);
}
.acc-tamano-control button:hover { background: var(--tinta); color: var(--papel); }
.acc-tamano-control output { min-width: 4.2ch; text-align: center; font-family: var(--mono); font-size: .95rem; font-variant-numeric: tabular-nums; }

.acc-grupo { margin: 8px 0 0; font-family: var(--mono); font-size: .75rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--rojo-texto); }
.acc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.acc-opcion {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px;
  min-height: 88px; padding: 12px; text-align: left; cursor: pointer;
  font: inherit; font-weight: 700; font-size: .92rem; line-height: 1.2;
  background: var(--papel); color: var(--tinta);
  border: 1.5px solid var(--linea); border-radius: var(--radio);
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}
.acc-opcion[hidden] { display: none; }
.acc-opcion .icono { width: 26px; height: 26px; color: var(--rojo-texto); }
.acc-opcion:hover { border-color: var(--tinta); transform: translateY(-2px); }
.acc-opcion[aria-pressed="true"] { background: var(--rojo-texto); border-color: var(--rojo-texto); color: #fff; }
.acc-opcion[aria-pressed="true"] .icono { color: #fff; }
.acc-opcion[aria-pressed="true"]::after {
  content: "✓"; position: absolute; top: 8px; right: 10px;
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--rojo-texto); font-size: .8rem; font-weight: 900;
}

.acc-reset {
  margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; cursor: pointer;
  font: inherit; font-weight: 700;
  background: var(--tinta); color: var(--papel); border: 1.5px solid var(--tinta); border-radius: 999px;
}
.acc-reset:hover { background: var(--rojo-texto); border-color: var(--rojo-texto); color: #fff; }
.acc-reset .icono { width: 18px; height: 18px; }
.acc-nota { margin: 2px 0 0; font-size: .82rem; color: var(--tinta-suave); text-align: center; }
.acc-nota kbd { font-family: var(--mono); font-size: .78rem; padding: 1px 5px; border: 1px solid var(--linea-fuerte); border-radius: 4px; background: var(--papel); }

/* Celular: botón un poco más chico y el panel sube desde abajo */
@media (max-width: 620px) {
  .acc-flotante { width: 52px; height: 52px; top: auto; bottom: max(18px, env(safe-area-inset-bottom, 0px)); transform: none; }
  .acc-flotante:hover { transform: scale(1.06); }
  .acc-flotante .icono { width: 28px; height: 28px; }
  @keyframes acc-entrar { from { opacity: 0; transform: translateX(30px); } }
  .acc-panel {
    left: 8px; right: 8px; top: auto; bottom: 8px; transform: none; width: auto;
    max-height: 82vh; max-height: 82svh;
    animation-name: acc-subir;
  }
  @keyframes acc-subir { from { opacity: 0; transform: translateY(24px); } }
}

/* =========================================================
   Efectos de cada opción
   (los filtros de color se aplican al contenido, no al panel)
   ========================================================= */
html.acc-gris body > *:not(.acc-ui):not(script)       { filter: grayscale(1); }
html.acc-saturacion body > *:not(.acc-ui):not(script) { filter: saturate(.35); }
html.acc-invertir body > *:not(.acc-ui):not(script)   { filter: invert(1) hue-rotate(180deg); }
html.acc-invertir body > *:not(.acc-ui) :is(img, video) { filter: invert(1) hue-rotate(180deg) !important; }

html.acc-espaciado body :is(p, li, a, span, label, dt, dd, summary, button, input, textarea, select, td, th, figcaption, legend):not(.gigante *):not(.acc-ui *) {
  letter-spacing: .06em !important; word-spacing: .16em !important; line-height: 1.9 !important;
}

html.acc-legible body :not(.gigante):not(.gigante *):not(svg):not(svg *) {
  font-family: "Atkinson Hyperlegible", Verdana, Tahoma, sans-serif !important;
}

html.acc-enlaces a:not(.ventana):not(.logo) {
  background: #FFEB3B !important; color: #000 !important;
  text-decoration: underline 3px !important; text-underline-offset: 3px;
  outline: 2px solid #000; outline-offset: 1px;
}
html.acc-enlaces a.ventana { outline: 3px dashed var(--rojo-texto); outline-offset: 8px; border-radius: 4px; }

html.acc-izquierda body *:not(.acc-ui *) { text-align: left !important; }

html.acc-cursor, html.acc-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M6 4l32 17-14 3.6L16.5 40z' fill='%23111' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 6 4, auto !important;
}
html.acc-cursor :is(a, button, [role="button"], summary, label, select),
html.acc-cursor :is(a, button, [role="button"], summary, label, select) * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M6 4l32 17-14 3.6L16.5 40z' fill='%23E5483B' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 6 4, pointer !important;
}

html.acc-sin-animacion *, html.acc-sin-animacion *::before, html.acc-sin-animacion *::after {
  animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
  transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
}
html.acc-sin-animacion a.ventana:hover { transform: none; }

html.acc-sin-imagenes :is(main, .pie) :is(img, video):not(.pie-logo) { visibility: hidden !important; }
html.acc-sin-imagenes .ventana-media { background-image: none; }

/* Guía de lectura: oscurece todo menos una franja que sigue al cursor */
.acc-mascara {
  position: fixed; left: 0; right: 0; z-index: 2400; height: 120px; pointer-events: none;
  box-shadow: 0 0 0 100vmax rgba(20,19,18,.6);
  border-top: 3px solid var(--rojo); border-bottom: 3px solid var(--rojo);
}

/* Texto que se está leyendo en voz alta */
.acc-leyendo { outline: 3px solid var(--rojo) !important; outline-offset: 4px; background-color: rgba(229,72,59,.12) !important; border-radius: 4px; }
html.acc-lector main :is(p, h1, h2, h3, li, dt, dd, summary) { cursor: help; }

/* En alto contraste el panel también cambia */
.alto-contraste .acc-cab { background: #000; border-bottom-color: #FFEB3B; }
.alto-contraste .acc-flotante { background: #FFEB3B; color: #000; border-color: #000; box-shadow: 0 0 0 2px #FFEB3B; }
.alto-contraste .acc-opcion[aria-pressed="true"], .alto-contraste .acc-opcion[aria-pressed="true"] .icono { background: #FFEB3B; color: #000; }
