/* ============================================================
   Just The Good News — Main Stylesheet
   Colour palette: gold #F59E0B, teal #0D9488, warm white #FFFBF5
   text #1F2937, coral #FB7185, green #10B981
   ============================================================ */

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

:root {
  --gold:    #F59E0B;
  --teal:    #0D9488;
  --bg:      #FFFBF5;
  --text:    #1F2937;
  --coral:   #FB7185;
  --green:   #10B981;
  --muted:   #6B7280;
  --border:  #E5E7EB;
  --card-bg: #FFFFFF;
  --shadow:  0 2px 8px rgba(31,41,55,0.08);
  --shadow-hover: 0 6px 20px rgba(31,41,55,0.14);
  --radius:  12px;
  --radius-sm: 6px;
  --font-head: 'DM Sans', system-ui, sans-serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --max-w:   1200px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden; /* prevent horizontal scroll from tight header */
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; height: auto; }

/* --- Utility --- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: linear-gradient(135deg, #FFFBF5 0%, #FFF8EC 100%);
  border-bottom: 2px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(245,158,11,0.10);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon { font-size: 1.5rem; line-height: 1; }

.logo-text {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
}

.nav-link {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  padding: 0.5rem 0.25rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}

.nav-link:hover { color: var(--teal); border-bottom-color: var(--teal); text-decoration: none; }
.nav-rss { color: var(--gold); }
.nav-rss:hover { color: var(--gold); border-bottom-color: var(--gold); }

/* ── Story count bar (homepage, between hero and filters) ── */
.story-count-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.5rem;
  background: #FFFBF5;
  border-bottom: 1px solid rgba(245,158,11,0.15);
}

.story-count-bar::before,
.story-count-bar::after {
  content: '';
  flex: 1;
  max-width: 100px;
  height: 1px;
}
.story-count-bar::before {
  background: linear-gradient(to right, transparent, rgba(245,158,11,0.35));
}
.story-count-bar::after {
  background: linear-gradient(to left, transparent, rgba(245,158,11,0.35));
}

.story-count-number {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--gold);
}

.story-count-label {
  font-family: var(--font-head);
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ============================================================
   TODAY BANNER
   ============================================================ */
.today-banner {
  background: rgba(245,158,11,0.07);
  padding: 0.55rem 1.5rem;
}

.today-banner-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-head);
  font-size: 0.85rem;
  color: var(--muted);
}

.today-icon { font-size: 0.9rem; line-height: 1; }

.today-text strong {
  color: var(--text);
  font-weight: 600;
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero-section {
  background: linear-gradient(160deg, #FFF8EC 0%, #F0FDFA 100%);
  border-bottom: 1px solid var(--border);
  padding: 3rem 1.5rem;
}

.hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.hero-image {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-hover);
}

.hero-image img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.hero-content { display: flex; flex-direction: column; gap: 1rem; }

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

.hero-badge {
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--gold);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}

.hero-title {
  font-family: var(--font-head);
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

.hero-title a { color: inherit; text-decoration: none; }
.hero-title a:hover { color: var(--teal); text-decoration: none; }

.hero-summary {
  font-size: 1.05rem;
  color: #374151;
  line-height: 1.65;
}

.hero-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.hero-source {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
}

.hero-date {
  font-family: var(--font-head);
  font-size: 0.85rem;
  color: var(--muted);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--teal);
  color: white !important;
  padding: 0.55rem 1.2rem;
  border-radius: 99px;
  text-decoration: none !important;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn-primary:hover { background: #0b7a70; transform: translateY(-1px); }
.btn-large { font-size: 1rem; padding: 0.75rem 1.75rem; }

/* ============================================================
   FILTER BAR (category + region)
   ============================================================ */
.filter-bar {
  background: linear-gradient(to bottom, #FFFBF5 0%, #FFF8EC 100%);
  border-bottom: 1px solid rgba(245,158,11,0.18);
  position: sticky;
  top: 64px;
  z-index: 90;
  box-shadow: 0 2px 12px rgba(245,158,11,0.06);
}

.filter-bar-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0;
}

/* ── Category pills ── */
.filter-cats {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  /* fade-out right edge before region dropdown */
  -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
          mask-image: linear-gradient(to right, black 85%, transparent 100%);
  padding-right: 2rem; /* space for mask fade */
}
.filter-cats::-webkit-scrollbar { display: none; }

.cat-btn {
  font-family: var(--font-head);
  font-size: 0.82rem;
  font-weight: 500;
  background: rgba(245,158,11,0.09);
  border: none;
  color: #4B5563;
  padding: 0.45rem 1rem;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.18s;
  flex-shrink: 0;
  min-height: 36px;
  line-height: 1;
}

.cat-btn:hover {
  background: rgba(245,158,11,0.2);
  color: var(--text);
  transform: translateY(-1px);
}

.cat-btn.active {
  background: linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 14px rgba(245,158,11,0.38);
  transform: translateY(-1px);
}

/* ── Region dropdown ── */
.filter-region-wrap {
  position: relative;
  flex-shrink: 0;
  padding-left: 0.9rem;
  margin-left: 0.25rem;
  border-left: 1px solid rgba(245,158,11,0.25);
}

.region-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-head);
  font-size: 0.82rem;
  font-weight: 500;
  background: rgba(245,158,11,0.09);
  border: none;
  color: #4B5563;
  padding: 0.45rem 0.9rem;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  min-height: 36px;
}

.region-toggle:hover {
  background: rgba(245,158,11,0.2);
  color: var(--text);
}

.region-toggle[aria-expanded="true"] {
  background: rgba(13,148,136,0.1);
  color: var(--teal);
}

/* active region (non-"all" selected) */
.region-toggle.has-region {
  background: linear-gradient(135deg, #0D9488 0%, #0891B2 100%);
  color: #fff;
  box-shadow: 0 3px 14px rgba(13,148,136,0.32);
}

.chevron {
  transition: transform 0.2s ease;
  opacity: 0.7;
}
.region-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

/* Dropdown panel */
.region-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(31,41,55,0.14), 0 2px 8px rgba(31,41,55,0.06);
  border: 1px solid rgba(245,158,11,0.15);
  min-width: 188px;
  overflow: hidden;
  z-index: 200;
  /* subtle entrance animation */
  animation: dropIn 0.15s ease;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.region-btn {
  display: flex;
  align-items: center;
  width: 100%;
  font-family: var(--font-head);
  font-size: 0.875rem;
  font-weight: 500;
  background: transparent;
  border: none;
  color: #4B5563;
  padding: 0.65rem 1.1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
  gap: 0.5rem;
}

.region-btn:hover {
  background: rgba(245,158,11,0.08);
  color: var(--text);
}

.region-btn.active {
  color: var(--teal);
  font-weight: 600;
  background: rgba(13,148,136,0.07);
}

.region-btn.active::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
}

.region-btn:not(.active)::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  flex-shrink: 0;
}

/* ============================================================
   KIDS SECTION  (/kids/ listing + /kids/article-slug/ single)
   Colour palette: teal #0D9488, green-50 #F0FDF4, emerald-900 #064E3B
   ============================================================ */

/* Page wrapper — green background fills the flex-1 main area */
.kids-page {
  background: #F0FDF4;
  min-height: 100%;
  flex: 1;
}

/* ── Banner ── */
.kids-banner {
  background: linear-gradient(135deg, #0D9488 0%, #059669 100%);
  padding: 2rem 1.5rem 1.75rem;
  text-align: center;
}
.kids-banner-inner { max-width: 640px; margin: 0 auto; }

.kids-banner-pill {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  color: white;
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.kids-banner-title {
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 900;
  color: white;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.kids-banner-sub {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: rgba(255,255,255,0.85);
  margin: 0;
}

/* ── Content area ── */
.kids-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* ── Category badges ── */
.kids-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}
.kids-cat-badge--sm { font-size: 0.65rem; padding: 0.2rem 0.6rem; }

/* Per-category colours */
.kids-cat-badge--animals   { background: #DCFCE7; color: #166534; }
.kids-cat-badge--space     { background: #DBEAFE; color: #1E40AF; }
.kids-cat-badge--dinosaurs { background: #D1FAE5; color: #065F46; }
.kids-cat-badge--records   { background: #FEF3C7; color: #92400E; }
.kids-cat-badge--inventors { background: #FEF9C3; color: #713F12; }
.kids-cat-badge--sport     { background: #FEE2E2; color: #991B1B; }
.kids-cat-badge--nature    { background: #DCFCE7; color: #166534; }
.kids-cat-badge--science   { background: #F3E8FF; color: #6B21A8; }
.kids-cat-badge--funny     { background: #FFF7ED; color: #9A3412; }

/* ── Hero card ── */
.kids-hero-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(13,148,136,0.13);
  margin-bottom: 1.25rem;
}

.kids-hero-image {
  position: relative;
  height: 220px;
  background: linear-gradient(135deg, #A7F3D0, #34D399);
  overflow: hidden;
}
.kids-hero-image img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.kids-hero-image-placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 4rem;
  background: linear-gradient(135deg, #A7F3D0, #34D399);
}
.kids-hero-image .kids-cat-badge {
  position: absolute; top: 12px; left: 12px;
  background: white !important; color: #065F46 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.kids-top-badge {
  position: absolute; top: 12px; right: 12px;
  background: #FCD34D; color: #78350F;
  font-family: var(--font-head); font-size: 0.68rem; font-weight: 800;
  padding: 0.25rem 0.7rem; border-radius: 999px;
}

.kids-hero-body { padding: 1.25rem 1.5rem 1.5rem; }

.kids-hero-title {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 900;
  color: #064E3B;
  line-height: 1.25;
  margin: 0 0 0.75rem;
}
.kids-hero-title a { color: inherit; text-decoration: none; }
.kids-hero-title a:hover { color: var(--teal); }

.kids-hero-summary {
  font-family: var(--font-body);
  font-size: 0.97rem;
  line-height: 1.75;
  color: #374151;
  margin: 0 0 1rem;
}

.kids-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #0D9488;
  color: white;
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.55rem 1.25rem;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s;
}
.kids-hero-btn:hover { background: #0F766E; color: white; }

/* ── Story grid ── */
.kids-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ── Story card ── */
.kids-card {
  background: white;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 14px rgba(13,148,136,0.08);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}
.kids-card:hover { box-shadow: 0 6px 24px rgba(13,148,136,0.18); transform: translateY(-2px); }

.kids-card-image-link { display: block; text-decoration: none; }
.kids-card-image {
  position: relative;
  height: 110px;
  background: linear-gradient(135deg, #A7F3D0, #6EE7B7);
  overflow: hidden;
}
.kids-card-image img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.kids-card-image-placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 2.5rem; opacity: 0.7;
}
.kids-card-image .kids-cat-badge {
  position: absolute; bottom: 7px; left: 8px;
  background: white !important;
  box-shadow: 0 1px 6px rgba(0,0,0,0.10);
}

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

.kids-card-title {
  font-family: var(--font-head);
  font-size: 0.9rem;
  font-weight: 800;
  color: #1E293B;
  line-height: 1.35;
  margin: 0;
}
.kids-card-title a { color: inherit; text-decoration: none; }
.kids-card-title a:hover { color: #0D9488; }

.kids-card-summary {
  font-family: var(--font-body);
  font-size: 0.82rem;
  line-height: 1.6;
  color: #6B7280;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kids-card-link {
  font-family: var(--font-head);
  font-size: 0.78rem;
  font-weight: 700;
  color: #0D9488;
  text-decoration: none;
  margin-top: auto;
}
.kids-card-link:hover { color: #0F766E; text-decoration: underline; }

/* ── Empty state ── */
.kids-empty {
  text-align: center;
  padding: 4rem 1.5rem;
}
.kids-empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.kids-empty-text {
  font-family: var(--font-head);
  font-size: 1.1rem;
  color: var(--muted);
}

/* ── Footer note ── */
.kids-footer-note {
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: #9CA3AF;
  margin-top: 1.5rem;
}
.kids-footer-note a { color: #0D9488; }

/* ── Single article page ── */
.kids-single-page { padding-top: 0; }

.kids-single-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.kids-back-link {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.82rem;
  font-weight: 700;
  color: #0D9488;
  text-decoration: none;
  margin-bottom: 1rem;
}
.kids-back-link:hover { text-decoration: underline; }

.kids-single-title {
  font-family: var(--font-head);
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  font-weight: 900;
  color: #064E3B;
  line-height: 1.2;
  margin: 0.75rem 0 0.6rem;
}

.kids-single-meta {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: #9CA3AF;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.kids-single-meta-sep { color: #D1D5DB; }

.kids-single-image {
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.kids-single-image img {
  width: 100%; display: block;
  aspect-ratio: 16/9; object-fit: cover;
}
.kids-single-image-credit {
  font-size: 0.72rem; color: #9CA3AF;
  margin: 0.4rem 0 0;
  font-family: var(--font-body);
}
.kids-single-image-credit a { color: #9CA3AF; }

.kids-single-body {
  background: white;
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 2px 16px rgba(13,148,136,0.08);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.85;
  color: #1E293B;
  margin-bottom: 1.1rem;
}

.kids-single-source {
  background: white;
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  margin-bottom: 1.5rem;
}
.kids-single-source-label {
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 700;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}
.kids-single-source-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 0.75rem;
}
.kids-single-source-name {
  font-family: var(--font-head);
  font-size: 0.88rem;
  font-weight: 700;
  color: #1E293B;
}
.kids-single-source-link {
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 700;
  color: #0D9488;
  text-decoration: none;
  white-space: nowrap;
}
.kids-single-source-link:hover { text-decoration: underline; }

.kids-single-cta { text-align: center; }

/* ── Kids nav link — teal to match section ── */
.nav-kids { color: #0D9488 !important; }
.nav-kids:hover {
  color: #0F766E !important;
  border-bottom-color: #0D9488 !important;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .kids-grid { grid-template-columns: 1fr; }
  .kids-hero-image { height: 160px; }
  .kids-banner { padding: 1.5rem 1rem 1.25rem; }
  .kids-content { padding: 1rem 1rem 2rem; }
  .kids-single-wrap { padding: 1rem 1rem 2rem; }
  .kids-single-body { font-size: 0.95rem; }
}

/* ============================================================
   ARTICLE GRID
   ============================================================ */
.articles-section { padding: 3rem 1.5rem; flex: 1; }

.articles-inner { max-width: var(--max-w); margin: 0 auto; }

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

.no-results, .empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 1.05rem;
}

/* ============================================================
   ARTICLE CARD
   ============================================================ */
.article-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.15s;
}

.article-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.card-image {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #F3F4F6;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

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

.ai-badge {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  font-family: var(--font-head);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(31,41,55,0.6);
  color: rgba(255,255,255,0.85);
  padding: 0.15rem 0.45rem;
  border-radius: 99px;
  backdrop-filter: blur(4px);
}

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

.card-meta-top { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }

.card-title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-title-link { color: var(--text); text-decoration: none; }
.card-title-link:hover { color: var(--teal); text-decoration: none; }

.card-summary {
  font-size: 0.875rem;
  color: #4B5563;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  gap: 0.5rem;
}

.card-source { display: flex; flex-direction: column; gap: 0.1rem; }

.source-name {
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.source-date {
  font-family: var(--font-head);
  font-size: 0.7rem;
  color: var(--muted);
}

.read-original {
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--teal);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.read-original:hover { text-decoration: underline; }

/* ============================================================
   CATEGORY PILLS
   ============================================================ */
.category-pill {
  font-family: var(--font-head);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  white-space: nowrap;
}

.category-environment    { background: #D1FAE5; color: #065F46; }
.category-health-science { background: #DBEAFE; color: #1E40AF; }
.category-community      { background: #FEF3C7; color: #92400E; }
.category-tech-for-good  { background: #E0E7FF; color: #3730A3; }
.category-education      { background: #FCE7F3; color: #9D174D; }
.category-arts-culture   { background: #FEE2E2; color: #991B1B; }
.category-justice-equality { background: #F3E8FF; color: #6B21A8; }
.category-economy-work   { background: #ECFDF5; color: #065F46; }

.region-tag {
  font-family: var(--font-head);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  background: #F3F4F6;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

/* ============================================================
   SINGLE ARTICLE PAGE
   ============================================================ */
.single-article { padding: 3rem 1.5rem; flex: 1; }

.single-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.back-link {
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.back-link:hover { color: var(--teal); text-decoration: none; }

.single-header { display: flex; flex-direction: column; gap: 0.75rem; }

.single-meta-top { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

.single-title {
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.25;
}

.single-meta-bottom {
  display: flex;
  gap: 1rem;
  font-family: var(--font-head);
  font-size: 0.85rem;
  color: var(--muted);
}

.single-image { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.single-image img { width: 100%; aspect-ratio: 2/1; object-fit: cover; }

.photo-credit {
  font-family: var(--font-head);
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  margin-top: 0.35rem;
}

.photo-credit a {
  color: var(--muted);
  text-decoration: underline;
}

.photo-credit a:hover {
  color: var(--teal);
}

.single-summary {
  font-size: 1.15rem;
  line-height: 1.7;
  background: linear-gradient(135deg, #FFFBF5 0%, #F0FDFA 100%);
  border-left: 4px solid var(--gold);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.single-cta { text-align: center; }

.single-content { font-size: 1rem; line-height: 1.75; }
.single-content p { margin-bottom: 1rem; }
.single-content a { color: var(--teal); }

.single-report {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.report-link {
  font-family: var(--font-head);
  font-size: 0.8rem;
  color: var(--muted);
}

.report-link:hover { color: var(--coral); }

/* ============================================================
   PAGE HEADER (list pages)
   ============================================================ */
.page-header {
  background: linear-gradient(135deg, #FFF8EC 0%, #F0FDFA 100%);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 1.5rem;
}

.page-header-inner { max-width: var(--max-w); margin: 0 auto; }

.page-title {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
}

.page-description {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 1rem;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--text);
  color: #D1D5DB;
  padding: 2.5rem 1.5rem;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  color: var(--gold);
}

.footer-tagline { color: #9CA3AF; }

.footer-nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-nav a {
  font-family: var(--font-head);
  font-size: 0.85rem;
  color: #9CA3AF;
  text-decoration: none;
  transition: color 0.15s;
}

.footer-nav a:hover { color: var(--gold); text-decoration: none; }

.footer-mission {
  font-size: 0.85rem;
  color: #6B7280;
  max-width: 540px;
  line-height: 1.5;
}

.footer-legal {
  font-family: var(--font-head);
  font-size: 0.78rem;
  color: #6B7280;
}

/* ============================================================
   SEARCH BUTTON (header)
   ============================================================ */
.search-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  margin-left: 0.5rem;
}

.search-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}

/* ============================================================
   SEARCH OVERLAY
   ============================================================ */
#search-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(31, 41, 55, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 1rem 1rem;
}

#search-overlay[hidden] { display: none; }

.search-box {
  background: var(--bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(31, 41, 55, 0.25);
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-bottom: 1.5px solid var(--border);
  flex-shrink: 0;
}

.search-icon-inline {
  color: var(--muted);
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  padding: 0.25rem 0;
  /* remove browser search decorations */
  -webkit-appearance: none;
  appearance: none;
}

#search-input::placeholder { color: var(--muted); }
#search-input::-webkit-search-cancel-button { display: none; }

.search-close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.search-close-btn:hover { color: var(--text); background: var(--border); }

#search-results {
  overflow-y: auto;
  flex: 1;
}

.search-result {
  display: block;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.12s;
}

.search-result:last-child { border-bottom: none; }
.search-result:hover { background: #F0FDFA; text-decoration: none; }

.search-result-title {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
  line-height: 1.35;
}

.search-result:hover .search-result-title { color: var(--teal); }

.search-result-excerpt {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Pagefind highlights search terms */
.search-result-excerpt mark {
  background: rgba(245, 158, 11, 0.25);
  color: var(--text);
  border-radius: 2px;
  padding: 0 2px;
}

.search-hint {
  font-family: var(--font-head);
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  padding: 1rem 1.25rem;
  flex-shrink: 0;
}

.search-hint kbd {
  font-family: var(--font-head);
  font-size: 0.72rem;
  background: var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  border: 1px solid #D1D5DB;
}

.search-status {
  font-family: var(--font-head);
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  padding: 2rem 1.25rem;
}

/* ============================================================
   PLACEHOLDER SVG IMAGES — generated inline via CSS background
   (actual SVG files created separately)
   ============================================================ */

/* ============================================================
   HIDDEN (filtered out) article cards
   ============================================================ */
.article-card.hidden { display: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .article-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero-image { max-height: 280px; }
  .hero-image img { aspect-ratio: 16/7; }
}


@media (max-width: 640px) {
  .logo-text { font-size: 0.95rem; }
  .article-grid { grid-template-columns: 1fr; }
  .articles-section { padding: 1.5rem 1rem; }
  .hero-section { padding: 1.5rem 1rem; }
  .single-article { padding: 1.5rem 1rem; }
  .filter-bar-inner { padding: 0.5rem 1rem; }
  .cat-btn { font-size: 0.8rem; padding: 0.4rem 0.85rem; }
  .region-toggle { font-size: 0.8rem; padding: 0.4rem 0.75rem; }
}

/* Small phones — remove redundant Home link (logo already links home),
   tighten header padding so nav fits without overflow */
@media (max-width: 480px) {
  .nav-home { display: none; }
  .header-inner { padding: 0 1rem; gap: 1rem; }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
