:root {
  --color-bg: #0c0b0a;
  --color-surface: #161412;
  --color-surface-hover: #1c1a17;
  --color-text: #f3ede2;
  --color-muted: #948d80;
  --color-accent: #ff9d2e;
  --color-accent-dim: #4a2c0a;
  --color-border: #2a2621;
  --font-display: "Bebas Neue", "Arial Narrow", sans-serif;
  --font-body: "Archivo", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --radius: 4px;
}

* {
  box-sizing: border-box;
}

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

/* Subtle grain overlay for atmosphere */
.grain {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- Header ---------- */

.site-header {
  padding: 28px 0 10px;
  animation: fade-up 0.5s ease both;
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  font-family: var(--font-display);
  font-size: 2.75rem;
  letter-spacing: 0.03em;
  color: var(--color-text);
  text-decoration: none;
  line-height: 1;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  border: 1px solid var(--color-accent-dim);
  padding: 4px 8px 4px 6px;
  border-radius: 999px;
  margin-top: 4px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
  animation: pulse 1.6s ease-in-out infinite;
}

.tagline {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.tagline em {
  color: var(--color-accent);
  font-style: normal;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(255, 157, 46, 0.5);
  }
  50% {
    opacity: 0.4;
    box-shadow: 0 0 0 4px rgba(255, 157, 46, 0);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main {
  padding: 14px 0 60px;
}

.loading,
.error {
  color: var(--color-muted);
  text-align: center;
  padding: 40px 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.error {
  color: var(--color-accent);
}

.page-meta {
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  margin: 0 0 18px;
}

/* ---------- Tabs ---------- */

.tab-nav {
  margin-bottom: 32px;
  border-bottom: 1px solid var(--color-border);
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tab {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
  color: var(--color-text);
}

.tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

/* ---------- Trend header ---------- */

.trend-header {
  margin-bottom: 28px;
  animation: fade-up 0.4s ease both;
}

.trend-volume {
  display: inline-block;
  background: var(--color-accent);
  color: #2a1400;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.trend-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 0.95;
  margin: 0 0 10px;
  text-transform: uppercase;
}

/* ---------- Article grid ---------- */

.articles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.article-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  animation: fade-up 0.45s ease both;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.article-card:hover {
  border-color: var(--color-accent-dim);
  background: var(--color-surface-hover);
  transform: translateY(-2px);
}

.article-card:nth-child(1) { animation-delay: 0.03s; }
.article-card:nth-child(2) { animation-delay: 0.07s; }
.article-card:nth-child(3) { animation-delay: 0.11s; }
.article-card:nth-child(4) { animation-delay: 0.15s; }
.article-card:nth-child(5) { animation-delay: 0.19s; }
.article-card:nth-child(6) { animation-delay: 0.23s; }
.article-card:nth-child(7) { animation-delay: 0.27s; }
.article-card:nth-child(8) { animation-delay: 0.31s; }
.article-card:nth-child(9) { animation-delay: 0.35s; }
.article-card:nth-child(10) { animation-delay: 0.39s; }

.article-source {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.article-title {
  display: block;
  margin: 8px 0 8px;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  line-height: 1.3;
}

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

.article-description {
  margin: 0 0 12px;
  color: var(--color-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.article-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-muted);
  margin-top: auto;
  padding-top: 6px;
}

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

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 20px 0;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-align: center;
}

.site-footer p {
  margin: 4px 0;
}

.site-footer a {
  color: var(--color-muted);
  text-decoration: underline;
}

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

@media (prefers-reduced-motion: reduce) {
  .live-dot,
  .article-card,
  .site-header,
  .trend-header {
    animation: none !important;
  }

  .article-card {
    opacity: 1 !important;
  }
}
