/* ==========================================================================
   Epicod Accessibility — widget + visitor preference classes on <html>
   Widget sizes use px on purpose: the panel must stay stable while the
   page text is scaled through --a11y-text-scale.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Visually hidden text
   -------------------------------------------------------------------------- */
.epicod-a11y__sr {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* --------------------------------------------------------------------------
   Skip link: hidden until focused, then visible (for sighted keyboard users too)
   -------------------------------------------------------------------------- */
.epicod-a11y-skip {
    position: absolute;
    top: 16px;
    inset-inline-start: 16px;
    z-index: 100001;
    padding: 12px 20px;
    border: 2px solid #E66A3C;
    background: #fff;
    color: #1d1d1d;
    font: 600 16px/1.3 Arial, "Segoe UI", sans-serif;
    text-decoration: underline;
    transform: translateY(-200%);
}

.epicod-a11y-skip:focus,
.epicod-a11y-skip:focus-visible {
    transform: none;
    outline: 3px solid #1d1d1d;
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Launcher button
   Defaults on :root; the admin settings are printed inline right after this file.
   -------------------------------------------------------------------------- */
:root {
    --epicod-a11y-color: #2C3138;
    --epicod-a11y-offset: 24px;
    /* Keep keyboard-focused elements clear of the fixed launcher (WCAG 2.4.11). */
    scroll-padding-bottom: calc(var(--epicod-a11y-offset) + 72px);
}

.epicod-a11y {
    font: 400 16px/1.4 Arial, "Segoe UI", sans-serif;
    letter-spacing: normal;
    word-spacing: normal;
}

.epicod-a11y__launcher {
    position: fixed;
    bottom: var(--epicod-a11y-offset);
    z-index: 99990;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 0;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--epicod-a11y-color);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    cursor: pointer;
}

.epicod-a11y--start .epicod-a11y__launcher {
    inset-inline-start: 16px;
}

.epicod-a11y--end .epicod-a11y__launcher {
    inset-inline-end: 16px;
}

.epicod-a11y__launcher .epicod-a11y__icon {
    width: 30px;
    height: 30px;
}

.epicod-a11y__launcher:hover {
    filter: brightness(1.15);
}

.epicod-a11y__launcher:focus-visible,
.epicod-a11y__panel button:focus-visible,
.epicod-a11y__panel a:focus-visible {
    outline: 3px solid #E66A3C;
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Panel
   -------------------------------------------------------------------------- */
.epicod-a11y__panel {
    position: fixed;
    bottom: calc(var(--epicod-a11y-offset) + 64px);
    z-index: 99991;
    box-sizing: border-box;
    width: 340px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - var(--epicod-a11y-offset) - 96px);
    overflow-y: auto;
    padding: 16px;
    border: 1px solid #c9c9c9;
    border-radius: 10px;
    background: #fff;
    color: #1d1d1d;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.epicod-a11y__panel[hidden] {
    display: none;
}

.epicod-a11y--start .epicod-a11y__panel {
    inset-inline-start: 16px;
}

.epicod-a11y--end .epicod-a11y__panel {
    inset-inline-end: 16px;
}

.epicod-a11y__panel *,
.epicod-a11y__panel *::before,
.epicod-a11y__panel *::after {
    box-sizing: border-box;
}

.epicod-a11y__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
}

.epicod-a11y__title {
    margin: 0;
    color: #1d1d1d;
    font: 700 20px/1.2 Arial, "Segoe UI", sans-serif;
}

.epicod-a11y__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 1px solid #c9c9c9;
    border-radius: 8px;
    background: #fff;
    color: #1d1d1d;
    cursor: pointer;
}

.epicod-a11y__close:hover {
    background: #f1f1f1;
}

/* Text size */
.epicod-a11y__text-size {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #c9c9c9;
    border-radius: 8px;
}

.epicod-a11y__text-size-label {
    font-weight: 700;
}

.epicod-a11y__text-size-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.epicod-a11y__step {
    min-width: 44px;
    height: 40px;
    margin: 0;
    padding: 0 8px;
    border: 1px solid #1d1d1d;
    border-radius: 8px;
    background: #fff;
    color: #1d1d1d;
    font: 700 16px/1 Arial, "Segoe UI", sans-serif;
    cursor: pointer;
}

.epicod-a11y__step:hover {
    background: #f1f1f1;
}

.epicod-a11y__step:disabled {
    border-color: #9a9a9a;
    color: #6b6b6b;
    cursor: not-allowed;
}

.epicod-a11y__text-size-value {
    min-width: 48px;
    text-align: center;
    font-weight: 700;
}

/* Toggle grid */
.epicod-a11y__options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.epicod-a11y__options li {
    margin: 0;
    padding: 0;
}

.epicod-a11y__options li::before,
.epicod-a11y__options li::after {
    content: none;
}

.epicod-a11y__option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 76px;
    margin: 0;
    padding: 10px 8px;
    border: 1px solid #c9c9c9;
    border-radius: 8px;
    background: #fff;
    color: #1d1d1d;
    font: 400 14px/1.25 Arial, "Segoe UI", sans-serif;
    text-align: center;
    cursor: pointer;
}

.epicod-a11y__option:hover {
    border-color: #1d1d1d;
}

.epicod-a11y__option[aria-pressed="true"] {
    border-color: var(--epicod-a11y-color);
    background: var(--epicod-a11y-color);
    color: #fff;
    font-weight: 700;
}

/* Footer */
.epicod-a11y__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.epicod-a11y__reset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid #1d1d1d;
    border-radius: 8px;
    background: #fff;
    color: #1d1d1d;
    font: 400 14px/1.2 Arial, "Segoe UI", sans-serif;
    cursor: pointer;
}

.epicod-a11y__reset .epicod-a11y__icon {
    width: 18px;
    height: 18px;
}

.epicod-a11y__statement {
    color: #1d1d1d;
    font-size: 14px;
    text-decoration: underline;
}

@media (max-width: 480px) {
    .epicod-a11y__panel {
        inset-inline: 8px !important;
        width: auto;
        max-width: none;
    }
}

/* ==========================================================================
   Visitor preferences (classes on <html>)
   ========================================================================== */

/* Text size — fallback for themes without the --a11y-text-scale hook.
   Uses its own variable so a theme that also reads --a11y-text-scale is not scaled twice. */
html.a11y-zoom {
    zoom: var(--a11y-page-zoom, 1);
}

/* High contrast — replaces colours instead of filtering them, so every text reaches
   at least 7:1 (WCAG G174: a control that switches to a presentation with sufficient contrast).
   Media and empty decorative layers (overlays, rules, gradients) keep transparent backgrounds
   so images and video stay visible. The widget itself is left alone. */
html.a11y-contrast body,
html.a11y-contrast body *:not(.epicod-a11y):not(.epicod-a11y *):not(img):not(video):not(iframe):not(picture):not(svg):not(svg *) {
    background-color: #fff !important;
    background-image: none !important;
    color: #000 !important;
    border-color: #000 !important;
    text-shadow: none !important;
}

html.a11y-contrast body *:empty:not(.epicod-a11y *):not(input):not(textarea):not(select) {
    background-color: transparent !important;
}

/* Same :not() chain as the generic rule plus `a`, so links win on specificity and stay blue. */
html.a11y-contrast body a:not(.epicod-a11y):not(.epicod-a11y *):not(img):not(video):not(iframe):not(picture):not(svg):not(svg *),
html.a11y-contrast body a:not(.epicod-a11y *) *:not(.epicod-a11y):not(img):not(video):not(iframe):not(picture):not(svg):not(svg *) {
    color: #0B3D91 !important;
}

html.a11y-contrast body a:not(.epicod-a11y *) {
    text-decoration: underline !important;
}

html.a11y-contrast body :is(button, input, select, textarea, .button, .btn):not(.epicod-a11y *) {
    border: 2px solid #000 !important;
}

html.a11y-contrast body ::placeholder {
    color: #333 !important;
    opacity: 1 !important;
}

/* Icons drawn with hard-coded colours follow the text colour. */
html.a11y-contrast body svg:not(.epicod-a11y *) [stroke]:not([stroke="none"]) {
    stroke: currentColor !important;
}

html.a11y-contrast body svg:not(.epicod-a11y *) [fill]:not([fill="none"]) {
    fill: currentColor !important;
}

/* Grayscale — filter on <html> so fixed elements keep working */
html.a11y-grayscale {
    filter: grayscale(1);
}

/* Highlight links */
html.a11y-links a:not(.epicod-a11y-skip):not(.epicod-a11y__statement) {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 3px !important;
    outline: 2px dashed currentColor !important;
    outline-offset: 2px !important;
}

/* Highlight headings */
html.a11y-headings :is(h1, h2, h3, h4, h5, h6, [role="heading"]):not(.epicod-a11y__title) {
    outline: 3px solid #E66A3C !important;
    outline-offset: 4px !important;
    background-color: rgba(255, 235, 59, 0.35) !important;
}

/* Readable font — skip icon fonts so icons keep rendering */
html.a11y-readable-font body *:not([class*="ico-"]):not(.dashicons):not([class*="dashicons-"]):not(i) {
    font-family: Arial, Helvetica, "Segoe UI", sans-serif !important;
}

/* Text spacing — WCAG 1.4.12 values */
html.a11y-spacing body :is(p, li, dd, dt, td, th, blockquote, figcaption, label, a, span, button, h1, h2, h3, h4, h5, h6) {
    line-height: 1.5 !important;
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
}

html.a11y-spacing body p {
    margin-bottom: 2em !important;
}

/* Big cursor */
html.a11y-big-cursor,
html.a11y-big-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='M5 3l14 8.5-6.2 1.3 3.7 7.2-2.6 1.3-3.7-7.2L5 18.5z' fill='%23000' stroke='%23fff' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") 8 4, auto !important;
}

/* Strong focus — on every focus, not only keyboard */
html.a11y-focus :focus,
html.a11y-focus :focus-visible {
    outline: 3px solid #000 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 6px #ffeb3b !important;
}

/* Stop animations (the JS also pauses sliders and videos) */
html.a11y-no-motion,
html.a11y-no-motion *,
html.a11y-no-motion *::before,
html.a11y-no-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}
