:root {
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0e0e10;
  --card: #18181c;
  --card-hover: #1d1d23;
  --border: #262630;
  --border-strong: #36363f;
  --topbar-bg: rgba(14, 14, 16, 0.85);
  --text: #e4e4e7;
  --muted: #a1a1aa;
  --dim: #71717a;
  --green: #4ade80;
  --red: #f87171;
  --yellow: #fbbf24;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --orange: #fb923c;
  --teal: #2dd4bf;
  --cat-pillar: #fbbf24;
  --cat-bull: #4ade80;
  --cat-bear: #f87171;
  --cat-sector: #60a5fa;
  --cat-style: #a78bfa;
}

html[data-theme="light"] {
  --bg: #fafaf9;
  --card: #ffffff;
  --card-hover: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --topbar-bg: rgba(250, 250, 249, 0.85);
  --text: #18181b;
  --muted: #52525b;
  --dim: #71717a;
  --green: #15803d;
  --red: #b91c1c;
  --yellow: #a16207;
  --blue: #1d4ed8;
  --purple: #6d28d9;
  --orange: #c2410c;
  --teal: #0d9488;
  --cat-pillar: #a16207;
  --cat-bull: #15803d;
  --cat-bear: #b91c1c;
  --cat-sector: #1d4ed8;
  --cat-style: #6d28d9;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { display: flex; align-items: baseline; gap: 0.6rem; }
.brand h1 { margin: 0; font-size: 1.05rem; font-weight: 600; letter-spacing: 0.01em; }
.brand .tagline { font-size: 0.78rem; color: var(--muted); font-family: var(--mono); }
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cat-bull), var(--cat-sector));
  display: inline-block;
}
.meta button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}
.meta button:hover { color: var(--text); border-color: var(--border-strong); }

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.hero { margin-bottom: 2rem; }
.hero h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.6rem;
  letter-spacing: -0.01em;
}
.hero-blurb {
  color: var(--muted);
  max-width: 70ch;
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}
.hero-blurb em { color: var(--dim); font-style: italic; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.filter-chip {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: var(--mono);
  transition: all 0.12s ease;
}
.filter-chip:hover { color: var(--text); border-color: var(--border-strong); }
.filter-chip[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.cat-section { margin-top: 2.5rem; }
.cat-section:first-of-type { margin-top: 1rem; }
.cat-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}
.cat-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.cat-header .cat-blurb {
  color: var(--muted);
  font-size: 0.82rem;
}
.cat-section[data-cat="pillar"] .cat-header h3 { color: var(--cat-pillar); }
.cat-section[data-cat="bull"]   .cat-header h3 { color: var(--cat-bull); }
.cat-section[data-cat="bear"]   .cat-header h3 { color: var(--cat-bear); }
.cat-section[data-cat="sector"] .cat-header h3 { color: var(--cat-sector); }
.cat-section[data-cat="style"]  .cat-header h3 { color: var(--cat-style); }

.thesis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.thesis-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.thesis-card:hover {
  border-color: var(--border-strong);
}

.thesis-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.thesis-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
}
.thesis-code {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border: 1px solid var(--border);
}
.cat-section[data-cat="pillar"] .thesis-code {
  color: var(--cat-pillar);
  border-color: rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.07);
}

.thesis-tagline {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  margin: 0;
  line-height: 1.45;
}
.thesis-summary {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
  line-height: 1.55;
}

.thesis-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  font-size: 0.74rem;
  font-family: var(--mono);
  color: var(--dim);
  margin-top: 0.1rem;
}
.thesis-meta strong { color: var(--muted); font-weight: 500; }

.thesis-voices {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}
.thesis-voices strong {
  color: var(--dim);
  font-weight: 500;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.4rem;
}

.thesis-names {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.3rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
}
.thesis-name-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.78rem;
}
.thesis-ticker {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  min-width: 4.5rem;
  font-size: 0.78rem;
}
.thesis-name-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.thesis-opposed {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--dim);
  margin-top: 0.3rem;
}
.thesis-opposed a { color: var(--muted); }
.thesis-opposed a:hover { color: var(--text); }

.momentum-pill {
  font-family: var(--mono);
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.momentum-pill[data-flavor="high"]      { color: var(--green); border-color: rgba(74, 222, 128, 0.3); }
.momentum-pill[data-flavor="strong"]    { color: var(--green); border-color: rgba(74, 222, 128, 0.3); }
.momentum-pill[data-flavor="gaining"]   { color: var(--blue);  border-color: rgba(96, 165, 250, 0.3); }
.momentum-pill[data-flavor="contested"] { color: var(--yellow); border-color: rgba(251, 191, 36, 0.3); }
.momentum-pill[data-flavor="fading"]    { color: var(--red);   border-color: rgba(248, 113, 113, 0.3); }
.momentum-pill[data-flavor="contrarian"]{ color: var(--purple); border-color: rgba(167, 139, 250, 0.3); }

footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}
footer .muted { color: var(--dim); font-family: var(--mono); font-size: 0.72rem; }

@media (max-width: 720px) {
  main { padding: 1.25rem 1rem 3rem; }
  .hero h2 { font-size: 1.4rem; }
  .thesis-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0.6rem 1rem; }
  .brand h1 { font-size: 0.95rem; }
}
