/* ==========================================================================
   JAPAF Río — menú de accesibilidad
   ========================================================================== */

/* ---------- Botón flotante ---------- */
.a11y-widget { position: fixed; bottom: var(--a11y-offset, 20px); z-index: 9990; font-family: var(--font-body); }
.a11y-widget--right { right: 20px; }
.a11y-widget--left { left: 20px; }

.a11y-trigger {
	display: grid; place-items: center; width: 56px; height: 56px; padding: 0;
	border: 3px solid var(--blanco); border-radius: 50%;
	background: var(--azul); color: var(--blanco);
	box-shadow: 0 6px 20px rgba(15, 26, 70, 0.35); cursor: pointer;
}
.a11y-trigger svg { width: 30px; height: 30px; }
.a11y-trigger:hover, .a11y-trigger[aria-expanded="true"] { background: var(--azul-profundo); }
.a11y-trigger:focus-visible { outline: 3px solid var(--cian); outline-offset: 3px; }

/* ---------- Panel ---------- */
.a11y-panel {
	position: absolute; bottom: calc(100% + 12px); width: min(340px, calc(100vw - 40px));
	max-height: calc(100vh - var(--a11y-offset, 20px) - 100px); overflow-y: auto;
	background: var(--blanco); color: var(--tinta);
	border-radius: 8px; border-top: 5px solid var(--azul);
	box-shadow: 0 20px 50px rgba(15, 26, 70, 0.3);
	padding: 1rem 1.1rem 1.1rem;
	font-size: 16px; /* el panel no crece con el texto para que siempre quepa */
	line-height: 1.4;
}
.a11y-panel[hidden] { display: none; }
.a11y-widget--right .a11y-panel { right: 0; }
.a11y-widget--left .a11y-panel { left: 0; }

.a11y-panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.a11y-panel__title { font-family: var(--font-display); font-size: 22px; font-stretch: 85%; margin: 0; color: var(--azul-profundo); }
.a11y-close { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 6px; background: var(--fondo); color: var(--tinta); cursor: pointer; }
.a11y-close svg { width: 20px; height: 20px; }
.a11y-close:hover { background: var(--agua); }

.a11y-size { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.75rem; margin-bottom: 0.75rem; background: var(--agua); border-radius: 6px; }
.a11y-size__label { font-weight: 700; }
.a11y-size__controls { display: flex; align-items: center; gap: 0.4rem; }
.a11y-size__controls button {
	min-width: 44px; height: 40px; border: 2px solid var(--azul); border-radius: 6px;
	background: var(--blanco); color: var(--azul); font: 700 16px/1 var(--font-body); cursor: pointer;
}
.a11y-size__controls button:hover:not(:disabled) { background: var(--azul); color: var(--blanco); }
.a11y-size__controls button:disabled { opacity: 0.4; cursor: not-allowed; }
.a11y-size__value { min-width: 3.2em; text-align: center; font-weight: 700; }

.a11y-options { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.a11y-option {
	width: 100%; min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem;
	padding: 0.6rem 0.4rem; border: 2px solid var(--linea); border-radius: 6px;
	background: var(--blanco); color: var(--tinta); font: 700 14px/1.2 var(--font-body); text-align: center; cursor: pointer;
}
.a11y-option svg { width: 24px; height: 24px; color: var(--azul); }
.a11y-option:hover { border-color: var(--azul); }
.a11y-option[aria-pressed="true"] { background: var(--azul); border-color: var(--azul); color: var(--blanco); }
.a11y-option[aria-pressed="true"] svg { color: var(--blanco); }
.a11y-panel button:focus-visible, .a11y-panel a:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }

.a11y-panel__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.9rem; font-size: 14px; }
.a11y-reset { border: 0; background: none; padding: 0.4rem 0; color: var(--azul); font: 700 14px/1.2 var(--font-body); text-decoration: underline; cursor: pointer; }

@media (max-width: 480px) {
	.a11y-widget--right { right: 12px; }
	.a11y-widget--left { left: 12px; }
	.a11y-trigger { width: 50px; height: 50px; }
}

/* ==========================================================================
   Efectos de cada opción
   ========================================================================== */

/* Tamaño del texto */
html[data-a11y-size="1"] { font-size: 112%; }
html[data-a11y-size="2"] { font-size: 125%; }
html[data-a11y-size="3"] { font-size: 140%; }
html[data-a11y-size="4"] { font-size: 160%; }

/* Escala de grises (se aplica al contenido, no al botón, para que siga fijo en pantalla) */
html.a11y-gray body > *:not(.a11y-widget):not(.a11y-guide-line) { filter: grayscale(1); }

/* Resaltar enlaces */
html.a11y-links a:not(.btn):not(.a11y-panel a) {
	text-decoration: underline !important; text-decoration-thickness: 2px !important; text-underline-offset: 0.2em;
}
html.a11y-links a:not(.a11y-panel a):hover, html.a11y-links a:not(.a11y-panel a):focus { background: #FFF3A0; color: #000 !important; }

/* Espaciado de texto (WCAG 1.4.12) */
html.a11y-spacing body *:not(.a11y-widget):not(.a11y-widget *) {
	line-height: 1.9 !important; letter-spacing: 0.08em !important; word-spacing: 0.16em !important;
}
html.a11y-spacing .entry-content p, html.a11y-spacing .hero__text p { margin-bottom: 2em !important; }

/* Detener animaciones */
html.a11y-noanim *, html.a11y-noanim *::before, html.a11y-noanim *::after {
	animation: none !important; transition: none !important; scroll-behavior: auto !important;
}

/* Cursor grande */
html.a11y-cursor, html.a11y-cursor * {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath d='M4 2l16 8-7 2.4L10.6 20Z' fill='%23000' stroke='%23fff' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E") 4 2, auto !important;
}

/* Guía de lectura */
.a11y-guide-line { display: none; }
html.a11y-guide .a11y-guide-line {
	display: block; position: fixed; left: 0; right: 0; top: 0; height: 44px; z-index: 9980; pointer-events: none;
	border-block: 3px solid var(--acento); background: rgba(54, 201, 255, 0.12);
	transform: translateY(40vh);
}

/* Alto contraste: fondo negro, texto blanco, enlaces amarillos */
html.a11y-contrast body,
html.a11y-contrast body *:not(svg):not(svg *):not(img):not(video):not(iframe):not(.a11y-widget):not(.a11y-widget *):not(.a11y-guide-line) {
	background-color: #000 !important; background-image: none !important;
	color: #fff !important; border-color: #fff !important; box-shadow: none !important; text-shadow: none !important;
}
html.a11y-contrast body a:not(.a11y-widget a), html.a11y-contrast body a:not(.a11y-widget a) * { color: #FFEB3B !important; }
html.a11y-contrast body a:not(.a11y-widget a):hover { text-decoration: underline !important; }
html.a11y-contrast .btn, html.a11y-contrast .wp-block-button__link { border: 2px solid #FFEB3B !important; }
html.a11y-contrast .hero__level { display: none !important; }
html.a11y-contrast .site-header::after { background: #FFEB3B !important; }
html.a11y-contrast .site-logo img, html.a11y-contrast .custom-logo { background: #fff !important; border-radius: 6px; padding: 4px; }
html.a11y-contrast .actions, html.a11y-contrast .phones, html.a11y-contrast .doc-list, html.a11y-contrast .site-footer { border: 2px solid #fff !important; }
html.a11y-contrast input::placeholder { color: #ddd !important; }
html.a11y-contrast :focus-visible { outline-color: #FFEB3B !important; }
/* El propio menú en alto contraste */
html.a11y-contrast .a11y-trigger { background: #000; border-color: #FFEB3B; color: #FFEB3B; }
html.a11y-contrast .a11y-panel { background: #000; color: #fff; border: 2px solid #FFEB3B; }
html.a11y-contrast .a11y-panel__title, html.a11y-contrast .a11y-reset, html.a11y-contrast .a11y-panel a { color: #FFEB3B; }
html.a11y-contrast .a11y-size, html.a11y-contrast .a11y-close { background: #111; color: #fff; }
html.a11y-contrast .a11y-option, html.a11y-contrast .a11y-size__controls button { background: #000; color: #fff; border-color: #fff; }
html.a11y-contrast .a11y-option svg { color: #FFEB3B; }
html.a11y-contrast .a11y-option[aria-pressed="true"] { background: #FFEB3B; color: #000; border-color: #FFEB3B; }
html.a11y-contrast .a11y-option[aria-pressed="true"] svg { color: #000; }

@media print { .a11y-widget, .a11y-guide-line { display: none !important; } }

/* ---------- Encabezado con texto ampliado ---------- */
html[data-a11y-size] .primary-nav a, html[data-a11y-size] .site-nav__tools .btn { white-space: nowrap; }
@media (min-width: 1061px) {
	html[data-a11y-size="1"] .header-search input { width: 6rem; }
	html[data-a11y-size="1"] .primary-nav a { padding-inline: 0.55rem; }

	/* Desde 125 % se usa el menú desplegable también en computadora */
	html[data-a11y-size="2"] .nav-toggle, html[data-a11y-size="3"] .nav-toggle, html[data-a11y-size="4"] .nav-toggle { display: block; }
	html[data-a11y-size="2"] .site-nav, html[data-a11y-size="3"] .site-nav, html[data-a11y-size="4"] .site-nav {
		display: none; position: absolute; left: 0; right: 0; top: 100%;
		flex-direction: column; align-items: stretch; gap: 1rem;
		background: var(--blanco); padding: 1rem var(--gutter) 1.5rem; border-top: 4px solid var(--azul);
		box-shadow: 0 20px 40px rgba(15, 26, 70, 0.18); max-height: calc(100vh - 100px); overflow-y: auto;
	}
	html[data-a11y-size="2"] .site-nav.is-open, html[data-a11y-size="3"] .site-nav.is-open, html[data-a11y-size="4"] .site-nav.is-open { display: flex; }
	html[data-a11y-size="2"] .primary-nav > ul, html[data-a11y-size="3"] .primary-nav > ul, html[data-a11y-size="4"] .primary-nav > ul,
	html[data-a11y-size="2"] .primary-nav > div > ul, html[data-a11y-size="3"] .primary-nav > div > ul, html[data-a11y-size="4"] .primary-nav > div > ul { flex-direction: column; }
	html[data-a11y-size="2"] .primary-nav a, html[data-a11y-size="3"] .primary-nav a, html[data-a11y-size="4"] .primary-nav a { padding: 0.75rem 0.5rem; border-bottom: 1px solid var(--linea); border-radius: 0; }
	html[data-a11y-size="2"] .primary-nav .sub-menu, html[data-a11y-size="3"] .primary-nav .sub-menu, html[data-a11y-size="4"] .primary-nav .sub-menu {
		position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; min-width: 0; padding: 0 0 0 1rem; background: transparent;
	}
	html[data-a11y-size="2"] .primary-nav .sub-menu a, html[data-a11y-size="3"] .primary-nav .sub-menu a, html[data-a11y-size="4"] .primary-nav .sub-menu a { color: var(--tinta); }
	html[data-a11y-size="2"] .primary-nav .menu-item-has-children > a::after, html[data-a11y-size="3"] .primary-nav .menu-item-has-children > a::after, html[data-a11y-size="4"] .primary-nav .menu-item-has-children > a::after { display: none; }
	html[data-a11y-size="2"] .site-nav__tools, html[data-a11y-size="3"] .site-nav__tools, html[data-a11y-size="4"] .site-nav__tools { flex-direction: column; align-items: stretch; }
	html[data-a11y-size="2"] .header-search input, html[data-a11y-size="3"] .header-search input, html[data-a11y-size="4"] .header-search input { width: 100%; flex: 1; }
}
