/* ==========================================================================
   Menú de accesibilidad
   ========================================================================== */

.a11y { position: fixed; bottom: 1.25rem; z-index: 99990; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.a11y.is-left { left: 1.25rem; }
.a11y.is-right { right: 1.25rem; }

.a11y-trigger {
	width: 3.75rem; height: 3.75rem; border-radius: 50%; border: 3px solid #fff;
	display: grid; place-items: center; cursor: pointer;
	background: #1a4fd6; color: #fff;
	box-shadow: 0 10px 25px -6px rgba(0,0,0,.45);
	transition: transform .2s, background .2s;
}
.a11y-trigger:hover { transform: scale(1.07); background: #0f3aa8; }
.a11y-trigger:focus-visible { outline: 4px solid #ffbf00; outline-offset: 3px; }

.a11y-panel {
	position: absolute; bottom: calc(100% + .9rem);
	width: min(24rem, calc(100vw - 2.5rem));
	max-height: min(40rem, calc(100vh - 7rem)); overflow-y: auto; overscroll-behavior: contain;
	background: #fff; color: #1b1b1f; border-radius: 1.1rem;
	box-shadow: 0 30px 60px -15px rgba(0,0,0,.45); border: 1px solid #dde1ea;
	font-size: 16px; line-height: 1.4;
}
.a11y.is-left .a11y-panel { left: 0; }
.a11y.is-right .a11y-panel { right: 0; }
.a11y-panel[hidden] { display: none; }

.a11y-head {
	position: sticky; top: 0; z-index: 1;
	display: flex; align-items: center; justify-content: space-between;
	padding: 1rem 1.1rem; background: #1a4fd6; color: #fff; border-radius: 1.1rem 1.1rem 0 0;
}
.a11y-head h2 { margin: 0; font-size: 1.15rem; color: #fff; font-family: inherit; letter-spacing: 0; }
.a11y-close {
	width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 0; display: grid; place-items: center;
	background: rgba(255,255,255,.16); color: #fff; cursor: pointer;
}
.a11y-close:hover { background: rgba(255,255,255,.3); }
.a11y-close:focus-visible, .a11y-panel button:focus-visible { outline: 3px solid #ffbf00; outline-offset: 2px; }
.a11y-close .icon { width: 1.3rem; height: 1.3rem; }

.a11y-body { padding: 1rem 1.1rem; }
.a11y-label { margin: 0 0 .5rem; font-weight: 700; font-size: .95rem; }
.a11y-size { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.a11y-size button {
	flex: 1; height: 3rem; border-radius: .7rem; border: 2px solid #dde1ea; background: #f4f6fb;
	color: #1b1b1f; font-size: 1.15rem; font-weight: 800; cursor: pointer;
}
.a11y-size button:hover { border-color: #1a4fd6; color: #1a4fd6; }
.a11y-size-value { min-width: 4rem; text-align: center; font-weight: 700; font-size: 1.05rem; }

.a11y-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem; }
.a11y-opt {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem;
	min-height: 5.6rem; padding: .7rem .5rem; border-radius: .8rem; cursor: pointer;
	border: 2px solid #dde1ea; background: #f4f6fb; color: #1b1b1f;
	font-size: .875rem; font-weight: 600; text-align: center; line-height: 1.2;
	transition: border-color .15s, background .15s, color .15s;
}
.a11y-opt:hover { border-color: #1a4fd6; }
.a11y-opt svg { color: #1a4fd6; }
.a11y-opt[aria-pressed="true"] { background: #1a4fd6; border-color: #1a4fd6; color: #fff; }
.a11y-opt[aria-pressed="true"] svg { color: #fff; }
.a11y-opt[aria-pressed="true"]::after { content: "✓ Activado"; font-size: .72rem; font-weight: 700; opacity: .9; }

.a11y-foot { padding: .25rem 1.1rem 1.1rem; }
.a11y-reset {
	width: 100%; padding: .85rem; border-radius: .7rem; border: 0; cursor: pointer;
	background: #1b1b1f; color: #fff; font-weight: 700; font-size: .95rem;
}
.a11y-reset:hover { background: #000; }
.a11y-hint { margin: .7rem 0 0; font-size: .78rem; color: #555b66; text-align: center; }

/* ---------- Efectos sobre el sitio ---------- */

/* Filtros (se aplican al contenido, no al menú de accesibilidad) */
html.a11y-filter #page { filter: var(--a11y-gray, ) var(--a11y-inv, ) var(--a11y-sat, ); }
html.a11y-grayscale { --a11y-gray: grayscale(1); }
html.a11y-invert { --a11y-inv: invert(1) hue-rotate(180deg); }
html.a11y-invert #page img, html.a11y-invert #page video, html.a11y-invert #page iframe { filter: invert(1) hue-rotate(180deg); }
html.a11y-saturation { --a11y-sat: saturate(.35); }

/* Alto contraste */
html.a11y-contrast #page, html.a11y-contrast #page * {
	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 #page a, html.a11y-contrast #page a * { color: #ffff00 !important; text-decoration: underline !important; }
html.a11y-contrast #page button, html.a11y-contrast #page .btn { border: 2px solid #ffff00 !important; color: #ffff00 !important; }
html.a11y-contrast #page h1, html.a11y-contrast #page h2, html.a11y-contrast #page h3 { color: #00ffff !important; }
html.a11y-contrast #page img { filter: contrast(1.15); }
html.a11y-contrast #page .hero::before, html.a11y-contrast #page .hero-shapes { display: none !important; }

/* Modo oscuro */
html.a11y-dark #page { background: #121016 !important; }
html.a11y-dark #page *:not(img):not(svg):not(path):not(iframe):not(video) {
	background-color: transparent;
	color: #ece8f2 !important; border-color: #3a3346 !important;
}
html.a11y-dark #page .site-header, html.a11y-dark #page .main-navigation, html.a11y-dark #page .sub-menu,
html.a11y-dark #page .header-search, html.a11y-dark #page .card, html.a11y-dark #page .info-card,
html.a11y-dark #page .icon-btn, html.a11y-dark #page .search-field, html.a11y-dark #page .emergency,
html.a11y-dark #page .social-links a, html.a11y-dark #page .post-navigation a { background-color: #1d1a24 !important; }
html.a11y-dark #page .section-news, html.a11y-dark #page .section-contact, html.a11y-dark #page .section-related,
html.a11y-dark #page .info-icon, html.a11y-dark #page .btn-ghost, html.a11y-dark #page .share a,
html.a11y-dark #page .tag-list a, html.a11y-dark #page .entry-content blockquote { background-color: #19161f !important; }
html.a11y-dark #page a { color: #d6b4ff !important; }
html.a11y-dark #page .btn-primary, html.a11y-dark #page .btn-light { color: #fff !important; }
html.a11y-dark #page .btn-light { background: #3b2160 !important; }

/* Resaltar enlaces */
html.a11y-links #page a {
	text-decoration: underline !important; text-decoration-thickness: 2px !important;
	outline: 2px dashed #ffbf00; outline-offset: 2px; background-color: rgba(255,230,0,.18) !important;
}

/* Resaltar títulos */
html.a11y-headings #page h1, html.a11y-headings #page h2, html.a11y-headings #page h3,
html.a11y-headings #page h4, html.a11y-headings #page h5, html.a11y-headings #page h6 {
	outline: 3px solid #1a4fd6 !important; outline-offset: 4px; border-radius: 4px;
}

/* Fuente legible (amigable con dislexia) */
html.a11y-dyslexia #page, html.a11y-dyslexia #page * {
	font-family: Verdana, Tahoma, "Atkinson Hyperlegible", Arial, sans-serif !important;
	font-style: normal !important;
}

/* Espaciado */
html.a11y-spacing #page * { letter-spacing: .12em !important; word-spacing: .16em !important; }
html.a11y-lineheight #page * { line-height: 2 !important; }
html.a11y-lineheight #page p { margin-bottom: 2em !important; }

/* Alinear a la izquierda */
html.a11y-align #page * { text-align: left !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 2l15 9-6.5 1.6L9 19z' fill='%23000' stroke='%23fff' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 4 2, auto !important;
}
html.a11y-cursor a, html.a11y-cursor a *, html.a11y-cursor button, html.a11y-cursor button * {
	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 2l15 9-6.5 1.6L9 19z' fill='%231a4fd6' stroke='%23fff' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 4 2, pointer !important;
}

/* Foco del teclado */
html.a11y-focus *:focus, html.a11y-focus *:focus-visible {
	outline: 4px solid #ff6a00 !important; outline-offset: 3px !important;
	box-shadow: 0 0 0 8px rgba(255,106,0,.3) !important;
}

/* Detener animaciones */
html.a11y-animations *, html.a11y-animations *::before, html.a11y-animations *::after {
	animation: none !important; transition: none !important; scroll-behavior: auto !important;
}
html.a11y-animations .reveal { opacity: 1 !important; transform: none !important; }

/* Ocultar imágenes */
html.a11y-images #page img, html.a11y-images #page picture, html.a11y-images #page video,
html.a11y-images #page .card-media, html.a11y-images #page .hero-media, html.a11y-images #page .feature-media { display: none !important; }
html.a11y-images #page * { background-image: none !important; }

/* Guía de lectura */
.a11y-guide {
	position: fixed; left: 0; right: 0; height: .6rem; z-index: 99980; pointer-events: none;
	background: #ffbf00; border-top: 2px solid #000; border-bottom: 2px solid #000; opacity: .85;
	transform: translateY(-50%);
}
.a11y-guide[hidden], .a11y-mask[hidden] { display: none; }

/* Máscara de lectura */
.a11y-mask span { position: fixed; left: 0; right: 0; z-index: 99979; pointer-events: none; background: rgba(0,0,0,.6); }
.a11y-mask-top { top: 0; }
.a11y-mask-bottom { bottom: 0; }

/* Lectura en voz alta */
html.a11y-tts #page p:hover, html.a11y-tts #page h1:hover, html.a11y-tts #page h2:hover, html.a11y-tts #page h3:hover,
html.a11y-tts #page li:hover, html.a11y-tts #page a:hover { outline: 2px dashed #1a4fd6; outline-offset: 2px; cursor: help; }
.a11y-speaking { background: rgba(255,230,0,.45) !important; outline: 2px solid #ffbf00 !important; }

@media (max-width: 480px) {
	.a11y { bottom: .9rem; }
	.a11y.is-left { left: .9rem; }
	.a11y.is-right { right: .9rem; }
	.a11y-trigger { width: 3.25rem; height: 3.25rem; }
}
@media print { .a11y, .a11y-guide, .a11y-mask { display: none !important; } }
