/* ==========================================================================
   OBSERVATORY — Dark theme design system for vibecodingbenchmarks.com
   ========================================================================== */

/* --- Tokens --- */
:root {
  --bg-primary: #09090f;
  --bg-secondary: #111119;
  --bg-surface: #17172a;
  --bg-surface-hover: #1e1e35;
  --bg-surface-active: #25253f;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.1);
  --border-amber: rgba(245,158,11,0.3);

  --text-primary: #f5f5f5;
  --text-body: #d4d4d8;
  --text-muted: #71717a;
  --text-dim: #3f3f46;

  --amber: #f59e0b;
  --amber-dark: #b45309;
  --amber-glow: rgba(245,158,11,0.08);
  --amber-glow-strong: rgba(245,158,11,0.18);
  --blue: #3b82f6;
  --blue-dim: rgba(59,130,246,0.15);

  --good: #22c55e;
  --good-bg: rgba(34,197,94,0.1);
  --warn: #f59e0b;
  --warn-bg: rgba(245,158,11,0.1);
  --bad: #ef4444;
  --bad-bg: rgba(239,68,68,0.1);

  --font-display: 'Outfit', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --nav-h: 56px;
  --max-w: 1160px;
  --radius: 6px;
  --radius-lg: 10px;
}

/* --- Reset --- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-body);
  background: var(--bg-primary);
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--blue); text-decoration: none; transition: color .15s; }
a:hover { color: var(--amber); }

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

/* --- Typography --- */
h1,h2,h3,h4 { font-family: var(--font-display); color: var(--text-primary); line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -0.02em; margin-bottom: 1rem; }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; margin-bottom: 0.6rem; }
h4 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 500; margin-bottom: 0.5rem; }

p + p { margin-top: 1rem; }

.mono { font-family: var(--font-mono); }
.metric { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-amber { color: var(--amber); }
.text-good  { color: var(--good); }
.text-bad   { color: var(--bad); }
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-sm    { font-size: 0.85rem; }
.text-xs    { font-size: 0.75rem; }

/* --- Layout --- */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }
.section + .section { border-top: 1px solid var(--border); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; gap: 8px; }

/* --- Navigation --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(9,9,15,0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

.nav-brand {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  text-transform: uppercase;
}
.nav-brand span { color: var(--amber); }

.nav-links { display: flex; gap: 32px; list-style: none; }
.nav-links a {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color .15s;
  position: relative;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text-primary); }
.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0; right: 0;
  height: 1px;
  background: var(--amber);
}

.nav-toggle { display: none; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }
.nav-toggle svg { width: 22px; height: 22px; }

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: -12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 0;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-body);
}
.nav-dropdown-menu a:hover { background: var(--bg-surface-hover); color: var(--text-primary); }

/* --- Hero --- */
.hero {
  padding: 100px 0 80px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  animation: scan 3s ease-out 0.5s 1 forwards;
  opacity: 0;
}
@keyframes scan {
  0%   { opacity: 0.8; top: 0; }
  100% { opacity: 0; top: 100%; }
}
.hero h1 { max-width: 720px; }
.hero h1 .line-2 { display: block; color: var(--amber); }
.hero-sub {
  margin-top: 20px;
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.6;
}

/* Live indicator */
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  background: var(--good);
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

/* --- Cards --- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color .2s, box-shadow .2s;
}
.card:hover {
  border-color: var(--border-amber);
  box-shadow: 0 0 24px var(--amber-glow);
}
.card-sm { padding: 16px; }
.card-flat { background: transparent; border: 1px solid var(--border); }

/* --- Score Badge --- */
.score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score-good { color: var(--good); }
.score-warn { color: var(--warn); }
.score-bad  { color: var(--bad); }
.score-bar {
  height: 3px;
  border-radius: 2px;
  margin-top: 12px;
  background: var(--border);
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .8s cubic-bezier(0.16,1,0.3,1);
}

/* --- Platform identity --- */
.platform-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.platform-lovable  { background: #e11d48; }
.platform-bolt     { background: #8b5cf6; }
.platform-v0       { background: #fff; color: #000; }
.platform-replit    { background: #f26522; }
.platform-emergent { background: #06b6d4; }
.platform-openkbs  { background: var(--amber); color: #000; }

.platform-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* --- Scoreboard --- */
.scoreboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.scoreboard-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.scoreboard-card:hover {
  border-color: var(--border-amber);
  box-shadow: 0 0 20px var(--amber-glow);
  transform: translateY(-2px);
}
.scoreboard-card .platform-logo { margin: 0 auto 10px; }
.scoreboard-card .score { margin: 10px 0 4px; }
.scoreboard-metrics {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.scoreboard-metric {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}
.scoreboard-metric .label { color: var(--text-dim); font-family: var(--font-body); }
.scoreboard-metric .value { font-family: var(--font-mono); color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* --- Findings --- */
.finding {
  padding: 20px 24px;
  border-left: 2px solid var(--amber);
  background: var(--amber-glow);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 16px;
}
.finding p { font-size: 0.95rem; line-height: 1.65; color: var(--text-body); }
.finding strong { color: var(--text-primary); }

/* --- Category navigation cards --- */
.cat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color .2s, box-shadow .2s;
  text-decoration: none;
  display: block;
}
.cat-card:hover {
  border-color: var(--border-amber);
  box-shadow: 0 0 20px var(--amber-glow);
  color: inherit;
}
.cat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--amber-glow-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--amber);
}
.cat-card-icon svg { width: 20px; height: 20px; }
.cat-card h3 { font-size: 1rem; margin-bottom: 6px; }
.cat-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

/* --- Data Tables --- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
thead { background: var(--bg-surface); }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-body);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-surface-hover); }
td.platform-cell {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
td.good { color: var(--good); }
td.warn { color: var(--warn); }
td.bad  { color: var(--bad); }
td.best { color: var(--good); font-weight: 600; }
td.worst { color: var(--bad); }

/* --- Chart containers --- */
.chart-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.chart-container h3 { margin-bottom: 4px; }
.chart-container .chart-sub { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 20px; }
.chart-canvas-wrap { position: relative; width: 100%; }
.chart-canvas-wrap canvas { width: 100% !important; }

/* Chart legend */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }
.chart-legend-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* --- Methodology block --- */
.method-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
}
.method-block h3 { margin-bottom: 8px; }
.method-block p { font-size: 0.92rem; color: var(--text-muted); line-height: 1.7; }
.method-block a { color: var(--amber); }

/* --- Comparison layout --- */
.vs-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 40px 0;
}
.vs-platform {
  display: flex;
  align-items: center;
  gap: 12px;
}
.vs-divider {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--text-dim);
}
.vs-verdict {
  background: var(--amber-glow);
  border-left: 2px solid var(--amber);
  padding: 20px 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 24px 0;
}
.vs-verdict p { color: var(--text-body); font-size: 0.95rem; }

.vs-table td.winner { color: var(--good); font-weight: 600; }
.vs-table td.loser { color: var(--text-muted); }

/* --- Page header (benchmark / compare pages) --- */
.page-header {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 { margin-bottom: 12px; }
.page-header .lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 640px;
  line-height: 1.7;
}
.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 16px;
  font-family: var(--font-mono);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb span { margin: 0 6px; }

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 80px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-left p { font-size: 0.82rem; color: var(--text-dim); line-height: 1.6; }
.footer-left a { color: var(--text-muted); }
.footer-links { display: flex; gap: 24px; }
.footer-links a { font-size: 0.82rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--amber); }

/* --- Prose (methodology, about pages) --- */
.prose { max-width: 680px; }
.prose h2 { margin-top: 48px; margin-bottom: 16px; }
.prose h3 { margin-top: 32px; margin-bottom: 12px; }
.prose p { margin-bottom: 16px; }
.prose ul, .prose ol { margin: 16px 0; padding-left: 24px; }
.prose li { margin-bottom: 8px; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--amber);
}
.prose blockquote {
  border-left: 2px solid var(--amber);
  padding: 12px 20px;
  margin: 24px 0;
  background: var(--amber-glow);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.prose blockquote p { color: var(--text-body); margin-bottom: 0; }

/* --- Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeIn 0.5s ease forwards;
}
@keyframes fadeIn {
  to { opacity: 1; transform: translateY(0); }
}
.fade-in:nth-child(1) { animation-delay: 0.05s; }
.fade-in:nth-child(2) { animation-delay: 0.1s; }
.fade-in:nth-child(3) { animation-delay: 0.15s; }
.fade-in:nth-child(4) { animation-delay: 0.2s; }
.fade-in:nth-child(5) { animation-delay: 0.25s; }

.counter { transition: all 0.6s cubic-bezier(0.16,1,0.3,1); }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .grid-5, .scoreboard { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0; bottom: 0;
    background: var(--bg-primary);
    padding: 32px 24px;
    gap: 20px;
    border-top: 1px solid var(--border);
    z-index: 99;
  }
  .nav-toggle { display: block; }
  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0 0 0 16px;
  }
  .nav-dropdown:hover .nav-dropdown-menu { display: none; }
  .nav-dropdown.open .nav-dropdown-menu { display: block; }

  .grid-5, .scoreboard { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }

  .hero { padding: 60px 0 50px; }
  .section { padding: 48px 0; }
  .vs-header { flex-direction: column; gap: 16px; }

  .footer-inner { flex-direction: column; gap: 20px; text-align: center; }
}

@media (max-width: 480px) {
  .scoreboard { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.75rem; }
}
