.d35-card-post {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 100%;
  align-self: stretch;
  overflow: hidden;
  border: 1px solid var(--d35-color-border);
  border-radius: var(--d35-radius);
  background: var(--d35-color-dark);
  color: var(--d35-color-surface);
}

.brxe-shortcode:has(> .d35-card-post) {
  width: 100%;
  height: 100%;
  min-height: 100%;
}

.brxe-shortcode > .d35-card-post {
  height: 100%;
}

.d35-card-post--clickable {
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

/* Kein Lift (der schnitt die Karte in overflow-Slidern ab) und kein Flächen-
   Tint — beim Hover wird die Karte nur in der Primärfarbe umrandet. Der inset-
   Ring bleibt vollständig innerhalb der Karte und wird daher im Slider nie
   abgeschnitten. */
.d35-card-post--clickable:hover {
  border-color: var(--d35-color-primary);
  box-shadow: inset 0 0 0 2px var(--d35-color-primary);
}

/* Helle Kartenvariante (variant="light"): helle Fläche + dunkle Schrift, für
   Karten in hellen Kontexten (z. B. Slider ohne dunkles Band). Entkoppelt die
   Karte von der Band-Variante des Containers. Overlay-Karten sind ausgenommen
   (`:not(--layout-overlay)`): die liegen mit weißem Text auf dem Bild und haben
   ihr eigenes Scrim-Treatment — eine helle Fläche/dunkle Schrift würde den
   (vom Overlay nicht überschriebenen) Kartentitel unlesbar machen. */
.d35-card-post--variant-light:not(.d35-card-post--layout-overlay) {
  background: var(--d35-color-surface);
  color: var(--d35-color-text);
}

.d35-card-post--variant-light:not(.d35-card-post--layout-overlay) .d35-card-post__preheading,
.d35-card-post--variant-light:not(.d35-card-post--layout-overlay) .d35-card-post__hint {
  color: color-mix(in srgb, var(--d35-color-text) 62%, transparent);
}

.d35-card-post--variant-light:not(.d35-card-post--layout-overlay) .d35-card-post__body {
  color: color-mix(in srgb, var(--d35-color-text) 82%, transparent);
}

.d35-card-post--variant-light:not(.d35-card-post--layout-overlay) .d35-card-post__footer {
  border-top-color: color-mix(in srgb, var(--d35-color-text) 12%, transparent);
}

/* Helle Karte teilt sich den Hover mit der dunklen: nur Rand/Ring in der
   Primärfarbe (via .d35-card-post--clickable:hover), kein Flächen-Tint. */

.d35-card-post--layout-inline {
  display: grid;
  grid-template-columns: minmax(15rem, 0.95fr) minmax(0, 1.2fr);
  align-items: stretch;
}

/* Highlight-Badge (allgemein_vorschau_highlight_text) auf dem Bild — bewusst
   präsent: in der dunklen Flächenfarbe (zweite Markenfarbe, z. B. Blau), fett,
   etwas größer. Trägt den Preis ("ab 389 €/Monat") ODER ein Label ("Aktion") —
   daher KEIN uppercase, damit Preise natürlich lesbar bleiben. Leeres Feld →
   kein Badge. Die Ecke ist pro Beitrag wählbar (allgemein_vorschau_highlight_
   position) über die --badge-*-Modifier; Default „oben rechts". */
.d35-card-post__badge {
  position: absolute;
  z-index: 2;
  padding: 0.45rem 0.85rem;
  border-radius: var(--d35-radius-button);
  /* Optionale Highlight-Farbe pro Beitrag (BadgeColor setzt beide Variablen
     inline am Badge); ohne Auswahl der bisherige Look. */
  background: var(--d35-badge-bg, var(--d35-color-dark));
  color: var(--d35-badge-text, #fff);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

/* Badge mit *Sternchen*-Betrag ("ab mtl. *389,00 €*"): den umgebenden Text
   (z. B. "ab mtl.") etwas zurücknehmen, damit der Größenkontrast zur Summe
   deutlich wird — nicht der Betrag schrumpft, sondern das Beiwerk. Greift nur
   bei markiertem Betrag; Plain-Badges ("Aktion") bleiben unberührt.
   0.4375rem = 7px bei 16px-Basis. */
.d35-card-post__badge--has-amount {
  font-size: 0.4375rem;
}

/* Der in *Sternchen* eingefasste Betrag selbst — deutlich größer gesetzt.
   em-relativ zur (reduzierten) Badge-Größe (2 × 7px = 14px) → kräftiger
   Größenkontrast, skaliert mit, falls der Badge-Grundwert geändert wird. */
.d35-card-post__badge-amount {
  font-size: 2em;
  line-height: 1;
}

.d35-card-post--badge-top-right .d35-card-post__badge {
  top: 0.85rem;
  right: 0.85rem;
}

.d35-card-post--badge-top-left .d35-card-post__badge {
  top: 0.85rem;
  left: 0.85rem;
}

.d35-card-post--badge-bottom-right .d35-card-post__badge {
  bottom: 0.85rem;
  right: 0.85rem;
}

.d35-card-post--badge-bottom-left .d35-card-post__badge {
  bottom: 0.85rem;
  left: 0.85rem;
}

/* Inline-Layout: Bild liegt links, Text rechts — die Default-Ecke „oben rechts"
   säße über dem Text, daher aufs Bild (oben links) zurückverankert. Eine
   ausdrücklich gewählte Ecke (links/unten) gewinnt weiterhin über ihre eigene
   Regel. */
.d35-card-post--layout-inline.d35-card-post--badge-top-right .d35-card-post__badge {
  right: auto;
  left: 0.85rem;
}

/* „Unten"-Badges im Standard-Layout (stacked) ans BILD statt an die Karte pinnen:
   Dort ist das Bild nur die obere Scheibe (festes Seitenverhältnis), der Text liegt
   darunter — „bottom:0" säße also unter dem Text am Karten-Rand. Container-Query-
   Units rechnen aus Kartenbreite + Ratio die Bildhöhe (4:3 → 75cqw, 3:2 → 66.667cqw,
   2:3 → 150cqw, 1:1 → 100cqw); translateY(-100%) hängt das Badge um die eigene Höhe
   nach oben, sodass seine Unterkante auf der Bild-Unterkante (minus 0.85rem) sitzt.
   Overlay (Bild füllt die Karte) und Inline (Bild volle Höhe) ankern bereits
   korrekt und bleiben unberührt. */
.d35-card-post--layout-stacked {
  container-type: inline-size;
}

.d35-card-post--layout-stacked.d35-card-post--badge-bottom-left .d35-card-post__badge,
.d35-card-post--layout-stacked.d35-card-post--badge-bottom-right .d35-card-post__badge {
  top: calc(75cqw - 0.85rem);
  bottom: auto;
  transform: translateY(-100%);
}

.d35-card-post--layout-stacked.d35-card-post--ratio-3-2.d35-card-post--badge-bottom-left .d35-card-post__badge,
.d35-card-post--layout-stacked.d35-card-post--ratio-3-2.d35-card-post--badge-bottom-right .d35-card-post__badge {
  top: calc(66.667cqw - 0.85rem);
}

.d35-card-post--layout-stacked.d35-card-post--ratio-2-3.d35-card-post--badge-bottom-left .d35-card-post__badge,
.d35-card-post--layout-stacked.d35-card-post--ratio-2-3.d35-card-post--badge-bottom-right .d35-card-post__badge {
  top: calc(150cqw - 0.85rem);
}

.d35-card-post--layout-stacked.d35-card-post--ratio-1-1.d35-card-post--badge-bottom-left .d35-card-post__badge,
.d35-card-post--layout-stacked.d35-card-post--ratio-1-1.d35-card-post--badge-bottom-right .d35-card-post__badge {
  top: calc(100cqw - 0.85rem);
}

.d35-card-post__media {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--d35-color-light);
}

.d35-card-post--ratio-4-3 .d35-card-post__media {
  aspect-ratio: 4 / 3;
}

.d35-card-post--ratio-3-2 .d35-card-post__media {
  aspect-ratio: 3 / 2;
}

.d35-card-post--ratio-2-3 .d35-card-post__media {
  aspect-ratio: 2 / 3;
}

.d35-card-post--ratio-1-1 .d35-card-post__media {
  aspect-ratio: 1 / 1;
}

.d35-card-post--layout-inline .d35-card-post__media {
  aspect-ratio: auto;
  min-height: 100%;
}

.d35-card-post__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Personenporträts (Mitarbeitende) oben verankern, damit bei quadratischem
   oder hohem Zuschnitt der Kopf nicht abgeschnitten wird (Crop unten statt
   mittig). */
.d35-card-post--type-mitarbeitende .d35-card-post__image {
  object-position: top;
}

.d35-card-post__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  padding: 1.25rem;
}

.d35-card-post__header {
  display: grid;
  gap: 0.35rem;
}

.d35-card-post__preheading {
  color: color-mix(in srgb, var(--d35-color-surface) 62%, transparent);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  /* Bewusst KEIN text-transform:uppercase — der Untertitel (z. B. technische
     Motorangabe „2.0 TSI 195 kW (265 PS) 7-Gang DSG 4Drive") soll wie eingegeben
     in natürlicher Schreibweise erscheinen. Fleet-weit. */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.d35-card-post__title {
  margin: 0;
  color: inherit;
  font-size: 1.35rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.d35-card-post__body {
  flex: 1 1 auto;
  min-height: 0;
  color: color-mix(in srgb, var(--d35-color-surface) 82%, transparent);
  font-size: 0.875rem; /* 14px — kompakter als zuvor (0.98rem) */
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.d35-card-post__body:empty {
  display: none;
}

.d35-card-post__body > :first-child {
  margin-top: 0;
}

.d35-card-post__body > :last-child {
  margin-bottom: 0;
}

.d35-card-post__footer {
  display: flex;
  margin-top: auto;
  min-width: 0;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.d35-card-post__hint {
  flex: 1 1 10rem;
  min-width: 0;
  color: color-mix(in srgb, var(--d35-color-surface) 62%, transparent);
  font-size: 0.9rem;
  line-height: 1.4;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.d35-card-post__link {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(100%, 100%);
  white-space: normal;
  text-align: right;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.d35-card-post__overlay-link {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
}

.d35-card-post__overlay-link:focus-visible {
  outline: 2px solid var(--d35-color-primary);
  outline-offset: -2px;
}

/* Terminbuchungs-Dropdown-Integration in die Karte. Das Dropdown selbst
   (natives <details>, neutrale Klassen) stylt booking-dropdown.css — hier nur
   der Karten-Kontext: volle Footer-Breite + Zeiger auf der ganzen Karte, weil
   ein Klick irgendwo das Dropdown togglet (filterable-card-grid.js). */
.d35-card-post__footer .d35-booking-dropdown {
  flex: 1 1 100%;
}

.d35-card-post:has(.d35-booking-dropdown) {
  cursor: pointer;
}

/* ─── Optionales Karten-Akkordion (allgemein_vorschau_akkordion_*) ───────────
   Frei benannter Titel (summary) + aufklappbarer HTML-Inhalt. Natives <details>,
   kein JS. Sitzt zwischen Body und Footer, mit Trennlinie darüber. */
.d35-card-post__accordion {
  position: relative;
  z-index: 4;
  border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}

/* Der Overlay-Link (z-3) deckt die ganze Karte ab, und __content bildet mit
   seinem z-index einen Stacking-Context — ein Akkordion darin bliebe sonst
   UNTER dem Link gefangen (Klick navigiert statt aufzuklappen). Nur für Karten
   MIT Akkordion den Trap lösen: im Stacked-/Inline-Layout braucht __content
   keinen eigenen z-index (keine Überlappung), dann gewinnt das Akkordion (z-4)
   über den Link; der Rest der Karte bleibt verlinkt. */
.d35-card-post:has(.d35-card-post__accordion):not(.d35-card-post--layout-overlay) .d35-card-post__content {
  z-index: auto;
}

/* Overlay-Layout: __content liegt per Design über Bild + Scrim (z-2). Hier
   __content über den Overlay-Link heben, damit das Akkordion klickbar ist;
   navigiert wird dann über den freien Bildbereich oberhalb des Textes. */
.d35-card-post--layout-overlay:has(.d35-card-post__accordion) .d35-card-post__content {
  z-index: 4;
}

.d35-card-post__accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  cursor: pointer;
  list-style: none;
  color: inherit;
  font-weight: 700;
  line-height: 1.3;
}

.d35-card-post__accordion-summary::-webkit-details-marker {
  display: none;
}

.d35-card-post__accordion-summary::marker {
  content: "";
}

.d35-card-post__accordion-summary:focus-visible {
  outline: 2px solid var(--d35-color-primary);
  outline-offset: 2px;
}

.d35-card-post__accordion-label {
  overflow-wrap: anywhere;
}

/* „+"-Zeichen, das beim Aufklappen zum „−" wird (vertikaler Strich blendet aus). */
.d35-card-post__accordion-icon {
  position: relative;
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--d35-color-primary);
}

.d35-card-post__accordion-icon::before,
.d35-card-post__accordion-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  background: currentColor;
}

.d35-card-post__accordion-icon::before {
  width: 100%;
  height: 2px;
}

.d35-card-post__accordion-icon::after {
  width: 2px;
  height: 100%;
  transition: opacity 0.15s ease;
}

.d35-card-post__accordion[open] .d35-card-post__accordion-icon::after {
  opacity: 0;
}

.d35-card-post__accordion-content {
  padding-bottom: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.d35-card-post__accordion-content > :first-child {
  margin-top: 0;
}

.d35-card-post__accordion-content > :last-child {
  margin-bottom: 0;
}

.d35-card-post--layout-inline .d35-card-post__content {
  min-height: 100%;
}

/* Overlay layout: the preview image fills the whole card as a background, a
   gradient scrim (dark at the bottom, clearing toward the top) keeps the text
   readable, and all content is anchored to the bottom on top of the image.
   Empty fields simply collapse, so shorter cards keep everything low. */
.d35-card-post--layout-overlay {
  min-height: clamp(20rem, 28vw, 26rem);
  justify-content: flex-end;
  background: var(--d35-color-dark);
}

.d35-card-post--layout-overlay .d35-card-post__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  aspect-ratio: auto;
  background: var(--d35-color-dark);
}

/* Gradient scrim on the card itself (not the image), so the text stays readable
   even when a hand-picked post has no preview image. */
.d35-card-post--layout-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.88) 0%,
    rgba(0, 0, 0, 0.55) 38%,
    rgba(0, 0, 0, 0.12) 100%
  );
}

/* Primary-tinted scrim, as an alternative to the plain black one. */
.d35-card-post--layout-overlay.d35-card-post--overlay-primary::before {
  background: linear-gradient(
    to top,
    color-mix(in srgb, var(--d35-color-primary) 92%, #000) 0%,
    color-mix(in srgb, var(--d35-color-primary) 55%, transparent) 42%,
    transparent 100%
  );
}

.d35-card-post--layout-overlay .d35-card-post__content {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  margin-top: auto;
  gap: 0.65rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.d35-card-post--layout-overlay .d35-card-post__body {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.92);
}

.d35-card-post--layout-overlay .d35-card-post__preheading,
.d35-card-post--layout-overlay .d35-card-post__hint {
  color: rgba(255, 255, 255, 0.82);
}

.d35-card-post--layout-overlay .d35-card-post__footer {
  margin-top: 0.35rem;
  border-top-color: rgba(255, 255, 255, 0.28);
}

@media (max-width: 640px) {
  .d35-card-post--layout-inline {
    grid-template-columns: minmax(0, 1fr);
  }

  .d35-card-post__content {
    padding: 1rem;
  }

  .d35-card-post__footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
