/* SW Zielgruppen-Filter – Frontend
   Farben greifen auf Avada-Variablen zurück, Fallbacks passen zur Seite. */

.sw-zg {
  --sw-zg-gap: 30px;
  --sw-zg-radius: 4px;
  --sw-zg-border: #e8e8e8;
  --sw-zg-bg: #fff;
  --sw-zg-title: var(--awb-color5, #6fbf73);
  --sw-zg-text: var(--awb-color8, #333);
  --sw-zg-muted: #555;
  --sw-zg-accent: var(--awb-color4, #f7941d);
  --sw-zg-focus: #1a73e8;
  margin: 3em 0 4em;
  clear: both;
  scroll-margin-top: 120px; /* Platz für den fixierten Avada-Header bei Anker-Sprüngen */
}

.sw-zg__title,
.fusion-body .sw-zg h2.sw-zg__title {
  text-align: center;
  color: var(--sw-zg-title);
  margin: 0 0 1.2em;
  /* bleibt semantisch H2, optisch in H3-Größe und fett */
  font-size: var(--h3_typography-font-size, 24px);
  line-height: var(--h3_typography-line-height, 1.3);
  font-weight: 700;
}

.sw-zg__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sw-zg-gap);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.sw-zg--cols-1 .sw-zg__grid { grid-template-columns: 1fr; }
.sw-zg--cols-2 .sw-zg__grid { grid-template-columns: repeat(2, 1fr); }
.sw-zg--cols-3 .sw-zg__grid { grid-template-columns: repeat(3, 1fr); }
.sw-zg--cols-4 .sw-zg__grid { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .sw-zg--cols-3 .sw-zg__grid,
  .sw-zg--cols-4 .sw-zg__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .sw-zg { --sw-zg-gap: 20px; }
  .sw-zg__grid,
  .sw-zg--cols-2 .sw-zg__grid,
  .sw-zg--cols-3 .sw-zg__grid,
  .sw-zg--cols-4 .sw-zg__grid { grid-template-columns: 1fr; }
}

.sw-zg__item { margin: 0; padding: 0; }

.sw-zg__card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--sw-zg-bg);
  border: 1px solid var(--sw-zg-border);
  border-radius: var(--sw-zg-radius);
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}
.sw-zg__card:hover,
.sw-zg__card:focus-within {
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  transform: translateY(-2px);
}

.sw-zg__media { display: block; line-height: 0; }
.sw-zg__img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  max-width: 100%;
}

.sw-zg__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 18px 20px 22px;
  color: var(--sw-zg-text);
}

.sw-zg__heading {
  margin: 0 0 .5em;
  font-size: 1.25em;
  line-height: 1.3;
}
.sw-zg__link {
  color: var(--sw-zg-text);
  text-decoration: none;
}
/* Gesamte Karte klickbar – über Pseudo-Element des Titel-Links */
.sw-zg__link::after {
  content: "";
  position: absolute;
  inset: 0;
}
.sw-zg__link:hover { color: var(--sw-zg-accent); }
.sw-zg__link:focus { outline: none; }
.sw-zg__link:focus-visible::after {
  outline: 3px solid var(--sw-zg-focus);
  outline-offset: 2px;
  border-radius: var(--sw-zg-radius);
}

.sw-zg__excerpt {
  flex: 1;
  margin: 0 0 1em;
  font-size: .95em;
  line-height: 1.6;
  color: var(--sw-zg-muted);
}

.sw-zg__more {
  color: var(--sw-zg-accent);
  font-weight: 600;
  font-size: .9em;
}
.sw-zg__more::after { content: " \203A"; }

.sw-zg .sw-zg__all,
.fusion-body .sw-zg p.sw-zg__all {
  text-align: center;
  margin: 0;
  padding: 3.5em 0 0;
}
.sw-zg__all-link { display: inline-block; }

.sw-zg__empty { text-align: center; color: var(--sw-zg-muted); }

.sw-zg-notice {
  background: #fff3cd;
  border: 1px solid #ffe69c;
  padding: 10px 14px;
  border-radius: 4px;
  color: #664d03;
}

@media (prefers-reduced-motion: reduce) {
  .sw-zg__card { transition: none; }
  .sw-zg__card:hover, .sw-zg__card:focus-within { transform: none; }
}

@media print {
  .sw-zg__card { box-shadow: none; break-inside: avoid; }
  .sw-zg__all { display: none; }
}

/* ---------- Übersichtsseite: Zielgruppen-Kacheln + Filter ---------- */

.sw-zg-tiles {
  list-style: none;
  margin: 0 0 2.5em;
  padding: 0;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.sw-zg-tile__link {
  display: block;
  height: 100%;
  padding: 18px 20px;
  background: var(--awb-color5, #6fbf73);
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  transition: background .2s ease;
}
.sw-zg-tile__link:hover,
.sw-zg-tile__link:focus-visible { background: var(--awb-color4, #f7941d); color: #fff; }
.sw-zg-tile__link:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
.sw-zg-tile__name { display: block; font-weight: 700; font-size: 1.15em; }
.sw-zg-tile__desc { display: block; font-size: .9em; opacity: .92; margin-top: 4px; }

.sw-zg-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 0 0 .5em;
}
.sw-zg-filter__label { font-weight: 600; margin-right: 4px; }
.sw-zg-filter__btn {
  font: inherit;
  cursor: pointer;
  background: #fff;
  color: #333;
  border: 2px solid var(--awb-color5, #6fbf73);
  border-radius: 999px;
  padding: 8px 18px;
  text-decoration: none;
  line-height: 1.2;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: background .15s ease, color .15s ease;
}
.sw-zg-filter__btn:hover { background: #eef7ee; }
.sw-zg-filter__btn.is-active,
.sw-zg-filter__btn[aria-pressed="true"] {
  background: var(--awb-color5, #6fbf73);
  color: #fff;
}
.sw-zg-filter__btn:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
/* Typ-Filter (Veranstaltungen) leicht abgesetzt */
.sw-zg-filter__btn--typ { margin-left: 10px; border-style: dashed; }
.sw-zg-filter__btn--typ.is-active { border-style: solid; }

.sw-zg-filter__status {
  text-align: center;
  color: #666;
  font-size: .9em;
  min-height: 1.4em;
  margin: 0 0 1em;
}

.sw-zg-overview .sw-zg { margin-top: 2em; }
.sw-zg__item[hidden] { display: none; }

/* ---------- Automatisch angehängter Block: auf Avada-Seitenbreite begrenzen ---------- */
.sw-zg.sw-zg-auto {
  margin-bottom: 5em;
  max-width: var(--site_width, var(--awb-site-width, 1100px));
  margin-left: auto;
  margin-right: auto;
  padding-left: 30px;
  padding-right: 30px;
  box-sizing: border-box;
}
@media (max-width: 640px) {
  .sw-zg.sw-zg-auto { padding-left: 20px; padding-right: 20px; }
}
