/* ============================================================
   Dynamic Post Grid Widget — Styles v1.3
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────── */
.dpg-wrapper {
  display: flex;
  gap: 16px;
  width: 100%;
  align-items: stretch;
  box-sizing: border-box;
}

/* ── Columns ─────────────────────────────────────────── */
.dpg-featured-col {
  flex: 0 0 52%;
  max-width: 52%;
  display: flex;
  flex-direction: column;
}

.dpg-grid-col {
  flex: 1 1 0;
  min-width: 0;
}

/* ── Grid inner ──────────────────────────────────────── */
.dpg-grid-inner {
  display: grid;
  gap: 16px;
  height: 100%;
}

/* 2-column grid: 2 equal rows to match featured height */
.dpg-grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.dpg-grid-cols-1 {
  grid-template-columns: 1fr;
}

/* ── Card base ───────────────────────────────────────── */
.dpg-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  display: block;
  height: 100%;
}

/* Featured card stretches to fill column */
.dpg-featured-col .dpg-card {
  flex: 1 1 auto;
  min-height: 420px;
}

/* Grid cards fill their grid cell */
.dpg-grid-col .dpg-card {
  min-height: 0;
  height: 100%;
}

.dpg-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
  position: relative;
}

/* ── Background cover ────────────────────────────────── */
.dpg-bg-cover {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.dpg-card:hover .dpg-bg-cover {
  transform: scale(1.06);
}

/* No thumbnail fallback */
.dpg-no-thumb {
  background-color: #d0d0d0;
}

/* ── Thumb wrap ──────────────────────────────────────── */
.dpg-thumb-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

/* ── Gradient overlay ────────────────────────────────── */
.dpg-overlay {
  --dpg-overlay-start: rgba(0, 0, 0, 0);
  --dpg-overlay-end: rgba(0, 0, 0, 0.82);
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    var(--dpg-overlay-start) 25%,
    var(--dpg-overlay-end) 100%
  );
  z-index: 1;
  pointer-events: none;
}

/* ── Content area ────────────────────────────────────── */
.dpg-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 20px 18px 18px;
}

/* ── Category Badge ──────────────────────────────────── */
.dpg-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 8px;
  position: relative;
  padding-bottom: 4px;
}

.dpg-badge::after {
  content: "";
  display: block;
  width: 28px;
  height: 2.5px;
  background: #e63946;
  margin-top: 4px;
  border-radius: 2px;
}

/* ── Title ───────────────────────────────────────────── */
.dpg-title {
  color: #fff;
  margin: 0;
  padding: 0;
  line-height: 1.35;
  font-weight: 700;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.dpg-featured-col .dpg-title {
  font-size: clamp(16px, 2vw, 22px);
}

.dpg-grid-col .dpg-title {
  font-size: clamp(12px, 1.2vw, 15px);
}

/* ── No posts placeholder ────────────────────────────── */
.dpg-no-posts {
  color: #888;
  font-size: 14px;
  padding: 20px;
  text-align: center;
  border: 1px dashed #ccc;
  border-radius: 12px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9f9f9;
}

/* ── Hover highlight bar ─────────────────────────────── */
.dpg-card::before {
  content: "";
  position: absolute;
  background: transparent;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 3;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
  border-radius: 12px 12px 0 0;
}

.dpg-card:hover::before {
  transform: scaleX(1);
}

/* ══ RESPONSIVE ═════════════════════════════════════════ */

@media (max-width: 1024px) {
  .dpg-featured-col .dpg-card {
    min-height: 340px;
  }
}

/* ── Mobile breakpoint styles are output as inline <style> per widget instance.
   Configure them in Elementor → Edit Widget → 📱 Mobile Settings. ── */

/* Shared mobile content padding for small screens */
@media (max-width: 768px) {
  .dpg-content {
    padding: 14px;
  }
  .dpg-grid-col .dpg-title {
    font-size: 14px;
  }
}
@media (max-width: 480px) {
  .dpg-content   { padding: 12px; }
  .dpg-badge     { font-size: 10px; }
  .dpg-featured-col .dpg-title { font-size: 16px; }
  .dpg-grid-col .dpg-title     { font-size: 13px; }
}

/* ── Elementor editor preview ────────────────────────── */
.elementor-editor-active .dpg-featured-col .dpg-card {
  min-height: 300px !important;
}
.elementor-editor-active .dpg-grid-col .dpg-card {
  min-height: 150px !important;
}
