/* ============================================================
   GridTruth.io — Main Stylesheet
   Dark/Light theme via [data-theme] attribute on <html>
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Barlow+Condensed:wght@500;600;700&display=swap');

/* ── Design tokens ────────────────────────────────────────── */
:root {
  /* Dark theme (default) */
  --bg-base:       #0d0d0d;
  --bg-card:       #161616;
  --bg-card-hover: #1e1e1e;
  --bg-elevated:   #1e1e1e;
  --bg-filter:     #111111;

  --text-primary:   #f0ede8;
  --text-secondary: #8a8a8a;
  --text-muted:     #555555;

  --accent:         #e8002d;
  --accent-dark:    #b50023;
  --accent-glow:    rgba(232, 0, 45, 0.15);

  --border:         rgba(255,255,255,0.07);
  --border-strong:  rgba(255,255,255,0.14);

  --tag-bg:         rgba(255,255,255,0.06);
  --tag-text:       #a0a0a0;

  --shadow-card:    0 2px 12px rgba(0,0,0,0.5);
  --shadow-hover:   0 6px 24px rgba(0,0,0,0.7);

  --header-height:  60px;
  --filter-height:  0px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --font-sans:   'Inter', system-ui, -apple-system, sans-serif;
  --font-display:'Barlow Condensed', 'Inter', sans-serif;

  --transition: 180ms ease;
}

[data-theme="light"] {
  --bg-base:       #f0ede8;
  --bg-card:       #ffffff;
  --bg-card-hover: #fafafa;
  --bg-elevated:   #f5f2ed;
  --bg-filter:     #ffffff;

  --text-primary:   #111111;
  --text-secondary: #555555;
  --text-muted:     #999999;

  --border:         rgba(0,0,0,0.08);
  --border-strong:  rgba(0,0,0,0.15);

  --tag-bg:         rgba(0,0,0,0.05);
  --tag-text:       #555555;

  --shadow-card:    0 2px 8px rgba(0,0,0,0.08);
  --shadow-hover:   0 6px 20px rgba(0,0,0,0.14);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

/* ── Subtle speed-line background texture ─────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 99px,
    var(--border) 99px,
    var(--border) 100px
  );
  opacity: 0.3;
  z-index: 0;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-base);
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
}

/* Subtle checkered flag accent strip */
.site-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    #fff 0px, #fff 4px,
    #000 4px, #000 8px
  );
  opacity: 0.12;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.site-logo .logo-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.site-logo .logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

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

.header-tagline {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: none;
}

@media (min-width: 640px) { .header-tagline { display: block; } }

.header-spacer { flex: 1; }

.header-search {
  position: relative;
  flex-shrink: 1;
  min-width: 0;
}

.header-search input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px 7px 36px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  width: 200px;
  transition: width var(--transition), border-color var(--transition);
  outline: none;
}

.header-search input::placeholder { color: var(--text-muted); }
.header-search input:focus { width: 260px; border-color: var(--accent); }

.header-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

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

.btn-icon svg { width: 16px; height: 16px; }

/* ── Live update indicator ────────────────────────────────── */
.live-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.live-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4caf50;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ── Filter bar ───────────────────────────────────────────── */
.filter-bar {
  position: sticky;
  top: var(--header-height);
  z-index: 90;
  background: var(--bg-filter);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--filter-height);
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
}

/* Allow dropdown panels to escape the filter bar clipping area when open. */
.filter-bar:has(.filter-panel.open) {
  overflow: visible;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 4px;
}

.filter-sep {
  width: 1px;
  height: 20px;
  background: var(--border-strong);
  flex-shrink: 0;
  margin: 0 4px;
}

/* Filter dropdown button */
.filter-dropdown {
  position: relative;
  flex-shrink: 0;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

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

.filter-btn .caret { font-size: 9px; opacity: 0.6; }
.filter-btn .count-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

.filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  padding: 10px;
  min-width: 220px;
  max-width: 320px;
  max-height: 320px;
  overflow-y: auto;
  display: none;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.filter-panel.open { display: block; }

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  text-align: left;
  transition: background var(--transition);
}

.filter-option:hover { background: var(--tag-bg); }
.filter-option.selected { color: var(--accent); font-weight: 600; }

.filter-option input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.filter-option .team-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Clear filters button */
.btn-clear-filters {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: none;
  border: 1px solid var(--accent);
  border-radius: 20px;
  color: var(--accent);
  font-size: 12px;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-clear-filters:hover { background: var(--accent); color: #fff; }
.btn-clear-filters.visible { display: flex; }

/* ── Sidebar filters ───────────────────────────────────────── */
.sidebar-filters {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
}

.sidebar-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.sidebar-filters .sidebar-title {
  margin: 0;
  padding: 0;
  border-bottom: none;
}

.sidebar-filters .btn-clear-filters {
  display: inline-flex;
  padding: 4px 10px;
  font-size: 11px;
}

.sidebar-filters .btn-clear-filters:not(.visible) {
  pointer-events: none;
  opacity: 0.5;
  border-color: var(--border);
  color: var(--text-muted);
}

.filter-list-block + .filter-list-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.filter-list-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.filter-list {
  max-height: none;
  overflow: visible;
  scrollbar-width: auto;
}

.sidebar-filters .filter-option {
  padding: 5px 6px;
}

.sidebar-filters .filter-option.selected {
  background: var(--tag-bg);
}

/* ── Layout ───────────────────────────────────────────────── */
.page-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 60px;
  position: relative;
  z-index: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}

@media (max-width: 1024px) {
  .content-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ── Ad banner (leaderboard) ─────────────────────────────── */
.ad-leaderboard {
  width: 100%;
  margin: 0 0 24px;
  display: flex;
  justify-content: center;
}

.ad-slot {
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  overflow: hidden;
}

.ad-slot-728x90 { width: 100%; max-width: 728px; height: 90px; }
.ad-slot-300x250 { width: 300px; height: 250px; }
.ad-slot-300x600 { width: 300px; height: 600px; }

/* ── Results meta ─────────────────────────────────────────── */
.results-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.results-count {
  font-size: 13px;
  color: var(--text-secondary);
}

.results-count strong { color: var(--text-primary); }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.filter-chip button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  opacity: 0.7;
}

.filter-chip button:hover { opacity: 1; }

/* ── Article grid ─────────────────────────────────────────── */
.articles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 700px) {
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Featured / first article takes full width */
.articles-grid .article-card:first-child {
  grid-column: 1 / -1;
}

/* ── Article card ─────────────────────────────────────────── */
.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
  position: relative;
}

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

.article-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.article-card:hover::before { opacity: 1; }

/* Featured card image */
.article-card.featured .card-image {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
}

.article-card.featured .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

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

.card-image-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image-placeholder svg { opacity: 0.15; width: 64px; height: 64px; }

.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-category {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Category colours */
.cat-race         { background: #e8002d22; color: #ff4d6d; }
.cat-qualifying   { background: #e8002d22; color: #ff4d6d; }
.cat-practice     { background: #ff800022; color: #ff9933; }
.cat-technical    { background: #3671c622; color: #6699ff; }
.cat-driver-market{ background: #22997122; color: #33cc88; }
.cat-team         { background: #22997122; color: #33cc88; }
.cat-regulations  { background: #ff87bc22; color: #ff87bc; }
.cat-safety       { background: #ffcc0022; color: #ffcc00; }
.cat-stats        { background: #6692ff22; color: #6692ff; }
.cat-stewards     { background: #ffcc0022; color: #ffcc00; }
.cat-contract     { background: #22997122; color: #33cc88; }
.cat-general      { background: var(--tag-bg); color: var(--text-muted); }

.card-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}

.article-card.featured .card-title { font-size: 24px; }

.card-title:hover { color: var(--accent); }

.card-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.card-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.source-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag-chip {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  background: var(--tag-bg);
  border-radius: 10px;
  color: var(--tag-text);
  border: 1px solid var(--border);
}

.tag-chip.driver { border-color: rgba(232, 0, 45, 0.25); color: #ff6680; background: rgba(232,0,45,0.05); }
.tag-chip.team   { border-color: rgba(54, 113, 198, 0.25); color: #7799dd; background: rgba(54,113,198,0.05); }

.update-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #ffcc00;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.update-badge::before {
  content: '↑';
  font-size: 12px;
}

/* ── Ad between articles (in-feed) ───────────────────────── */
.in-feed-ad {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

/* ── Load more ────────────────────────────────────────────── */
.load-more-wrap {
  text-align: center;
  padding: 32px 0 16px;
}

.btn-load-more {
  padding: 10px 32px;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-load-more:hover { border-color: var(--accent); color: var(--accent); }
.btn-load-more:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: relative;
  align-self: stretch;
  height: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-sticky-ad {
  position: sticky;
  top: calc(var(--header-height) + 12px);
  align-self: flex-start;
  width: 100%;
  z-index: 2;
}

.sidebar-section { }
.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.sidebar-article {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.sidebar-article:last-child { border-bottom: none; }
.sidebar-article:hover .sidebar-article-title { color: var(--accent); }

.sidebar-article-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
  transition: color var(--transition);
}

.sidebar-article-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Empty / loading states ───────────────────────────────── */
.state-wrap {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.state-wrap .state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.state-wrap h3 { font-size: 18px; color: var(--text-secondary); margin-bottom: 6px; }
.state-wrap p { font-size: 13px; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  height: 200px;
}

/* ── Article detail page ──────────────────────────────────── */
.article-page {
  max-width: 740px;
  margin: 0 auto;
}

.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: 0.4; }

.article-header {
  margin-bottom: 24px;
}

.article-meta-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.article-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.3px;
  margin-bottom: 14px;
}

.article-summary {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin-bottom: 16px;
}

.article-dateline {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.article-dateline .dot { opacity: 0.4; }

.article-hero {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
}

.article-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-primary);
}

.article-content p {
  margin-bottom: 18px;
}

/* In-article ad */
.article-ad-inline {
  margin: 28px 0;
  display: flex;
  justify-content: center;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 28px 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.article-sources {
  margin: 28px 0;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.article-sources h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.source-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.source-item:last-child { border-bottom: none; }
.source-item a { color: var(--accent); }
.source-item a:hover { text-decoration: underline; }
.source-item .source-date { color: var(--text-muted); font-size: 11px; }

/* Update history */
.update-history {
  margin: 24px 0;
}

.update-history summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color var(--transition);
}

.update-history summary:hover { border-color: var(--accent); }
.update-history summary::before { content: '▶'; font-size: 10px; }
.update-history[open] summary::before { content: '▼'; }

.update-entry {
  padding: 14px;
  border: 1px solid var(--border);
  border-top: none;
  font-size: 13px;
  background: var(--bg-card);
}

.update-entry + .update-entry { border-top: 1px solid var(--border); }
.update-entry .update-time { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }

/* Update link banner */
.update-link-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(255, 204, 0, 0.06);
  border: 1px solid rgba(255, 204, 0, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 13px;
}

.update-link-banner .icon { font-size: 18px; flex-shrink: 0; }
.update-link-banner a { color: #ffcc00; font-weight: 600; }

/* Related articles */
.related-articles {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 2px solid var(--border);
}

.related-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  margin-top: 48px;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  position: relative;
  z-index: 1;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-copy { font-size: 12px; color: var(--text-muted); }
.footer-sources { font-size: 12px; color: var(--text-muted); }
.footer-sources a { color: var(--text-secondary); }
.footer-sources a:hover { color: var(--accent); }

/* ── Toast notifications ──────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
}

.toast.show { transform: translateY(0); opacity: 1; }

/* ── Utilities ────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.text-accent { color: var(--accent); }
.mt-auto { margin-top: auto; }

/* ── Scrollbar styling ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Mobile tweaks ────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-header { padding: 0 16px; }
  .filter-bar { padding: 0 16px; }
  .page-wrap { padding: 16px 16px 48px; }
  .header-search input { width: 130px; }
  .header-search input:focus { width: 170px; }
  .article-card.featured .card-image { height: 200px; }
  .article-card.featured .card-title { font-size: 20px; }
  .live-badge { display: none; }
}
