/* ============================================
   POSTS INDEX PAGE
   Layout: Hero + category bar + grid + sidebar
   Dark UI to match VAN brand
============================================ */

/* ---------------
   Root container
   --------------- */

.posts-page {
  /* Soft radial background with brand colours */
  background: radial-gradient(
      circle at top,
      rgba(245, 178, 0, 0.11),
      transparent 55%
    ),
    radial-gradient(circle at bottom, rgba(37, 99, 235, 0.12), #020617 70%);
  min-height: 100vh;
  padding: 1.5rem 1rem 3rem;
  color: #e5e7eb;
}

.posts-page-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* ============================================
   HERO FEATURED POST
   - Uses background-image for hero
   - Recommended hero image: 1600x900 (16:9)
============================================ */

.posts-hero {
  position: relative;
  border-radius: 1.5rem;
  overflow: hidden;
  min-height: 260px;
  margin-bottom: 2rem;
  background: #020617;
  isolation: isolate; /* so overlay effects don't leak */
  color: #f9fafb;
}

/* Hero backdrop
   - uses CSS background for flexible cropping
   - recommended asset: 1600x900px / 16:9
*/
.posts-hero-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.05);
  filter: brightness(0.7);
  transition: transform 0.4s ease, filter 0.4s ease;
}

/* Gradient overlay to improve text contrast */
.posts-hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(
      circle at top left,
      rgba(15, 23, 42, 0.2),
      transparent 55%
    ),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.1), #020617 82%);
}

/* Hover: slight zoom & brighten backdrop */
.posts-hero:hover .posts-hero-backdrop {
  transform: scale(1.08);
  filter: brightness(0.78);
}

/* Hero content block */
.posts-hero-content {
  position: relative;
  padding: 1.75rem 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 680px;
}

/* Kicker row: "Featured" badge + category pill */
.posts-hero-kicker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.25rem;
}

/* Small uppercase badge */
.posts-hero-kicker-badge {
  font-size: 0.7rem;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  border: 1px solid rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.08);
  color: #bbf7d0;
}

/* Category label */
.posts-hero-category-pill {
  font-size: 0.7rem;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(248, 250, 252, 0.18);
  background: rgba(15, 23, 42, 0.75);
  color: #e5e7eb;
}

/* Hero title */
.posts-hero-title {
  font-family: Poppins, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.75rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0.25rem 0 0.35rem;
}

.posts-hero-title a {
  color: #f9fafb;
  text-decoration: none;
}

.posts-hero-title a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* Short hero summary */
.posts-hero-tagline {
  font-size: 0.93rem;
  line-height: 1.6;
  color: #e5e7eb;
  max-width: 40rem;
}

/* Meta row: author, role, time, reading time */
.posts-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.78rem;
  color: #cbd5f5;
  opacity: 0.95;
}

/* Small dot separator (also used globally) */
.posts-hero-meta .dot,
.dot {
  opacity: 0.6;
}

/* Hero actions: CTAs row */
.posts-hero-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* Shared button base */
.posts-hero-btn-primary,
.posts-hero-btn-secondary,
.posts-hero-btn-icon {
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.55rem 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
}

/* Primary CTA */
.posts-hero-btn-primary {
  background: linear-gradient(135deg, #f5b200, #f97316);
  color: #020617;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.65);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.posts-hero-btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.78);
}

/* Secondary CTA */
.posts-hero-btn-secondary {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.posts-hero-btn-secondary:hover {
  border-color: rgba(248, 250, 252, 0.9);
}

/* Icon / beta CTA */
.posts-hero-btn-icon {
  padding-inline: 0.95rem;
  background: rgba(15, 23, 42, 0.75);
  color: #e5e7eb;
  border: 1px dashed rgba(148, 163, 184, 0.7);
}

.posts-hero-btn-icon:hover {
  border-style: solid;
}

/* Accessibility: focus outlines */
.posts-hero-btn-primary:focus-visible,
.posts-hero-btn-secondary:focus-visible,
.posts-hero-btn-icon:focus-visible,
.posts-filter-btn:focus-visible,
.posts-category-pill:focus-visible,
.posts-pagination-btn:focus-visible {
  outline: 2px solid #f5b200;
  outline-offset: 2px;
}

/* ============================================
   CATEGORY BAR + SEARCH
   - Sticky-like tools just under hero
============================================ */

.posts-categories-bar {
  margin-bottom: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Horizontal scroll list for categories */
.posts-categories-scroll {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  scrollbar-width: thin;
}

/* Custom scrollbar (WebKit) */
.posts-categories-scroll::-webkit-scrollbar {
  height: 4px;
}

.posts-categories-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.posts-categories-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 999px;
}

/* Category pill buttons */
.posts-category-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.85);
  color: #e5e7eb;
  font-size: 0.78rem;
  padding: 0.35rem 0.95rem;
  cursor: pointer;
  white-space: nowrap;
}

/* Hover states */
.posts-category-pill:hover {
  border-color: rgba(248, 250, 252, 0.9);
}

/* Active category */
.posts-category-pill.is-active {
  background: rgba(245, 178, 0, 0.12);
  border-color: #f5b200;
  color: #fefce8;
}

/* Search + filter container */
.posts-categories-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
}

/* Search input wrapper (full-width on small) */
.posts-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

/* Search input */
.posts-search-wrap input[type="search"] {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.92);
  color: #e5e7eb;
  padding: 0.55rem 0.9rem;
  font-size: 0.8rem;
}

.posts-search-wrap input[type="search"]::placeholder {
  color: #6b7280;
}

/* Filter button */
.posts-filter-btn {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.8rem;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

/* ============================================
   MAIN LAYOUT: GRID + SIDEBAR
============================================ */

.posts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

/* Main column */
.posts-main {
  min-width: 0;
}

/* Section block */
.posts-section {
  margin-bottom: 1.5rem;
}

/* Section header: title + subtitle + link */
.posts-section-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.posts-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f9fafb;
}

.posts-section-subtitle {
  font-size: 0.78rem;
  color: #9ca3af;
  margin-top: 0.2rem;
}

/* View all link */
.posts-section-link {
  font-size: 0.8rem;
  color: #f5b200;
  text-decoration: none;
}

.posts-section-link:hover {
  text-decoration: underline;
}

/* ============================================
   POSTS GRID
   - Cards for $latestPosts (partial: _card.php)
   - RECOMMENDED CARD IMAGE:
   - 800 x 450px (16:9) in the partial
============================================ */

.posts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

/* If _card.php uses this class, we enforce aspect ratio
   Example inside the partial:
   <img class="posts-card-image" src="..." alt="...">
*/
.posts-card-image {
  width: 100%;
  aspect-ratio: 16 / 9; /* maintain 16:9 card thumbnails */
  object-fit: cover;
  border-radius: 0.75rem;
  display: block;
}

/* ============================================
   PAGINATION
============================================ */

.posts-pagination {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.posts-pagination-btn {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  font-size: 0.8rem;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}

/* Active page */
.posts-pagination-btn.is-active {
  background: #f5b200;
  border-color: #f5b200;
  color: #020617;
}

/* Next button spacing */
.posts-pagination-next {
  margin-left: 0.2rem;
}

/* ============================================
   SIDEBAR
============================================ */

.posts-sidebar {
  min-width: 0;
}

/* Sidebar section card */
.posts-sidebar-section {
  background: rgba(15, 23, 42, 0.96);
  border-radius: 1rem;
  padding: 1.1rem 1rem;
  border: 1px solid rgba(31, 41, 55, 0.85);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  margin-bottom: 1rem;
}

/* Special styling for newsletter CTA block */
.posts-sidebar-section--cta {
  background: radial-gradient(
      circle at top left,
      rgba(245, 158, 11, 0.26),
      transparent 55%
    ),
    rgba(15, 23, 42, 0.98);
  border-color: rgba(245, 158, 11, 0.6);
}

/* Sidebar header: title + small action */
.posts-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.posts-sidebar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f9fafb;
}

/* Small "Refresh" button */
.posts-sidebar-refresh-btn {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: transparent;
  color: #e5e7eb;
  font-size: 0.7rem;
  padding: 0.25rem 0.65rem;
  cursor: pointer;
}

/* Popular list */
.posts-popular-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Popular item: rank + text */
.posts-popular-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.45rem 0;
}

/* Rank circle */
.posts-popular-rank {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #e5e7eb;
}

/* Popular body */
.posts-popular-body {
  min-width: 0;
}

/* Popular post title */
.posts-popular-title {
  font-size: 0.8rem;
  color: #e5e7eb;
  text-decoration: none;
}

.posts-popular-title:hover {
  text-decoration: underline;
}

/* Popular meta (e.g., "2 days ago") */
.posts-popular-meta {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 0.1rem;
}

/* Topics / tags pills */
.posts-sidebar-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.posts-topic-pill {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  text-decoration: none;
  color: #e5e7eb;
  background: rgba(15, 23, 42, 0.9);
}

/* Newsletter copy */
.posts-sidebar-text {
  font-size: 0.8rem;
  color: #e5e7eb;
  margin-bottom: 0.7rem;
}

/* Newsletter form */
.posts-sidebar-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

/* Newsletter email input */
.posts-sidebar-form input[type="email"] {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.9);
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

/* Newsletter submit button */
.posts-sidebar-form button {
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #f5b200, #f97316);
  color: #020617;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

/* Small note under form */
.posts-sidebar-note {
  font-size: 0.7rem;
  color: #9ca3af;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
============================================ */

@media (min-width: 640px) {
  /* Hero spacing on small tablets */
  .posts-hero-content {
    padding: 2rem 2rem 2rem;
  }

  .posts-hero-title {
    font-size: 2.1rem;
  }

  .posts-hero-actions {
    gap: 0.75rem;
  }

  /* 2-column grid for posts */
  .posts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Category bar: categories left, tools right */
  .posts-categories-bar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .posts-categories-bar > .posts-categories-scroll {
    flex: 1;
  }

  .posts-categories-tools {
    max-width: 360px;
  }
}

@media (min-width: 1024px) {
  /* Larger hero on desktop */
  .posts-hero {
    min-height: 320px;
  }

  .posts-hero-title {
    font-size: 2.4rem;
  }

  /* Two-column layout: main + sidebar */
  .posts-layout {
    grid-template-columns:
      minmax(0, 1.9fr)
      minmax(260px, 1fr);
    align-items: flex-start;
  }

  /* 3-column grid for posts on large screens */
  .posts-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
