/* ═══════════════════════════════════════════════════════════
   SI MARES — Accessibility layer (IS 5568 / WCAG 2.0 AA)
   Loaded after main.css. Contains:
     • Skip link
     • Screen-reader-only helper
     • Always-visible keyboard focus (overrides theme outline:none)
     • User-preference classes toggled on <html> by the a11y widget
     • The accessibility widget UI
   The widget is a comfort tool: it only restyles via these classes.
   It never rewrites content, alt text, or ARIA.
   ═══════════════════════════════════════════════════════════ */

/* ── Skip to content link ─────────────────────────────────── */
.skip-link {
    position: fixed;
    top: -200px;
    inset-inline-start: 12px;
    z-index: 2147483647;
    background: var(--color-obsidian, #000);
    color: var(--color-ivory, #fff);
    padding: 12px 22px;
    font-family: var(--font-body, sans-serif);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    text-decoration: none;
    border: 2px solid var(--color-ivory, #fff);
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 12px;
}

/* ── Screen-reader-only ───────────────────────────────────── */
.a11y-sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ── Always-visible keyboard focus ────────────────────────────
   The theme sets `outline:none` on several form fields, which
   hides focus from keyboard users. These !important rules win
   on both light and dark backgrounds (obsidian outline + ivory
   halo => always at least one ring is visible). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--color-obsidian, #000) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 5px var(--color-ivory, #fff) !important;
}

/* ════════════════════════════════════════════════════════════
   USER-PREFERENCE CLASSES (toggled on <html> by the widget)
   ════════════════════════════════════════════════════════════ */

/* ── Text size (root font-size; theme uses rem so this cascades) ── */
html.a11y-text-115 { font-size: 115% !important; }
html.a11y-text-130 { font-size: 130% !important; }
html.a11y-text-150 { font-size: 150% !important; }

/* ── Line spacing ─────────────────────────────────────────── */
html.a11y-lines-16 body,
html.a11y-lines-16 body :where(p, li, a, span, td, th, h1, h2, h3, h4, h5, h6, blockquote, label) {
    line-height: 1.6 !important;
}
html.a11y-lines-20 body,
html.a11y-lines-20 body :where(p, li, a, span, td, th, h1, h2, h3, h4, h5, h6, blockquote, label) {
    line-height: 2 !important;
    letter-spacing: 0.02em !important;
}

/* ── Readable font (OS sans stack — no webfont, no reflow risk) ── */
html.a11y-readable-font body,
html.a11y-readable-font body :not(svg):not(.a11y-trigger svg *) {
    font-family: Arial, "Segoe UI", Tahoma, "Helvetica Neue", "Noto Sans Hebrew", sans-serif !important;
    letter-spacing: normal !important;
}

/* ── Highlight links ──────────────────────────────────────── */
html.a11y-links a:not(.a11y-trigger):not(.a11y-card):not(.skip-link) {
    text-decoration: underline !important;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px !important;
    font-weight: 600 !important;
}

/* ── Highlight headings ───────────────────────────────────── */
html.a11y-headings :where(h1, h2, h3, h4, h5, h6) {
    outline: 2px dashed var(--color-accent, #C9A96E) !important;
    outline-offset: 4px !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='M4 1l16 12.5-7 .8 4.2 8.2-3.3 1.6-4.2-8.3L4 21z' fill='%23000' stroke='%23fff' stroke-width='1.2'/%3E%3C/svg%3E") 4 1, auto !important;
}

/* ── Stop animations (also pauses autoplay hero video — WCAG 2.2.2) ── */
html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}
html.a11y-reduce-motion video.hero__video { display: none !important; }
html.a11y-reduce-motion .fade-in-section,
html.a11y-reduce-motion .reveal-item {
    opacity: 1 !important;
    transform: none !important;
}

/* ── Contrast modes via blend overlay ─────────────────────────
   filter: on <html> would break the theme's many position:fixed
   elements (header, drawers, this widget). A fixed full-screen
   pseudo-element with a blend mode inverts / desaturates the page
   WITHOUT touching layout. The widget sits at a higher z-index, so
   it is painted on top of the overlay and stays readable. */
html.a11y-contrast-invert::after,
html.a11y-contrast-mono::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2147483640;
}
html.a11y-contrast-invert::after {
    background: #fff;
    mix-blend-mode: difference;
}
html.a11y-contrast-mono::after {
    background: hsl(0, 0%, 50%);
    mix-blend-mode: saturation;
}

/* ════════════════════════════════════════════════════════════
   ACCESSIBILITY WIDGET UI
   ════════════════════════════════════════════════════════════ */

.a11y-trigger {
    position: fixed;
    bottom: 20px;
    inset-inline-start: 20px;
    z-index: 2147483646;
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-obsidian, #000);
    color: var(--color-ivory, #fff);
    border: 2px solid var(--color-ivory, #fff);
    border-radius: 50% !important;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, background 0.2s ease;
}
.a11y-trigger:hover { transform: scale(1.06); }
.a11y-trigger svg { display: block; }

/* Lift above the mobile bottom nav bar */
@media (max-width: 768px) {
    .a11y-trigger { bottom: 84px; inset-inline-start: 14px; width: 48px; height: 48px; }
}

.a11y-panel {
    position: fixed;
    bottom: 86px;
    inset-inline-start: 20px;
    z-index: 2147483647;
    width: 344px;
    max-width: calc(100vw - 28px);
    max-height: min(80vh, 600px);
    overflow-y: auto;
    background: var(--color-ivory, #F9F9F9);
    color: var(--color-obsidian, #000);
    border: 1px solid var(--color-obsidian, #000);
    border-top: 3px solid var(--color-accent, #C9A96E); /* gold editorial accent */
    box-shadow: 0 24px 60px -14px rgba(0, 0, 0, 0.5);
    padding: 24px 22px 22px;
    font-family: var(--font-body, serif);
}
.a11y-panel[hidden] { display: none; }

/* Premium entrance — runs as the panel switches from display:none to block */
.a11y-panel:not([hidden]) {
    animation: a11yPanelIn 0.4s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}
@keyframes a11yPanelIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .a11y-panel:not([hidden]) { animation: none; }
}

@media (max-width: 768px) {
    .a11y-panel { bottom: 140px; inset-inline-start: 14px; }
}

.a11y-panel__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--color-light-gray, #E5E5E5);
    padding-bottom: 14px;
    margin-bottom: 18px;
}
.a11y-panel__title {
    font-family: var(--font-heading, serif);
    font-size: 1.6rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.01em;
    margin: 0;
    color: var(--color-obsidian, #000);
}
.a11y-panel__close {
    flex: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-warm-gray, #6E6E6E);
    padding: 0 2px;
    transition: color 0.25s var(--ease-out, ease), transform 0.25s var(--ease-out, ease);
}
.a11y-panel__close:hover {
    color: var(--color-obsidian, #000);
    transform: rotate(90deg);
}

.a11y-panel__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.a11y-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
    min-height: 84px;
    padding: 13px 14px;
    text-align: start;
    background: #fff;
    color: var(--color-obsidian, #000);
    border: 1px solid var(--color-light-gray, #E5E5E5);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s var(--ease-out, ease),
                background 0.2s var(--ease-out, ease),
                color 0.2s var(--ease-out, ease);
}
.a11y-card:hover { border-color: var(--color-obsidian, #000); }

/* Active state: cycle control not on default, or toggle pressed */
.a11y-card[aria-pressed="true"],
.a11y-card.is-active {
    background: var(--color-obsidian, #000);
    color: var(--color-ivory, #fff);
    border-color: var(--color-obsidian, #000);
}

/* Category micro-label — editorial uppercase, muted */
.a11y-card__label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-warm-gray, #6E6E6E);
}
.a11y-card[aria-pressed="true"] .a11y-card__label,
.a11y-card.is-active .a11y-card__label {
    color: var(--color-ivory, #fff);
    opacity: 0.7;
}

/* Current value — serif, prominent */
.a11y-card__value,
.a11y-card__state {
    font-family: var(--font-heading, serif);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.2;
    color: inherit;
}

.a11y-panel__reset {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 13px;
    background: var(--color-obsidian, #000);
    color: var(--color-ivory, #fff);
    border: 1px solid var(--color-obsidian, #000);
    cursor: pointer;
    font-family: var(--font-body, serif);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: background 0.25s var(--ease-out, ease), color 0.25s var(--ease-out, ease);
}
.a11y-panel__reset:hover {
    background: transparent;
    color: var(--color-obsidian, #000);
}

.a11y-panel__statement {
    display: block;
    margin-top: 16px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-dark, #1A1A1A);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: opacity 0.2s ease;
}
.a11y-panel__statement:hover { opacity: 0.6; }

/* ── Footer legal links row ───────────────────────────────── */
.footer__legal {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
}
.footer__legal a {
    color: inherit;
    text-decoration: none;
    opacity: 0.85;
}
.footer__legal a:hover { opacity: 1; text-decoration: underline; }
.footer__legal-sep { opacity: 0.5; }

/* ── Print: never carry a11y restyling onto paper ─────────── */
@media print {
    .a11y-trigger,
    .a11y-panel,
    .skip-link { display: none !important; }
    html[class*="a11y-text-"] { font-size: 100% !important; }
    html[class*="a11y-lines-"] body,
    html[class*="a11y-lines-"] body * { line-height: normal !important; }
    html.a11y-contrast-invert::after,
    html.a11y-contrast-mono::after { display: none !important; }
}
