/* Coin Wiki Accessibility v1.0.1 — toolbar, modes, and site-wide a11y fixes.
   Matches the Coin Wiki palette: bg #0b0c0e, surfaces #101214/#15171a,
   text #f5f1e8, muted #a9a294, gold #c9a227. No external requests. */

/* ---------- Skip link: hidden until keyboard focus ---------- */
.cwa-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100000;
    background: #c9a227;
    color: #10151f;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 0 0 10px 0;
    text-decoration: none;
}
.cwa-skip-link:focus {
    left: 0;
}

/* ---------- Visible keyboard focus, site-wide (frontend) ---------- */
body:not(.wp-admin) :focus-visible {
    outline: 3px solid #c9a227;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Floating accessibility button (bottom-left; search FAB is bottom-right) ---------- */
.cwa-root {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 99990;
}
.cwa-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid #c9a227;
    cursor: pointer;
    background: #101214;
    color: #f5f1e8;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cwa-fab:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
}

/* ---------- Options panel ---------- */
.cwa-panel {
    position: absolute;
    left: 0;
    bottom: 72px;
    width: 300px;
    max-width: calc(100vw - 36px);
    background: #101214;
    color: #f5f1e8;
    border: 1px solid #2a2d33;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
    padding: 16px 16px 12px;
}
.cwa-panel[hidden] {
    display: none;
}
.cwa-panel-title {
    margin: 0 0 10px;
    font-size: 17px;
    font-weight: 700;
    color: #c9a227;
}
.cwa-row {
    margin: 8px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.cwa-label {
    font-size: 14px;
    color: #f5f1e8;
}
.cwa-stepper {
    display: flex;
    gap: 6px;
}
.cwa-btn {
    background: #1a1d21;
    color: #f5f1e8;
    border: 1px solid #3a3d44;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.cwa-btn:hover {
    border-color: #c9a227;
}
.cwa-btn.cwa-reset {
    font-weight: 400;
    color: #a9a294;
}
.cwa-live {
    min-height: 18px;
    margin: 2px 0 4px;
    font-size: 13px;
    color: #a9a294;
}
.cwa-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #f5f1e8;
    font-size: 14px;
    padding: 8px 6px;
    cursor: pointer;
    text-align: left;
}
.cwa-toggle:hover {
    background: #1a1d21;
}
.cwa-toggle-dot {
    flex: 0 0 auto;
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: #3a3d44;
    position: relative;
    transition: background 0.15s ease;
}
.cwa-toggle-dot::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f5f1e8;
    transition: left 0.15s ease;
}
.cwa-toggle[aria-pressed="true"] .cwa-toggle-dot {
    background: #c9a227;
}
.cwa-toggle[aria-pressed="true"] .cwa-toggle-dot::after {
    left: 21px;
    background: #10151f;
}
.cwa-note {
    margin: 10px 0 0;
    font-size: 12px;
    color: #6f6a5d;
}

/* ---------- High contrast mode ---------- */
html.cwa-contrast body {
    --cwl-text: #ffffff;
    --cwl-muted: #e8e4da;
    --cwl-faint: #cfc9bb;
}
html.cwa-contrast body,
html.cwa-contrast body .cwl-surface,
html.cwa-contrast body [class*="surface"] {
    color: #ffffff;
}
html.cwa-contrast a {
    text-decoration: underline;
}
html.cwa-contrast img {
    filter: contrast(1.08);
}

/* ---------- Color-blind safe palette (Okabe-Ito) ----------
   Maps the common up/down semantics away from red/green:
   gains -> blue #0072B2, losses -> vermillion #D55E00.
   The gold brand accent #c9a227 is already distinguishable and stays. */
html.cwa-cb {
    --cwl-up: #0072b2;
    --cwl-down: #d55e00;
}
html.cwa-cb .gain, html.cwa-cb .positive, html.cwa-cb .up, html.cwa-cb .is-gain,
html.cwa-cb [class*="gain"], html.cwa-cb .cwl-gain {
    color: #0072b2 !important;
    border-color: #0072b2 !important;
}
html.cwa-cb .loss, html.cwa-cb .negative, html.cwa-cb .down, html.cwa-cb .is-loss,
html.cwa-cb [class*="loss"], html.cwa-cb .cwl-loss {
    color: #d55e00 !important;
    border-color: #d55e00 !important;
}

/* ---------- Reduced motion ---------- */
html.cwa-motion *, html.cwa-motion *::before, html.cwa-motion *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
}

/* ---------- Underline links ---------- */
html.cwa-links a {
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

/* ---------- Easier-to-read text (dyslexia-friendly spacing) ---------- */
html.cwa-dyslexia body {
    line-height: 1.75 !important;
    letter-spacing: 0.035em;
    word-spacing: 0.16em;
    font-family: Verdana, Geneva, "Segoe UI", system-ui, sans-serif !important;
}
html.cwa-dyslexia body p,
html.cwa-dyslexia body li {
    max-width: 75ch;
}

@media (max-width: 480px) {
    .cwa-root {
        left: 12px;
        bottom: 12px;
    }
    .cwa-fab {
        width: 52px;
        height: 52px;
    }
}

/* ---------- v1.0.1: responsive images — entry photos must never overflow the viewport ---------- */
.entry-content img,
.wp-block-post-content img,
.wp-block-html img,
figure img,
.cw-hero img,
.cw-coin-pair img,
.cw-gallery img {
    max-width: 100%;
    height: auto;
}
