/* Barrierefreiheit: Einstellungen werden von a11y.js als data-Attribute auf <html> gesetzt. */

/* Schriftgröße (alle Maße der Seite sind in rem angegeben) */
html[data-fs="1"] { font-size: 115%; }
html[data-fs="2"] { font-size: 130%; }
html[data-fs="3"] { font-size: 150%; }

/* Bei großer Schrift passt die Desktop-Navigation nicht mehr in eine Zeile */
html[data-fs="2"] ul.nav-links, html[data-fs="3"] ul.nav-links,
html[data-fs="2"] .nav-cta, html[data-fs="3"] .nav-cta { display: none !important; }
html[data-fs="2"] .menu-toggle, html[data-fs="3"] .menu-toggle { display: inline-flex !important; }
@media (max-width: 1100px) {
  html[data-fs="1"] ul.nav-links, html[data-fs="1"] .nav-cta { display: none !important; }
  html[data-fs="1"] .menu-toggle { display: inline-flex !important; }
}

/* Dunkelmodus */
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121712; --paper-2: #1a211b; --ink: #e9eee5; --ink-soft: #c3ccbf;
  --muted: #9ea896; --signal: #5cc98d; --signal-dark: #7fd9a5; --border: #2f3a30; --line: #3a463b;
}
html[data-theme="dark"] .highlight { background: #1f2b22; border-color: var(--signal); color: #f1f4ee; }
html[data-theme="dark"] .highlight .btn-outline { border-color: #f1f4ee; color: #f1f4ee; }
html[data-theme="dark"] .highlight .btn-outline:hover { background: #f1f4ee; color: #10160f; }
html[data-theme="dark"] .callout { background: #1a2a20; }

/* Hoher Kontrast */
html[data-contrast="1"] {
  --ink: #000000; --ink-soft: #000000; --muted: #1f1f1f;
  --signal: #0d5a34; --signal-dark: #0a4527; --border: #000000; --line: #000000;
}
html[data-contrast="1"][data-theme="dark"] {
  --paper: #000000; --paper-2: #0d0d0d; --ink: #ffffff; --ink-soft: #ffffff; --muted: #e6e6e6;
  --signal: #8ff0b8; --signal-dark: #a8f5c8; --border: #ffffff; --line: #ffffff;
}
html[data-contrast="1"][data-theme="dark"] .highlight { background: #000000; color: #ffffff; }
html[data-contrast="1"] .highlight * { color: inherit !important; }

/* Links unterstreichen */
html[data-links="1"] a:not(.btn):not(.logo-link):not(.a11y-skip) {
  text-decoration: underline !important; text-underline-offset: 3px; text-decoration-thickness: 2px;
}

/* Lesefreundliche Schrift und größere Abstände */
html[data-readable="1"] body, html[data-readable="1"] body * {
  font-family: 'Atkinson Hyperlegible', Verdana, Tahoma, sans-serif !important;
  font-style: normal !important;
}
html[data-readable="1"] body p, html[data-readable="1"] body li, html[data-readable="1"] body dd,
html[data-readable="1"] body summary, html[data-readable="1"] body label {
  line-height: 1.85 !important; letter-spacing: 0.03em !important; word-spacing: 0.1em;
}
html[data-readable="1"] h1, html[data-readable="1"] h2, html[data-readable="1"] h3 {
  line-height: 1.3 !important; letter-spacing: 0 !important;
}

/* Animationen reduzieren */
html[data-motion="reduce"], html[data-motion="reduce"] * {
  animation: none !important; transition: none !important; scroll-behavior: auto !important;
}

/* Gut sichtbarer Tastaturfokus */
:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }

/* Sprunglink */
.a11y-skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 200;
  background: var(--ink); color: var(--paper); padding: 0.75rem 1.25rem; border-radius: 6px;
  font-weight: 600; text-decoration: none;
}
.a11y-skip:focus { top: 1rem; }

/* Schaltfläche und Panel */
.a11y-fab {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 120;
  width: 3.25rem; height: 3.25rem; border-radius: 50%; border: none; cursor: pointer;
  background: var(--signal-dark); color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.a11y-fab:hover { background: var(--signal); }
.a11y-fab svg { width: 1.6rem; height: 1.6rem; }

.a11y-panel {
  position: fixed; right: 1.25rem; bottom: 5.25rem; z-index: 121;
  width: min(22rem, calc(100vw - 2.5rem)); max-height: calc(100vh - 7rem); overflow-y: auto;
  background: var(--paper); color: var(--ink); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18); padding: 1.25rem 1.25rem 1rem;
  font-family: 'Source Sans 3', system-ui, sans-serif; font-size: 1rem;
}
.a11y-panel[hidden] { display: none; }
.a11y-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.a11y-head h2 { font-size: 1.2rem; font-weight: 700; margin: 0; font-family: inherit; }
.a11y-close {
  width: 2.25rem; height: 2.25rem; border: 1px solid var(--border); border-radius: 6px;
  background: none; color: var(--ink); cursor: pointer; font-size: 1.3rem; line-height: 1;
}
.a11y-group { border: none; margin: 0 0 1.1rem; padding: 0; }
.a11y-group legend, .a11y-label { font-weight: 600; margin-bottom: 0.5rem; padding: 0; display: block; }

.a11y-size { display: flex; align-items: center; gap: 0.5rem; }
.a11y-size button {
  min-width: 2.75rem; height: 2.5rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--paper-2); color: var(--ink); font-weight: 700; font-size: 1rem; cursor: pointer;
}
.a11y-size button:disabled { opacity: 0.4; cursor: default; }
.a11y-size output { flex: 1; text-align: center; font-weight: 600; }

.a11y-seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.a11y-seg label { flex: 1; position: relative; }
.a11y-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.a11y-seg span {
  display: block; text-align: center; padding: 0.55rem 0.25rem; font-size: 0.95rem;
  border-right: 1px solid var(--border); cursor: pointer;
}
.a11y-seg label:last-child span { border-right: none; }
.a11y-seg input:checked + span { background: var(--ink); color: var(--paper); font-weight: 600; }
.a11y-seg input:focus-visible + span { outline: 3px solid var(--signal); outline-offset: -3px; }

.a11y-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.65rem 0; border-top: 1px solid var(--border); cursor: pointer;
}
.a11y-switch input {
  appearance: none; -webkit-appearance: none; flex-shrink: 0; margin: 0; cursor: pointer;
  width: 2.75rem; height: 1.6rem; border-radius: 999px; background: var(--line); position: relative;
}
.a11y-switch input::after {
  content: ''; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.2rem; height: 1.2rem;
  border-radius: 50%; background: #fff; transition: transform 0.15s;
}
.a11y-switch input:checked { background: var(--signal-dark); }
.a11y-switch input:checked::after { transform: translateX(1.15rem); }

.a11y-reset {
  width: 100%; margin-top: 0.75rem; height: 2.6rem; border: 1px solid var(--ink); border-radius: 6px;
  background: none; color: var(--ink); font-weight: 600; font-size: 0.95rem; cursor: pointer;
}
.a11y-reset:hover { background: var(--ink); color: var(--paper); }

@media print { .a11y-fab, .a11y-panel, .a11y-skip { display: none !important; } }