/* ==========================================================================
   Herramientas de accesibilidad (inc/accesibilidad.php)
   1. La barra: pestaña en el borde izquierdo y panel. Medida en px, para que
      no crezca al aumentar el texto.
   2. Los modos, como clases en <html> (las pone assets/js/accesibilidad.js,
      y en <head> lo guardado).
   Los modos de color no tocan la barra (.oc-a11y), para que siempre se pueda
   volver atrás.
   ========================================================================== */

/* 1. Barra ---------------------------------------------------------------- */

.oc-a11y {
	position: fixed;
	left: 0;
	top: 96px;
	z-index: 55; /* Sobre la cabecera (50), bajo el menú del móvil (60) y el aviso de cookies (70). */
	font-family: var(--oc-fuente-texto);
	font-size: 14px;
	line-height: 1.4;
	color: var(--oc-tinta);
}

@media (min-width: 1024px) {
	.oc-a11y {
		top: 144px;
	}
}

.oc-a11y__abrir {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 0 12px 12px 0;
	background: var(--oc-marca);
	color: #fff;
	box-shadow: 0 10px 24px -10px rgba(4, 122, 150, .65);
	cursor: pointer;
	transition: background-color .2s;
}

.oc-a11y__abrir:hover,
.oc-a11y__abrir[aria-expanded="true"] {
	background: var(--oc-marca-700);
}

.oc-a11y__abrir svg {
	width: 26px;
	height: 26px;
}

.oc-a11y__panel {
	position: absolute;
	top: 0;
	left: 52px;
	width: 272px;
	max-width: calc(100vw - 60px);
	max-height: calc(100vh - 112px);
	max-height: calc(100dvh - 112px);
	overflow-y: auto;
	padding: 14px;
	border-radius: 20px;
	background: #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 2px 6px rgba(35, 42, 44, .05), 0 30px 60px -24px rgba(35, 42, 44, .32);
}

.oc-a11y__panel[hidden] {
	display: none;
}

.oc-a11y__cabecera {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 0 0 8px 10px;
}

.oc-a11y__titulo {
	margin: 0;
	font-family: var(--oc-fuente-titulos);
	font-size: 18px;
	line-height: 1.25;
}

.oc-a11y__cerrar {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--oc-gris);
	cursor: pointer;
}

.oc-a11y__cerrar:hover {
	background: var(--oc-crema);
	color: var(--oc-tinta);
}

.oc-a11y__cerrar svg {
	width: 18px;
	height: 18px;
}

.oc-a11y__lista {
	display: grid;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.oc-a11y__enlaces {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--oc-borde);
}

.oc-a11y__boton {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 8px 10px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--oc-tinta);
	font: inherit;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .15s, color .15s;
}

.oc-a11y__boton svg {
	flex: none;
	width: 18px;
	height: 18px;
	color: var(--oc-marca);
}

.oc-a11y__boton:hover {
	background: var(--oc-crema);
}

.oc-a11y__boton[aria-pressed="true"] {
	background: var(--oc-marca);
	color: #fff;
}

.oc-a11y__boton[aria-pressed="true"] svg {
	color: #fff;
}

.oc-a11y__boton[aria-disabled="true"] {
	background: transparent;
	opacity: .45;
	cursor: not-allowed;
}

.oc-a11y__estado {
	margin: 2px 10px 0;
	font-size: 12px;
	color: var(--oc-gris);
}

/* 2. Modos ---------------------------------------------------------------- */

/* Texto más grande: los tamaños los pone assets/js/accesibilidad.js en cada
   elemento. Aquí, que las palabras largas puedan partirse para no salirse de
   su columna. */
html.oc-a11y-texto body *:not(.oc-a11y *) {
	overflow-wrap: anywhere;
}

/* Y que lo que va en una sola línea pueda partirse (salvo en la cabecera,
   que crece poco y cabe). */
html.oc-a11y-texto :is(main, footer) .whitespace-nowrap {
	white-space: normal !important;
}

/* Escala de grises. El filtro en <html> no cambia la posición de lo fijo
   (en <body> sí la cambiaría). */
html.oc-a11y-grises {
	filter: grayscale(100%);
}

/* Contraste negativo: colores invertidos. Fotos, vídeos y mapas se vuelven a
   invertir para que se vean como son; el logo no, para que se lea sobre el
   fondo oscuro. La barra tampoco. */
html.oc-a11y-negativo {
	filter: invert(100%) hue-rotate(180deg);
}

html.oc-a11y-negativo :is(img:not([src*="/assets/img/logo"]), video, iframe),
html.oc-a11y-negativo .oc-a11y {
	filter: invert(100%) hue-rotate(180deg);
}

/* Alto contraste (como en la web anterior): fondo negro, texto blanco y
   enlaces amarillos. */
html.oc-a11y-alto-contraste body,
html.oc-a11y-alto-contraste body *:not(.oc-a11y, .oc-a11y *, svg, svg *) {
	background-color: #000 !important;
	background-image: none !important;
	color: #fff !important;
	border-color: #fff !important;
	box-shadow: none !important;
	text-shadow: none !important;
}

html.oc-a11y-alto-contraste body a:not(.oc-a11y *),
html.oc-a11y-alto-contraste body a:not(.oc-a11y *) *:not(svg, svg *) {
	color: #ff0 !important;
}

html.oc-a11y-alto-contraste body :is(button, input, select, textarea, .oc-boton):not(.oc-a11y *) {
	border: 1px solid currentColor !important;
}

html.oc-a11y-alto-contraste body :focus-visible {
	outline: 3px solid #ff0 !important;
	outline-offset: 2px;
}

/* Las imágenes, sin fondo: si no, el logo (que se aclara para que se lea)
   quedaría como un rectángulo. */
html.oc-a11y-alto-contraste body img:not(.oc-a11y *) {
	background-color: transparent !important;
}

html.oc-a11y-alto-contraste img[src*="/assets/img/logo.png"] {
	filter: brightness(0) invert(1);
}

/* Fondo claro: fondo blanco y texto negro. */
html.oc-a11y-claro body,
html.oc-a11y-claro body *:not(.oc-a11y, .oc-a11y *, svg, svg *) {
	background-color: #fff !important;
	background-image: none !important;
	color: #000 !important;
	box-shadow: none !important;
	text-shadow: none !important;
}

html.oc-a11y-claro body :is(button, input, select, textarea, .oc-boton):not(.oc-a11y *) {
	border: 1px solid #000 !important;
}

html.oc-a11y-claro body img:not(.oc-a11y *) {
	background-color: transparent !important;
}

/* El logo blanco del pie, en negro para que se vea sobre el fondo blanco. */
html.oc-a11y-claro img[src*="/assets/img/logo-blanco"] {
	filter: brightness(0);
}

/* Subrayar enlaces. */
html.oc-a11y-subrayar a:not(.oc-a11y *),
html.oc-a11y-subrayar a:not(.oc-a11y *) *:not(svg, svg *) {
	text-decoration: underline !important;
	text-underline-offset: .2em;
}

/* Fuente legible. */
html.oc-a11y-legible body,
html.oc-a11y-legible body *:not(svg, svg *) {
	font-family: Verdana, Arial, Helvetica, sans-serif !important;
}
