:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-2: #f1f1ed;
  --border: #e4e5e7;
  --text: #0d0f12;
  --text-secondary: #545b66;
  --text-muted: #8b93a1;
  --shadow: 0 4px 20px rgba(16, 24, 40, 0.07);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* ── Pill nav ──────────────────────────────────── */

.pill-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  width: fit-content;
  margin: 28px auto 0;
}

.pill-nav-item {
  padding: 9px 22px;
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: background 0.2s, color 0.2s;
}

.pill-nav-item:hover { color: var(--text); }
.pill-nav-item.active { background: var(--surface-2); color: var(--text); }

/* ── Back link ─────────────────────────────────── */

.post-back {
  max-width: 900px;
  margin: 32px auto 0;
  padding: 0 24px;
}

.post-back a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.post-back a:hover { color: var(--text); }

/* ── Post header ───────────────────────────────── */

.post-header {
  max-width: 900px;
  margin: 40px auto 0;
  padding: 0 24px 40px;
  border-bottom: 1px solid var(--border);
}

.post-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.post-tag {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.post-read-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 14px;
}

.post-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 600px;
}

/* ── Main ──────────────────────────────────────── */

main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  width: 100%;
}

/* ── Tab bar ───────────────────────────────────── */

.tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.tab-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab-pill {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

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

.tab-pill.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.tab-arrows {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.arrow-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  font-family: inherit;
}

.arrow-btn:hover { background: var(--surface-2); }

/* ── Slider ────────────────────────────────────── */

.slider-shell { overflow: hidden; }

.slider {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.slide {
  min-width: 100%;
}

/* ── Card grid (overview) ──────────────────────── */

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
}

.badge--highlight {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.card-kicker {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.score {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.score-num {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.score-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-bottom: 4px;
  line-height: 1.4;
}

.card-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: ui-monospace, "SF Mono", monospace;
  margin-bottom: 6px;
  display: block;
}

.card ul {
  padding-left: 16px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card li {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ── Matrix (stage comparison) ─────────────────── */

.matrix-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.matrix {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, 1fr);
  border-collapse: collapse;
}

.mcell {
  padding: 16px 18px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.mcell:last-child,
.mcell:nth-child(4n) {
  border-right: none;
}

.mcell--head {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  letter-spacing: -0.01em;
}

.mcell--row-head {
  background: var(--surface-2);
}

.metric-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.metric-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.dots {
  display: flex;
  gap: 4px;
  margin-top: 10px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
}

.dot.on { background: var(--text); }

/* ── Workflow steps ────────────────────────────── */

.flow-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.flow-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flow-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.flow-step h4 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.flow-step p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.footer-note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ── Footer ────────────────────────────────────── */

footer {
  padding: 14px 0;
  text-align: center;
  position: sticky;
  bottom: 0;
  background: var(--bg);
}

.footer-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ── Mobile ────────────────────────────────────── */

@media (max-width: 800px) {
  .overview-grid { grid-template-columns: 1fr; }
  .flow-grid { grid-template-columns: 1fr 1fr; }
  .matrix { grid-template-columns: 1fr; }
  .mcell--head:not(:first-child) { display: none; }
}

@media (max-width: 520px) {
  .flow-grid { grid-template-columns: 1fr; }
  .post-header, .post-back, main { padding-left: 16px; padding-right: 16px; }
}
