/* ==========================================================================
   Efecto de las preferencias de accesibilidad + los controles del panel.

   Se carga la última para poder ganar a las demás hojas sin recurrir a
   !important salvo donde es imprescindible (alto contraste).
   ========================================================================== */

/* ===================== 1. Lo que hace cada preferencia ================== */

/* --- Tamaño del texto ---------------------------------------------------
   Casi todo el proyecto mide en rem, así que basta con mover la raíz.      */
html[data-texto="grande"] { font-size: 112.5%; }
html[data-texto="enorme"] { font-size: 125%; }

/* --- Reducir movimiento -------------------------------------------------
   Mismo efecto que prefers-reduced-motion, pero elegido a mano por si el
   sistema operativo no lo tiene puesto.                                    */
html[data-movimiento="reducido"] *,
html[data-movimiento="reducido"] *::before,
html[data-movimiento="reducido"] *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}

/* --- Subrayar enlaces ---------------------------------------------------
   Para no depender solo del color al distinguir un enlace del texto.       */
html[data-enlaces="subrayados"] a:not(.btn):not(.mbtn):not(.mcta):not(.skip-link) {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- Alto contraste -----------------------------------------------------
   Sube los grises intermedios a tinta, marca los bordes y quita las
   superficies teñidas. Aquí sí hace falta !important: pisa tokens que se
   usan en cientos de sitios.                                              */
html[data-contraste="alto"] {
  --gray-400: #4B5563 !important;
  --gray-500: #333333 !important;
  --gray-600: #1F2937 !important;
  --gray-700: #111111 !important;
  --gray-200: #767676 !important;
  --gray-300: #767676 !important;
}

html[data-contraste="alto"] .museo {
  --m-tinta-2: #1A1A1A !important;
  --m-tinta-3: #3A3A3A !important;
  --m-filete:  #767676 !important;
  --m-filete-2:#767676 !important;
  --m-fondo:   #FFFFFF !important;
}

/* Fondos suaves fuera: dificultan más de lo que decoran. */
html[data-contraste="alto"] .aviso--azul,
html[data-contraste="alto"] .utiles-caja,
html[data-contraste="alto"] .prox__nota,
html[data-contraste="alto"] .consejos,
html[data-contraste="alto"] .hero {
  background-image: none !important;
  background-color: #FFFFFF !important;
  border: 2px solid #111111;
}

html[data-contraste="alto"] .card,
html[data-contraste="alto"] .dato,
html[data-contraste="alto"] .destacado,
html[data-contraste="alto"] .mcard,
html[data-contraste="alto"] .msala,
html[data-contraste="alto"] .tarjeta {
  border: 2px solid #111111 !important;
  background-color: #FFFFFF !important;
}

html[data-contraste="alto"] :focus-visible {
  outline: 3px solid #000000 !important;
  outline-offset: 3px !important;
}

/* ===================== 2. Controles del panel ========================== */

.pref { display: flex; flex-direction: column; gap: 1rem; }

.pref__grupo {
  border: 0;
  margin: 0;
  padding: 0;
}

.pref__leyenda {
  display: block;
  padding: 0;
  margin-bottom: 0.625rem;
  font-size: 0.9375rem;
  color: var(--gray-700);
}

/* --- Tamaño del texto: radios de verdad, estilados --------------------- */

.tam { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }

.tam__opcion { position: relative; }

.tam__opcion input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.tam__cara {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  min-height: 4.5rem;      /* muy por encima del mínimo táctil de 44 px */
  padding: 0.5rem;
  background-color: var(--white);
  /* WCAG 1.4.11 pide 3:1 para el contorno de un control. Con gray-300 el
     borde daba 1.47:1 y el control no se distinguía del fondo. */
  border: 2px solid var(--gray-500);
  border-radius: var(--r-lg);
  color: var(--gray-700);
  text-align: center;
  transition: border-color .15s ease, background-color .15s ease;
}

.tam__muestra { line-height: 1; color: #111111; }
.tam__opcion:nth-child(1) .tam__muestra { font-size: 1rem; }
.tam__opcion:nth-child(2) .tam__muestra { font-size: 1.375rem; }
.tam__opcion:nth-child(3) .tam__muestra { font-size: 1.75rem; }

.tam__nombre { font-size: 0.75rem; color: var(--gray-600); }

.tam__opcion input:hover + .tam__cara { border-color: #111111; }
.tam__opcion input:focus-visible + .tam__cara { outline: 3px solid var(--blue); outline-offset: 2px; }

.tam__opcion input:checked + .tam__cara {
  border-color: #3730A3;
  background-color: #EEF2FF;
}
/* La selección no se marca solo con color: también aparece la palomita. */
.tam__opcion input:checked + .tam__cara .tam__nombre::before {
  content: '✓ ';
  color: #3730A3;
}

/* --- Interruptores ----------------------------------------------------- */

.sw {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.875rem 1rem;
  min-height: 3.25rem;
  background-color: var(--white);
  border: 2px solid var(--gray-500);   /* 3:1 mínimo, ver .tam__cara */
  border-radius: var(--r-lg);
  text-align: left;
  transition: border-color .15s ease;
}
.sw:hover { border-color: #111111; }
.sw[aria-checked="true"] { border-color: #15803D; }

.sw__txt { display: flex; flex-direction: column; gap: 0.125rem; }
.sw__nombre { color: #111111; }
.sw__nota { font-size: 0.8125rem; color: var(--gray-600); }

.sw__pista {
  position: relative;
  flex-shrink: 0;
  width: 3.25rem;
  height: 1.875rem;
  background-color: var(--gray-500);
  border-radius: var(--r-full);
  transition: background-color .15s ease;
}
.sw[aria-checked="true"] .sw__pista { background-color: #15803D; }

.sw__bola {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 1.375rem;
  height: 1.375rem;
  background-color: var(--white);
  border-radius: var(--r-full);
  transition: transform .15s ease;
}
.sw[aria-checked="true"] .sw__bola { transform: translateX(1.375rem); }

/* Además del color y la posición, el estado se escribe con palabras. */
.sw__estado {
  position: absolute;
  right: calc(100% + 0.5rem);
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--gray-600);
  white-space: nowrap;
}

.sw__marco { position: relative; display: flex; align-items: center; }

/* --- Tarjetas de guía (AudioGuía / LSP) -------------------------------- */

.guia {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem;
  background-color: var(--white);
  border: 2px solid var(--gray-500);   /* 3:1 mínimo, ver .tam__cara */
  border-left-width: 6px;
  border-radius: var(--r-lg);
  text-align: left;
  transition: border-color .15s ease, background-color .15s ease;
}
.guia:hover { background-color: #F8F8F7; }

.guia--audio { border-left-color: #3730A3; }
.guia--audio:hover { border-color: #3730A3; border-left-color: #3730A3; }
.guia--lsp { border-left-color: #92400E; }
.guia--lsp:hover { border-color: #92400E; border-left-color: #92400E; }

.guia__icono {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  color: var(--white);
  border-radius: var(--r-lg);
}
.guia--audio .guia__icono { background-color: #3730A3; }  /* 9.93:1 con blanco */
.guia--lsp   .guia__icono { background-color: #92400E; }  /* 7.09:1 con blanco */

.guia__txt { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.guia__nombre { font-size: 1.125rem; color: #111111; }
.guia__desc { font-size: 0.875rem; color: #4B5563; }      /* 7.56:1 */
.guia__flecha { margin-left: auto; flex-shrink: 0; color: #4B5563; }

/* --- Lista informativa del museo --------------------------------------- */

.enmuseo { display: flex; flex-direction: column; gap: 0.75rem; }
.enmuseo li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: #333333;
}
.enmuseo .icon { flex-shrink: 0; margin-top: 2px; color: #4B5563; }

/* --- Reproductor de la audioguía --------------------------------------- */

.repro { display: flex; flex-direction: column; gap: 1rem; }

.repro__controles { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.repro__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding-inline: 1.25rem;
  background-color: #3730A3;
  color: var(--white);
  border-radius: var(--r-lg);
  transition: background-color .15s ease;
}
.repro__btn:hover { background-color: #2A2480; }

.repro__btn--sec {
  background-color: var(--white);
  color: #111111;
  border: 2px solid var(--gray-500);
}
.repro__btn--sec:hover { background-color: #F3F4F6; }

.repro__btn:disabled { opacity: .45; cursor: not-allowed; }

.repro__pista {
  height: 0.5rem;
  background-color: var(--gray-200);
  border-radius: var(--r-full);
  overflow: hidden;
}
.repro__avance {
  height: 100%;
  width: 0;
  background-color: #3730A3;
  border-radius: var(--r-full);
  transition: width .2s linear;
}

.repro__estado {
  font-size: 0.875rem;
  color: #333333;
}

.repro__aviso {
  padding: 0.875rem 1rem;
  background-color: #FEF3C7;
  border-left: 4px solid #92400E;
  color: #3A2A0A;
  font-size: 0.875rem;
}

/* --- Cabecera de sección dentro del panel ------------------------------ */

.seccion__titulo {
  display: block;
  padding-bottom: 0.5rem;
  margin-bottom: 0.875rem;
  border-bottom: 2px solid #111111;
  font-size: 0.75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #333333;
}

.seccion + .seccion { margin-top: 1.75rem; }

.pref__pie {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.5rem;
}
.pref__reset {
  min-height: 2.75rem;
  padding-inline: 1rem;
  color: #333333;
  text-decoration: underline;
  text-underline-offset: 3px;
  border-radius: var(--r-lg);
}
.pref__reset:hover { color: #111111; background-color: #F3F4F6; }

@media (max-width: 420px) {
  .guia { flex-wrap: wrap; }
  .guia__flecha { display: none; }
}
