/* ============================================================
   Bohema accessibility toolbar — first-party, no external vendor.
   Two parts: (1) the toolbar's own UI, (2) the effect classes it
   puts on <html> to adapt the page.
   ============================================================ */

/* ---------- 1. Toolbar UI ---------- */
.a11y-ui, .a11y-ui * { box-sizing: border-box; }
.a11y-ui {
  --a11y-bg:     #ffffff;
  --a11y-fg:     #1b1b1b;
  --a11y-muted:  #5c5c5c;
  --a11y-line:   #d8d8d8;
  --a11y-accent: #1f4a3d;
  --a11y-on:     #f4dbb3;
  font-family: Arial, Helvetica, sans-serif;
  direction: rtl;
}

.a11y-open-btn {
  position: fixed; top: 300px; right: 0; z-index: 2147483000;
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; padding: 0;
  background: var(--a11y-accent); color: #fff;
  border: 0; border-top-left-radius: 8px; border-bottom-left-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.a11y-open-btn:hover { background: #2b6152; }
.a11y-open-btn svg { width: 28px; height: 28px; fill: currentColor; }

.a11y-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 2147483001;
  width: 340px; max-width: 100vw;
  display: flex; flex-direction: column;
  background: var(--a11y-bg); color: var(--a11y-fg);
  box-shadow: -4px 0 24px rgba(0,0,0,.4);
  overflow-y: auto;
  font-size: 15px; line-height: 1.5;
}
.a11y-panel[hidden] { display: none; }

.a11y-panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px;
  background: var(--a11y-accent); color: #fff;
}
.a11y-panel__head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.a11y-close {
  width: 36px; height: 36px; padding: 0;
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.5);
  border-radius: 6px; font-size: 20px; line-height: 1; cursor: pointer;
}
.a11y-close:hover { background: rgba(255,255,255,.15); }

.a11y-group { padding: 14px 20px; border-bottom: 1px solid var(--a11y-line); }
.a11y-group > h3 {
  margin: 0 0 10px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--a11y-muted);
}
.a11y-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.a11y-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 74px; padding: 10px 8px;
  background: #f5f5f5; color: var(--a11y-fg);
  border: 2px solid transparent; border-radius: 8px;
  font: inherit; font-size: 13px; text-align: center; cursor: pointer;
}
.a11y-btn:hover { background: #ececec; }
.a11y-btn[aria-pressed="true"] {
  background: var(--a11y-accent); color: #fff; border-color: var(--a11y-on);
}
.a11y-btn svg { width: 22px; height: 22px; fill: currentColor; flex: none; }

.a11y-step { display: flex; align-items: center; gap: 8px; }
.a11y-step button {
  width: 44px; height: 44px;
  background: #f5f5f5; border: 2px solid var(--a11y-line); border-radius: 8px;
  font: inherit; font-size: 20px; font-weight: 700; cursor: pointer;
}
.a11y-step button:hover { background: #ececec; }
.a11y-step output { flex: 1; text-align: center; font-weight: 700; }

.a11y-panel__foot { padding: 16px 20px; }
.a11y-reset {
  width: 100%; padding: 12px;
  background: #8a1c1c; color: #fff;
  border: 0; border-radius: 8px;
  font: inherit; font-weight: 700; cursor: pointer;
}
.a11y-reset:hover { background: #a52222; }
.a11y-note { margin: 12px 0 0; font-size: 12px; color: var(--a11y-muted); }
.a11y-note a { color: var(--a11y-accent); }

/* the toolbar must stay legible no matter what the page filters do */
.a11y-ui :focus-visible { outline: 3px solid #1f4a3d; outline-offset: 2px; }
.a11y-panel :focus-visible { outline-color: #b8860b; }

.a11y-skip {
  position: fixed; top: -100px; left: 16px; z-index: 2147483002;
  padding: 12px 20px; background: #1f4a3d; color: #fff;
  border-radius: 0 0 8px 8px; text-decoration: none; font-weight: 700;
}
.a11y-skip:focus { top: 0; }

/* ---------- 2. Effects applied to the page ---------- */

/* Colour treatments. Applied per top-level child so the toolbar itself,
   which is also a child of <body>, is never filtered. */
html.a11y-invert    body > *:not(.a11y-ui):not(.a11y-guide):not(.a11y-alt-caption) { filter: invert(1) hue-rotate(180deg); }
html.a11y-grayscale body > *:not(.a11y-ui):not(.a11y-guide):not(.a11y-alt-caption) { filter: grayscale(1); }
html.a11y-contrast  body > *:not(.a11y-ui):not(.a11y-guide):not(.a11y-alt-caption) { filter: contrast(1.45) saturate(1.15); }

/* Readable font */
html.a11y-readable body :not(.a11y-ui):not(.a11y-ui *) {
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !important;
  letter-spacing: normal !important;
}

/* Text spacing — the WCAG 1.4.12 values */
html.a11y-spacing body :not(.a11y-ui):not(.a11y-ui *) {
  line-height: 1.5 !important;
  letter-spacing: .12em !important;
  word-spacing: .16em !important;
}
html.a11y-spacing body p:not(.a11y-ui *) { margin-bottom: 2em !important; }

/* Link emphasis */
html.a11y-links body a:not(.a11y-ui a) {
  text-decoration: underline !important;
  text-underline-offset: 3px;
  outline: 1px dashed currentColor; outline-offset: 2px;
}

/* Stop motion — pauses CSS animation, video and the lottie flourish */
html.a11y-stop-motion body *:not(.a11y-ui *) {
  animation-play-state: paused !important;
  transition: none !important;
}

/* Large cursor */
html.a11y-cursor, html.a11y-cursor body *:not(.a11y-ui *) {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'><path d='M5 2l14 9-6 1.5L15.5 20 12 21l-2.5-7.5L5 17z' fill='%23000' stroke='%23fff' stroke-width='1.5'/></svg>") 4 2, auto;
}

/* Reading guide */
.a11y-guide {
  position: fixed; left: 0; right: 0; z-index: 2147482999;
  height: 14px; background: rgba(0,0,0,.75);
  border-top: 2px solid #f4dbb3; border-bottom: 2px solid #f4dbb3;
  pointer-events: none;
}

/* Image descriptions — surface alt text under each image */
html.a11y-alt body img:not(.a11y-ui img) { outline: 2px solid #b8860b; outline-offset: 2px; }
.a11y-alt-caption {
  position: absolute; z-index: 2147482998;
  max-width: 320px; padding: 6px 10px;
  background: #000; color: #fff;
  border: 1px solid #f4dbb3; border-radius: 6px;
  font: 13px/1.4 Arial, sans-serif; direction: rtl; text-align: start;
  pointer-events: none;
}

@media (max-width: 479px) {
  .a11y-panel { width: 100vw; }
  .a11y-open-btn { top: 100px; width: 42px; height: 42px; }
}

@media print { .a11y-ui { display: none !important; } }
