/*
 * Plugin „Vereinigungen" — Frontend (Übersichten via ShortCode und
 * verschachtelte Detailseiten). Nutzt die Design-Tokens des Themes (style.css)
 * und dessen Namenskonvention: kurze Block-Klassen mit einfachen Kind-
 * Selektoren (wie .event .place im Theme), KEIN BEM-__. Wird über die
 * head-Region auf dem Template „vereinigung" geladen; die Übersichten werden
 * zusätzlich in Seiten eingebettet, die dieses Template nicht tragen — die
 * Kachel-Optik nutzt daher ausschließlich Tokens.
 */

/* ==================== Übersicht (ShortCode) ==================== */

/* Die Übersicht wird in .page-content eingebettet — dessen Theme-Regeln
   (page.css) treffen sonst unsere Karten-Bilder/Überschriften: img bekommt
   dort margin + box-shadow (→ Lücke/Halo über dem Bild), h3 ein margin und
   a eine Unterstreichung. Gezielt für die Übersicht neutralisieren
   (vereinigungen.css lädt nach page.css). */
.vereinigungen-overview img {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}
.vereinigungen-overview h3 { margin: 0; }
.vereinigungen-overview a { text-decoration: none; }

/* ----- Karten-Raster (Tokens wie .event/.press-card im Theme) ----- */
.vereinigungen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: clamp(16px, 1rem + 1vw, 26px);
}

.vereinigung-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: box-shadow 0.18s, transform 0.18s;
}
.vereinigung-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-3px);
}
.vereinigung-card .card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.vereinigung-card .media {
  aspect-ratio: 16 / 9;
  background: var(--bg-soft);
  overflow: hidden;
}
.vereinigung-card .media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.vereinigung-card:hover .media img { transform: scale(1.04); }

/* Platzhalter ohne Foto: FW-Logo zentriert (nicht beschnitten), auf zartem
   Marken-Verlauf — so wirken Kacheln mit/ohne Bild einheitlich. */
.vereinigung-card .media--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-soft), var(--bg-softer));
  border-bottom: 1px solid var(--line-soft);
}
.vereinigung-card .media--placeholder img {
  width: auto;
  height: auto;
  max-width: 62%;
  max-height: 46%;
  object-fit: contain;
  opacity: 0.9;
  transition: transform 0.35s ease, opacity 0.18s;
}
.vereinigung-card:hover .media--placeholder img {
  transform: none;
  opacity: 1;
}

.vereinigung-card .body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px 20px;
  flex: 1 1 auto;
}
.vereinigung-card h3 {
  margin: 0;
  font-family: var(--ff-head);
  font-weight: 700;
  font-size: 1.24rem;
  line-height: 1.25;
  color: var(--blue-ink);
  overflow-wrap: break-word;
  hyphens: auto;
}
.vereinigung-card .more {
  margin-top: auto;
  padding-top: 6px;
  font-weight: 600;
  color: var(--blue);
}

.vereinigungen-empty {
  padding: 22px 24px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text-mid);
  font-size: 1.02rem;
  margin: 0;
}

@media (max-width: 340px) {
  .vereinigungen-grid { grid-template-columns: 1fr; }
}

/* ==================== Detailseite ==================== */

/* Wrapper: bewusst KEINE .card-Klasse — das Theme definiert .card global.
   Der Detail-Artikel ist nur ein zentrierter Container → eigener Name .inner. */
.vereinigung-detail .inner {
  max-width: 820px;
}

.vereinigung-detail .head { margin-bottom: 22px; }
.vereinigung-detail .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: 0 0 12px;
}
.vereinigung-detail .kind {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--blue);
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
}
.vereinigung-detail .page-title {
  margin: 0;
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.3rem);
  line-height: 1.15;
  color: var(--blue-ink);
  overflow-wrap: break-word;
  hyphens: auto;
}

.vereinigung-detail .media {
  margin: 0 0 24px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-soft);
}
.vereinigung-detail .media img {
  display: block;
  width: 100%;
  height: auto;
}

.vereinigung-detail .body { margin: 0; }

/* Kontaktzeile (Website/E-Mail der Vereinigung) */
.vereinigung-detail .contact {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.vereinigung-detail .contact-item {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  word-break: break-word;
  transition: color 0.15s;
}
/* Beim Hover klar als Link erkennbar: Unterstreichung + Orange (wie im Theme). */
.vereinigung-detail .contact-item:hover,
.vereinigung-detail .contact-item:focus-visible {
  color: var(--orange);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.vereinigung-detail .contact-item svg { width: 18px; height: 18px; flex: none; }

@media (max-width: 620px) {
  .vereinigung-detail .page-title { font-size: 1.55rem; }
}

/* ==================== Vorstand (je Vereinigung) ==================== */

.vereinigung-vorstand {
  padding-top: clamp(1.6rem, 1rem + 2vw, 2.6rem);
  /* Abstand zur Newsletter-Sektion darüber dem Footer. Ohne padding-bottom
     stößt das Vorstand-Grid auf langen Seiten (margin-top:auto kollabiert dort
     zu 0) direkt an die blaue Newsletter-Box. Wert = Sektions-Rhythmus des
     Themes (.page-section unten). */
  padding-bottom: clamp(3rem, 2rem + 3vw, 5rem);
}
.vereinigung-vorstand .section-eyebrow {
  margin: 0 0 clamp(1rem, 0.6rem + 1.5vw, 1.6rem);
  font-family: var(--ff-head);
  font-weight: 800;
  font-size: clamp(1.3rem, 1rem + 1.4vw, 1.8rem);
  color: var(--blue-ink);
}

.vorstand-grid {
  display: grid;
  /* Breitere Mindestbreite → weniger, breitere Spalten, damit der Text unter
     dem Foto (Amt, Name, Zitat, Kontakt) mehr Platz hat und nicht so lang
     umbricht. */
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: clamp(16px, 1rem + 1vw, 26px);
}
/* Sehr schmale Viewports: 340px-Mindestbreite würde sonst überlaufen. */
@media (max-width: 400px) {
  .vorstand-grid { grid-template-columns: 1fr; }
}

.profil-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.profil-card .profil-photo {
  aspect-ratio: 4 / 3;
  background: var(--bg-soft);
  overflow: hidden;
}
.profil-card .profil-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profil-card .profil-photo--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}
.profil-card .profil-photo--empty span {
  font-family: var(--ff-head);
  font-weight: 800;
  font-size: 2.6rem;
  color: var(--text-mid);
  opacity: 0.5;
}

.profil-card .profil-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 18px;
  flex: 1 1 auto;
}
.profil-card .profil-tag {
  align-self: flex-start;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
}
.profil-card .profil-name {
  margin: 0;
  font-family: var(--ff-head);
  font-weight: 700;
  font-size: 1.18rem;
  line-height: 1.2;
  color: var(--blue-ink);
}
.profil-card .profil-quote {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid var(--orange);
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text-mid);
  font-style: italic;
}
.profil-card .profil-contact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
}
.profil-card .profil-contact-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  word-break: break-word;
  transition: color 0.15s;
}
/* Beim Hover klar als Link erkennbar: Unterstreichung + Orange (wie im Theme). */
.profil-card .profil-contact-item:hover,
.profil-card .profil-contact-item:focus-visible {
  color: var(--orange);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.profil-card .profil-contact-item svg { width: 16px; height: 16px; flex: none; }

/* ============ Untergeordnete Vereinigungen (unter dem Vorstand) ============ */
/* Bezirk-Detail: Kreis-Karten mit eingebetteter Ort-Liste; Kreis-Detail:
   Ort-Karten. Setzt den Abstand zur Newsletter-Sektion (padding-bottom), da
   dieser Block – falls vorhanden – zwischen Vorstand und Footer steht. */
.vereinigung-children {
  padding-top: clamp(1.4rem, 0.9rem + 1.8vw, 2.4rem);
  padding-bottom: clamp(3rem, 2rem + 3vw, 5rem);
  border-top: 1px solid var(--line);
}
/* Folgt der Kinder-Block direkt auf den Vorstand, dessen Sektions-Abstand nach
   unten zurücknehmen — die Trennung übernimmt hier padding-top + border-top des
   Kinder-Blocks (sonst doppelte Lücke mit der Trennlinie mittendrin). */
.vereinigung-vorstand:has(+ .vereinigung-children) {
  padding-bottom: clamp(1.2rem, 0.8rem + 1.4vw, 2rem);
}
.vereinigung-children .section-eyebrow {
  margin: 0 0 clamp(1rem, 0.6rem + 1.5vw, 1.6rem);
  font-family: var(--ff-head);
  font-weight: 800;
  font-size: clamp(1.3rem, 1rem + 1.4vw, 1.8rem);
  color: var(--blue-ink);
}

.children-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: clamp(16px, 1rem + 1vw, 24px);
  align-items: start;
}

.child-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: box-shadow 0.18s, transform 0.18s;
}
.child-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-3px);
}

/* Klickbarer Kopf = die Vereinigung selbst (Thumbnail + Name + Pfeil).
   min-height gibt allen Karten – auch ohne Bild – dieselbe, etwas höhere
   Grundhöhe, damit ein gemischtes Raster nicht ungleichmäßig wirkt. */
.child-card .child-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 18px;
  min-height: 100px;
  color: var(--blue-ink);
  text-decoration: none;
}
.child-card .child-media {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-soft);
}
.child-card .child-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.child-card .child-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}
.child-card .child-name {
  font-family: var(--ff-head);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.25;
  color: var(--blue-ink);
}
.child-card .child-arrow {
  margin-left: auto;
  flex: none;
  color: var(--blue);
  transition: transform 0.18s;
}
.child-card .child-arrow svg { width: 20px; height: 20px; display: block; }
.child-card:hover .child-arrow { transform: translateX(3px); }

/* Eingebettete Ort-Liste — visuell untergeordnet (getönter Block, kleiner). */
.child-card .child-sub {
  border-top: 1px solid var(--line-soft);
  background: var(--bg-soft);
  padding: 12px 16px 14px;
}
.child-card .child-sub-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mid);
}
.child-card .child-sub-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.child-card .child-sub-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  margin: 0 -8px;
  border-radius: var(--r-sm);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.child-card .child-sub-list a:hover {
  background: #fff;
  color: var(--blue-deep);
}
.child-card .child-sub-list svg { width: 15px; height: 15px; flex: none; opacity: 0.8; }

/* ==================== Umkreis-Suche „Vor Ort Aktiv werden" ==================== */

.vor-ort {
  padding-block: clamp(28px, 2rem + 2vw, 56px);
}

.vor-ort-head {
  max-width: 620px;
  margin-bottom: clamp(20px, 1rem + 1.5vw, 32px);
}
.vor-ort-head .page-title { margin: 0 0 10px; }
.vor-ort-lead {
  margin: 0;
  color: var(--text-mid);
  font-size: 1.05rem;
  line-height: 1.55;
}

/* ----- Suchformular (nutzt .finder-form/.field aus style.css) ----- */
/* Horizontal statt der spaltigen Startseiten-Optik: PLZ-Feld wächst, Umkreis
   und Button fassen sich an. Auf schmalen Viewports stapeln sie (unten). */
.vor-ort-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, auto) auto;
  gap: 12px;
  align-items: start;
  max-width: 760px;
  margin-bottom: clamp(24px, 1.5rem + 1.5vw, 40px);
}
.vor-ort-form .field { margin-bottom: 0; }
/* Das select trägt rechts den Pfeil (.trail-ic bei right:14px, 18px breit).
   Die Theme-Regel gibt nur 14px rechts frei → auf dem schmaleren Umkreis-Feld
   überlagert der Pfeil das „m" von „km". Mehr rechten Innenabstand schaffen. */
.vor-ort-form .field select { padding-right: 40px; }
.vor-ort-form .btn-primary { justify-content: center; white-space: nowrap; height: 100%; }

/* ----- Ergebnis: Zustands-Hinweiszeile ----- */
.vor-ort-note {
  margin: 0 0 14px;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--text);
}
.vor-ort-note strong { color: var(--blue-ink); }

/* ----- Ergebnis: primäre Treffer-Karte (visueller Anker) ----- */
.vor-ort-hit {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: box-shadow 0.18s, transform 0.18s;
}
.vor-ort-hit:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-2px); }

.vor-ort-hit__main {
  display: flex;
  align-items: stretch;
  gap: 0;
  text-decoration: none;
  color: inherit;
}
.vor-ort-hit__media {
  flex: none;
  width: clamp(96px, 8rem, 148px);
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.vor-ort-hit__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vor-ort-hit__media--empty { color: var(--blue); }
.vor-ort-hit__media--empty svg { width: 34px; height: 34px; opacity: 0.5; }

.vor-ort-hit__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: clamp(16px, 1rem + 0.6vw, 24px);
  min-width: 0;
}
.vor-ort-hit__kind {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--orange-deep);
}
.vor-ort-hit__name {
  font-family: var(--ff-head);
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.55rem);
  font-weight: 700;
  color: var(--blue-ink);
  line-height: 1.2;
}
.vor-ort-hit__excerpt {
  margin-top: 2px;
  color: var(--text-mid);
  font-size: 0.98rem;
  line-height: 1.5;
}
.vor-ort-hit__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-weight: 600;
  color: var(--blue);
  transition: gap 0.16s, color 0.16s;
}
.vor-ort-hit__cta svg { width: 18px; height: 18px; }
.vor-ort-hit__main:hover .vor-ort-hit__cta { gap: 10px; color: var(--blue-deep); }
.vor-ort-hit__main:focus-visible { outline: 3px solid rgba(20, 80, 163, 0.4); outline-offset: 2px; }

/* ----- Ergebnis: „gehört zu:"-Kontext-Kette (untergeordnet) ----- */
.vor-ort-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 16px;
  padding-left: 4px;
}
.vor-ort-context__label {
  font-size: 0.9rem;
  color: var(--text-mid);
}
.vor-ort-context__chain {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.vor-ort-context__chain li { display: flex; }
.vor-ort-context__chain a {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.vor-ort-context__chain a:hover,
.vor-ort-context__chain a:focus-visible {
  border-color: var(--blue);
  background: #fff;
}
.vor-ort-context__kind {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-mid);
}
.vor-ort-context__name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--blue-ink);
}

/* ----- Ergebnis: Leerzustände ----- */
.vor-ort-empty {
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--bg-soft);
  padding: clamp(22px, 1.5rem + 1vw, 34px);
}
.vor-ort-empty--prompt { border-style: solid; background: #fff; }
.vor-ort-empty__title {
  margin: 0 0 8px;
  font-family: var(--ff-head);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--blue-ink);
}
.vor-ort-empty__hint { margin: 0; color: var(--text-mid); line-height: 1.55; }
.vor-ort-empty__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.vor-ort-empty__actions .btn { min-width: 84px; justify-content: center; }

/* ----- Ergebnis: CTA „eigene Vereinigung gründen" (kein Treffer im Umkreis) ----- */
.vor-ort-cta {
  display: flex;
  gap: clamp(14px, 1rem + 1vw, 22px);
  align-items: flex-start;
  margin-top: 16px;
  padding: clamp(20px, 1.4rem + 1vw, 30px);
  border: 1px solid rgba(20, 80, 163, 0.22);
  border-left: 4px solid var(--blue);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(20, 80, 163, 0.06), rgba(20, 80, 163, 0.015));
}
.vor-ort-cta__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
}
.vor-ort-cta__icon svg { width: 24px; height: 24px; }
.vor-ort-cta__body { min-width: 0; }
.vor-ort-cta__title {
  margin: 2px 0 8px;
  font-family: var(--ff-head);
  font-size: clamp(1.12rem, 1rem + 0.5vw, 1.3rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--blue-ink);
}
.vor-ort-cta__text {
  margin: 0 0 16px;
  color: var(--text-mid);
  line-height: 1.6;
}
.vor-ort-cta__text strong { color: var(--blue-ink); }
.vor-ort-cta .btn svg { width: 18px; height: 18px; }

@media (max-width: 640px) {
  .vor-ort-form { grid-template-columns: 1fr; }
  .vor-ort-hit__main { flex-direction: column; }
  .vor-ort-hit__media { width: 100%; height: 140px; }
  .vor-ort-cta { flex-direction: column; gap: 12px; }
}
