/* Barrierefreiheits-Werkzeug (schwebender Button + Panel)
   Markup: includes/a11y_werkzeug.php · Logik: assets/js/barrierefreiheit.js
   Angelehnt an die Umsetzung im Holzkunst-Dost-Projekt, hier in den
   Spatzennest-Farben (Orange statt Blau) statt Blau. */

.a11y { --dock-offset: 0px; }
.a11y__toggle {
  position: fixed;
  left: 20px;
  bottom: calc(20px + var(--dock-offset));
  z-index: 250;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--farbe-orange);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  transition: transform 0.15s ease, bottom 0.15s ease;
}
.a11y__toggle:hover { transform: scale(1.06); }
.a11y__toggle:focus-visible { outline: 3px solid var(--farbe-orange-hell); outline-offset: 3px; }
.a11y--right .a11y__toggle { left: auto; right: 20px; bottom: calc(76px + var(--dock-offset)); }

.a11y__panel {
  position: fixed;
  left: 20px;
  bottom: calc(82px + var(--dock-offset));
  z-index: 251;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 100px - var(--dock-offset));
  overflow-y: auto;
  background: #fff;
  color: var(--farbe-text);
  border-radius: 14px;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.5);
  padding: 16px;
  font-family: 'Nunito', Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.35;
}
.a11y__panel[hidden] { display: none; }
.a11y--right .a11y__panel { left: auto; right: 20px; bottom: calc(138px + var(--dock-offset)); max-height: calc(100vh - 156px - var(--dock-offset)); }
@media (max-width: 480px) {
  .a11y__panel,
  .a11y--right .a11y__panel { left: 16px; right: 16px; width: auto; }
}
.a11y__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.a11y__title { margin: 0; font-family: 'Fredoka', Arial, sans-serif; font-size: 17px; color: var(--farbe-text); }
.a11y__close {
  appearance: none;
  border: 0;
  background: var(--farbe-creme);
  color: var(--farbe-text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.a11y__close:hover,
.a11y__close:focus-visible { background: var(--farbe-orange); color: #fff; outline: none; }
.a11y__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.a11y__option {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 92px;
  padding: 10px 6px;
  border: 2px solid var(--farbe-rand);
  border-radius: 10px;
  background: var(--farbe-creme);
  color: var(--farbe-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.a11y__option:hover { border-color: var(--farbe-orange); }
.a11y__option:focus-visible { outline: 3px solid var(--farbe-orange); outline-offset: 2px; }
.a11y__option[aria-pressed="true"] { background: var(--farbe-orange); border-color: var(--farbe-orange); color: #fff; }
.a11y__state { font-size: 12px; font-weight: 400; min-height: 14px; }
.a11y__footer { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.a11y__small {
  flex: 1 1 auto;
  appearance: none;
  border: 1px solid var(--farbe-rand);
  background: #fff;
  color: var(--farbe-text);
  border-radius: 999px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.a11y__small:hover,
.a11y__small:focus-visible { background: var(--farbe-orange); border-color: var(--farbe-orange); color: #fff; outline: none; }

.a11y__structure {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.a11y__structure[hidden] { display: none; }
.a11y__structure-box {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: #fff;
  color: var(--farbe-text);
  border-radius: 14px;
  padding: 16px;
  font-family: 'Nunito', Arial, Helvetica, sans-serif;
  font-size: 15px;
}
.a11y__tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.a11y__tabs button {
  flex: 1;
  appearance: none;
  border: 2px solid var(--farbe-rand);
  background: var(--farbe-creme);
  color: var(--farbe-text);
  border-radius: 8px;
  padding: 7px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.a11y__tabs button[aria-selected="true"] { background: var(--farbe-orange); border-color: var(--farbe-orange); color: #fff; }
.a11y__tabs button:focus-visible { outline: 3px solid var(--farbe-orange); outline-offset: 2px; }
.a11y__structure-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.a11y__structure-list li { border-top: 1px solid var(--farbe-rand); }
.a11y__structure-item {
  appearance: none;
  display: block;
  width: 100%;
  border: 0;
  background: none;
  color: var(--farbe-text);
  text-align: left;
  padding: 9px 12px;
  font: inherit;
  cursor: pointer;
}
.a11y__structure-item:hover,
.a11y__structure-item:focus-visible { background: var(--farbe-creme); outline: 2px solid var(--farbe-orange); outline-offset: -2px; }

.a11y__guide {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: -100px;
  height: 36px;
  z-index: 240;
  pointer-events: none;
  border-top: 3px solid #ffd600;
  border-bottom: 3px solid #ffd600;
  background: rgba(255, 214, 0, 0.12);
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
}
.a11y__guide.is-active { display: block; }
.a11y__tooltip {
  position: fixed;
  z-index: 260;
  max-width: 320px;
  padding: 7px 10px;
  background: #111;
  color: #fff;
  border: 2px solid #ffd600;
  border-radius: 6px;
  font-family: 'Nunito', Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.35;
  pointer-events: none;
}
.a11y__tooltip[hidden] { display: none; }

/* ---------- Darstellungs-Modi (Klassen auf <html>) ---------- */
html.a11y-contrast-invert { filter: invert(1) hue-rotate(180deg); }
html.a11y-contrast-invert img,
html.a11y-contrast-invert video,
html.a11y-contrast-invert iframe { filter: invert(1) hue-rotate(180deg); }
html.a11y-contrast-gray { filter: grayscale(1); }

html.a11y-contrast-dark body,
html.a11y-contrast-dark body *:not(.a11y *):not(svg):not(svg *):not(img) {
  background-color: #000 !important;
  background-image: none !important;
  color: #fff !important;
  border-color: #fff !important;
  text-shadow: none !important;
  box-shadow: none !important;
}
html.a11y-contrast-dark body a:not(.a11y *),
html.a11y-contrast-dark body a:not(.a11y *) * { color: #ffeb3b !important; }
html.a11y-contrast-dark .btn-spatz { border: 2px solid #ffeb3b !important; }

html.a11y-contrast-light body,
html.a11y-contrast-light body *:not(.a11y *):not(svg):not(svg *):not(img) {
  background-color: #fff !important;
  background-image: none !important;
  color: #000 !important;
  border-color: #000 !important;
  text-shadow: none !important;
  box-shadow: none !important;
}
html.a11y-contrast-light body a:not(.a11y *),
html.a11y-contrast-light body a:not(.a11y *) * { color: #0033cc !important; }
html.a11y-contrast-light .btn-spatz { border: 2px solid #000 !important; }

/* Links hervorheben */
html.a11y-links body a:not(.a11y *) {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px;
  outline: 2px solid #ffeb3b;
  outline-offset: 1px;
  background-color: rgba(0, 0, 0, 0.55) !important;
  color: #ffeb3b !important;
}

/* Zeichen-Abstand (WCAG 2.1, Kriterium 1.4.12) */
html.a11y-spacing body *:not(.a11y *) {
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
  line-height: 1.6 !important;
}
html.a11y-spacing body p:not(.a11y *) { margin-bottom: 2em !important; }

/* Lesbare Schrift */
html.a11y-font body,
html.a11y-font body *:not(.a11y *):not(svg):not(svg *) {
  font-family: Verdana, Tahoma, Arial, sans-serif !important;
}

/* Großer Mauszeiger */
html.a11y-cursor,
html.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 2l15 9-6.5 1.6L16 20l-3 1.4-3.5-7.3L4 18z' fill='%23000' stroke='%23fff' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") 8 4, auto !important;
}

/* Animationen pausieren */
html.a11y-noanim *,
html.a11y-noanim *::before,
html.a11y-noanim *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Tastatur-Fokus deutlich sichtbar */
html.a11y-focus *:focus,
html.a11y-focus *:focus-visible {
  outline: 4px solid #ff1744 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 7px #fff !important;
}
