/* ==========================================================================
   ARTICLES & NEWS PAGE STYLING (Optimized, No !important)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ROOT VARIABLES (Light & Dark mode)
   -------------------------------------------------------------------------- */
:root {
  /* Light mode – ultra‑subtle card backgrounds */
  --articles-card-bg: rgba(0, 0, 0, 0.025);
  --articles-card-bg-hover: rgba(0, 0, 0, 0.05);
  --articles-card-border: rgba(0, 0, 0, 0.07);
  --articles-card-border-hover: var(--border-focus);

  --articles-inner-card-bg: #ffffff;
  --articles-img-placeholder-bg: rgba(0, 0, 0, 0.04);
}

html.dark-mode,
body.dark-mode {
  /* Dark mode – same subtle wash on dark background */
  --articles-card-bg: rgba(255, 255, 255, 0.025);
  --articles-card-bg-hover: rgba(255, 255, 255, 0.055);
  --articles-card-border: rgba(255, 255, 255, 0.07);
  --articles-card-border-hover: var(--border-focus);

  --articles-inner-card-bg: #15161e;
  --articles-img-placeholder-bg: rgba(255, 255, 255, 0.04);
}

/* --------------------------------------------------------------------------
   2. PAGE WRAPPER (Matches footer shell width: 1080px)
   -------------------------------------------------------------------------- */
.articles-page-wrapper {
  position: relative;
  z-index: 5;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(8px, 1.5vw, 16px) clamp(44px, 6vw, 84px);
  box-sizing: border-box;
}

/* 4:3 aspect‑ratio container for images */
.media-aspect-4-3 {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  position: relative;
}

/* Image zoom on hover (used in cards) */
.article-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-item-card:hover .article-card-img,
.featured-hero-card:hover .article-card-img {
  transform: scale(1.04);
}

/* --------------------------------------------------------------------------
   3. PAGE HEADER – Centered title & subtitle
   -------------------------------------------------------------------------- */
.page-title-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: 0 auto clamp(28px, 4.5vw, 46px);
}

.page-main-headline {
  font-family: var(--font-display);
  font-size: clamp(28px, 4.2vw, 44px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.15;
  margin-bottom: 10px;
}

.page-main-subtext {
  font-size: clamp(12.5px, 1.15vw, 14.5px);
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 540px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   4. HERO FEATURED GRID
   -------------------------------------------------------------------------- */
.articles-featured-grid {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vw, 20px);
  margin-bottom: clamp(36px, 5vw, 64px);
  width: 100%;
}

/* ---- 4.1 Top Hero Card (side‑by‑side columns) ---- */
.featured-hero-card {
  background: var(--articles-card-bg);
  border: 1px solid var(--articles-card-border);
  border-radius: clamp(16px, 2.4vw, 28px);
  padding: clamp(10px, 1.8vw, 20px);
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: stretch;
  gap: clamp(10px, 2vw, 28px);
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.featured-hero-card:hover {
  background: var(--articles-card-bg-hover);
  border-color: var(--articles-card-border-hover);
  transform: translateY(-2px);
}

/* Left column – nested white card */
.hero-nested-white-card {
  background: var(--articles-inner-card-bg);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: clamp(12px, 2vw, 22px);
  padding: clamp(12px, 2.5vw, 36px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

html.dark-mode .hero-nested-white-card {
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.featured-hero-title {
  font-family: var(--font-display);
  font-size: clamp(10px, 2vw, 24px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: clamp(4px, 1vw, 14px);
  word-break: break-word;
}

.featured-hero-title a {
  text-decoration: none;
  color: var(--text-main);
  transition: color 0.2s ease;
}

.featured-hero-title a:hover {
  color: #3b82f6;
}

.featured-hero-excerpt {
  font-size: clamp(8.5px, 1.05vw, 13.5px);
  line-height: 1.38;
  color: var(--text-muted);
  margin-bottom: clamp(6px, 1.4vw, 22px);
  word-break: break-word;
}

.featured-hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(4px, 1vw, 10px);
  margin-bottom: clamp(8px, 1.5vw, 24px);
  width: 100%;
}

/* Author attribution */
.author-attribution {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.7vw, 10px);
  min-width: 0;
}

.author-avatar-wrap {
  width: clamp(20px, 2.5vw, 36px);
  height: clamp(20px, 2.5vw, 36px);
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}

.author-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.author-label {
  font-size: clamp(5px, 0.7vw, 10px);
  color: var(--text-muted);
  line-height: 1.1;
}

.author-name {
  font-size: clamp(9px, 1vw, 13.5px);
  font-weight: 600;
  color: var(--text-main);
  word-break: break-word;
}

/* Right column – image (fills entire height) */
.hero-image-media-link {
  height: 100%;
  min-height: 0;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: clamp(10px, 1.8vw, 20px);
  overflow: hidden;
  min-width: 0;
  text-decoration: none;
}

.hero-media-box {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  background: var(--articles-img-placeholder-bg);
  border-radius: clamp(10px, 1.8vw, 20px);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

html.dark-mode .hero-media-box {
  border-color: rgba(255, 255, 255, 0.08);
}

.hero-media-box .article-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   5. MID‑ROW: NEWSLETTER + STACKED CARDS
   -------------------------------------------------------------------------- */
.featured-mid-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.25fr) minmax(170px, 1fr);
  gap: clamp(8px, 1.5vw, 20px);
  align-items: stretch;
}

/* Left – dark newsletter card */
.articles-newsletter-card {
  background: #08080c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: clamp(14px, 2.2vw, 28px);
  padding: clamp(14px, 2.8vw, 36px);
  color: #ffffff;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.newsletter-ambient-glow {
  position: absolute;
  left: 10%;
  bottom: -30%;
  width: 90%;
  height: 80%;
  border-radius: 50%;
  background: radial-gradient(circle,
      rgba(217, 119, 6, 0.35) 0%,
      rgba(236, 72, 153, 0.3) 40%,
      rgba(59, 130, 246, 0.25) 70%,
      transparent 90%);
  filter: blur(40px);
  pointer-events: none;
}

.newsletter-inner-content {
  position: relative;
  z-index: 2;
}

.newsletter-badge-text {
  font-size: clamp(8px, 0.85vw, 11px);
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 4px;
  display: block;
}

.newsletter-headline {
  font-family: var(--font-display);
  font-size: clamp(12px, 1.8vw, 26px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin-bottom: clamp(6px, 1vw, 12px);
  word-break: break-word;
}

.newsletter-desc {
  font-size: clamp(8.5px, 1vw, 12.5px);
  color: #cbd5e1;
  line-height: 1.4;
  margin-bottom: clamp(10px, 1.8vw, 24px);
  word-break: break-word;
}

.newsletter-capsule-form {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 9999px;
  padding: 3px 4px 3px clamp(8px, 1.2vw, 16px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  width: 100%;
}

.capsule-email-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: clamp(9.5px, 1.05vw, 13px);
  color: #09090b;
  font-family: inherit;
  min-width: 0;
}

.capsule-email-input::placeholder {
  color: #9ca3af;
}

.capsule-submit-btn {
  background: #3b82f6;
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  padding: clamp(5px, 0.8vw, 10px) clamp(8px, 1.5vw, 22px);
  font-size: clamp(9.5px, 1vw, 13px);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.capsule-submit-btn:hover {
  background: #2563eb;
  transform: scale(1.02);
}

/* Right – stacked article cards */
.featured-stacked-column {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5vw, 20px);
}

.stacked-article-card {
  flex: 1;
  background: var(--articles-card-bg);
  border: 1px solid var(--articles-card-border);
  border-radius: clamp(14px, 2vw, 24px);
  padding: clamp(12px, 2vw, 28px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.stacked-article-card:hover {
  background: var(--articles-card-bg-hover);
  border-color: var(--articles-card-border-hover);
  transform: translateY(-2px);
}

.stacked-card-title {
  font-family: var(--font-display);
  font-size: clamp(11px, 1.5vw, 19px);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: clamp(6px, 1vw, 16px);
  word-break: break-word;
}

.stacked-card-title a {
  text-decoration: none;
  color: var(--text-main);
  transition: color 0.2s ease;
}

.stacked-card-title a:hover {
  color: #3b82f6;
}

.stacked-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   6. LATEST POSTS SECTION
   -------------------------------------------------------------------------- */
.latest-posts-section {
  width: 100%;
}

.latest-posts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(20px, 3.5vw, 32px);
  flex-wrap: wrap;
  gap: 14px;
}

.latest-posts-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

/* Filter pills */
.filter-pills-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--articles-card-bg);
  border: 1px solid var(--articles-card-border);
  padding: 4px;
  border-radius: 9999px;
}

.filter-pill {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: clamp(11.5px, 1.1vw, 13px);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.filter-pill:hover {
  color: var(--text-main);
}

.filter-pill.active {
  background: #ffffff;
  color: #09090b;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

html.dark-mode .filter-pill.active {
  background: #27272a;
  color: #ffffff;
}

/* 2‑column grid of posts */
.latest-posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(14px, 2.5vw, 26px);
}

.post-item-card {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 18px);
  background: var(--articles-card-bg);
  border: 1px solid var(--articles-card-border);
  border-radius: clamp(14px, 2vw, 20px);
  padding: clamp(10px, 1.4vw, 14px);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.post-item-card:hover {
  background: var(--articles-card-bg-hover);
  border-color: var(--articles-card-border-hover);
  transform: translateY(-2px);
}

.post-media-link {
  width: clamp(100px, 15vw, 155px);
  flex-shrink: 0;
  text-decoration: none;
  display: block;
}

.post-thumbnail-box {
  border-radius: clamp(10px, 1.4vw, 14px);
  background: var(--articles-img-placeholder-bg);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

html.dark-mode .post-thumbnail-box {
  border-color: rgba(255, 255, 255, 0.06);
}

.post-item-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.post-item-title {
  font-family: var(--font-display);
  font-size: clamp(13px, 1.35vw, 16.5px);
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -0.015em;
  margin-bottom: clamp(6px, 1vw, 10px);
}

.post-item-title a {
  text-decoration: none;
  color: var(--text-main);
  transition: color 0.2s ease;
}

.post-item-title a:hover {
  color: #3b82f6;
}

.post-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   7. PAGINATION BUTTON
   -------------------------------------------------------------------------- */
.articles-pagination-wrap {
  display: flex;
  justify-content: center;
  margin-top: clamp(28px, 4.5vw, 48px);
}

.btn-pagination {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 26px;
  border-radius: 9999px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

html.dark-mode .btn-pagination {
  background: #171820;
}

.btn-pagination:hover {
  border-color: var(--border-focus);
  background: var(--connect-hover);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   8. RESPONSIVE BREAKPOINTS (no !important)
   -------------------------------------------------------------------------- */

/* Tablet & small desktops – stack mid‑row and posts to single column */
@media (max-width: 600px) {
  .featured-mid-row {
    grid-template-columns: 1fr;
  }

  .latest-posts-grid {
    grid-template-columns: 1fr;
  }

  .post-media-link {
    width: 110px;
  }

  .latest-posts-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Very small phones (≤540px) – tighter spacing and smaller fonts */
@media (max-width: 540px) {
  .hero-nested-white-card {
    padding: 10px 12px;
  }

  .featured-hero-card {
    gap: 8px;
    padding: 8px;
  }

  .featured-hero-title {
    font-size: 11.5px;
    margin-bottom: 4px;
  }

  .featured-hero-excerpt {
    font-size: 8.5px;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .featured-hero-meta {
    margin-bottom: 4px;
    gap: 4px;
  }

  .news-tag {
    font-size: 7px;
    padding: 1px 6px;
  }

  .news-date {
    font-size: 7px;
  }

  .author-avatar-wrap {
    width: 16px;
    height: 16px;
  }

  .author-label {
    font-size: 6.5px;
  }

  .author-name {
    font-size: 8px;
  }
}