:root {
  --accent: #ed3500;
  --accent-dim: #c72c00;
  --bg: #eeebe3;
  --bg-card: #f8f6f1;
  --text: #3c3333;
  --text-muted: #7a6f6f;
  --border: #ddd5c8;
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
}

a { color: inherit; }

/* ---------- Masthead ---------- */

.masthead {
  border-bottom: 3px solid var(--text);
  padding: 3.5rem 1.5rem 2rem;
  text-align: center;
}

.masthead-inner { max-width: 760px; margin: 0 auto; }

.eyebrow {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.masthead h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  margin: 0;
  letter-spacing: -0.01em;
}

.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text-muted);
  margin: 0.9rem 0 0.5rem;
}

.updated {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}

/* ---------- Ticker ---------- */

.ticker-section {
  background: var(--text);
  color: var(--bg);
  padding: 1.25rem 1.5rem;
}

.ticker-inner { max-width: 1040px; margin: 0 auto; }

.ticker-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #c9c0c0;
  margin: 0 0 0.75rem;
}

.ticker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.9rem 1.25rem;
}

.ticker-item { min-width: 0; }

.ticker-item .t-name {
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #d8d0d0;
  white-space: normal;
  line-height: 1.25;
  margin-bottom: 0.35rem;
  min-height: 2.2em;
}

.ticker-bar-track {
  background: rgba(255,255,255,0.14);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.ticker-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

.ticker-item .t-count {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--bg);
  margin-top: 0.3rem;
}

/* ---------- Trend chart ---------- */

.trend-section {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem;
}

.trend-inner { max-width: 1040px; margin: 0 auto; }

.trend-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.trend-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0;
}

.trend-sublabel {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0;
}

.trend-chart-wrap { position: relative; height: 260px; }

.trend-empty {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 0;
  margin: 0;
}

/* ---------- Controls ---------- */

.controls {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.5rem;
}

.controls-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.controls input,
.controls select {
  font-family: var(--sans);
  font-size: 0.88rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text);
}

.controls input[type="search"] { flex: 1 1 220px; }

.controls select { cursor: pointer; }

.controls input:focus,
.controls select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.result-count {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.export-buttons {
  display: flex;
  gap: 0.4rem;
}

.export-btn {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
}

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

/* ---------- Topic sections ---------- */

main { max-width: 1040px; margin: 0 auto; padding: 1rem 1.5rem 4rem; }

.topic-section { margin-top: 2.75rem; }

.topic-heading {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  border-bottom: 2px solid var(--text);
  padding-bottom: 0.4rem;
  margin-bottom: 1.1rem;
}

.topic-numeral {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.95rem;
}

.topic-heading h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin: 0;
  flex: 1;
}

.topic-count {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(60,51,51,0.1);
}

.article-meta {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.article-type-badge {
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  align-self: flex-start;
}

.article-card h3 {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.3;
  margin: 0;
}

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

.article-card h3 a:hover { color: var(--accent); }

.article-authors {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.article-snippet {
  font-size: 0.85rem;
  color: var(--text);
  margin: 0;
  opacity: 0.85;
}

.no-results {
  font-family: var(--mono);
  color: var(--text-muted);
  padding: 3rem 0;
  text-align: center;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem 3rem;
  text-align: center;
}

.site-footer p {
  max-width: 640px;
  margin: 0 auto 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.site-footer p:last-child { margin-bottom: 0; }

.site-footer a { color: var(--accent); }

@media (max-width: 560px) {
  .controls-inner { flex-direction: column; align-items: stretch; }
  .result-count { margin-left: 0; text-align: right; }
}
