/* ============================================================
   OSTSEE7 – Barrierefreiheit-Widget (a11y.css)
   WCAG 2.1 AA / BFSG-konform
   ============================================================ */

/* ── Toggle-Button (immer sichtbar, fixiert) ─────────────── */
.a11y-toggle {
  position: fixed;
  bottom: 9rem;
  right: 1.5rem;
  z-index: 9999;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-accent, #d4a84b);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(212, 168, 75, 0.45);
  transition:
    background 0.2s,
    box-shadow 0.2s,
    transform 0.2s;
  cursor: pointer;
  border: none;
  padding: 0;
}
.a11y-toggle .fa-universal-access {
  font-size: inherit;
  color: #fff;
  pointer-events: none;
}
.a11y-toggle:hover,
.a11y-toggle:focus-visible {
  background: #c4963a;
  box-shadow: 0 6px 22px rgba(212, 168, 75, 0.6);
  outline: 3px solid #fff;
  outline-offset: 3px;
  border-radius: 50%;
}
.a11y-toggle[aria-expanded="true"] {
  background: #c4963a;
}

/* ── Panel ───────────────────────────────────────────────── */
.a11y-panel {
  position: fixed;
  bottom: 8.5rem;
  right: 1.5rem;
  z-index: 9998;
  width: 300px;
  max-height: 80vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(13, 79, 110, 0.15);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  padding: 0;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
  overscroll-behavior: contain;
}
.a11y-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Panelkopf */
.a11y-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(13, 79, 110, 0.1);
  background: var(--color-primary, #0d4f6e);
  color: #fff;
  border-radius: 11px 11px 0 0;
}
.a11y-panel-head strong {
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.a11y-panel-head strong .fa-universal-access {
  font-size: 1.1rem;
  opacity: 0.9;
}

.a11y-status-badge {
  font-size: 0.7rem;
  background: var(--color-accent, #d4a84b);
  color: #1a1a1a;
  border-radius: 20px;
  padding: 0.15em 0.6em;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-left: 0.3rem;
}

.a11y-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  transition:
    color 0.15s,
    background 0.15s;
}
.a11y-close:hover,
.a11y-close:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  outline: 2px solid var(--color-accent, #d4a84b);
}

/* Controls-Bereich */
.a11y-controls {
  padding: 0.75rem 0.9rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(13, 79, 110, 0.08);
}

.a11y-controls button {
  background: #f5f8fa;
  border: 1px solid rgba(13, 79, 110, 0.14);
  border-radius: 7px;
  padding: 0.5rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-primary, #0d4f6e);
  text-align: center;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
  min-height: 38px;
  cursor: pointer;
}
.a11y-controls button:hover,
.a11y-controls button:focus-visible {
  background: var(--color-primary, #0d4f6e);
  color: #fff;
  border-color: var(--color-primary, #0d4f6e);
  outline: 2px solid var(--color-accent, #d4a84b);
  outline-offset: 2px;
}
.a11y-controls button[aria-pressed="true"] {
  background: var(--color-primary, #0d4f6e);
  color: #fff;
  border-color: var(--color-primary, #0d4f6e);
}

/* Reset-Button volle Breite */
.a11y-reset {
  grid-column: 1 / -1 !important;
  background: #fef3f3 !important;
  color: #c0392b !important;
  border-color: rgba(192, 57, 43, 0.25) !important;
}
.a11y-reset:hover,
.a11y-reset:focus-visible {
  background: #c0392b !important;
  color: #fff !important;
  border-color: #c0392b !important;
}

/* Vorlesen-Bereich */
.a11y-reader {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid rgba(13, 79, 110, 0.08);
}
.a11y-speak-toggle {
  width: 100%;
  background: #f0f7fb;
  border: 1px solid rgba(13, 79, 110, 0.18);
  border-radius: 7px;
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary, #0d4f6e);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition:
    background 0.15s,
    color 0.15s;
  min-height: 42px;
  cursor: pointer;
}
.a11y-speak-toggle::before {
  content: "🔊";
  font-size: 1rem;
  flex-shrink: 0;
}
.a11y-speak-toggle.is-active {
  background: var(--color-primary, #0d4f6e);
  color: #fff;
}
.a11y-speak-toggle.is-active::before {
  content: "🔇";
}
.a11y-speak-toggle:hover,
.a11y-speak-toggle:focus-visible {
  background: var(--color-primary, #0d4f6e);
  color: #fff;
  outline: 2px solid var(--color-accent, #d4a84b);
  outline-offset: 2px;
}

/* Status-Bereich (aria-live) */
.a11y-status {
  min-height: 1.5rem;
  padding: 0.4rem 0.9rem 0.6rem;
  font-size: 0.75rem;
  color: #555;
  font-style: italic;
}

/* ── Hochkontrast-Modus ───────────────────────────────────── */
body.a11y-contrast {
  --color-primary: #003d5c;
  filter: none;
}
body.a11y-contrast *:not(.a11y-panel):not(.a11y-panel *):not(.a11y-toggle) {
  background-color: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}
body.a11y-contrast a,
body.a11y-contrast button {
  color: #ffff00 !important;
}
body.a11y-contrast img {
  filter: grayscale(0.3) contrast(1.2);
}

/* ── Links hervorheben ────────────────────────────────────── */
body.a11y-links a:not(.a11y-toggle):not(.a11y-panel a) {
  text-decoration: underline !important;
  text-underline-offset: 3px;
  outline: 1px dashed currentColor;
  outline-offset: 2px;
}

/* ── Lesemodus ────────────────────────────────────────────── */
body.a11y-reading .site-header,
body.a11y-reading .site-footer,
body.a11y-reading .back-to-top,
body.a11y-reading .cookie-banner,
body.a11y-reading .ticker,
body.a11y-reading .a11y-toggle {
  opacity: 0.15 !important;
  pointer-events: none !important;
}
body.a11y-reading .a11y-toggle {
  opacity: 1 !important;
  pointer-events: auto !important;
}
body.a11y-reading #main-content {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* ── Bewegung reduzieren ──────────────────────────────────── */
body.a11y-motion * {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* ── Vorlese-Highlight ────────────────────────────────────── */
.a11y-highlight {
  background: rgba(212, 168, 75, 0.35) !important;
  outline: 2px solid var(--color-accent, #d4a84b) !important;
  border-radius: 2px;
}

/* ── Responsiv (mobil) ────────────────────────────────────── */
@media (max-width: 640px) {
  .a11y-toggle {
    bottom: 5rem;
    right: 1rem;
    width: 60px;
    height: 60px;
    font-size: 1.9rem;
  }
  .a11y-panel {
    width: calc(100vw - 2rem);
    right: 1rem;
    bottom: 16.5rem;
  }
}

/* ── Reduced Motion: Panel ohne Übergang ─────────────────── */
@media (prefers-reduced-motion: reduce) {
  .a11y-panel,
  .a11y-toggle {
    transition: none;
  }
}
