/* === Accesibilidad (Yeboyebo_Accessibility::widget.phtml / head.phtml) ===
   Botón flotante abajo a la derecha, encima del del chat (como en la PWA, pero el chat
   abajo del todo) y panel con las opciones. Cada opción se aplica con un atributo
   data-a11y-* o una clase yb-a11y-* en <html> que pone head.phtml antes de pintar.

   Tamaño del texto: escala el font-size de <html>, así que solo afecta a lo que está en
   rem/em (Tailwind y los partials del tema; por eso no se usan px para font-size). */

/* ---------- Mínimos del theme parent que el build no incluye ---------- */

/* Anillo de foco de Hyvä (base/preflight.css del parent). :where() = especificidad 0,
   cualquier estilo de foco propio del tema gana */
:where(:focus-visible) {
    outline: var(--outline-size, 2px) solid var(--color-primary);
    outline-offset: var(--outline-offset, 2px);
}

/* Campos con outline: none y sin otro indicador de foco */
.elg-nav-search-input:focus-visible,
.elg-cetico-search-input:focus-visible,
.elg-pcontact-input:focus-visible,
.elg-cart-stepper-qty:focus-visible,
.elg-app-menu-search-input:focus-visible,
.elg-about-newsletter-input:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}
.elg-help-hero-search-input:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

/* Enlace "Saltar al contenido" de Hyvä (Magento_Theme::html/skip.phtml): sus clases focus:*
   no están en el build (el @source al parent no resuelve), así que no se veía al tabular */
a.action.skip:focus {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 9999;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0.75rem 1rem;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    background: #fff;
    color: #041D40;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

/* ---------- Botón flotante ---------- */

.yb-a11y {
    --yb-a11y-bottom: 1.25rem;
    /* Botón del chat (47px) + separación */
    --yb-a11y-stack: 0px;
}
body:has(.yb-chat-launcher) .yb-a11y { --yb-a11y-stack: calc(47px + 0.75rem); }
html.is-app .yb-a11y { --yb-a11y-bottom: calc(var(--elg-app-tabbar-h) + var(--elg-safe-bottom) + 1rem); }
html.is-app body:has(#elganso-announcement) .yb-a11y {
    --yb-a11y-bottom: calc(var(--elg-app-tabbar-h) + var(--elg-safe-bottom) + 3rem);
}

.yb-a11y-launcher {
    position: fixed;
    right: 1.25rem;
    bottom: calc(var(--yb-a11y-bottom) + var(--yb-a11y-stack));
    z-index: 45;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 47px;
    height: 47px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    /* Color del botón de la PWA */
    background: #0d233f;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.yb-a11y-launcher:hover { transform: scale(1.1); box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.6); }
.yb-a11y-launcher:focus-visible { outline: 2px solid #0d233f; outline-offset: 3px; }
.yb-a11y-launcher svg { display: block; width: 28px; height: 28px; }

/* ---------- Panel ---------- */

.yb-a11y-panel {
    position: fixed;
    inset: auto 1.25rem var(--yb-a11y-bottom) auto;
    z-index: 8900;
    flex-direction: column;
    width: 360px;
    max-width: calc(100vw - 2.5rem);
    max-height: calc(100dvh - var(--yb-a11y-bottom) - 1.25rem);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: #fff;
    color: #041D40;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    font-size: 0.875rem;
    line-height: 1.4;
}
.yb-a11y-panel[open] { display: flex; }
@media (max-width: 639px) {
    .yb-a11y-panel {
        inset: auto 0.5rem var(--yb-a11y-bottom) 0.5rem;
        width: auto;
        max-width: none;
    }
}

.yb-a11y-head {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.75rem 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(4, 29, 64, 0.1);
}
.yb-a11y-title {
    flex: 1;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.yb-a11y-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.yb-a11y-icon-btn:hover { background: rgba(4, 29, 64, 0.06); }

.yb-a11y-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1.25rem 1.25rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.yb-a11y-stepper {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    border: 1px solid rgba(4, 29, 64, 0.15);
    border-radius: 4px;
}
.yb-a11y-stepper-icon { display: inline-flex; flex: 0 0 auto; }
.yb-a11y-stepper-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.yb-a11y-stepper-label { font-weight: 600; }
.yb-a11y-stepper-value { font-size: 0.75rem; color: rgba(4, 29, 64, 0.65); }
.yb-a11y-step {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid #041D40;
    border-radius: 50%;
    background: #fff;
    color: #041D40;
    cursor: pointer;
}
.yb-a11y-step:hover { background: #041D40; color: #fff; }
.yb-a11y-step[aria-disabled="true"] { opacity: 0.35; cursor: default; }
.yb-a11y-step[aria-disabled="true"]:hover { background: #fff; color: #041D40; }

.yb-a11y-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.25rem;
}
.yb-a11y-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 5.25rem;
    padding: 0.75rem 0.5rem;
    border: 1px solid rgba(4, 29, 64, 0.15);
    border-radius: 4px;
    background: #fff;
    color: #041D40;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
}
.yb-a11y-toggle:hover { border-color: #041D40; }
.yb-a11y-toggle[aria-pressed="true"] { border-color: #041D40; background: #041D40; color: #fff; }
.yb-a11y-toggle-sub { display: block; font-size: 0.75rem; font-weight: 400; opacity: 0.8; }

/* ---------- Opciones ---------- */

/* Tamaño del texto (pasos de head.phtml / widget.phtml: -2..3) */
html[data-a11y-text="-2"] { font-size: 85%; }
html[data-a11y-text="-1"] { font-size: 92%; }
html[data-a11y-text="1"] { font-size: 115%; }
html[data-a11y-text="2"] { font-size: 130%; }
html[data-a11y-text="3"] { font-size: 150%; }

/* Espaciado del texto (el máximo son los valores de WCAG 1.4.12) */
html[data-a11y-spacing="1"] { --yb-a11y-ls: 0.04em; --yb-a11y-ws: 0.06em; }
html[data-a11y-spacing="2"] { --yb-a11y-ls: 0.08em; --yb-a11y-ws: 0.11em; }
html[data-a11y-spacing="3"] { --yb-a11y-ls: 0.12em; --yb-a11y-ws: 0.16em; }
html[data-a11y-spacing] body *:not(svg, svg *, .yb-a11y-panel *) {
    letter-spacing: var(--yb-a11y-ls) !important;
    word-spacing: var(--yb-a11y-ws) !important;
}

/* Altura de línea */
html[data-a11y-lh="1"] { --yb-a11y-lh: 1.6; }
html[data-a11y-lh="2"] { --yb-a11y-lh: 1.9; }
html[data-a11y-lh="3"] { --yb-a11y-lh: 2.2; }
html[data-a11y-lh] body *:not(svg, svg *, .yb-a11y-panel *) {
    line-height: var(--yb-a11y-lh) !important;
}

/* Invertir colores: las fotos y vídeos se vuelven a invertir para que no salgan en negativo */
html.yb-a11y-invert { background: #fff; filter: invert(1) hue-rotate(180deg); }
html.yb-a11y-invert :is(img, video, iframe, [style*="background-image"]) { filter: invert(1) hue-rotate(180deg); }

/* Escala de grises */
html.yb-a11y-gray { filter: grayscale(1); }

/* Subrayar enlaces */
html.yb-a11y-links a { text-decoration: underline !important; text-underline-offset: 0.15em; }

/* Cursor grande (flecha y mano de Lucide a 48px: mouse-pointer-2 y pointer) */
html.yb-a11y-cursor,
html.yb-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.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z' fill='%23000' stroke='%23fff' stroke-width='1.25' stroke-linejoin='round'/%3E%3C/svg%3E") 8 9, auto !important;
}
html.yb-a11y-cursor :is(a, button, label, select, summary, [role="button"], [role="tab"], [role="option"], input[type="checkbox"], input[type="radio"], input[type="submit"]),
html.yb-a11y-cursor :is(a, button, label, summary, [role="button"]) * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L6 14V4a2 2 0 0 1 4 0v5.5V9a2 2 0 0 1 4 0v1a2 2 0 0 1 4 0z' fill='%23fff'/%3E%3Cpath d='M18 11v-1M14 10V9M10 9.5V4'/%3E%3C/svg%3E") 16 4, pointer !important;
}

/* Guía de lectura: barra que sigue al puntero (como la de la PWA). Oculta salvo con la clase
   en <html>, que pone head.phtml antes de pintar: así no se ve mientras carga la página */
.yb-a11y-guide-bar { display: none; }
html.yb-a11y-guide .yb-a11y-guide-bar {
    display: block;
    position: fixed;
    top: -6px;
    left: 0;
    right: 0;
    z-index: 2147483647;
    height: 12px;
    background: #000;
    border: 3px solid #20ff69;
    border-radius: 2px;
    pointer-events: none;
    transform: translateY(50vh);
}

/* Detener animaciones */
html.yb-a11y-motion *,
html.yb-a11y-motion *::before,
html.yb-a11y-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}

/* Lectura en voz alta: resalta lo que se va a leer */
html.yb-a11y-tts :is(img[alt], a, button, label, h1, h2, h3, h4, h5, h6, p, li, dt, dd, td, th, figcaption, blockquote):hover {
    outline: 2px dashed #041D40;
    outline-offset: 2px;
}
