/* ─── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --bg-subtle: #f7f8fa;
  --surface: #ffffff;
  --border: #e5e8ed;
  --border-strong: #d0d5dd;
  --accent: #2563eb;
  --accent-light: #eff4ff;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --red: #dc2626;
  --red-light: #fef2f2;
  --amber: #d97706;
  --amber-light: #fffbeb;
  --text: #111827;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 10px;
  --radius-sm: 6px;
}

html { scroll-behavior: smooth; }

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

/* ─── Layout ───────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 28px; }
.container.narrow { max-width: 760px; }

.section { padding: 72px 0; }
.section.bg-subtle { background: var(--bg-subtle); }

/* ─── Hero ─────────────────────────────────────────────────────── */
.hero {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 80px 0 64px;
  text-align: center;
}

.tag {
  display: inline-block;
  background: var(--accent-light);
  border: 1px solid #bfdbfe;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 18px;
}

.subtitle {
  max-width: 640px;
  margin: 0 auto 32px;
  color: var(--text-muted);
  font-size: 1rem;
}

.hero-links { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Hero Stats ────────────────────────────────────────────────── */
.hero-stats {
  display: flex;
  gap: 0;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto;
}

.stat-item {
  flex: 1;
  padding: 16px 12px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none; }

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  font-family: var(--mono);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* ─── Section titles ───────────────────────────────────────────── */
.section-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
}

.section-sub { color: var(--text-muted); margin-bottom: 32px; margin-top: -8px; font-size: 0.92rem; }

.section p { color: #374151; font-size: 0.96rem; line-height: 1.75; }

/* ─── Research Questions ────────────────────────────────────────── */
.rq-list {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rq-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: #374151;
  line-height: 1.5;
}

.rq-num {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid #bfdbfe;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

/* ─── Chart ─────────────────────────────────────────────────────── */
.chart-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 28px;
  overflow: hidden;
}

.chart-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-label {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--text-dim);
}

.chart-label-sub {
  font-size: 9px;
  fill: var(--text-muted);
  font-weight: 600;
}

.chart-value {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}

.chart-axis-title {
  font-family: var(--font);
  font-size: 10px;
  fill: var(--text-muted);
}

.chart-annotation {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
}

.chart-legend-text {
  font-family: var(--font);
  font-size: 10px;
  fill: var(--text-muted);
  dominant-baseline: middle;
}

/* ─── Result Row ────────────────────────────────────────────────── */
.result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.result-card {
  flex: 1;
  min-width: 180px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.result-card-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.result-card-value {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--mono);
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.result-card-note {
  font-size: 0.76rem;
  line-height: 1.5;
}

.result-baseline {
  background: #fffbeb;
  border-color: #fde68a;
}
.result-baseline .result-card-label { color: #92400e; }
.result-baseline .result-card-value { color: #92400e; }
.result-baseline .result-card-note { color: #a16207; }

.result-worst {
  background: var(--red-light);
  border-color: #fecaca;
}
.result-worst .result-card-label { color: #991b1b; }
.result-worst .result-card-value { color: var(--red); }
.result-worst .result-card-note { color: #b91c1c; }

.result-best {
  background: var(--accent-light);
  border-color: #bfdbfe;
}
.result-best .result-card-label { color: #1e40af; }
.result-best .result-card-value { color: var(--accent); }
.result-best .result-card-note { color: #1e40af; }

.result-sep {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--mono);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Findings Grid ─────────────────────────────────────────────── */
.findings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.finding-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.finding-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 12px rgba(37,99,235,0.07);
}

.finding-icon { font-size: 1.5rem; margin-bottom: 8px; }

.finding-num {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-family: var(--mono);
}

.finding-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.3;
}

.finding-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 14px;
}

.finding-stat {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.finding-red { background: #fff; }
.finding-red .finding-stat { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.finding-orange { background: #fff; }
.finding-orange .finding-stat { background: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }

.finding-yellow { background: #fff; }
.finding-yellow .finding-stat { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }

.finding-blue { background: #fff; }
.finding-blue .finding-stat { background: var(--accent-light); color: var(--accent); border: 1px solid #bfdbfe; }

/* ─── Heatmap ───────────────────────────────────────────────────── */
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.hm-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.08);
}

.hm-legend-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-right: 8px;
  font-family: var(--mono);
}

/* Swatch colors */
.hm-swatch.hm-red    { background: #fee2e2; }
.hm-swatch.hm-orange { background: #ffedd5; }
.hm-swatch.hm-yellow { background: #fef9c3; }
.hm-swatch.hm-lgreen { background: #d1fae5; }
.hm-swatch.hm-green  { background: #a7f3d0; }

.heatmap-table { width: 100%; border-collapse: collapse; }

.heatmap-table th {
  text-align: center;
  padding: 10px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.hm-condition-col { text-align: left !important; min-width: 140px; }
.hm-avg-col { border-left: 2px solid var(--border-strong) !important; background: #f3f4f6 !important; }

.task-sub {
  font-weight: 400;
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: normal;
  margin-top: 2px;
  line-height: 1.3;
}

.hm-cell {
  padding: 10px 6px;
  text-align: center;
  font-size: 0.82rem;
  font-family: var(--mono);
  font-weight: 600;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.hm-avg-cell {
  border-left: 2px solid var(--border-strong);
  font-weight: 700;
}

/* Cell colors */
.hm-red    { background: #fee2e2; color: #991b1b; }
.hm-orange { background: #ffedd5; color: #c2410c; }
.hm-yellow { background: #fef9c3; color: #854d0e; }
.hm-lgreen { background: #d1fae5; color: #065f46; }
.hm-green  { background: #a7f3d0; color: #064e3b; }

.condition-cell {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.cond-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: 0.03em;
}

.cond-zero { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.cond-frac { background: var(--accent-light); color: var(--accent); border: 1px solid #bfdbfe; }
.cond-full { background: var(--green-light); color: var(--green); border: 1px solid #bbf7d0; }

.cond-sub {
  display: block;
  font-size: 0.68rem;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-top: 2px;
}

/* ─── Setup Cards ───────────────────────────────────────────────── */
.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.setup-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.setup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.setup-header-blue { background: #eff6ff; }
.setup-header-green { background: #f0fdf4; }

.setup-icon { font-size: 1.4rem; flex-shrink: 0; }
.setup-title { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.setup-subtitle { font-size: 0.75rem; color: var(--text-muted); font-family: var(--mono); margin-top: 2px; }

.setup-body { padding: 4px 0; }

.setup-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 20px;
  font-size: 0.82rem;
  border-bottom: 1px solid #f1f3f5;
}
.setup-row:last-child { border-bottom: none; }
.setup-row:hover { background: var(--bg-subtle); }

.setup-key {
  font-weight: 600;
  color: var(--text);
  width: 90px;
  flex-shrink: 0;
  font-size: 0.78rem;
}

.setup-val {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  flex: 1;
}

/* ─── Pipeline ──────────────────────────────────────────────────── */
.pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 24px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pipe-block {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
  min-width: 88px;
}
.pipe-block small {
  font-size: 0.7rem;
  font-weight: 400;
  display: block;
  font-family: var(--mono);
  opacity: 0.8;
}

.pipe-block.sensor     { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.pipe-block.controller { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.pipe-block.data       { background: #fff7ed; border: 1px solid #fed7aa; color: #c2410c; }
.pipe-block.rl         { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.pipe-block.output     { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.pipe-block.robot      { background: #f5f3ff; border: 1px solid #ddd6fe; color: #6d28d9; }
.pipe-arrow            { color: var(--text-dim); font-size: 1rem; }

/* ─── Tasks Grid ────────────────────────────────────────────────── */
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.task-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color 0.15s;
}
.task-card:hover { border-color: #93c5fd; }
.task-card-hard { border-color: #fecaca; background: #fff5f5; }

.task-id {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--mono);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.task-id.task-easy { background: #dcfce7; border-color: #bbf7d0; color: #15803d; }
.task-id.task-hard { background: #fee2e2; border-color: #fecaca; color: #991b1b; }

.task-body { flex: 1; }

.task-name {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 3px;
}

.task-zs {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--mono);
}
.task-zs-good { color: #15803d; }
.task-zs-bad  { color: #991b1b; font-weight: 600; }

/* ─── Phase List ────────────────────────────────────────────────── */
.phase-list { display: flex; flex-direction: column; gap: 14px; }

.phase-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: border-color 0.15s;
}
.phase-item:hover { border-color: #93c5fd; }

.phase-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
  margin-top: 2px;
}

.phase-zero { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.phase-1    { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.phase-2    { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.phase-3    { background: var(--green-light); color: var(--green); border: 1px solid #bbf7d0; }

.phase-body { flex: 1; }
.phase-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.phase-range {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--mono);
  font-weight: 400;
}
.phase-desc { font-size: 0.84rem; color: var(--text-muted); line-height: 1.65; margin-bottom: 10px; }

/* ─── Formula ───────────────────────────────────────────────────── */
.formula {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #1e40af;
}

/* ─── Fusion Note ───────────────────────────────────────────────── */
.fusion-note {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
}
.fusion-note strong { color: var(--text); }

/* ─── Tech Stack ────────────────────────────────────────────────── */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.tech-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 0.15s;
}
.tech-item:hover { border-color: #93c5fd; }
.tech-name { font-weight: 600; font-size: 0.88rem; margin-bottom: 3px; color: var(--text); }
.tech-role { color: var(--text-muted); font-size: 0.76rem; }

/* ─── Table ──────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 12px 18px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 18px;
  font-size: 0.87rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }

code {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #1e40af;
  background: #eff6ff;
  padding: 2px 6px;
  border-radius: 3px;
}

/* ─── Footer ─────────────────────────────────────────────────────── */
.footer {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  padding: 36px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
}
.footer-note { font-size: 0.76rem; color: var(--text-dim); margin-top: 5px; }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-stats { max-width: 360px; }
  .stat-value { font-size: 1.2rem; }
  .result-row { flex-direction: column; }
  .result-sep { display: none; }
  .result-card { min-width: 0; width: 100%; }
  .tasks-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .hm-condition-col { min-width: 110px; }
}

@media (max-width: 640px) {
  .pipeline { gap: 6px; padding: 16px; }
  .pipe-block { min-width: 68px; padding: 8px 10px; font-size: 0.73rem; }
  .hero { padding: 60px 0 48px; }
  .section { padding: 52px 0; }
  .setup-grid { grid-template-columns: 1fr; }
  .findings-grid { grid-template-columns: 1fr; }
  .phase-item { flex-direction: column; gap: 10px; }
  .tasks-grid { grid-template-columns: 1fr 1fr; }
  .chart-wrap { padding: 4px; }
}
