/* ============================================================
   Deep Feed AI — style.css
   Color palette:
     --bg-dark:    #0d1117  (deep navy/charcoal)
     --bg-card:    #161b22  (card surface)
     --accent:     #4F8EF7  (electric blue)
     --accent-dim: #2d5fbe  (hover shade)
     --text:       #e6edf3  (near-white)
     --muted:      #8b949e  (subdued text)
     --border:     #21262d  (subtle border)
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Dark theme (default) */
  --bg:        #0d1117;
  --bg-card:   #161b22;
  --bg-header: rgba(13, 17, 23, 0.92);
  --accent:    #4F8EF7;
  --accent-dim:#2d5fbe;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --border:    #21262d;
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
  --radius:    12px;
  --transition: 0.25s ease;
}

/* Light theme overrides */
body.light {
  --bg:        #f4f6fb;
  --bg-card:   #ffffff;
  --bg-header: rgba(244, 246, 251, 0.94);
  --text:      #1a1f2e;
  --muted:     #5a6370;
  --border:    #dde1ea;
  --shadow:    0 4px 24px rgba(0,0,0,0.1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-dim);
}

img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ============================================================
   HEADER / NAV
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: background var(--transition), border-color var(--transition);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-shrink: 0;
}

/* Logo */
.logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.logo span.accent {
  color: var(--accent);
}

/* Nav links */
.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

/* Header right controls */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Search bar */
.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

#search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.75rem 0.45rem 2.2rem;
  color: var(--text);
  font-size: 0.875rem;
  width: 220px;
  transition: border-color var(--transition), width var(--transition);
  outline: none;
}

#search-input:focus {
  border-color: var(--accent);
  width: 280px;
}

#search-input::placeholder {
  color: var(--muted);
}

/* Theme toggle */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  color: var(--text);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  transition: border-color var(--transition), background var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent);
}

/* Hamburger (mobile) */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--text);
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  padding: 5rem 1.5rem 3.5rem;
  text-align: center;
  background: linear-gradient(160deg, var(--bg) 0%, #0e1a2e 60%, var(--bg) 100%);
  position: relative;
  overflow: hidden;
}

/* Decorative glow blob */
.hero::before {
  content: '';
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse at center, rgba(79, 142, 247, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-block;
  background: rgba(79, 142, 247, 0.15);
  border: 1px solid rgba(79, 142, 247, 0.35);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.85rem;
  border-radius: 99px;
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  max-width: 800px;
  margin: 0 auto 1rem;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero p {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 2rem;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.6rem;
  border-radius: 99px;
  transition: background var(--transition), transform var(--transition);
}

.hero-cta:hover {
  background: var(--accent-dim);
  color: #fff;
  transform: translateY(-2px);
}

/* ============================================================
   MAIN CONTENT WRAPPER
   ============================================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================================
   SECTION HEADINGS
   ============================================================ */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.section-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

/* ============================================================
   CATEGORY FILTER
   ============================================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  padding-top: 3rem;
}

.filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 1rem;
  border-radius: 99px;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============================================================
   NEWS GRID
   ============================================================ */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 4rem;
}

/* No results message */
.no-results {
  display: none;
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.no-results svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  opacity: 0.4;
}

/* ============================================================
   NEWS CARD
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  /* Entrance animation */
  opacity: 0;
  transform: translateY(20px);
  animation: cardIn 0.5s ease forwards;
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}

/* Stagger delay for each card */
.card:nth-child(1)  { animation-delay: 0.05s; }
.card:nth-child(2)  { animation-delay: 0.10s; }
.card:nth-child(3)  { animation-delay: 0.15s; }
.card:nth-child(4)  { animation-delay: 0.20s; }
.card:nth-child(5)  { animation-delay: 0.25s; }
.card:nth-child(6)  { animation-delay: 0.30s; }
.card:nth-child(7)  { animation-delay: 0.35s; }
.card:nth-child(8)  { animation-delay: 0.40s; }
.card:nth-child(9)  { animation-delay: 0.45s; }
.card:nth-child(10) { animation-delay: 0.50s; }
.card:nth-child(11) { animation-delay: 0.55s; }
.card:nth-child(12) { animation-delay: 0.60s; }

.card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(79, 142, 247, 0.2);
}

/* Image area */
.card-image {
  width: 100%;
  height: 180px;
  overflow: hidden;
  position: relative;
  background: #0d1117;
}

.card-image img {
  transition: transform 0.4s ease;
}

.card:hover .card-image img {
  transform: scale(1.05);
}

/* Featured badge on card */
.card-image .featured-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

/* Card body */
.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

/* Category tag on card */
.card-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-summary {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card footer */
.card-footer {
  margin-top: auto;
  padding: 0 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-source {
  font-weight: 600;
  color: var(--text);
}

.card-read-more {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: gap var(--transition);
}

.card-read-more:hover {
  gap: 0.55rem;
}

/* Hidden card (filtered out) */
.card.hidden {
  display: none;
}

/* ============================================================
   FEATURED ROW (first article is wider)
   ============================================================ */
.card.featured {
  grid-column: span 2;
  flex-direction: row;
}

.card.featured .card-image {
  width: 260px;
  min-width: 260px;
  height: auto;
}

.card.featured .card-body {
  padding: 1.5rem;
}

.card.featured .card-title {
  font-size: 1.2rem;
  -webkit-line-clamp: 4;
}

/* ============================================================
   NEWSLETTER SECTION
   ============================================================ */
.newsletter {
  background: linear-gradient(135deg, #0e1a2e 0%, var(--bg-card) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  margin-bottom: 5rem;
}

body.light .newsletter {
  background: linear-gradient(135deg, #dce8ff 0%, var(--bg-card) 100%);
}

.newsletter h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.newsletter p {
  color: var(--muted);
  max-width: 480px;
  margin: 0 auto 1.75rem;
}

.newsletter-form {
  display: flex;
  gap: 0.75rem;
  max-width: 480px;
  margin: 0 auto;
}

.newsletter-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}

.newsletter-form input:focus {
  border-color: var(--accent);
}

.newsletter-form input::placeholder {
  color: var(--muted);
}

.newsletter-form button {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  white-space: nowrap;
}

.newsletter-form button:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
}

.newsletter-success {
  display: none;
  color: #4ade80;
  font-weight: 600;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
}

.footer-brand p {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.75rem;
  max-width: 280px;
  line-height: 1.6;
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.footer-col ul li a {
  color: var(--muted);
  font-size: 0.875rem;
  transition: color var(--transition);
}

.footer-col ul li a:hover {
  color: var(--text);
}

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ============================================================
   ARTICLE PAGE
   ============================================================ */
.article-hero {
  padding: 3rem 1.5rem 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.article-hero .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  transition: color var(--transition);
}

.article-hero .back-link:hover { color: var(--text); }

.article-tag {
  display: inline-block;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.article-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.article-meta .source { color: var(--text); font-weight: 600; }

.article-cover {
  width: 100%;
  max-width: 800px;
  margin: 2rem auto;
  border-radius: var(--radius);
  overflow: hidden;
  height: 380px;
}

.article-cover img { height: 100%; }

.article-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}

.article-content p { margin-bottom: 1.5rem; }
.article-content h2 { font-size: 1.4rem; font-weight: 700; margin: 2rem 0 1rem; }
.article-content h3 { font-size: 1.15rem; font-weight: 700; margin: 1.75rem 0 0.75rem; }
.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-style: italic;
}

/* ============================================================
   ABOUT PAGE
   ============================================================ */
.about-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

.about-page h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.about-page .lead {
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2.5rem 0;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.about-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.about-card p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

.about-icon {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

/* ============================================================
   RESPONSIVE — Tablet (≤ 900px)
   ============================================================ */
@media (max-width: 900px) {
  .news-grid { grid-template-columns: repeat(2, 1fr); }

  .card.featured {
    grid-column: span 2;
    flex-direction: column;
  }

  .card.featured .card-image {
    width: 100%;
    height: 200px;
  }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }

  .about-grid { grid-template-columns: 1fr; }

  #search-input { width: 180px; }
  #search-input:focus { width: 220px; }
}

/* ============================================================
   RESPONSIVE — Mobile (≤ 600px)
   ============================================================ */
@media (max-width: 600px) {
  .nav-links { display: none; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-header);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    backdrop-filter: blur(12px);
  }

  .hamburger { display: flex; }

  #search-input { width: 140px; }
  #search-input:focus { width: 160px; }

  .news-grid { grid-template-columns: 1fr; }

  .card.featured {
    grid-column: span 1;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .footer-inner {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .hero { padding: 3.5rem 1.5rem 2.5rem; }
}

/* ============================================================
   LEGAL PAGES (privacy.html, terms.html)
   ============================================================ */
.legal-page {
  max-width: 740px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.legal-page h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  margin: 1rem 0 0.25rem;
  line-height: 1.2;
}

.legal-date {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

.legal-page h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2.25rem 0 0.6rem;
  color: var(--text);
}

.legal-page h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.25rem 0 0.4rem;
  color: var(--text);
}

.legal-page p {
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.legal-page ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.legal-page ul li {
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.legal-page a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-page code {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-size: 0.875em;
  color: var(--accent);
}

/* ============================================================
   ARTICLE PAGE — DYNAMIC
   ============================================================ */

/* Make cards fully clickable */
.card {
  cursor: pointer;
}

/* Back link */
.article-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  transition: color var(--transition);
}
.article-back-link:hover { color: var(--text); }

/* Hero image — full width, capped height */
.article-hero-image {
  width: 100%;
  max-height: 450px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto 2rem;
}

/* Article page header block */
.article-page-header {
  max-width: 720px;
  margin: 0 auto 1.5rem;
}

.article-page-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 0.6rem 0 0.85rem;
}

/* Meta row — source · date */
.article-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.875rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.article-meta .source { color: var(--text); font-weight: 600; }

/* Summary section */
.article-summary {
  max-width: 720px;
  margin: 0 auto 1.5rem;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}
.article-summary p { margin-bottom: 1.25rem; }
.article-summary-note {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* CTA button — prominent electric blue */
.article-cta {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.9rem 2.2rem;
  border-radius: 99px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 20px rgba(79, 142, 247, 0.35);
}
.article-cta:hover {
  background: var(--accent-dim);
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(79, 142, 247, 0.5);
}

/* ---- Related articles grid ---- */
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

@media (max-width: 900px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .related-grid { grid-template-columns: 1fr; }
}

/* Related card — slimmer version of .card */
.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.related-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 6px 24px rgba(79, 142, 247, 0.18);
}

.related-card-image {
  width: 100%;
  height: 130px;
  overflow: hidden;
  background: var(--bg);
}
.related-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.related-card:hover .related-card-image img { transform: scale(1.05); }

.related-card-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.related-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card-summary {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   AD UNITS
   ============================================================ */
.ad-unit {
  width: 100%;
  overflow: hidden;
  text-align: center;
}

.ad-leaderboard {
  margin: 1.5rem 0 2rem;
  min-height: 90px;
}

.ad-banner {
  margin: 2.5rem 0;
  min-height: 90px;
}

/* Prevent layout shift while ads load */
.ad-unit ins {
  display: block;
  min-height: 90px;
}

/* ============================================================
   AI THUMBNAIL SHIMMER
   Shows an animated shimmer while Imagen generates the image.
   Once loaded, the image fades in smoothly.
   ============================================================ */

.card-image.thumb-loading {
  position: relative;
  background: var(--surface);
  overflow: hidden;
}

.card-image.thumb-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(79, 142, 247, 0.12) 40%,
    rgba(79, 142, 247, 0.25) 50%,
    rgba(79, 142, 247, 0.12) 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: thumb-shimmer 1.6s ease-in-out infinite;
}

/* Keep the existing image visible while AI thumb generates */
.card-image.thumb-loading img {
  opacity: 0.35;
  transition: opacity 0.5s ease;
}

/* Fade in when thumb-loading class is removed */
.card-image:not(.thumb-loading) img {
  opacity: 1;
  transition: opacity 0.5s ease;
}

@keyframes thumb-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ✨ AI badge on generated thumbnails */
.card-image.ai-generated::before {
  content: '✨ AI';
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
  z-index: 2;
  pointer-events: none;
}
