/**
 * ============================================================================
 * FRAMEWORK DE ACCESIBILIDAD ADAPTATIVA COGNITIVA Y MOTORA (WCAG 2.2 NIVEL AAA)
 * N16 STUDIO · CIRCUITO DIGITAL URBANO DE SAN SEBASTIÁN
 * ============================================================================
 * 
 * Cumplimiento riguroso de las directrices WCAG 2.2 AAA:
 *  - 1.4.6 Contraste Incrementado (Nivel AAA, ratio >= 7:1)
 *  - 1.4.12 Espaciado de Texto (Nivel AAA)
 *  - 2.2.2 Pausa, Detención, Ocultación (Nivel AAA)
 *  - 2.4.1 Evitación de Bloques / Skip Links (Nivel AAA)
 *  - 2.4.7 Foco Visible & 2.4.13 Apariencia de Foco (Nivel AAA, halo dual)
 *  - 2.5.5 Tamaño del Objetivo Táctil Mínimo (Nivel AAA, min 44x44px)
 *  - 3.2.1 Al Recibir el Foco & Control de Diálogos / Focus Trap (Nivel AAA)
 *  - 4.1.3 Mensajes de Estado / Región Viva ARIA (Nivel AAA)
 * 
 * Inspirado en: Apple Accessibility, Microsoft Inclusive Design & UK GDS.
 */

/* -------------------------------------------------------------
   1. UTILIDAD UNIVERSAL PARA LECTORES DE PANTALLA (SCREEN READERS)
   ------------------------------------------------------------- */
.sr-only,
.biz-a11y-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* -------------------------------------------------------------
   2. ENLACES DE SALTO PRIORITARIOS (SKIP LINKS - WCAG 2.4.1 AAA)
   ------------------------------------------------------------- */
.biz-skip-links-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000000;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
    pointer-events: none;
    background: transparent;
}

.biz-skip-link {
    position: absolute;
    transform: translateY(-200%);
    background: #0F172A;
    color: #F8FAFC;
    border: 2px solid #F59E0B;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 12px;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.biz-skip-link:focus,
.biz-skip-link:focus-visible {
    position: relative;
    transform: translateY(0);
    outline: 3px solid #F59E0B;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px #000000, 0 12px 36px rgba(0, 0, 0, 0.8);
}

.biz-skip-link kbd {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 11px;
    font-family: monospace;
}

/* -------------------------------------------------------------
   3. APARIENCIA DE FOCO DE ALTO CONTRASTE (WCAG 2.4.13 AAA)
   ------------------------------------------------------------- */
:focus-visible:not(.biz-msearch-input):not(.biz-market-search-form *):not(.biz-msearch-btn):not(.biz-msearch-clear) {
    outline: 3px solid #000000 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px #F59E0B, 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] :focus-visible:not(.biz-msearch-input):not(.biz-market-search-form *):not(.biz-msearch-btn):not(.biz-msearch-clear) {
    outline: 3px solid #FFFFFF !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px #38BDF8, 0 4px 18px rgba(0, 0, 0, 0.8) !important;
}

/* -------------------------------------------------------------
   4. TAMAÑO MÍNIMO DE ZONA TÁCTIL Y CLIC (WCAG 2.5.5 AAA >= 44x44px)
   ------------------------------------------------------------- */
.biz-btn,
.biz-btn-primary,
.biz-action-btn,
.biz-dock-item,
.biz-dock-icon-btn,
.biz-premenu-btn,
.biz-premenu-schedule-btn,
.biz-modal-close,
.biz-lightbox-close,
.biz-lightbox-nav-btn,
.biz-schedule-modal-close,
.biz-share-modal-close,
.biz-wa-crm-close,
.biz-wa-crm-intent-card,
.biz-wa-intent-card,
.biz-a11y-toggle-btn {
    min-width: 44px;
    min-height: 44px;
    box-sizing: border-box;
}

/* -------------------------------------------------------------
   5. MODO ALTO CONTRASTE REFORZADO AAA (WCAG 1.4.6 AAA >= 7:1)
   ------------------------------------------------------------- */
[data-a11y-contrast="high"] {
    --theme-card-bg: #FFFFFF !important;
    --theme-card-border: #000000 !important;
    --theme-text-hero: #000000 !important;
    --theme-text-body: #111827 !important;
    --theme-text-muted: #1F2937 !important;
    --theme-bg-base: #F8FAFC !important;
}

[data-a11y-contrast="high"][data-theme="dark"] {
    --theme-card-bg: #000000 !important;
    --theme-card-border: #FFFFFF !important;
    --theme-text-hero: #FFFFFF !important;
    --theme-text-body: #F9FAFB !important;
    --theme-text-muted: #E5E7EB !important;
    --theme-bg-base: #000000 !important;
}

[data-a11y-contrast="high"] * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    text-shadow: none !important;
}

[data-a11y-contrast="high"] .biz-glass-panel,
[data-a11y-contrast="high"] .biz-sch-modal-card,
[data-a11y-contrast="high"] .biz-vcard-modal-card,
[data-a11y-contrast="high"] .biz-share-modal-card,
[data-a11y-contrast="high"] .biz-wa-crm-drawer,
[data-a11y-contrast="high"] .biz-wa-crm-sheet {
    background: #FFFFFF !important;
    border: 3px solid #000000 !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4) !important;
    color: #000000 !important;
}

[data-a11y-contrast="high"] .biz-wa-crm-drawer .biz-wa-crm-title,
[data-a11y-contrast="high"] .biz-wa-crm-drawer .biz-wa-intent-title,
[data-a11y-contrast="high"] .biz-wa-crm-drawer .biz-wa-intent-sub,
[data-a11y-contrast="high"] .biz-wa-crm-drawer .biz-wa-crm-status,
[data-a11y-contrast="high"] .biz-wa-crm-drawer .biz-wa-crm-bypass-btn {
    color: #000000 !important;
}

[data-a11y-contrast="high"] .biz-wa-intent-card {
    border: 2px solid #000000 !important;
    background: #FFFFFF !important;
}

[data-a11y-contrast="high"][data-theme="dark"] .biz-glass-panel,
[data-a11y-contrast="high"][data-theme="dark"] .biz-sch-modal-card,
[data-a11y-contrast="high"][data-theme="dark"] .biz-vcard-modal-card,
[data-a11y-contrast="high"][data-theme="dark"] .biz-share-modal-card,
[data-a11y-contrast="high"][data-theme="dark"] .biz-wa-crm-drawer,
[data-a11y-contrast="high"][data-theme="dark"] .biz-wa-crm-sheet {
    background: #000000 !important;
    border: 3px solid #FFFFFF !important;
    box-shadow: 0 8px 30px rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
}

[data-a11y-contrast="high"][data-theme="dark"] .biz-wa-crm-drawer .biz-wa-crm-title,
[data-a11y-contrast="high"][data-theme="dark"] .biz-wa-crm-drawer .biz-wa-intent-title,
[data-a11y-contrast="high"][data-theme="dark"] .biz-wa-crm-drawer .biz-wa-intent-sub,
[data-a11y-contrast="high"][data-theme="dark"] .biz-wa-crm-drawer .biz-wa-crm-status,
[data-a11y-contrast="high"][data-theme="dark"] .biz-wa-crm-drawer .biz-wa-crm-bypass-btn {
    color: #FFFFFF !important;
}

[data-a11y-contrast="high"][data-theme="dark"] .biz-wa-intent-card {
    border: 2px solid #FFFFFF !important;
    background: #000000 !important;
}

[data-a11y-contrast="high"] a {
    text-decoration: underline !important;
    text-underline-offset: 4px !important;
    font-weight: 700 !important;
}

/* -------------------------------------------------------------
   6. MODO TIPOGRAFÍA Y ESPACIADO ADAPTADO (WCAG 1.4.12 AAA)
   ------------------------------------------------------------- */
[data-a11y-font="readable"] {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif !important;
    line-height: 1.85 !important;
    letter-spacing: 0.12em !important;
    word-spacing: 0.18em !important;
}

[data-a11y-font="readable"] p,
[data-a11y-font="readable"] li,
[data-a11y-font="readable"] .biz-narrative-p {
    margin-bottom: 2em !important;
    line-height: 1.9 !important;
}

[data-a11y-font="readable"] h1,
[data-a11y-font="readable"] h2,
[data-a11y-font="readable"] h3 {
    line-height: 1.5 !important;
    letter-spacing: 0.08em !important;
    margin-bottom: 1.2em !important;
}

/* -------------------------------------------------------------
   7. MODO CONGELACIÓN DE MOVIMIENTO (WCAG 2.2.2 PAUSE / STOP)
   ------------------------------------------------------------- */
[data-a11y-motion="frozen"],
[data-a11y-motion="frozen"] * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

[data-a11y-motion="frozen"] .aurora-bg-container,
[data-a11y-motion="frozen"] .aurora-stream,
[data-a11y-motion="frozen"] .aurora-grid-pattern,
[data-a11y-motion="frozen"] .biz-status-dot,
[data-a11y-motion="frozen"] .biz-status-dot-mini,
[data-a11y-motion="frozen"] .biz-wallet-pulse-dot {
    animation: none !important;
    transform: none !important;
}

[data-a11y-motion="frozen"] .aurora-stream {
    display: none !important;
}

/* -------------------------------------------------------------
   8. MODO CONMUTADOR / SWITCH ACCESS Y ASISTENCIA MOTORA
   ------------------------------------------------------------- */
.a11y-switch-keytag {
    display: none;
}

[data-a11y-switch="active"] .a11y-switch-keytag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #F59E0B;
    color: #0F172A;
    font-weight: 800;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
    margin-right: 6px;
    border: 1px solid #000000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    vertical-align: middle;
}

[data-a11y-switch="active"] button,
[data-a11y-switch="active"] a {
    margin: 4px !important;
}

/* -------------------------------------------------------------
   9. PANEL FLOTANTE DE ACCESIBILIDAD ADAPTATIVA (A11Y DRAWER)
   ------------------------------------------------------------- */
.biz-a11y-trigger-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99990;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #0F172A;
    color: #F8FAFC;
    border: 2px solid #F59E0B;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.biz-a11y-trigger-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
}

.biz-a11y-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.biz-a11y-drawer-overlay.is-active {
    display: flex;
}

.biz-a11y-drawer-card {
    background: #0F172A;
    color: #F8FAFC;
    border: 2px solid #F59E0B;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    position: relative;
}

.biz-a11y-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 20px;
}

.biz-a11y-drawer-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.biz-a11y-drawer-icon {
    width: 38px;
    height: 38px;
    background: #F59E0B;
    color: #0F172A;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.biz-a11y-drawer-title {
    font-size: 18px;
    font-weight: 800;
    color: #FFFFFF;
    margin: 0;
}

.biz-a11y-drawer-subtitle {
    font-size: 12px;
    color: #94A3B8;
    margin: 2px 0 0 0;
}

.biz-a11y-drawer-close {
    background: rgba(255, 255, 255, 0.1);
    color: #F8FAFC;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
}

.biz-a11y-grid-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.biz-a11y-control-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.biz-a11y-control-info {
    flex: 1;
}

.biz-a11y-control-name {
    font-size: 14px;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.biz-a11y-control-desc {
    font-size: 12px;
    color: #94A3B8;
    line-height: 1.4;
    margin: 0;
}

.biz-a11y-switch-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #FFFFFF;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    min-height: 44px;
    min-width: 90px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.biz-a11y-switch-btn[aria-pressed="true"] {
    background: #F59E0B;
    color: #0F172A;
    border-color: #F59E0B;
}

.biz-a11y-shortcuts-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.biz-a11y-shortcuts-title {
    font-size: 13px;
    font-weight: 700;
    color: #F59E0B;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.biz-a11y-shortcuts-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    font-size: 12px;
    color: #CBD5E1;
}

.biz-a11y-shortcut-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.biz-a11y-shortcut-item kbd {
    background: #1E293B;
    border: 1px solid #475569;
    padding: 3px 7px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 11px;
    font-weight: 700;
    color: #F8FAFC;
}

.biz-a11y-drawer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.biz-a11y-reset-btn {
    background: transparent;
    border: 1px solid #475569;
    color: #94A3B8;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    cursor: pointer;
    min-height: 44px;
}

.biz-a11y-reset-btn:hover {
    color: #FFFFFF;
    border-color: #94A3B8;
}
