/* ============================================================
   rande.xyz Research — design system
   Dark-mode-first, restrained single accent, system font stacks
   (no external font fetch — keeps CSP font-src 'self' trivial and
   the site fast with zero extra network requests).
   ============================================================ */

:root {
  /* Surfaces */
  --bg: #090c10;
  --bg-elevated: #10151c;
  --bg-card: #131922;
  --border: #1f2733;
  --border-soft: #171e29;

  /* Text */
  --text: #e6edf3;
  --text-muted: #8b97a8;
  --text-faint: #5a6577;

  /* Accent */
  --accent: #22d3ee;
  --accent-dim: #0e7490;
  --accent-bg: rgba(34, 211, 238, 0.1);

  /* Severity */
  --sev-critical: #f43f5e;
  --sev-high: #fb923c;
  --sev-medium: #eab308;
  --sev-low: #3b82f6;
  --sev-info: #6b7280;

  /* Type */
  --font-sans:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
    'Apple Color Emoji', 'Segoe UI Emoji';
  --font-mono:
    ui-monospace, 'SF Mono', 'Cascadia Code', 'Consolas', 'JetBrains Mono', monospace;

  --radius: 8px;
  --radius-lg: 14px;
  --max-width: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

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

.site-header {
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: rgba(9, 12, 16, 0.85);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover {
  text-decoration: none;
  color: var(--text);
}
.brand__mark {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
}

.nav {
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav a {
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
}
.nav a:hover {
  color: var(--text);
  text-decoration: none;
}

/* ---------- Hero ---------- */

.hero {
  padding: 72px 24px 48px;
  border-bottom: 1px solid var(--border-soft);
}
.hero__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}
.hero h1 {
  font-size: 40px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.hero p {
  color: var(--text-muted);
  font-size: 17px;
  max-width: 640px;
  margin: 0;
}
.hero .accent {
  color: var(--accent);
}

/* ---------- Post grid / cards ---------- */

.section {
  padding: 48px 24px;
}
.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 20px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.post-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}
.post-card__cover {
  aspect-ratio: 16 / 9;
  background: var(--bg-elevated);
  object-fit: cover;
  width: 100%;
}
.post-card__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.post-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.post-card h3 {
  font-size: 18px;
  line-height: 1.35;
  margin: 0;
}
.post-card h3 a {
  color: var(--text);
}
.post-card h3 a:hover {
  color: var(--accent);
  text-decoration: none;
}
.post-card__excerpt {
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0;
  flex: 1;
}
.post-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 4px;
}

/* ---------- Badges / pills ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--critical {
  color: var(--sev-critical);
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.3);
}
.badge--high {
  color: var(--sev-high);
  background: rgba(251, 146, 60, 0.12);
  border-color: rgba(251, 146, 60, 0.3);
}
.badge--medium {
  color: var(--sev-medium);
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.3);
}
.badge--low {
  color: var(--sev-low);
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
}
.badge--info {
  color: var(--sev-info);
  background: rgba(107, 114, 128, 0.12);
  border-color: rgba(107, 114, 128, 0.3);
}

.pill {
  display: inline-block;
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}
.pill:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
  text-decoration: none;
}

/* ---------- Article page ---------- */

.article {
  padding: 56px 24px 80px;
  max-width: 760px;
  margin: 0 auto;
}
.article__meta-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.article h1 {
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
}
.article__byline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 36px;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  object-fit: cover;
  flex-shrink: 0;
}
.avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--border);
}
.byline__name {
  font-weight: 600;
  color: var(--text);
}
.byline__name a {
  color: inherit;
}
.byline__sub {
  font-size: 13px;
  color: var(--text-faint);
  display: flex;
  gap: 8px;
  align-items: center;
}
.x-handle {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.x-handle:hover {
  color: var(--accent);
}

.prose {
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--text);
}
.prose h2 {
  font-size: 24px;
  margin: 40px 0 16px;
  letter-spacing: -0.01em;
}
.prose h3 {
  font-size: 19px;
  margin: 32px 0 12px;
}
.prose p {
  margin: 0 0 20px;
}
.prose ul,
.prose ol {
  margin: 0 0 20px;
  padding-left: 24px;
}
.prose li {
  margin-bottom: 6px;
}
.prose blockquote {
  margin: 24px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--accent-dim);
  color: var(--text-muted);
}
.prose img {
  border-radius: var(--radius);
  margin: 28px 0;
}
.prose a {
  text-decoration: underline;
  text-decoration-color: var(--accent-dim);
  text-underline-offset: 2px;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}
.prose pre {
  margin: 24px 0;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: #0d1117;
  border: 1px solid var(--border);
  overflow-x: auto;
}
.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.6;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14.5px;
}
.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.prose th {
  background: var(--bg-elevated);
  font-weight: 600;
}

.article__tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
}

/* ---------- Page headers (categories/tags/researchers listing) ---------- */

.page-header {
  padding: 56px 24px 32px;
  max-width: var(--max-width);
  margin: 0 auto;
}
.page-header h1 {
  font-size: 30px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.page-header p {
  color: var(--text-muted);
  margin: 0;
}

/* ---------- Researcher profile ---------- */

.profile-card {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 28px 0;
}
.profile-card .avatar,
.profile-card .avatar--placeholder {
  width: 72px;
  height: 72px;
  font-size: 24px;
}
.profile-card h1 {
  margin: 0 0 6px;
  font-size: 26px;
}
.profile-card__bio {
  color: var(--text-muted);
  max-width: 560px;
  margin: 8px 0 0;
}
.profile-card__links {
  display: flex;
  gap: 14px;
  margin-top: 10px;
}

.researcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.researcher-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.researcher-card h3 {
  margin: 0 0 4px;
  font-size: 15.5px;
}
.researcher-card .count {
  font-size: 13px;
  color: var(--text-faint);
}

/* ---------- Category list ---------- */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: border-color 0.15s ease;
}
.category-card:hover {
  border-color: var(--accent-dim);
  text-decoration: none;
}
.category-card h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 17px;
}
.category-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}
.category-card .count {
  display: inline-block;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--accent);
  font-family: var(--font-mono);
}

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

.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 32px 24px;
  margin-top: 40px;
}
.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-faint);
  font-size: 13.5px;
  flex-wrap: wrap;
  gap: 12px;
}
.site-footer a {
  color: var(--text-faint);
}
.site-footer a:hover {
  color: var(--accent);
}

/* ---------- Empty / error states ---------- */

.empty-state,
.error-state {
  text-align: center;
  padding: 100px 24px;
  color: var(--text-muted);
}
.error-state h1 {
  font-size: 72px;
  margin: 0;
  color: var(--border);
  font-family: var(--font-mono);
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .hero h1 {
    font-size: 30px;
  }
  .article h1 {
    font-size: 26px;
  }
  .nav {
    gap: 16px;
  }
  .nav a {
    font-size: 13px;
  }
}
