/* IEPC Accessibility Suite v2.0 — Core CSS
 * Visual modes, palettes, filters, skip link, common utilities
 */

/* ── Visually hidden (for live regions) ────────────────────────── */
.a11y-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Skip link ─────────────────────────────────────────────────── */
.a11y-skip-link {
    position: fixed;
    top: -100px;
    left: 1rem;
    z-index: 100000;
    background: #000;
    color: #fff;
    padding: .75rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    transition: top .2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}
.a11y-skip-link:focus { top: 1rem; outline: 3px solid #facc15; }

/* ── Base / typography ─────────────────────────────────────────── */
html { scroll-behavior: smooth; }
body { transition: background-color .2s, color .2s; }

/* ── Contraste alto ────────────────────────────────────────────── */
body.a11y-contrast-high,
body.a11y-contrast-high .main-header,
body.a11y-contrast-high .main-sidebar,
body.a11y-contrast-high .content-wrapper,
body.a11y-contrast-high .card,
body.a11y-contrast-high .modal-content,
body.a11y-contrast-high .navbar,
body.a11y-contrast-high .dropdown-menu {
    background: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}
body.a11y-contrast-high a,
body.a11y-contrast-high .nav-link,
body.a11y-contrast-high .dropdown-item { color: #ffd84d !important; }
body.a11y-contrast-high .btn { border: 2px solid #fff !important; }
body.a11y-contrast-high input,
body.a11y-contrast-high select,
body.a11y-contrast-high textarea,
body.a11y-contrast-high button {
    background: #000 !important; color: #fff !important;
    border: 2px solid #fff !important;
}

/* ── Contraste invertido ──────────────────────────────────────── */
body.a11y-contrast-inverted { filter: invert(1) hue-rotate(180deg); }
body.a11y-contrast-inverted img,
body.a11y-contrast-inverted video,
body.a11y-contrast-inverted iframe { filter: invert(1) hue-rotate(180deg); }

/* ── Cursor grande ─────────────────────────────────────────────── */
body.a11y-cursor-large,
body.a11y-cursor-large * {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'><path d='M5 2 L5 32 L14 25 L19 34 L24 32 L19 23 L29 20 Z' fill='%23000' stroke='%23fff' stroke-width='2'/></svg>") 5 2, auto !important;
}

/* ── Reducir movimiento ────────────────────────────────────────── */
body.a11y-motion-reduced,
body.a11y-motion-reduced *,
body.a11y-motion-reduced *::before,
body.a11y-motion-reduced *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

/* ── Fuente para dislexia ──────────────────────────────────────── */
body.a11y-dyslexia-font,
body.a11y-dyslexia-font *:not(.fa):not(.fas):not(.far):not(.fab):not(.fad):not(.fal):not(.icon) {
    font-family: 'Comic Sans MS', 'Comic Sans', 'Trebuchet MS', cursive, sans-serif !important;
    letter-spacing: 0.04em !important;
    line-height: 1.8 !important;
}

/* ── Espaciado amplio ──────────────────────────────────────────── */
body.a11y-spacing-wide,
body.a11y-spacing-wide p,
body.a11y-spacing-wide li,
body.a11y-spacing-wide td,
body.a11y-spacing-wide th,
body.a11y-spacing-wide label,
body.a11y-spacing-wide input,
body.a11y-spacing-wide textarea {
    letter-spacing: 0.08em !important;
    line-height: 2 !important;
    word-spacing: 0.25em !important;
}

/* ── Dyslexia palette (background) ─────────────────────────────── */
body[data-a11y-palette="sepia"]  { background-color: #f4ecd8 !important; }
body[data-a11y-palette="cream"]  { background-color: #fdf6e3 !important; }
body[data-a11y-palette="green"]  { background-color: #e8f0d6 !important; }
body[data-a11y-palette="blue"]   { background-color: #d6e4f0 !important; }
body[data-a11y-palette="yellow"] { background-color: #fff8d6 !important; }
body[data-a11y-palette] .content-wrapper,
body[data-a11y-palette] .card,
body[data-a11y-palette] .modal-content {
    background-color: inherit !important;
}

/* ── Filtros de color ──────────────────────────────────────────── */
body.a11y-color-grayscale { filter: grayscale(1); }
body.a11y-color-grayscale img,
body.a11y-color-grayscale video { filter: grayscale(1); }
body.a11y-color-protanopia { filter: url('#a11y-svg-protanopia'); }
body.a11y-color-deuteranopia { filter: url('#a11y-svg-deuteranopia'); }
body.a11y-color-tritanopia { filter: url('#a11y-svg-tritanopia'); }

/* ── Highlight links/headings/focus/hover ─────────────────────── */
body.a11y-highlight-links a:not(.btn):not(.nav-link):not(.dropdown-item):not(.a11y-tab) {
    background: #fff3a3 !important; color: #000 !important; text-decoration: underline !important;
    padding: 0 2px; border-radius: 2px;
}
body.a11y-highlight-headings :is(h1, h2, h3, h4, h5, h6) {
    outline: 3px solid #ef4444 !important; outline-offset: 2px; background: rgba(239, 68, 68, 0.08);
}
body.a11y-emphasize-focus :focus-visible {
    outline: 4px solid #facc15 !important; outline-offset: 3px !important;
    box-shadow: 0 0 0 6px rgba(250, 204, 21, 0.25) !important;
}
body.a11y-hover-highlight *:hover {
    outline: 2px dashed #4f46e5 !important; outline-offset: 2px;
}

/* ── Forced colors (Windows High Contrast) ────────────────────── */
@media (forced-colors: active) {
    .a11y-skip-link { background: Highlight; color: HighlightText; forced-color-adjust: none; }
    .a11y-ruler-bar::before { background: Highlight; forced-color-adjust: none; }
    .a11y-mask-top, .a11y-mask-bottom { background: Canvas; opacity: 0.85; forced-color-adjust: none; }
    body.a11y-color-protanopia, body.a11y-color-deuteranopia, body.a11y-color-tritanopia { filter: none; }
}

/* ── Reduced motion respect ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .a11y-skip-link, .a11y-magnifier, .a11y-tts-bar { transition: none !important; animation: none !important; }
}

/* ── Print friendly ────────────────────────────────────────────── */
@media print {
    body { font-size: 14pt !important; background: #fff !important; color: #000 !important; }
    body.a11y-motion-reduced, body.a11y-motion-reduced * { transition: none !important; }
    .a11y-skip-link, .a11y-panel, .a11y-tts-bar, .a11y-magnifier,
    .a11y-ruler-bar, .a11y-mask-top, .a11y-mask-bottom,
    .main-sidebar, .main-header.navbar, .main-footer,
    .fab-container, .a11y-reading-time { display: none !important; }
    .content-wrapper { margin: 0 !important; }
    a { color: #000 !important; text-decoration: underline !important; }
}

/* ── High contrast overrides for FAB items ───────────────────── */
body.a11y-contrast-high .fab-item {
    background: #000 !important;
    color: #ffd84d !important;
    border: 2px solid #ffd84d !important;
}
body.a11y-contrast-high .fab-item:hover {
    background: #ffd84d !important;
    color: #000 !important;
}
