/* 
 * AccessFlow - Neuro Modes CSS
 * Estilos para el widget y las alteraciones del DOM (Focus, Dyslexia, Calm).
 */

:root {
    --af-primary: #4A90E2;
    --af-bg: #ffffff;
    --af-text: #111111;
    --af-border: #111111;
    --af-shadow: 4px 4px 0 var(--af-border); /* sombra dura, sin desenfoque (neo-brutalismo) */
    --af-radius: 6px;
}

/* WIDGET STYLES */
.af-widget {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Pestaña lateral discreta y brutalista: apenas asoma y se despliega al hover/focus. */
.af-toggle-btn {
    background: var(--af-primary);
    color: #fff;
    border: 2px solid var(--af-border);
    border-right: none;
    border-radius: 6px 0 0 6px;
    width: 38px;
    height: 56px;
    cursor: pointer;
    box-shadow: -4px 4px 0 var(--af-border);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Casi totalmente oculto: solo asoma una rendija. */
    transform: translateX(30px);
    opacity: 0.6;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.af-widget:hover .af-toggle-btn,
.af-toggle-btn:focus-visible {
    transform: translateX(0);
    opacity: 1;
}

.af-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
}

.af-panel {
    position: absolute;
    top: 50%;
    right: 56px;
    transform: translateY(-50%);
    width: 300px;
    background: var(--af-bg);
    border-radius: var(--af-radius);
    box-shadow: var(--af-shadow);
    padding: 16px;
    border: 2px solid var(--af-border);
    transition: opacity 0.3s, transform 0.3s;
    transform-origin: center right;
}

.af-hidden {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

/* El panel conserva su centrado vertical también al ocultarse. */
.af-panel.af-hidden {
    transform: translateY(-50%) scale(0.95);
}

.af-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.af-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--af-text);
}

.af-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--af-text);
    padding: 2px;
    display: flex;
    align-items: center;
}

.af-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.af-option-btn {
    background: #fff;
    border: 2px solid var(--af-border);
    box-shadow: 3px 3px 0 var(--af-border);
    padding: 10px 12px;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--af-text);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}

/* Interacción brutalista: el botón "se hunde" al pulsar. */
.af-option-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--af-border);
}

.af-option-btn:active {
    transform: translate(3px, 3px);
    box-shadow: 0 0 0 var(--af-border);
}

.af-option-btn.af-active {
    background: var(--af-primary);
    color: #fff;
}

.af-primary-btn {
    background: var(--af-primary);
    color: #fff;
    justify-content: center;
}

.af-pulse {
    animation: af-pulse-anim 1.5s infinite;
}

@keyframes af-pulse-anim {
    0% { box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(74, 144, 226, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 144, 226, 0); }
}

.af-summary-box {
    margin-top: 16px;
    padding: 12px;
    background: #f9f9f9;
    border: 2px solid var(--af-border);
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
}

/* =========================================
   NEURO MODES
   ========================================= */

/* 1. FOCUS MODE
   El JS etiqueta como .af-distraction los elementos calculados en servidor
   (selectores base + perfil del tema + personalizados). */
body.af-mode-focus .af-distraction {
    opacity: 0.1 !important;
    pointer-events: none !important;
    transition: opacity 0.5s ease-in-out !important;
}

/* Resaltar el contenido principal para reforzar el foco. */
body.af-mode-focus main,
body.af-mode-focus article,
body.af-mode-focus .entry-content,
body.af-mode-focus .site-main {
    position: relative;
    z-index: 1;
}

/* 2. DYSLEXIA READING
   Se excluyen iconos de fuente (FontAwesome, Dashicons, Material Icons), SVG
   y bloques de código: aplicarles la tipografía o el espaciado rompe sus
   glifos/ligaduras y los convierte en texto ilegible. */
body.af-mode-dyslexia
    *:not(svg):not(i):not(code):not(pre):not(kbd):not(.dashicons):not([class*="dashicons"]):not([class*="icon"]):not([class*="fa-"]):not(.material-icons):not(.material-symbols-outlined) {
    font-family: "OpenDyslexic", "Comic Sans MS", "Verdana", "Tahoma", sans-serif !important;
    line-height: 1.8 !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
}

/* 3. CALM INTERFACE */
body.af-mode-calm * {
    animation: none !important;
    transition: all 0.5s ease-in-out !important;
}

body.af-mode-calm {
    filter: saturate(0.7) sepia(0.1) !important;
}
