/* =============================================================
   UI-Tools: Back-to-Top + Barrierefreiheit-Widget
   Global auf allen Seiten geladen (via header.php)
   ============================================================= */

/* ---------- Back-to-Top ---------- */
.back-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 999;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #80002A;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .25s ease, transform .25s ease, background .18s ease, box-shadow .18s ease;
  pointer-events: none;
  padding: 0;
}
.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top svg { width: 20px; height: 20px; fill: #fff; }
.back-to-top:hover, .back-to-top:focus-visible {
  background: #4c0521;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.30);
  outline: none;
}

/* ---------- Barrierefreiheit-Toggle (links, mittig) ---------- */
.a11y-toggle {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 999;
  width: 44px;
  height: 52px;
  padding: 0;
  border: none;
  background: #80002A;
  color: #fff;
  border-radius: 0 10px 10px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
  transition: background .18s ease, transform .18s ease;
}
.a11y-toggle:hover, .a11y-toggle:focus-visible {
  background: #4c0521;
  outline: none;
  transform: translateY(-50%) translateX(2px);
}
.a11y-toggle svg { width: 26px; height: 26px; fill: currentColor; }

/* ---------- Barrierefreiheit-Panel ---------- */
.a11y-panel {
  position: fixed;
  left: 44px;
  top: 50%;
  transform: translateY(-50%) translateX(-110%);
  z-index: 998;
  width: 300px;
  max-width: calc(100vw - 60px);
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-left: none;
  border-radius: 0 10px 10px 0;
  padding: 20px 22px;
  box-shadow: 4px 4px 16px rgba(0, 0, 0, 0.18);
  transition: transform .3s ease;
  font-family: inherit;
}
.a11y-panel.is-open { transform: translateY(-50%) translateX(0); }
.a11y-panel h3 {
  margin: 0 0 6px;
  font-size: 17px;
  color: #333;
}
.a11y-panel > p {
  margin: 0 0 16px;
  font-size: 12px;
  color: #666;
  line-height: 1.5;
}
.a11y-group { margin-bottom: 14px; }
.a11y-label {
  font-size: 12px;
  font-weight: 700;
  color: #555;
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.a11y-buttons {
  display: flex;
  gap: 6px;
}
.a11y-buttons button {
  flex: 1;
  padding: 10px 0;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease, border-color .15s ease;
}
.a11y-buttons button:hover { background: #ececec; border-color: #80002A; }
.a11y-panel button[data-toggle] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 6px;
  background: #f5f5f5;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 13.5px;
  color: #333;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background .15s ease, border-color .15s ease;
}
.a11y-panel button[data-toggle]:hover { border-color: #80002A; }
.a11y-panel button[data-toggle].is-active {
  background: #80002A;
  color: #fff;
}
.a11y-panel button[data-toggle]::after {
  content: "aus";
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(0, 0, 0, .08);
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .04em;
}
.a11y-panel button[data-toggle].is-active::after {
  content: "AN";
  background: rgba(255, 255, 255, .22);
  color: #fff;
}
.a11y-panel .a11y-reset {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: #80002A;
  border: 1px solid #80002A;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: background .15s ease, color .15s ease;
}
.a11y-panel .a11y-reset:hover { background: #80002A; color: #fff; }

/* =============================================================
   NAV-BADGE (kleine „Neu"-Kennzeichnung im Dropdown)
   ============================================================= */
.nav-badge {
  display: inline-block;
  background: #631832;
  color: #F6EDF0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
  line-height: 1.2;
}

/* =============================================================
   POPUP — Transparenzpflicht-Kampagne (bis 2.8.2026)
   Best-Practice 2026: Bottom-right Slide-in, nicht störend,
   dismissible, Frequency-Cap, Focus-Trap, ESC schließt.
   ============================================================= */
.tp-popup {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 997;               /* unter A11y (999) und Back-to-Top (999) */
  width: 360px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 12px;
  box-shadow:
    0 4px 12px rgba(31, 26, 36, 0.08),
    0 20px 44px rgba(77, 14, 37, 0.18),
    0 0 0 1px rgba(77, 14, 37, 0.06);
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px) scale(.96);
  pointer-events: none;
  transition:
    opacity .35s ease,
    transform .45s cubic-bezier(.2, .8, .2, 1);
  font-family: inherit;
}
.tp-popup.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.tp-popup__head {
  background: linear-gradient(135deg, #4D0E25 0%, #631832 100%);
  color: #F6EDF0;
  padding: 16px 44px 16px 20px;
  position: relative;
}
.tp-popup__eyebrow {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .85;
  margin-bottom: 4px;
}
.tp-popup__countdown {
  font-family: var(--font-deco, 'Roboto Condensed', sans-serif);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}
.tp-popup__countdown small {
  font-size: 12px;
  font-weight: 400;
  opacity: .75;
  display: block;
  margin-top: 3px;
  letter-spacing: .04em;
}
.tp-popup__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.14);
  color: #F6EDF0;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s ease;
}
.tp-popup__close:hover,
.tp-popup__close:focus-visible {
  background: rgba(255,255,255,.28);
  outline: none;
}

.tp-popup__body {
  padding: 18px 20px 20px;
}
.tp-popup__title {
  font-size: 16px;
  font-weight: 700;
  color: #231A24;
  margin: 0 0 6px;
  line-height: 1.3;
}
.tp-popup__text {
  font-size: 13.5px;
  line-height: 1.5;
  color: #4B4452;
  margin: 0 0 14px;
}
.tp-popup__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tp-popup__cta {
  flex: 1;
  background: #631832;
  color: #fff;
  text-decoration: none;
  text-align: center;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 700;
  transition: background .15s ease, transform .1s ease;
}
.tp-popup__cta:hover,
.tp-popup__cta:focus-visible {
  background: #4D0E25;
  color: #fff;
  outline: none;
  transform: translateY(-1px);
}
.tp-popup__dismiss {
  background: transparent;
  border: none;
  color: #6F6A75;
  font-size: 12px;
  cursor: pointer;
  padding: 8px 6px;
  font-family: inherit;
  text-decoration: underline;
}
.tp-popup__dismiss:hover { color: #231A24; }

/* Mobile: von unten, volle Breite bis 32 px Rand */
@media (max-width: 640px) {
  .tp-popup {
    right: 16px;
    left: 16px;
    bottom: 16px;
    width: auto;
    max-width: none;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tp-popup {
    transition: opacity .2s ease;
    transform: none;
  }
  .tp-popup.is-visible { transform: none; }
}

/* ---------- Angewandte Klassen (auf <body>) ----------
   WICHTIG: `filter` erzeugt einen Containing-Block für alle position:fixed
   Kinder — sie würden dadurch scrollen. Deshalb wird der Kontrast-Filter
   NICHT auf body angewandt, sondern nur auf main + gerahmte Layout-Bereiche.
   So bleiben Back-to-Top-Button und A11y-Widget weiterhin viewport-fixiert. */
body.a11y-high-contrast main,
body.a11y-high-contrast > header,
body.a11y-high-contrast > footer,
body.a11y-high-contrast > .authority-bar,
body.a11y-high-contrast > .funding-ticker,
body.a11y-high-contrast > .funding-teaser,
body.a11y-high-contrast > .qualifications,
body.a11y-high-contrast > .einsatzgebiete-section {
  filter: contrast(1.35) saturate(1.1);
}
body.a11y-wide-spacing,
body.a11y-wide-spacing p,
body.a11y-wide-spacing li {
  line-height: 1.9 !important;
  letter-spacing: .03em !important;
}
body.a11y-no-motion *,
body.a11y-no-motion *::before,
body.a11y-no-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
body.a11y-focus-boost *:focus,
body.a11y-focus-boost *:focus-visible {
  outline: 4px solid #f8e100 !important;
  outline-offset: 3px !important;
  border-radius: 2px;
}

/* ---------- Anpassungen für kleine Screens ---------- */
@media (max-width: 640px) {
  .back-to-top { width: 40px; height: 40px; bottom: 18px; left: 18px; }
  .a11y-toggle { width: 40px; height: 48px; }
  .a11y-panel { width: 260px; padding: 16px 18px; }
}
