/* ── Blog page-scoped styles ── */

/* Hero */
.blog-hero {
  position: relative;
  padding: 4.5rem 0 3.5rem;
  text-align: center;
  overflow: hidden;
}

/* ── Blog page: reduce section padding on mobile to kill the huge gap ── */
@media (max-width: 959px) {
  .blog-hero.section {
    padding: 2.5rem 0 1.5rem;
  }
  section#posts.section {
    padding-top: 0.5rem;
    padding-bottom: 2rem;
  }
}

@media (max-width: 480px) {
  .blog-hero.section {
    padding: 2rem 0 1rem;
  }
  section#posts.section {
    padding-top: 0.25rem;
    padding-bottom: 1.5rem;
  }
}

.blog-hero::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 30% -10%, rgba(243, 207, 122, 0.14), transparent 50%),
    radial-gradient(circle at 70% 0, rgba(194, 140, 255, 0.22), transparent 55%);
  opacity: 0.8;
  z-index: -2;
}

.blog-hero-inner {
  max-width: 680px;
  margin: 0 auto;
}

.blog-hero h1 {
  font-family: "Marcellus", serif;
  font-weight: 400;
  font-size: clamp(2rem, 3.5vw, 2.6rem);
  letter-spacing: 0.04em;
  margin: 0 0 0.8rem;
}

.blog-hero-sub {
  color: var(--text-muted);
  font-size: 0.97rem;
  margin: 0;
}

/* ── Layout: main + sidebar ── */
.blog-layout {
  display: grid;
  gap: 2.5rem;
  align-items: flex-start;
}

@media (min-width: 960px) {
  .blog-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

/* ── Blog grid ── */
.blog-grid {
  display: grid;
  gap: 2rem;
  min-width: 0;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  padding: 2rem 0;
}

/* ── Blog card ──
   FIX: No longer uses .card base class (was adding unwanted padding:1.75rem).
   All padding is self-contained here. */
.blog-card {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
  /* Safari border-radius overflow fix */
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
}

.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 60px rgba(194, 140, 255, 0.12);
}

.blog-card-media {
  display: block;
  position: relative;
  overflow: hidden;
}

.blog-card-media-inner {
  position: relative;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  isolation: isolate;
}

.blog-card-img,
.blog-card-img-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.blog-card-img-placeholder {
  background:
    radial-gradient(circle at 30% 25%, rgba(243, 207, 122, 0.22), transparent 55%),
    radial-gradient(circle at 80% 75%, rgba(194, 140, 255, 0.26), transparent 55%),
    linear-gradient(145deg, #0e1122, #1a1230);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Marcellus", serif;
  font-size: 1.6rem;
  color: rgba(243, 207, 122, 0.45);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.blog-card-media-inner::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 45%;
  background: linear-gradient(to top, rgba(4, 5, 15, 0.95), transparent);
  pointer-events: none;
}

.blog-card-category {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.blog-card-body {
  padding: 1.25rem 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.45rem;
}

.blog-card-title {
  font-family: "Marcellus", serif;
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-title a {
  color: var(--text-main);
  transition: color 0.2s ease;
}

.blog-card-title a:hover { color: var(--accent); }

.blog-card-excerpt {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.35rem;
  font-size: 0.78rem;
}

.blog-card-date {
  font-size: 0.78rem;
  color: var(--text-soft);
  white-space: nowrap;
}

.blog-card-read {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.blog-card:hover .blog-card-read {
  color: #fff;
  transform: translateX(2px);
}

/* ── Sidebar ── */
.blog-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

@media (max-width: 959px) {
  .blog-sidebar { display: none; }
}

.sidebar-block {
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 1.3rem 1.3rem 1.4rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.sidebar-title {
  font-family: "Marcellus", serif;
  font-weight: 400;
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.sidebar-search { display: flex; gap: 0.5rem; }
.sidebar-search input { flex: 1; min-width: 0; }
.sidebar-search button { flex-shrink: 0; }

.sidebar-list { list-style: none; padding: 0; margin: 0; }
.sidebar-list li { border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-list li:last-child { border-bottom: none; }

.sidebar-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.sidebar-list a:hover { color: #fff; }

.sidebar-list a.active { color: var(--accent); font-weight: 500; }
.sidebar-list a.active .sidebar-count {
  background: rgba(243, 207, 122, 0.2);
  color: var(--accent);
}

.sidebar-count {
  font-size: 0.72rem;
  color: var(--text-soft);
  background: rgba(255,255,255,0.06);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.sidebar-recent-item {
  display: block;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-recent-item:last-child { border-bottom: none; }

.sidebar-recent-title {
  font-size: 0.85rem;
  color: var(--text-main);
  transition: color 0.2s ease;
  line-height: 1.35;
}

.sidebar-recent-item:hover .sidebar-recent-title { color: var(--accent); }

.sidebar-recent-date {
  font-size: 0.72rem;
  color: var(--text-soft);
  margin-top: 0.15rem;
}

.sidebar-cta {
  text-align: center;
  background:
    radial-gradient(circle at 40% 20%, rgba(243,207,122,0.1), transparent 55%),
    radial-gradient(circle at 80% 85%, rgba(194,140,255,0.12), transparent 50%);
  background-color: var(--bg-card);
}

.sidebar-cta-title {
  font-family: "Marcellus", serif;
  font-weight: 400;
  font-size: 1.05rem;
  margin: 0 0 0.45rem;
}

.sidebar-cta-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

/* ── Pagination (desktop) ── */
.blog-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(5,7,18,0.7);
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  font-family: inherit;
}

.page-btn:hover {
  background: rgba(243,207,122,0.1);
  border-color: rgba(243,207,122,0.5);
  color: var(--accent);
}

.page-btn.active {
  background: rgba(243,207,122,0.14);
  border-color: rgba(243,207,122,0.7);
  color: var(--accent);
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.page-dots {
  color: var(--text-soft);
  font-size: 0.82rem;
  padding: 0 0.25rem;
}

/* ── Empty / error state ── */
.blog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Ad slots ── */
.blog-grid-ad {
  margin: 0.5rem 0;
  min-height: 1px;
  max-width: 100%;
  overflow: hidden;
}

.blog-grid-ad * { max-width: 100%; }

/* ── Filter Pills — visible ALL screen sizes ── */
.filter-pills-container {
  margin-bottom: 1.5rem;
  overflow-x: auto;
  white-space: nowrap;
  padding: 0.5rem 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  display: flex;
  gap: 0.6rem;
}

.filter-pills-container::-webkit-scrollbar { display: none; }

.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.filter-pill:hover {
  background: rgba(243,207,122,0.05);
  border-color: rgba(243,207,122,0.3);
  color: var(--accent);
}

.filter-pill.active {
  background: rgba(243,207,122,0.12);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
  box-shadow: 0 0 15px rgba(243,207,122,0.1);
}

/* ── Mobile pagination nav — hidden by default, JS shows it ──
   FIX: was missing base display style, causing layout issues */
.mobile-blog-nav {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.mobile-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.5rem;
  height: 48px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mobile-nav-btn:hover {
  border-color: rgba(243,207,122,0.4);
  color: var(--accent);
}

.mobile-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.mobile-page-counter {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 3rem;
  text-align: center;
}

/* ── Skeleton Loading Cards — ALL screen sizes ──
   FIX: was only inside @media (max-width: 959px), so desktop showed blank page */
.skeleton-card {
  background: rgba(255,255,255,0.03);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.05);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  min-height: 280px;
}

.skeleton-img {
  width: 100%;
  height: 180px;
  background: rgba(255,255,255,0.04);
  border-radius: 16px 16px 0 0;
  flex-shrink: 0;
}

.skeleton-body {
  flex: 1;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  justify-content: center;
}

.skeleton-title {
  height: 1rem;
  width: 85%;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
}

.skeleton-text {
  height: 0.75rem;
  width: 65%;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
}

.skeleton-footer {
  height: 0.75rem;
  width: 40%;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE OPTIMIZATIONS  (≤ 959px — tablet + phone)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 959px) {

  /* ── 0. Stop any horizontal overflow ── */
  .blog-hero,
  .blog-layout,
  .blog-main,
  .blog-grid {
    overflow-x: hidden;
    max-width: 100%;
  }

  /* ── 1. Sticky search bar below header ── */
  .mobile-search-bar {
    position: sticky;
    top: 60px;            /* matches actual header height (~60px on mobile) */
    z-index: 81;
    background: rgba(4, 5, 15, 0.95);
    padding: 0.7rem 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin: 0 -1rem;      /* extend behind container padding */
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
    width: calc(100% + 2rem);
  }

  .mobile-search-bar .sidebar-search {
    width: 100%;
    gap: 0.6rem;
    display: flex;
  }

  /* FIX: font-size 16px prevents iOS Safari auto-zoom on input focus */
  .mobile-search-bar input {
    height: 44px;
    font-size: 16px !important;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    flex: 1;
    min-width: 0;
  }

  .mobile-search-bar button {
    height: 44px;
    min-width: 44px;
    flex-shrink: 0;
    /* override styles.css btn-full rule that sets width:100% at ≤480px */
    width: auto !important;
    padding: 0 0.85rem;
  }

  /* ── 2. Sticky filter pills below search bar ── */
  .filter-pills-container {
    position: sticky;
    top: 112px;           /* 60px header + 52px search bar */
    z-index: 80;
    margin: 0 -1rem 1.25rem;
    width: calc(100% + 2rem);
    background: rgba(4, 5, 15, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 0.6rem 1rem;
    gap: 0.65rem;
    scroll-snap-type: x mandatory;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    box-sizing: border-box;
    overflow-x: auto;
    white-space: nowrap;
  }

  .filter-pill {
    scroll-snap-align: center;
    min-height: 40px;
    padding: 0.45rem 1.1rem;
    font-size: 0.8rem;
    /* override styles.css .btn { width:100% } at ≤480px */
    width: auto !important;
    flex-shrink: 0;
  }

  .filter-pill.active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(243,207,122,0.12);
    box-shadow: 0 0 18px rgba(243,207,122,0.15);
  }

  /* ── 3. Blog grid: single-column, uses flex to prevent minmax overflow ── */
  .blog-grid {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: 0.75rem 0;
    width: 100%;
    box-sizing: border-box;
  }

  /* ── 4. Blog cards: vertical stacked layout ── */
  .blog-card,
  .blog-card.featured-card {
    flex-direction: column;
    min-height: auto;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
  }

  .blog-card-media,
  .featured-card .blog-card-media {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    flex-shrink: 0;
  }

  .blog-card-media-inner,
  .featured-card .blog-card-media-inner {
    width: 100%;
    height: 100%;
    border-radius: 16px 16px 0 0;
  }

  /* Images fully responsive */
  .blog-card-img,
  .blog-card-img-placeholder {
    width: 100%;
    height: 100%;
    max-width: 100%;
    aspect-ratio: auto;
    object-fit: cover;
  }

  .blog-card-category {
    font-size: 0.65rem;
    padding: 0.2rem 0.65rem;
    left: 0.6rem;
    bottom: 0.6rem;
  }

  .blog-card-body,
  .featured-card .blog-card-body {
    padding: 1rem 1.1rem 1.2rem;
    justify-content: flex-start;
    gap: 0.5rem;
    box-sizing: border-box;
  }

  .blog-card-title {
    font-size: 1.05rem;
    line-height: 1.4;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    margin-bottom: 0.1rem;
  }

  .blog-card-excerpt,
  .featured-card .blog-card-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
  }

  .blog-card-footer {
    gap: 0.5rem;
  }

  .blog-card-read { font-size: 0.75rem; }

  /* ── 5. Skeleton mobile overrides ── */
  .skeleton-card,
  .skeleton-card.featured-skeleton {
    flex-direction: column;
    min-height: 240px;
    width: 100%;
    box-sizing: border-box;
  }

  .skeleton-img,
  .featured-skeleton .skeleton-img {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 ratio */
    border-radius: 16px 16px 0 0;
    position: relative;
  }

  /* ── 6. Mobile nav pagination ── */
  .mobile-blog-nav {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .mobile-nav-btn {
    height: 48px;
    min-height: 44px;
    /* override any full-width rule */
    width: auto !important;
    padding: 0 1.25rem;
  }

  /* ── 7. Hide desktop pagination on mobile ── */
  .blog-pagination { display: none !important; }

  /* ── 8. Footer safe area ── */
  .site-footer {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  /* ── 9. Touch interaction improvements ── */
  .btn, .page-btn, .filter-pill, .nav-links a, .mobile-nav-btn, .blog-card a {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  /* ── 10. Disable hover lift on touch devices ── */
  @media (hover: none) {
    .blog-card:hover,
    .blog-card.card:hover {
      transform: none !important;
      box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65) !important;
    }
  }
}

/* ══════════════════════════════════════════════════════════════
   SMALL PHONES  (≤ 480px — 360px, 375px, 390px, 412px, 430px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  /* ── Hero ── */
  .blog-hero {
    padding: 3rem 0 2rem;
  }

  .blog-hero h1 {
    font-size: clamp(1.6rem, 6.5vw, 2rem);
    line-height: 1.2;
    padding: 0 4px;
  }

  .blog-hero-sub {
    font-size: 0.9rem;
    padding: 0 4px;
  }

  /* ── Layout gap reduction ── */
  .blog-layout {
    gap: 1rem;
  }

  /* ── Search bar ── */
  .mobile-search-bar {
    top: 56px; /* smaller header on tiny phones */
    padding: 0.6rem 0.85rem;
    margin: 0 -0.85rem;
    width: calc(100% + 1.7rem);
  }

  .mobile-search-bar input {
    height: 42px;
    font-size: 16px !important;
  }

  /* ── Filter pills position update ── */
  .filter-pills-container {
    top: 106px; /* 56px header + 50px search */
    padding: 0.55rem 0.85rem;
    margin: 0 -0.85rem 1rem;
    width: calc(100% + 1.7rem);
    gap: 0.5rem;
  }

  .filter-pill {
    min-height: 38px;
    padding: 0.4rem 0.9rem;
    font-size: 0.78rem;
  }

  /* ── Card adjustments ── */
  .blog-card {
    border-radius: 14px;
  }

  .blog-card-media-inner {
    border-radius: 14px 14px 0 0;
  }

  .blog-card-body {
    padding: 0.9rem 1rem 1.1rem;
    gap: 0.45rem;
  }

  .blog-card-title {
    font-size: 1rem;
    line-height: 1.4;
  }

  .blog-card-excerpt {
    font-size: 0.83rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .blog-card-date {
    font-size: 0.74rem;
  }

  .blog-card-read {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
  }

  /* ── Grid spacing ── */
  .blog-grid {
    gap: 1rem;
    padding: 0.5rem 0;
  }

  /* ── Skeleton ── */
  .skeleton-card {
    border-radius: 14px;
    min-height: 220px;
  }

  .skeleton-img {
    border-radius: 14px 14px 0 0;
  }

  /* ── Mobile nav buttons ── */
  .mobile-nav-btn {
    height: 44px;
    padding: 0 1rem;
    font-size: 0.82rem;
  }

  .mobile-page-counter {
    font-size: 0.85rem;
  }
}

/* ── Tablet-only card rounded corners ── */
@media (max-width: 767px) {
  .blog-card  { border-radius: 14px; }
  .sidebar-block { border-radius: 14px; }
}