/* =====================================================
   WP Post Grid Pro  –  style.css  v3.0
   News-optimised typography: Lora + Noto Sans
   ===================================================== */

/*
 * Lora        — Warm serif, excellent headline readability,
 *               used by major news publishers worldwide.
 * Noto Sans   — Clean humanist sans-serif, great legibility
 *               at small sizes, full Unicode/Devanagari support.
 */
@import url('https://fonts.googleapis.com/css2?family=Lora:wght@600;700&family=Noto+Sans:wght@400;500;600;700&display=swap');

/* ── Design tokens ── */
:root {
  --wpg-bg:       #f4f4ef;
  --wpg-card-bg:  #ffffff;
  --wpg-border:   #e5e5de;
  --wpg-text:     #111111;
  --wpg-muted:    #65717e;
  --wpg-accent:   #c0392b;          /* deep red — classic newspaper accent */
  --wpg-cat-bg:   #fdf0ef;
  --wpg-cat-txt:  #c0392b;
  --wpg-radius:   10px;
  --wpg-shadow:   0 1px 3px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
  --wpg-shadow-h: 0 4px 12px rgba(0,0,0,.10), 0 12px 32px rgba(0,0,0,.08);
  --wpg-tr:       .22s cubic-bezier(.4,0,.2,1);
  --wpg-fh:       'Lora', Georgia, 'Times New Roman', serif;
  --wpg-fb:       'Noto Sans', 'Segoe UI', Arial, sans-serif;
}

/* ── Root ── */
#wpg-root {
  font-family: var(--wpg-fb);
  max-width: 1280px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════
   GRID
═══════════════════════════════════════════ */
.wpg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 8px 0 32px;
}
@media (max-width: 900px) {
  .wpg-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
}
@media (max-width: 540px) {
  .wpg-grid { grid-template-columns: 1fr; gap: 14px; }
}

/* ═══════════════════════════════════════════
   CARD
═══════════════════════════════════════════ */
.wpg-card {
  background:    var(--wpg-card-bg);
  border:        1px solid var(--wpg-border);
  border-radius: var(--wpg-radius);
  overflow:      hidden;
  display:       flex;
  flex-direction: column;
  box-shadow:    var(--wpg-shadow);
  transition:    transform var(--wpg-tr), box-shadow var(--wpg-tr);
  animation:     wpg-fadeUp .4s ease both;
}
.wpg-card:hover {
  transform:  translateY(-4px);
  box-shadow: var(--wpg-shadow-h);
}

/* Image */
.wpg-card__img-wrap {
  position:   relative;
  overflow:   hidden;
  aspect-ratio: 16 / 9;
  background: #e8e8e4;
  flex-shrink: 0;
}
.wpg-card__img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s cubic-bezier(.4,0,.2,1);
}
.wpg-card:hover .wpg-card__img-wrap img { transform: scale(1.04); }

.wpg-card__img-wrap--empty {
  display:    flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0eafc, #cfdef3);
}

/* Body */
.wpg-card__body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Category badge */
.wpg-card__cat {
  display:        inline-block;
  background:     var(--wpg-cat-bg);
  color:          var(--wpg-cat-txt);
  font-family:    var(--wpg-fb);
  font-size:      10.5px;
  font-weight:    700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding:        3px 9px;
  border-radius:  4px;           /* sharp corners = editorial feel */
  text-decoration: none;
  margin-bottom:  9px;
  width: fit-content;
  transition: background var(--wpg-tr), color var(--wpg-tr);
}
.wpg-card__cat:hover { background: var(--wpg-accent); color: #fff; }

/* Title — Lora serif, optimised for news scannability */
.wpg-card__title {
  font-family:    var(--wpg-fh);
  font-size:      clamp(15px, 1.6vw, 18px);
  font-weight:    700;
  line-height:    1.38;
  color:          var(--wpg-text);
  margin-bottom:  8px;
  text-decoration: none;
  display:        -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow:       hidden;
  /* Crisp rendering on all screens */
  -webkit-font-smoothing:  antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.wpg-card__title:hover { color: var(--wpg-accent); }

/* Excerpt — Noto Sans, readable at 13px on mobile */
.wpg-card__excerpt {
  font-family:    var(--wpg-fb);
  font-size:      13px;
  font-weight:    400;
  color:          var(--wpg-muted);
  line-height:    1.65;
  margin-bottom:  14px;
  display:        -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow:       hidden;
  flex:           1;
}

/* Meta */
.wpg-card__meta {
  display:    flex;
  flex-wrap:  wrap;
  gap:        5px 12px;
  font-family: var(--wpg-fb);
  font-size:  11.5px;
  font-weight: 500;
  color:      var(--wpg-muted);
  margin-bottom: 15px;
  align-items: center;
}
.wpg-card__meta-item {
  display:    flex;
  align-items: center;
  gap: 4px;
}
.wpg-card__meta-item svg {
  width: 11px; height: 11px;
  fill: currentColor;
  opacity: .6;
  flex-shrink: 0;
}

/* Button */
.wpg-card__btn {
  display:    inline-block;
  border:     1.5px solid var(--wpg-accent);
  color:      var(--wpg-accent);
  background: transparent;
  padding:    6px 18px;
  border-radius: 4px;            /* editorial square corners */
  font-family: var(--wpg-fb);
  font-size:  12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  width: fit-content;
  transition: background var(--wpg-tr), color var(--wpg-tr);
}
.wpg-card__btn:hover {
  background: var(--wpg-accent);
  color: #fff;
}

/* Stagger animation on first batch */
.wpg-card:nth-child(1) { animation-delay: .04s; }
.wpg-card:nth-child(2) { animation-delay: .08s; }
.wpg-card:nth-child(3) { animation-delay: .12s; }
.wpg-card:nth-child(4) { animation-delay: .16s; }
.wpg-card:nth-child(5) { animation-delay: .20s; }
.wpg-card:nth-child(6) { animation-delay: .24s; }

/* ═══════════════════════════════════════════
   AD SLOT  (full-width row)
   Desktop ≥ 768px : 728 × 90  Leaderboard
   Mobile  < 768px : 320 × 50  Mobile Banner
═══════════════════════════════════════════ */
.wpg-ad-slot {
  grid-column: 1 / -1;
  background:  #fafaf8;
  border:      1px dashed #d1d5db;
  border-radius: var(--wpg-radius);
  padding:     14px 16px;
  display:     flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height:  120px;
  overflow:    hidden;
  animation:   wpg-fadeUp .35s ease both;
}

.wpg-ad-slot__label {
  font-size:   10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color:       #9ca3af;
  font-weight: 500;
  margin-bottom: 6px;
}

/* Desktop: 728 × 90 */
.wpg-ad-unit {
  display:   block !important;
  width:     728px !important;
  height:    90px !important;
  max-width: 100%;
}

/* Mobile: 320 × 50 */
@media (max-width: 767px) {
  .wpg-ad-slot { min-height: 76px; padding: 10px 12px; }
  .wpg-ad-unit { width: 320px !important; height: 50px !important; }
}

/* ═══════════════════════════════════════════
   SKELETON  (shimmer placeholders)
═══════════════════════════════════════════ */
@keyframes wpg-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.wpg-skeleton {
  background:    var(--wpg-card-bg);
  border:        1px solid var(--wpg-border);
  border-radius: var(--wpg-radius);
  overflow:      hidden;
  box-shadow:    var(--wpg-shadow);
}

.wpg-skel-line {
  border-radius: 6px;
  background: linear-gradient(90deg, #ebebeb 25%, #f5f5f5 37%, #ebebeb 63%);
  background-size: 600px 100%;
  animation: wpg-shimmer 1.3s infinite linear;
}

.wpg-skel-img   { aspect-ratio: 16/9; border-radius: 0; }
.wpg-skel-body  { padding: 18px 20px; }
.wpg-skel-cat   { height: 18px; width: 70px;  margin-bottom: 12px; }
.wpg-skel-title { height: 16px; width: 90%;   margin-bottom: 8px;  }
.wpg-skel-title2{ height: 16px; width: 65%;   margin-bottom: 14px; }
.wpg-skel-meta  { height: 12px; width: 55%;   margin-bottom: 16px; }
.wpg-skel-btn   { height: 32px; width: 100px; border-radius: 30px; }

/* ═══════════════════════════════════════════
   SPINNER  (subsequent-load indicator)
═══════════════════════════════════════════ */
.wpg-spinner {
  display:         flex;
  justify-content: center;
  align-items:     center;
  padding:         28px 0;
}
.wpg-spinner__dot {
  width:  9px; height: 9px;
  border-radius: 50%;
  background: var(--wpg-accent);
  margin: 0 4px;
  animation: wpg-bounce 1.1s infinite ease-in-out both;
}
.wpg-spinner__dot:nth-child(1) { animation-delay: -.32s; }
.wpg-spinner__dot:nth-child(2) { animation-delay: -.16s; }
.wpg-spinner__dot:nth-child(3) { animation-delay:    0s; }

/* ═══════════════════════════════════════════
   END  &  ANIMATIONS
═══════════════════════════════════════════ */
.wpg-end-msg {
  text-align:  center;
  padding:     32px 0;
  color:       var(--wpg-muted);
  font-size:   14px;
  font-style:  italic;
  letter-spacing: .02em;
}

/* ── Error state — shown once, never repeats ── */
.wpg-error-msg {
  text-align:    center;
  padding:       20px 16px;
  color:         #dc2626;
  font-size:     13px;
  line-height:   1.6;
  background:    #fef2f2;
  border:        1px solid #fecaca;
  border-radius: var(--wpg-radius);
  margin:        16px 0;
}

@keyframes wpg-fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes wpg-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: .3; }
  40%           { transform: scale(1); opacity: 1;  }
}

/* ── Reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
  .wpg-card,
  .wpg-ad-slot       { animation: none; }
  .wpg-skel-line     { animation: none; background: #ececec; }
  .wpg-spinner__dot  { animation: none; }
}
