:root {
  --logo-blue: #004aad;
  --purple: #6b4ce6;
  --purple-light: #ede9fe;
  --navy: #1e293b;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --red: #ef4444;
  --blue: #3b82f6;
  --gray-bar: #94a3b8;
  --badge-blue: #dbeafe;
  --badge-blue-text: #1d4ed8;
  --radius: 10px;
  --radius-pill: 999px;
  --max-width: 1200px;
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.4rem 1.5rem 0.3rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  display: block;
  flex-shrink: 0;
  line-height: 0;
  overflow: hidden;
  height: 74px;
}

.logo-img {
  display: block;
  height: 94px;
  width: auto;
  margin-top: -12px;
  margin-bottom: -12px;
  object-fit: contain;
  object-position: left bottom;
}

.main-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem 1.1rem;
  flex: 1;
  min-width: 0;
}

.nav-link {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding-bottom: 0.2rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  color: var(--purple);
  border-bottom-color: var(--purple);
}

/* Page layout */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

/* Latest Stories */
.latest-stories {
  position: relative;
}

.latest-stories-label {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.35rem 0.65rem;
  background: var(--logo-blue);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.latest-stories-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  min-height: 420px;
  background: #111;
}

.latest-stories-empty {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  margin: 0;
  padding: 2rem;
  color: #94a3b8;
  text-align: center;
}

.latest-stories-empty code {
  color: #e2e8f0;
  font-size: 0.85em;
}

.story-card {
  position: relative;
  display: block;
  overflow: hidden;
  min-height: 0;
  color: #fff;
}

.story-card--featured {
  grid-row: 1 / -1;
  grid-column: 1;
}

.story-card--secondary:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}

.story-card--secondary:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.story-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.story-card:hover .story-card__img {
  transform: scale(1.04);
}

.story-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.88) 0%,
    rgba(0, 0, 0, 0.35) 45%,
    rgba(0, 0, 0, 0.1) 100%
  );
  pointer-events: none;
}

.story-card__title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 1rem 1.1rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.story-card--featured .story-card__title {
  font-size: clamp(1.1rem, 2.2vw, 1.65rem);
  padding: 1.25rem 1.35rem;
}

.story-card--secondary .story-card__title {
  font-size: clamp(0.8rem, 1.4vw, 1rem);
  padding: 0.85rem;
}

@media (max-width: 768px) {
  .latest-stories-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    min-height: 0;
  }

  .story-card--featured,
  .story-card--secondary:nth-child(2),
  .story-card--secondary:nth-child(3) {
    grid-column: 1;
    grid-row: auto;
  }

  .story-card--featured {
    min-height: 260px;
  }

  .story-card--secondary {
    min-height: 180px;
  }
}

/* Hero */
.hero {
  margin-bottom: 2rem;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
}

.hero-desc {
  margin: 0 0 0.5rem;
  max-width: 640px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.hero-updated {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Filters */
.filters {
  margin-bottom: 1.75rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.filter-row + .filter-row {
  margin-top: 0.85rem;
}

.filter-secondary {
  justify-content: space-between;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.filter-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-right: 0.35rem;
}

.pill {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.pill:hover {
  background: #e2e8f0;
  color: var(--text);
}

.pill.active {
  background: var(--navy);
  color: #fff;
}

.pill-sm {
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
}

/* Content grid */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 1.25rem;
  align-items: start;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Article card */
.article-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.25rem;
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s;
}

.article-card:hover {
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.article-card.hidden {
  display: none;
}

.article-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-subtle);
}

.article-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.article-category {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-light);
}

.badge-sources {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--badge-blue);
  color: var(--badge-blue-text);
}

.sentiment {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sentiment-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.sentiment-negative .sentiment-dot { background: var(--red); }
.sentiment-neutral .sentiment-dot { background: var(--gray-bar); }
.sentiment-positive .sentiment-dot { background: #22c55e; }

.article-time {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-light);
}

.article-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.article-summary {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Bias spectrum bar */
.bias-bar-wrap {
  margin-bottom: 0.75rem;
}

.bias-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.bias-segment {
  min-width: 4px;
  transition: flex 0.3s;
}

.bias-left { background: var(--red); }
.bias-center { background: var(--gray-bar); }
.bias-right { background: var(--blue); }

.bias-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-light);
}

.bias-labels span strong {
  color: var(--text-muted);
  font-weight: 600;
}

.article-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--purple);
  margin-top: auto;
  align-self: flex-start;
}

.article-link:hover {
  text-decoration: underline;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: sticky;
  top: 5rem;
}

.sidebar-box {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.sidebar-title {
  margin: 0 0 0.5rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.sidebar-placeholder {
  margin: 0;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-light);
  line-height: 1.45;
}

.ownership-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ownership-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.ownership-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.ownership-list li:first-child {
  padding-top: 0;
}

.ownership-list strong {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.ownership-list span {
  font-size: 0.68rem;
  color: var(--text-light);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Responsive */
@media (max-width: 960px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-box {
    flex: 1 1 200px;
  }
}

@media (max-width: 640px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .main-nav {
    gap: 0.6rem 0.85rem;
  }

  .nav-link {
    font-size: 0.68rem;
  }

  .article-card {
    grid-template-columns: 1fr;
  }

  .article-image {
    height: 180px;
  }

  .filter-secondary {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .sidebar {
    flex-direction: column;
  }
}
