/**
 * A11y Assist – styles (modular, project-agnostic)
 * Pair with a11y-assist.js
 *
 * Popup: Default-Kontrast + dauerhaft dunkles Theme
 * (unabhängig vom Kontrastmodus der Seite).
 */

.a11y-assist {
  position: fixed;
  bottom: 20px;
  z-index: 1500;
  font-family: system-ui, Segoe UI, Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: #e6edf3;
  filter: none !important;
  mix-blend-mode: normal !important;
  isolation: isolate;
  color-scheme: dark;
}

.a11y-assist--left { left: 16px; }
.a11y-assist--right { right: 16px; }

.a11y-assist-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(220px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid #388bfd;
  border-radius: 999px;
  background: #161b22;
  color: #e6edf3;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.a11y-assist-toggle:hover,
.a11y-assist-toggle:focus-visible {
  background: #21262d;
  border-color: #58a6ff;
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}

.a11y-assist-toggle-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: #58a6ff;
}

.a11y-assist-toggle-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.a11y-assist-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  width: min(360px, calc(100vw - 32px));
  max-height: min(78vh, 640px);
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #30363d;
  background: #161b22 !important;
  color: #e6edf3 !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  overscroll-behavior: contain;
  filter: none !important;
  color-scheme: dark;
}

.a11y-assist--left .a11y-assist-panel { left: 0; }
.a11y-assist--right .a11y-assist-panel { right: 0; }

.a11y-assist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.a11y-assist-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #e6edf3 !important;
}

.a11y-assist-close {
  width: 34px;
  height: 34px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #21262d;
  color: #c9d1d9;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.a11y-assist-close:hover,
.a11y-assist-close:focus-visible {
  background: #30363d;
  color: #e6edf3;
  outline: 2px solid #58a6ff;
}

.a11y-assist-lead {
  margin: 0 0 12px;
  color: #8b949e !important;
  font-size: 0.86rem;
}

.a11y-assist-section {
  margin-bottom: 12px;
}

.a11y-assist-section h3 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8b949e !important;
}

.a11y-assist-row,
.a11y-assist-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.a11y-assist-row span {
  min-width: 3.5rem;
  text-align: center;
  font-weight: 700;
  align-self: center;
  color: #e6edf3 !important;
}

.a11y-assist-panel button[data-a11y-action],
.a11y-assist-panel button[data-a11y-contrast],
.a11y-assist-panel button[data-a11y-toggle],
.a11y-assist-reset {
  border: 1px solid #30363d;
  border-radius: 10px;
  background: #21262d !important;
  color: #e6edf3 !important;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.a11y-assist-panel button[aria-pressed="true"] {
  background: rgba(56, 139, 253, 0.18) !important;
  border-color: #58a6ff !important;
  color: #58a6ff !important;
  font-weight: 700;
}

.a11y-assist-panel button:focus-visible {
  outline: 2px solid #58a6ff;
  outline-offset: 1px;
}

.a11y-assist-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid #30363d;
}

.a11y-assist-reset {
  background: rgba(248, 81, 73, 0.12) !important;
  border-color: rgba(248, 81, 73, 0.45) !important;
  color: #f85149 !important;
}

.a11y-assist-statement {
  color: #58a6ff !important;
  font-weight: 600;
  font-size: 0.84rem;
}

.a11y-assist-statement:hover,
.a11y-assist-statement:focus-visible {
  text-decoration: underline;
  color: #79b8ff !important;
}

.a11y-assist-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ===== Seiten-Modi (ohne Widget) ===== */

html.a11y-text-scaled {
  font-size: calc(100% * var(--a11y-text-scale, 1));
}

html.a11y-readable-font body,
html.a11y-readable-font button,
html.a11y-readable-font input,
html.a11y-readable-font select,
html.a11y-readable-font textarea {
  font-family: Arial, Verdana, "Segoe UI", sans-serif !important;
  letter-spacing: 0.02em;
}

html.a11y-underline-links a {
  text-decoration: underline !important;
  text-underline-offset: 0.15em;
}

html.a11y-big-cursor,
html.a11y-big-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 fill='%23000' stroke='%23fff' stroke-width='1.2' d='M4 3l8 17 2-7 7-2z'/%3E%3C/svg%3E") 4 4, auto !important;
}

html.a11y-big-cursor .a11y-assist,
html.a11y-big-cursor .a11y-assist * {
  cursor: pointer !important;
}

html.a11y-highlight-focus *:focus {
  outline: 3px solid #ffbf00 !important;
  outline-offset: 3px !important;
}

html.a11y-spacing body {
  line-height: 1.75 !important;
  letter-spacing: 0.03em;
  word-spacing: 0.08em;
}

html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

html.a11y-hide-images img,
html.a11y-hide-images picture,
html.a11y-hide-images video,
html.a11y-hide-images svg:not(.a11y-assist svg) {
  opacity: 0 !important;
  visibility: hidden !important;
}

html.a11y-grayscale body {
  filter: grayscale(1);
}

html.a11y-protanopia body {
  filter: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='p'%3E%3CfeColorMatrix type='matrix' values='0.567 0.433 0 0 0 0.558 0.442 0 0 0 0 0.242 0.758 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3C/svg%3E#p");
}

html.a11y-blue-filter body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1400;
  background: rgba(255, 180, 60, 0.18);
  mix-blend-mode: multiply;
}

html[data-a11y-contrast="high"] body {
  filter: contrast(1.25);
  background: #000 !important;
  color: #fff !important;
}

html[data-a11y-contrast="high"] body a {
  color: #ffe14d !important;
}

html[data-a11y-contrast="invert"] body {
  filter: invert(1) hue-rotate(180deg);
}

html[data-a11y-contrast="invert"] body img,
html[data-a11y-contrast="invert"] body video,
html[data-a11y-contrast="invert"] body picture {
  filter: invert(1) hue-rotate(180deg);
}

html[data-a11y-contrast="dark"] body {
  background: #0b1220 !important;
  color: #e5eefc !important;
}

html[data-a11y-contrast="dark"] body a {
  color: #93c5fd !important;
}

@media (max-width: 640px) {
  .a11y-assist-toggle-label { display: none; }
  .a11y-assist-toggle { border-radius: 999px; padding: 12px; }
}
