/* ==========================================================================
   Eigenes Barrierefreiheits-Widget (ersetzt Ally/pojo-accessibility von cdn.elementor.com, docs/05 K07).
   Keine Bibliothek, keine fremden Server. Knopf wie live: 44 px rund, Oliv, 24 px vom rechten Rand,
   senkrecht mittig (gemessen an docs/referenz/v01-startseite_de_1440.png). Nora, 2026-11-23.
   ========================================================================== */

/* ---------- Wirkung der Einstellungen (Attribute an <html>, gesetzt von barrierefrei.js) ---------- */

/* Schriftgröße: Inhalt und Fuß wie Browser-Zoom vergrößern; das Layout bricht dabei sauber um */
html[data-hilfe-schrift='115'] main, html[data-hilfe-schrift='115'] .fuss { zoom: 1.15; }
html[data-hilfe-schrift='130'] main, html[data-hilfe-schrift='130'] .fuss { zoom: 1.3; }
html[data-hilfe-schrift='150'] main, html[data-hilfe-schrift='150'] .fuss { zoom: 1.5; }

/* Graustufen: ganze Seite; das Menü liegt in der obersten Ebene und bekommt den Filter einzeln */
html[data-hilfe-graustufen='an'],
html[data-hilfe-graustufen='an'] dialog[open] { filter: grayscale(1); }

/* Links unterstreichen */
html[data-hilfe-links='an'] a {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px;
}

/* Gut lesbare Schrift: Verdana (systemeigen, offene Formen) mit etwas mehr Zeichen- und Wortabstand (WCAG 1.4.12) */
html[data-hilfe-lesbar='an'] body,
html[data-hilfe-lesbar='an'] body *:not(svg):not(svg *) {
  font-family: Verdana, Tahoma, 'DejaVu Sans', sans-serif !important;
  letter-spacing: 0.02em !important;
  word-spacing: 0.08em !important;
}

/* Animationen anhalten */
html[data-hilfe-bewegung='aus'] *,
html[data-hilfe-bewegung='aus'] *::before,
html[data-hilfe-bewegung='aus'] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* ---------- Widget ---------- */

.hilfe {
  --hilfe-rand: 24px;
  --hilfe-knopf: 44px;
  position: fixed;
  right: var(--hilfe-rand);
  top: 50%;
  z-index: 120; /* über Kopf (100), Suche (110) und Sprachwahl (90); Menü und Sprunglink liegen darüber */
  font: 400 16px/1.4 var(--font-body);
  color: var(--color-text);
  letter-spacing: 0;
}
.hilfe[hidden] { display: none; }

.hilfe__knopf {
  display: grid; place-items: center;
  width: var(--hilfe-knopf); height: var(--hilfe-knopf);
  margin-top: calc(var(--hilfe-knopf) / -2);
  border-radius: 50%;
  background: var(--color-olive);
  color: var(--color-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: background-color var(--motion-icon), transform var(--motion-icon);
}
.hilfe__knopf svg { width: 30px; height: 30px; }
.hilfe__knopf:hover { background: var(--color-olive-accent); }
.hilfe__knopf:focus-visible { outline-offset: 3px; }
.hilfe[data-offen='ja'] .hilfe__knopf { background: var(--color-olive-light); }

.hilfe__panel {
  position: fixed;
  right: calc(var(--hilfe-rand) + var(--hilfe-knopf) + 12px);
  top: 50%;
  transform: translateY(-50%);
  width: 320px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-white);
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}
/* Öffnen: bewegung.css */

.hilfe__kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 6px 6px 20px;
  background: var(--color-olive-light);
}
.hilfe__titel { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
.hilfe__schliessen {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 4px;
}
.hilfe__schliessen:hover { background: rgba(255, 255, 255, 0.6); }
.hilfe__schliessen svg { width: 18px; height: 18px; }

.hilfe__inhalt { padding: 8px 20px 20px; }

.hilfe__zeile {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px;
  border-bottom: 1px solid var(--color-divider);
}
.hilfe__bezeichnung { font-weight: 700; }

/* Schriftgröße in Stufen */
.hilfe__stufen { display: flex; align-items: center; gap: 4px; }
.hilfe__stufe {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 1px solid #767676; border-radius: 4px;
  font-size: 22px; font-weight: 700; line-height: 1;
}
.hilfe__stufe:hover { background: var(--color-input-bg); }
.hilfe__stufe[aria-disabled='true'] { color: #767676; border-color: #c8c8c8; cursor: default; background: none; }
.hilfe__wert { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }

/* Schalter (role=switch) */
.hilfe__liste { list-style: none; margin: 0; padding: 0; }
.hilfe__schalter {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; min-height: 52px;
  padding: 4px 0;
  text-align: left;
  border-bottom: 1px solid var(--color-divider);
}
.hilfe__schalter:hover .hilfe__text { text-decoration: underline; text-underline-offset: 3px; }
.hilfe__spur {
  position: relative; flex: none;
  width: 44px; height: 24px;
  border: 2px solid #5c5c5a; border-radius: 12px;
  background: var(--color-white);
  transition: background-color 0.15s;
}
.hilfe__spur::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #5c5c5a;
  transition: transform 0.15s;
}
.hilfe__schalter[aria-checked='true'] .hilfe__spur { background: var(--color-olive); border-color: var(--color-text); }
.hilfe__schalter[aria-checked='true'] .hilfe__spur::after { background: var(--color-text); transform: translateX(20px); }

.hilfe__zuruecksetzen {
  display: block; width: 100%;
  margin-top: 16px; padding: 11px 16px;
  border: 2px solid var(--color-text); border-radius: 3px;
  font-weight: 700; text-align: center;
}
.hilfe__zuruecksetzen:hover { background: var(--color-text); color: var(--color-white); }

.hilfe__hinweis { margin: 12px 0 0; font-size: 14px; line-height: 1.5; color: #5c5c5a; }

/* Hoher Kontrast im Windows-Kontrastmodus: Systemfarben statt Oliv */
@media (forced-colors: active) {
  .hilfe__knopf, .hilfe__stufe, .hilfe__spur, .hilfe__zuruecksetzen { border: 2px solid ButtonText; }
  .hilfe__schalter[aria-checked='true'] .hilfe__spur::after { background: Highlight; }
}

/* Mobil: Knopf näher am Rand, Panel über fast die ganze Breite */
@media (max-width: 767px) {
  .hilfe { --hilfe-rand: 12px; }
  .hilfe__panel { right: 12px; left: 12px; width: auto; max-width: 400px; margin-left: auto; }
}
