/* ============================================================================
   a11y.css — Werkzeug „Anzeige anpassen“ (W4, Bauvorlage doku/A11Y-WIDGET.md)
   Wird NACH main.css geladen. Aufbau:
     (1) Ebenen und Faktoren   (2) Knopf   (3) Panel   (4) Werkzeug-Regeln
     (5) Kollisionen, Bewegung, Druck, Kontrastmodus des Systems
   Grundsatz: Ohne a11y-*-Klasse auf <html> ändert diese Datei an der Seite
   nichts (A-2 „strikt 1:1“). Panel-Maße sind feste px-Werte und skalieren nicht.
   ========================================================================== */

/* ====== (1) EBENEN UND FAKTOREN ========================================== */
:root {
  --z-a11y-filter: 10000;
  --z-a11y-maske:  10001;
  --z-a11y-knopf:  10002;
  --z-a11y-panel:  10003;
  --a11y-maske-h:  140px;
  /* Panel-Schriften fest (nicht var(--font), sonst wirkt „Lesbare Schrift“ hinein) */
  --a11y-font:      "Futura LT Pro", Arial, Helvetica, sans-serif;
  --a11y-font-cond: "Futura LT Pro Cond", "Futura LT Pro", Arial, sans-serif;
}

html.a11y-schrift-1 { --a11y-s: 1.2; }
html.a11y-schrift-2 { --a11y-s: 1.4; }
html.a11y-schrift-3 { --a11y-s: 1.6; }
html.a11y-zeilen-1  { --a11y-z: 1.2; }
html.a11y-zeilen-2  { --a11y-z: 1.4; }
html.a11y-zeilen-3  { --a11y-z: 1.6; }

/* ====== (2) KNOPF ======================================================== */
.a11y-knopf {
  position: fixed;
  right: 24px;
  top: var(--a11y-knopf-top, 50%);
  z-index: var(--z-a11y-knopf);
  width: 44px; height: 44px; padding: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: #000000; color: #FFFFFF;
  box-shadow: inset 0 0 0 7px #000000, inset 0 0 0 8.5px #FFFFFF;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease, transform .1s ease;
}
.a11y-icon { width: 18px; height: 18px; display: block; }
.a11y-knopf:hover,
.a11y-knopf[aria-expanded="true"] {
  background: #2A2F31; color: #D1CC7D;
  box-shadow: inset 0 0 0 7px #2A2F31, inset 0 0 0 8.5px #D1CC7D;
}
.a11y-knopf:active {
  background: #000000; color: #D1CC7D;
  box-shadow: inset 0 0 0 7px #000000, inset 0 0 0 8.5px #D1CC7D;
  transform: scale(.96);
}
.a11y-knopf:focus { outline: none; }
.a11y-knopf:focus-visible {
  outline: 3px solid #FFFFFF; outline-offset: 2px;
  box-shadow: inset 0 0 0 7px #000000, inset 0 0 0 8.5px #FFFFFF, 0 0 0 7px #2A2F31;
}
.a11y-knopf:hover:focus-visible,
.a11y-knopf[aria-expanded="true"]:focus-visible {
  box-shadow: inset 0 0 0 7px #2A2F31, inset 0 0 0 8.5px #D1CC7D, 0 0 0 7px #2A2F31;
}
.a11y-knopf__punkt {
  position: absolute; top: -2px; right: -2px;
  display: block; width: 12px; height: 12px;
  border-radius: 50%; background: #D1CC7D; border: 2px solid #FFFFFF;
}
.a11y-knopf__punkt[hidden] { display: none; }

/* ====== (3) PANEL ======================================================== */
.a11y-panel {
  position: fixed;
  right: 80px; top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-a11y-panel);
  width: 420px; max-width: calc(100vw - 96px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  overflow: hidden;
  background: #FFFFFF; color: #1E1C1C;
  border-radius: var(--radius-banner, 12px);
  box-shadow: var(--schatten-banner, 0 10px 20px 0 rgba(0,0,0,.19), 0 6px 6px 0 rgba(0,0,0,.23));
  font-family: var(--a11y-font-cond); font-weight: 400;
  font-size: 15px; line-height: 20px; letter-spacing: normal; word-spacing: normal;
  text-align: left;
  animation: a11y-ein-seite .2s ease-out;
}
.a11y-panel[hidden] { display: none; }
@keyframes a11y-ein-seite { from { opacity: 0; transform: translate(8px, -50%); } to { opacity: 1; transform: translate(0, -50%); } }
@keyframes a11y-ein-unten { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.a11y-panel__kopf {
  flex: 0 0 auto;
  height: 56px; padding: 0 8px 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: linear-gradient(140deg, #2B2B2B, #000000);
}
.a11y-panel__titel {
  margin: 0;
  font-family: var(--a11y-font-cond); font-weight: 500;
  font-size: 18px; line-height: 24px; letter-spacing: 1.6px;
  color: #FFFFFF;
}
.a11y-panel__titel:focus { outline: none; }
.a11y-panel__zu {
  flex: 0 0 auto;
  width: 44px; height: 44px; padding: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: #FFFFFF; cursor: pointer;
}
.a11y-panel__zu svg { width: 18px; height: 18px; display: block; }
.a11y-panel__zu:hover { color: #D1CC7D; }
.a11y-panel__zu:focus { outline: none; }
.a11y-panel__zu:focus-visible { outline: 3px solid #FFFFFF; outline-offset: -6px; }

.a11y-panel__inhalt {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding-bottom: 16px;
}
.a11y-panel__intro {
  margin: 16px 20px 4px;
  font-family: var(--a11y-font); font-weight: 400;
  font-size: 13px; line-height: 18px; color: #555555;
}
.a11y-gruppe {
  margin: 16px 20px 8px;
  font-family: var(--a11y-font-cond); font-weight: 500;
  font-size: 13px; line-height: 16px; letter-spacing: 1.6px;
  text-transform: uppercase; color: #54595F;
}
.a11y-raster {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 0; padding: 0 20px; list-style: none;
}
.a11y-raster > li { display: flex; }

.a11y-kachel {
  position: relative;
  width: 100%; min-height: 88px; margin: 0;
  padding: 12px 6px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px;
  background: #F6F6F6; color: #2A2F31;
  border: 1px solid #8A8F93; border-radius: 6px;
  font-family: var(--a11y-font-cond); font-weight: 500;
  font-size: 14px; line-height: 17px; letter-spacing: normal;
  text-align: center; hyphens: manual; overflow-wrap: break-word;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.a11y-kachel__icon { width: 24px; height: 24px; flex: 0 0 auto; display: block; }
.a11y-kachel__name { display: block; }
.a11y-kachel:hover { background: #ECECEC; border-color: #2A2F31; color: #2A2F31; }
.a11y-kachel[aria-pressed="true"] { background: #D1CC7D; border-color: #2A2F31; color: #2A2F31; }
.a11y-kachel[aria-pressed="true"]:hover { background: #C2BC66; color: #2A2F31; }
.a11y-kachel:focus { outline: none; }
.a11y-kachel:focus-visible { outline: 3px solid #2A2F31; outline-offset: 2px; }

.a11y-kachel__stufen { display: flex; gap: 3px; margin-top: auto; }
.a11y-kachel__stufen i { display: block; width: 14px; height: 4px; border-radius: 2px; background: #C4C7C9; }
.a11y-kachel[data-stufe="1"] .a11y-kachel__stufen i:nth-child(-n+1),
.a11y-kachel[data-stufe="2"] .a11y-kachel__stufen i:nth-child(-n+2),
.a11y-kachel[data-stufe="3"] .a11y-kachel__stufen i:nth-child(-n+3) { background: #2A2F31; }

.a11y-kachel__haken {
  position: absolute; top: 6px; right: 6px;
  display: none; width: 18px; height: 18px;
  align-items: center; justify-content: center;
  border-radius: 50%; background: #2A2F31; color: #FFFFFF;
}
.a11y-kachel[aria-pressed="true"] .a11y-kachel__haken { display: flex; }
.a11y-kachel__haken-icon { width: 12px; height: 12px; display: block; }

.a11y-panel__fuss {
  flex: 0 0 auto;
  padding: 16px 20px;
  border-top: 1px solid #ECECEC;
}
.a11y-reset {
  width: 100%; min-height: 44px; margin: 0; padding: 8px 12px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #F6F6F6; color: #222222;
  border: 1px solid #8A8F93; border-radius: 6px;
  font-family: var(--a11y-font-cond); font-weight: 500;
  font-size: 15px; line-height: 20px; letter-spacing: normal;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.a11y-reset__icon { width: 18px; height: 18px; flex: 0 0 auto; display: block; }
.a11y-reset:hover { background: #ECECEC; border-color: #2A2F31; }
.a11y-reset:focus { outline: none; }
.a11y-reset:focus-visible { outline: 3px solid #2A2F31; outline-offset: 2px; }

/* Seitenstruktur-Ansicht */
.a11y-ansicht[hidden] { display: none; }
.a11y-zurueck {
  display: flex; align-items: center; gap: 8px;
  width: calc(100% - 40px); min-height: 44px; margin: 12px 20px 0; padding: 0 8px;
  background: transparent; color: #2A2F31;
  border: 1px solid #8A8F93; border-radius: 6px;
  font-family: var(--a11y-font-cond); font-weight: 500;
  font-size: 15px; line-height: 20px; text-align: left;
  cursor: pointer;
}
.a11y-zurueck__icon { width: 18px; height: 18px; flex: 0 0 auto; display: block; }
.a11y-zurueck:hover { background: #F6F6F6; border-color: #2A2F31; }
.a11y-zurueck:focus { outline: none; }
.a11y-zurueck:focus-visible { outline: 3px solid #2A2F31; outline-offset: 2px; }
.a11y-struktur__titel {
  margin: 16px 20px 0;
  font-family: var(--a11y-font-cond); font-weight: 500;
  font-size: 18px; line-height: 24px; color: #1E1C1C;
}
.a11y-struktur h4.a11y-gruppe { margin-top: 12px; }
.a11y-liste { margin: 0; padding: 0; list-style: none; }
.a11y-liste__leer { padding: 6px 20px; font-family: var(--a11y-font); font-size: 15px; line-height: 20px; color: #555555; }
.a11y-sprung {
  display: flex; align-items: baseline; gap: 8px;
  width: 100%; min-height: 36px; margin: 0; padding: 8px 20px;
  background: transparent; color: #1E1C1C; border: 0;
  font-family: var(--a11y-font); font-weight: 400;
  font-size: 15px; line-height: 20px; text-align: left;
  cursor: pointer;
}
.a11y-sprung--e2 { padding-left: 32px; }
.a11y-sprung--e3 { padding-left: 44px; }
.a11y-sprung:hover { background: #F6F6F6; }
.a11y-sprung:focus { outline: none; }
.a11y-sprung:focus-visible { outline: 3px solid #2A2F31; outline-offset: -3px; }
.a11y-sprung__kuerzel {
  flex: 0 0 auto;
  font-family: var(--a11y-font-cond); font-weight: 500;
  font-size: 12px; line-height: 16px; color: #54595F;
}
[data-a11y-ziel] { scroll-margin-top: calc(var(--kopf-h-sticky, 88px) + 16px); }

/* Mobil: Bodenblatt über volle Breite */
@media (max-width: 767px) {
  :root { --a11y-maske-h: 100px; }
  .a11y-panel {
    left: 0; right: 0; bottom: 0; top: auto;
    transform: none;
    width: 100%; max-width: none;
    max-height: 85vh; max-height: 85dvh;
    border-radius: var(--radius-banner, 12px) var(--radius-banner, 12px) 0 0;
    animation-name: a11y-ein-unten;
  }
}
/* Sehr niedrige Fenster (z. B. 360×225 oder Zoom 400 %): ganzes Panel scrollt,
   sonst bliebe zwischen festem Kopf und Fuß kaum Inhalt sichtbar (Nora W6). */
@media (max-height: 420px) {
  .a11y-panel { overflow-y: auto; overscroll-behavior: contain; }
  .a11y-panel__inhalt { flex: 0 0 auto; overflow: visible; }
}
@media (max-width: 359px) {
  .a11y-raster { grid-template-columns: repeat(2, 1fr); }
}

/* ====== (4) WERKZEUG-REGELN ============================================= */

/* 4.1 Größere Schrift: Faktor oben; Schutz gegen waagrechtes Scrollen */
html[class*="a11y-schrift-"] :is(main, .fuss, .consent) { overflow-wrap: break-word; hyphens: auto; }
html[class*="a11y-schrift-"] .subnav { width: max-content; min-width: 130px; max-width: calc(100vw - 32px); height: auto; }
/* Skip-Link wird mit großer Schrift höher als sein Versteck (top:-60px) */
html[class*="a11y-schrift-"] .skip-link:not(:focus) { top: -300px; }
html[class*="a11y-schrift-"] .consent__knoepfe { flex-wrap: wrap; }
/* W6-M2: offenes Mobilmenü hängt bei großer Schrift nur an der Fensterhöhe (nicht an 520px) */
@media (max-width: 1024px) {
  html[class*="a11y-schrift-"] .kopf.is-menue-offen .hauptnav {
    max-height: calc(100vh - var(--kopf-h) - 20px);
    max-height: calc(100dvh - var(--kopf-h) - 20px);
  }
}
html[class*="a11y-schrift-"] .consent__knopf { white-space: normal; height: auto; }
/* Banner scrollbar; zusätzlich Platz für den Widget-Knopf zwischen Kopf und Banner
   lassen (5.2: Knopf mind. 10px über dem Banner), sonst läge er auf dessen X. */
html[class*="a11y-schrift-"] .consent {
  max-height: calc(100vh - var(--kopf-h, 100px) - 74px);
  max-height: calc(100dvh - var(--kopf-h, 100px) - 74px);
  overflow-y: auto;
}

/* 4.2 Zeilenabstand: zusätzlich Absatzabstand */
html[class*="a11y-zeilen-"] main p:not(.hero__titel, .loc__titel) { margin-bottom: calc(1em * var(--a11y-z)); }

/* 4.3 Textausrichtung: nur Textelemente im Inhalt */
html.a11y-ausrichtung-links  main :is(p, li, h1, h2, h3, h4, h5, h6, address, blockquote, dt, dd, td, th, label, figcaption):not(.hero__titel, .loc__titel) { text-align: left !important; }
html.a11y-ausrichtung-mitte  main :is(p, li, h1, h2, h3, h4, h5, h6, address, blockquote, dt, dd, td, th, label, figcaption):not(.hero__titel, .loc__titel) { text-align: center !important; }
html.a11y-ausrichtung-rechts main :is(p, li, h1, h2, h3, h4, h5, h6, address, blockquote, dt, dd, td, th, label, figcaption):not(.hero__titel, .loc__titel) { text-align: right !important; }

/* 4.4 Lesbare Schrift: Systemschrift, Light (300) wird 400 */
html.a11y-lesbar {
  --font:      system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-cond: var(--font);
}
html.a11y-lesbar body { letter-spacing: .01em; word-spacing: .06em; }
html.a11y-lesbar :where(body, main, .fuss, .kopf) { font-weight: 400; }
/* Gegenregeln zu allen font-weight:300-Regeln in main.css (ohne Anzeigetitel) */
html.a11y-lesbar body,
html.a11y-lesbar .fuss__copy,
html.a11y-lesbar .fuss__link,
html.a11y-lesbar .start-intro p,
html.a11y-lesbar .abschnitt-kopf__titel,
html.a11y-lesbar .teaser__titel,
html.a11y-lesbar .teaser__auszug,
html.a11y-lesbar .filter__btn,
html.a11y-lesbar .projekt__text p,
html.a11y-lesbar .projekt-nav__titel,
html.a11y-lesbar .kontakt__adresse,
html.a11y-lesbar .kontakt__intro,
html.a11y-lesbar .kontaktform__hinweis,
html.a11y-lesbar .inhalt .fliesstext p,
html.a11y-lesbar .akkordeon__panel-inner > div,
html.a11y-lesbar .loc__haupt,
html.a11y-lesbar .team__spaxi-text,
html.a11y-lesbar .kunden__titel { font-weight: 400; }
/* Ausnahmen: Anzeigetitel behalten Futura (breitere Systemschrift liefe über) */
html.a11y-lesbar :is(.hero__titel, .loc__titel) {
  font-family: "Futura LT Pro Cond", "Futura LT Pro", Arial, sans-serif;
}

/* 4.5 Graustufen: eigene Schicht statt filter auf Vorfahren */
html.a11y-graustufen body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  z-index: var(--z-a11y-filter);
  -webkit-backdrop-filter: grayscale(1);
  backdrop-filter: grayscale(1);
}

/* 4.6 Kontrast */
html.a11y-kontrast-hell body :not(.a11y, .a11y *, img, picture, video, svg, svg *, .a11y-maske__oben, .a11y-maske__unten) {
  color: #000000 !important; background-color: #FFFFFF !important;
  background-image: none !important; border-color: #000000 !important;
  text-shadow: none !important;
}
html.a11y-kontrast-hell body { background: #FFFFFF !important; }
html.a11y-kontrast-hell a[href]:not(.a11y *) { text-decoration: underline 2px !important; text-underline-offset: 3px; }
html.a11y-kontrast-hell :focus-visible { outline-color: #000000 !important; }

html.a11y-kontrast-dunkel body :not(.a11y, .a11y *, img, picture, video, svg, svg *, .a11y-maske__oben, .a11y-maske__unten) {
  color: #FFFFFF !important; background-color: #000000 !important;
  background-image: none !important; border-color: #FFFFFF !important;
  text-shadow: none !important;
}
html.a11y-kontrast-dunkel a[href]:not(.a11y *) { color: #D1CC7D !important; text-decoration: underline 2px !important; text-underline-offset: 3px; }
html.a11y-kontrast-dunkel :focus-visible { outline-color: #D1CC7D !important; }
html.a11y-kontrast-dunkel body { background: #000000 !important; }
html[class*="a11y-kontrast-"] body :is(button, input, select, textarea):not(.a11y *) { border: 2px solid currentColor !important; }
html.a11y-kontrast-dunkel .consent { border: 2px solid #FFFFFF !important; }

/* 4.8 Lesemaske */
.a11y-maske__oben,
.a11y-maske__unten {
  position: fixed; left: 0; right: 0;
  background: rgba(0, 0, 0, .6);
  pointer-events: none;
  z-index: var(--z-a11y-maske);
}
.a11y-maske__oben  { top: 0; height: max(0px, calc(var(--a11y-maske-y, 50vh) - var(--a11y-maske-h) / 2)); }
.a11y-maske__unten { top: calc(var(--a11y-maske-y, 50vh) + var(--a11y-maske-h) / 2); bottom: 0; }

/* 4.9 Bilder ausblenden (Logo bleibt) */
html.a11y-bilder-aus :is(img, picture, video, svg[role="img"]):not(.kopf__logo img, .a11y *) { visibility: hidden !important; }
html.a11y-bilder-aus .projektkarte__overlay { opacity: 1 !important; }
html.a11y-bilder-aus .projektkarte__titel { color: #2A2F31 !important; text-shadow: none; }

/* 4.10 Animationen anhalten (gilt auch für das Widget) */
html.a11y-animationen-aus *,
html.a11y-animationen-aus *::before,
html.a11y-animationen-aus *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important;
  transition-duration: .01ms !important; scroll-behavior: auto !important;
}
html.a11y-animationen-aus { scroll-behavior: auto !important; }
html.a11y-animationen-aus .a11y-panel { animation: none; }
html.a11y-animationen-aus .a11y-knopf:active { transform: none; }

/* 4.11 Links hervorheben */
html.a11y-links a[href]:not(.a11y *, .skip-link) {
  text-decoration: underline 2px !important; text-underline-offset: 3px !important;
  outline: 2px dashed currentColor !important; outline-offset: 2px;
}
html.a11y-links a[href]:not(.a11y *):focus-visible { outline-style: solid !important; outline-width: 3px !important; }

/* 4.12 Fokus hervorheben (bewusst :focus, auch nach Mausklick). „body“ im Selektor
   hebt die Spezifität über 4.11, damit der Fokusring auch auf Links gewinnt. */
html.a11y-fokus body :focus:not([tabindex="-1"]) {
  outline: 4px solid #2A2F31 !important; outline-offset: 4px !important;
  box-shadow: 0 0 0 4px #FFFFFF !important;
}
html.a11y-fokus body :is(.kopf, .fuss, .hero, .lightbox) :focus:not([tabindex="-1"]),
html.a11y-fokus .nach-oben:focus,
html.a11y-fokus .a11y-knopf:focus { outline-color: #D1CC7D !important; box-shadow: 0 0 0 4px #000000 !important; }
/* Zusammen mit „Links hervorheben“: der Fokusring (4px, durchgezogen) hat Vorrang */
html.a11y-fokus body a[href]:not(.a11y *):focus:not([tabindex="-1"]) { outline-width: 4px !important; outline-style: solid !important; }

/* ====== (5) KOLLISIONEN, BEWEGUNG, DRUCK, SYSTEM-KONTRAST ================ */
/* Lightbox offen: Widget weg (ihr rechter Pfeil sitzt genau an der Knopf-Lage) */
html:has(.lightbox.is-offen) .a11y { display: none; }

@media (prefers-reduced-motion: reduce) {
  .a11y-knopf, .a11y-kachel, .a11y-reset { transition: none; }
  .a11y-knopf:active { transform: none; }
  .a11y-panel { animation: none; }
}

@media print {
  .a11y, .a11y-maske__oben, .a11y-maske__unten { display: none !important; }
  html.a11y-graustufen body::after { display: none; }
}

@media (forced-colors: active) {
  .a11y-knopf { border: 2px solid ButtonText; color: ButtonText; }
  .a11y-kachel[aria-pressed="true"] { border: 3px solid Highlight; }
}
