*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3350;
  --text: #e2e8f0;
  --text-muted: #8892b0;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --link: #60a5fa;
  --link-hover: #93c5fd;
}

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

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

header {
  grid-column: 1 / -1;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

header h1 span { color: var(--accent-light); }

.tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 1px;
}

.header-meta {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

aside {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: calc(100vh - 57px);
}

aside h2 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.topic-list { list-style: none; }

.topic-list li { margin-bottom: 2px; }

.topic-list a {
  display: block;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-list a:hover,
.topic-list a.active {
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
}

.topic-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

main {
  padding: 1.5rem;
  max-width: 900px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.filter-bar .active-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

.filter-bar .active-filter a {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
}

.results-count {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.articles { display: flex; flex-direction: column; gap: 1px; }

.article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.5rem;
  transition: border-color 0.15s;
}

.article:hover { border-color: #3e4468; }

.article-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.topic-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
  opacity: 0.9;
  transition: opacity 0.1s;
}

.topic-pill:hover { opacity: 1; text-decoration: none; color: #fff; }

.fetched-at {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.article h3 {
  font-size: 0.975rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.4rem;
}

.article h3 a { color: var(--text); }
.article h3 a:hover { color: var(--link-hover); text-decoration: none; }

.article p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.no-articles {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1.5rem;
  padding-bottom: 2rem;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.6rem;
  border-radius: 8px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all 0.1s;
}

.pagination a:hover {
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
  border-color: #3e4468;
}

.pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.pagination .ellipsis {
  border: none;
  background: none;
}

@media (max-width: 700px) {
  .layout { grid-template-columns: 1fr; }
  aside { display: none; }
  main { padding: 1rem; }
}
