/* ================================================================
   Newsletter Post Form — Frontend Styles
   2-column desktop / 1-column mobile card grid + popup modal
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Source+Sans+3:wght@400;500;600&display=swap');

/* ── Variables ─────────────────────────────────────────── */
:root {
  --npf-green:        #1a6b3a;
  --npf-green-hover:  #145230;
  --npf-text:         #1a2332;
  --npf-muted:        #6b7280;
  --npf-light-muted:  #9ca3af;
  --npf-border:       #e5e7eb;
  --npf-bg:           #f5f5f0;
  --npf-white:        #ffffff;
  --npf-radius:       12px;
  --npf-shadow:       0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.06);
  --npf-shadow-hov:   0 8px 32px rgba(0,0,0,.13);
  --npf-transition:   .25s cubic-bezier(.4,0,.2,1);
  --npf-modal-z:      99999;
}

/* ── Reset / Base ──────────────────────────────────────── */
.npf-container *,
.npf-modal-overlay * {
  box-sizing: border-box;
}

.npf-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 64px;
  font-family: 'Source Sans 3', sans-serif;
  color: var(--npf-text);
}

/* ── Grid ──────────────────────────────────────────────── */
.npf-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

/* ── Card ──────────────────────────────────────────────── */
.npf-card {
  background: var(--npf-white);
  border: 1px solid var(--npf-border);
  border-radius: var(--npf-radius);
  overflow: hidden;
  box-shadow: var(--npf-shadow);
  display: flex;
  flex-direction: column;
  cursor: default;
  transition: transform var(--npf-transition), box-shadow var(--npf-transition);
}

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

/* ── Card Image ────────────────────────────────────────── */
.npf-card-img-wrap {
  width: 100%;
  overflow: hidden;
  aspect-ratio: 11 / 6;       /* matches ~660×360 ratio */
  background: #e9e9e6;
  flex-shrink: 0;
}

.npf-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform .4s ease;
}

.npf-card:hover .npf-thumb {
  transform: scale(1.04);
}

.npf-no-img {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--npf-light-muted);
}

/* ── Card Meta (date + author) ─────────────────────────── */
.npf-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px 0;
}

.npf-meta-date,
.npf-meta-author {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--npf-muted);
  line-height: 1.4;
}

.npf-icon {
  font-size: 13px;
  flex-shrink: 0;
}

/* ── Card Title ────────────────────────────────────────── */
.npf-card-title {
  margin: 10px 20px 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--npf-text);
}

/* ── 3-Line Excerpt ────────────────────────────────────── */
.npf-card-excerpt {
  margin: 8px 20px 0;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--npf-muted);

  /* Hard 3-line clamp */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* ── Read More ─────────────────────────────────────────── */
.npf-read-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 14px 20px 20px;
  padding: 0;
  background: none;
  border: none;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--npf-green);
  cursor: pointer;
  transition: color var(--npf-transition), gap var(--npf-transition);
  text-decoration: none;
  width: fit-content;
}

.npf-read-more:hover {
  color: var(--npf-green-hover);
  gap: 8px;
}

/* ── Empty State ───────────────────────────────────────── */
.npf-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 20px;
  color: var(--npf-muted);
}

.npf-empty-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

/* ════════════════════════════════════════════════════════
   MODAL OVERLAY
   ════════════════════════════════════════════════════════ */
.npf-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--npf-modal-z);
  background: rgba(15, 20, 30, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .3s ease;
}

.npf-modal-overlay.npf-modal-open {
  opacity: 1;
}

/* Hide when [hidden] attr present — before JS opens */
.npf-modal-overlay[hidden] {
  display: none !important;
}

/* ── Modal Box ─────────────────────────────────────────── */
.npf-modal-box {
  background: var(--npf-white);
  border-radius: 16px;
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(24px) scale(.97);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.npf-modal-overlay.npf-modal-open .npf-modal-box {
  transform: translateY(0) scale(1);
}

/* ── Close Button ──────────────────────────────────────── */
.npf-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(4px);
  color: var(--npf-text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: background var(--npf-transition), transform var(--npf-transition);
}

.npf-modal-close:hover {
  background: #fff;
  transform: scale(1.1);
}

/* ── Modal Image ───────────────────────────────────────── */
.npf-modal-img-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
  background: #e9e9e6;
  aspect-ratio: 19 / 10;
}

.npf-modal-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.npf-modal-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--npf-light-muted);
}

/* ── Modal Body ────────────────────────────────────────── */
.npf-modal-body {
  padding: 28px 32px 36px;
}

/* ── Modal Meta ────────────────────────────────────────── */
.npf-modal-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.npf-modal-meta-date,
.npf-modal-meta-author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--npf-muted);
}

/* ── Modal Title ───────────────────────────────────────── */
.npf-modal-title {
  margin: 0 0 16px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--npf-text);
}

/* ── Modal Full Content ────────────────────────────────── */
.npf-modal-content {
  font-size: 15.5px;
  line-height: 1.8;
  color: #374151;
}

.npf-modal-content p {
  margin: 0 0 1em;
}

.npf-modal-content p:last-child {
  margin-bottom: 0;
}

/* ── Divider inside modal ──────────────────────────────── */
.npf-modal-divider {
  width: 48px;
  height: 3px;
  background: var(--npf-green);
  border-radius: 2px;
  margin: 0 0 18px;
}

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

/* Tablet */
@media (max-width: 900px) {
  .npf-grid {
    gap: 20px;
  }
  .npf-modal-title {
    font-size: 22px;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .npf-container {
    padding: 0 14px 48px;
  }

  /* Switch to single column */
  .npf-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .npf-card-img-wrap {
    aspect-ratio: 16 / 9;
  }

  .npf-card-title {
    font-size: 17px;
  }

  .npf-card-excerpt {
    font-size: 14px;
  }

  /* Modal full-screen on mobile */
  .npf-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .npf-modal-box {
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    max-width: 100%;
  }

  .npf-modal-img-wrap {
    border-radius: 20px 20px 0 0;
  }

  .npf-modal-body {
    padding: 20px 18px 32px;
  }

  .npf-modal-title {
    font-size: 20px;
  }

  .npf-modal-content {
    font-size: 15px;
  }
}
