/* ================================================================
   Divi Post Cards – dpc-style.css
   Gleiche Bildhöhe · Titel auf einer Linie · Button bündig unten
   ================================================================ */

/* ── CSS-Variablen ─────────────────────────────────────────────── */
:root {
  --dpc-img-height    : 220px;
  --dpc-radius        : 10px;
  --dpc-gap           : 24px;
  --dpc-card-bg       : #ffffff;
  --dpc-card-shadow   : 0 2px 12px rgba(0,0,0,.08);
  --dpc-card-shadow-h : 0 6px 28px rgba(0,0,0,.14);
  --dpc-title-color   : #1a1a2e;
  --dpc-text-color    : #555e6d;
  --dpc-meta-color    : #888fa0;
  --dpc-badge-bg      : #f0f2f5;
  --dpc-badge-color   : #444;
  --dpc-btn-bg        : #D90452;
  --dpc-btn-color     : #ffffff;
  --dpc-btn-bg-h      : #b8033f;
  --dpc-accent        : #D90452;
  --dpc-font          : -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Grid ──────────────────────────────────────────────────────── */
.dpc-grid {
  display: grid;
  gap: var(--dpc-gap);
  list-style: none;
  margin: 0;
  padding: 0;
}

.dpc-col-1, .dpc-cols-1 { grid-template-columns: 1fr; }
.dpc-col-2, .dpc-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dpc-col-3, .dpc-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dpc-col-4, .dpc-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 980px) {
  .dpc-col-3,
  .dpc-col-4,
  .dpc-cols-3,
  .dpc-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .dpc-col-2,
  .dpc-col-3,
  .dpc-col-4,
  .dpc-cols-2,
  .dpc-cols-3,
  .dpc-cols-4 { grid-template-columns: 1fr; }
}

/* ================================================================
   Box-sizing für alle Plugin-Elemente – verhindert horizontales Schwimmen
   ================================================================ */
.dpc-wrapper *,
.dpc-wrapper *::before,
.dpc-wrapper *::after {
  box-sizing: border-box;
}

.dpc-wrapper {
  max-width: 100%;
  overflow-x: hidden;
}

.dpc-grid {
  width: 100%;
  max-width: 100%;
}

.dpc-card,
.dpc-card__image-wrap,
.dpc-card__image,
.dpc-card__body {
  max-width: 100%;
}

/* Karten die JS auf Mobile initial versteckt (statt nth-child) */
.dpc-mobile-hidden {
  display: none !important;
}

/* ================================================================
   Mobile-Optimierung (≤ 767 px)
   – 1 Spalte, Bild oben full-width, Text darunter, nur 3 Beiträge
   ================================================================ */
@media (max-width: 767px) {

  /* 1 Spalte erzwingen – überschreibt den Inline-Style */
  .dpc-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  /* Load-More-Button: volle Breite auf Mobile */
  .dpc-more-wrap {
    display: flex !important;
    margin-top: 24px;
  }

  .dpc-more-btn {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: .95rem;
  }

  /* Karte: vertikal – Bild oben, Text unten (wie Bild 2) */
  .dpc-card {
    flex-direction: column !important;
    width: 100% !important;
  }

  /* Bild: volle Breite, feste Höhe */
  .dpc-card__image-wrap {
    width: 100% !important;
    height: 200px !important;
    min-width: unset !important;
    flex-shrink: 0;
  }

  .dpc-card__image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .dpc-card__image--placeholder {
    height: 200px !important;
  }

  /* Karteninhalt */
  .dpc-card__body {
    padding: 16px 18px 18px !important;
    gap: 10px;
  }

  /* Titel vollständig anzeigen */
  .dpc-card__title {
    font-size: 1.05rem;
    line-height: 1.4;
    -webkit-line-clamp: 3;
    min-height: unset;
  }

  /* Auszug: 3 Zeilen */
  .dpc-card__excerpt {
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: .875rem;
  }

  /* "Mehr lesen"-Button: volle Breite */
  .dpc-btn {
    display: block !important;
    width: 100% !important;
    padding: 12px 20px;
    font-size: .9rem;
    text-align: center;
  }

  /* Filter-Leiste horizontal scrollbar */
  .dpc-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    margin-bottom: 20px;
    scrollbar-width: none;
  }
  .dpc-filter::-webkit-scrollbar { display: none; }

  .dpc-filter__btn {
    flex-shrink: 0;
  }
}

/* ── Karte ─────────────────────────────────────────────────────── */
.dpc-card {
  display: flex;
  flex-direction: column;
  background: var(--dpc-card-bg);
  border-radius: var(--dpc-radius);
  box-shadow: var(--dpc-card-shadow);
  overflow: hidden;
  transition: box-shadow .25s ease, transform .25s ease;
  font-family: var(--dpc-font);
}

.dpc-card:hover {
  box-shadow: var(--dpc-card-shadow-h);
  transform: translateY(-3px);
}

/* ── Bild ──────────────────────────────────────────────────────── */
.dpc-card__image-wrap {
  display: block;
  overflow: hidden;
  flex-shrink: 0;
  height: var(--dpc-img-height);      /* ← gleiche Höhe für alle Karten */
}

.dpc-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;                  /* Bild füllt exakt aus ohne Verzerrung */
  display: block;
  transition: transform .4s ease;
}

.dpc-card:hover .dpc-card__image {
  transform: scale(1.04);
}

/* Platzhalter wenn kein Beitragsbild */
.dpc-card__image--placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e8edf4, #cdd5e0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dpc-card__image--placeholder span {
  font-size: 3rem;
  font-weight: 700;
  color: #8899b0;
  text-transform: uppercase;
}

/* ── Karteninhalt ──────────────────────────────────────────────── */
.dpc-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;                            /* streckt sich auf gleiche Höhe */
  padding: 20px 22px 22px;
  gap: 10px;
}

/* ── Kategorien-Badges ─────────────────────────────────────────── */
.dpc-card__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 26px;                   /* gleichmäßige Höhe, auch ohne Badges */
}

.dpc-badge {
  display: inline-block;
  background: var(--dpc-badge-bg);
  color: var(--dpc-badge-color);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: .72rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: .02em;
  transition: background .2s;
}

.dpc-badge:hover {
  background: #dde2ea;
  color: #D90452;
}

/* ── Titel ─────────────────────────────────────────────────────── */
.dpc-card__title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
  color: var(--dpc-title-color);

  /* Exakt 2 Zeilen – Titel immer auf gleicher Höhe */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1rem * 1.4 * 2);  /* 2 Zeilen Reservierung */
}

.dpc-card__title a {
  color: inherit;
  text-decoration: none;
}

.dpc-card__title a:hover {
  color: #D90452;
}

/* ── Meta (Datum / Autor) ──────────────────────────────────────── */
.dpc-card__meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: .78rem;
  color: var(--dpc-meta-color);
  margin: 0;
  min-height: 18px;
}

.dpc-card__date::before {
  content: "📅 ";
  font-size: .75em;
}

.dpc-card__author::before {
  content: "✍ ";
  font-size: .75em;
}

/* ── Auszug ────────────────────────────────────────────────────── */
.dpc-card__excerpt {
  font-size: .875rem;
  color: var(--dpc-text-color);
  line-height: 1.6;
  margin: 0;
  flex: 1;                            /* nimmt verbleibenden Platz ein */

  /* Überschüssigen Text abschneiden (Sicherheitsnetz) */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Footer / Button – immer bündig am unteren Rand ───────────── */
.dpc-card__footer {
  margin-top: auto;                   /* schiebt Button nach ganz unten */
  padding-top: 10px;
}

.dpc-btn {
  display: block;
  width: 100%;
  background: #D90452 !important;
  color: #ffffff !important;
  border: none;
  border-radius: 6px;
  padding: 11px 20px;
  font-size: .875rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s ease, transform .15s ease;
  letter-spacing: .02em;
}

.dpc-btn:hover {
  background: #b8033f !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* ── Kein-Beiträge-Nachricht ───────────────────────────────────── */
.dpc-no-posts,
.dpc-no-results {
  text-align: center;
  color: var(--dpc-meta-color);
  padding: 40px;
  font-family: var(--dpc-font);
  grid-column: 1 / -1;
}

/* ================================================================
   Kategorie-Filter-Leiste
   ================================================================ */
.dpc-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  align-items: center;
}

.dpc-filter__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f0f2f5;
  color: #444;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 7px 18px;
  font-size: .83rem;
  font-weight: 600;
  font-family: var(--dpc-font);
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s, transform .15s;
  line-height: 1;
  letter-spacing: .02em;
}

.dpc-filter__btn:hover {
  background: #dde2ea;
  color: #D90452;
}

.dpc-filter__btn.is-active {
  background: #D90452 !important;
  color: #ffffff !important;
  border-color: #D90452 !important;
  transform: none;
}

.dpc-filter__btn.is-active:hover {
  background: #b8033f;
  border-color: #b8033f;
  color: #fff;
}

.dpc-card {
  transition: box-shadow .25s ease, transform .25s ease;
}

.dpc-grid {
  position: relative;
}

/* ================================================================
   "Weitere Beiträge" – AJAX Load-More Button
   ================================================================ */
.dpc-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 36px;
}

.dpc-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: #D90452;
  border: 2px solid #D90452;
  border-radius: 8px;
  padding: 12px 32px;
  font-size: .95rem;
  font-weight: 700;
  font-family: var(--dpc-font);
  cursor: pointer;
  letter-spacing: .03em;
  transition: background .2s ease, color .2s ease, transform .15s ease,
              box-shadow .2s ease, opacity .3s ease;
}

/* Pfeil-Icon */
.dpc-more-btn__icon {
  transition: transform .2s ease;
  flex-shrink: 0;
}

/* Spinner – standardmäßig unsichtbar */
.dpc-more-btn__spinner {
  display: none;
  animation: dpc-spin .75s linear infinite;
  flex-shrink: 0;
}

@keyframes dpc-spin {
  to { transform: rotate(360deg); }
}

/* Hover */
.dpc-more-btn:not(.is-loading):hover {
  background: #D90452;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30,58,95,.25);
}

.dpc-more-btn:not(.is-loading):hover .dpc-more-btn__icon {
  transform: translateY(3px);
}

/* Lade-Zustand */
.dpc-more-btn.is-loading {
  opacity: .7;
  cursor: wait;
}

.dpc-more-btn.is-loading .dpc-more-btn__icon {
  display: none;
}

.dpc-more-btn.is-loading .dpc-more-btn__spinner {
  display: block;
}

/* Versteckt / keine weiteren Posts */
.dpc-more-btn--hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Neu eingefügte Karten: fade-in ──────────────────────────── */
.dpc-card--new {
  opacity: 0;
  transform: translateY(16px);
}

/* Sobald JS die Klasse entfernt, läuft die Transition */
.dpc-card {
  transition: box-shadow .25s ease,
              transform   .3s ease,
              opacity     .3s ease;
}
