:root {
  --bg: #fbfbfd;
  --bg-alt: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --blue: #0071e3;
  --green: #1f9d45;
  --green-soft: #e3f6e8;
  --red: #e0263a;
  --red-soft: #fdeaec;
  --orange: #ff9500;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 28px rgba(0, 0, 0, 0.07);
  --radius: 22px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 22px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); }
code { font-size: 0.86em; background: var(--bg-alt); padding: 2px 7px; border-radius: 6px; }

/* Hero */
.hero {
  padding: 96px 0 72px;
  text-align: center;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(48, 209, 88, 0.16), transparent 70%),
    radial-gradient(40% 40% at 85% 30%, rgba(0, 113, 227, 0.10), transparent 70%),
    var(--bg);
}
.badge {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 28px; padding: 8px 16px;
  border-radius: 999px; background: var(--card); box-shadow: var(--shadow);
  font: 600 14px var(--mono); color: var(--green);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: #30d158; box-shadow: 0 0 0 4px rgba(48, 209, 88, 0.2); }
h1 {
  font-size: clamp(52px, 11vw, 112px); line-height: 0.98; margin: 0 auto 26px; max-width: 900px;
  font-weight: 700; letter-spacing: -0.045em;
}
h1 .grad { background: linear-gradient(100deg, #30d158 0%, #0fb5ae 45%, #0071e3 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: clamp(19px, 2.3vw, 24px); line-height: 1.45; color: var(--muted); max-width: 760px; margin: 0 auto 52px; letter-spacing: -0.01em; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 0 auto 44px; text-align: left; }
.stat { padding: 24px 22px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.stat .num { display: block; font: 700 clamp(38px, 5.5vw, 56px)/1 var(--sans); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat .lbl { display: block; margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.35; }
.stat.bad .num { color: var(--red); }
.stat.good .num { color: var(--green); }

.loop { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; counter-reset: step; text-align: left; }
.loop li { padding: 14px 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(210, 210, 215, 0.7); font-weight: 600; font-size: 15px; counter-increment: step; backdrop-filter: blur(8px); }
.loop li::before { content: counter(step); display: inline-grid; place-items: center; width: 22px; height: 22px; margin-bottom: 8px; border-radius: 50%; background: var(--bg-alt); color: var(--muted); font: 600 12px var(--sans); }
.loop li:nth-child(3)::before { background: var(--red-soft); color: var(--red); }
.loop li:nth-child(n+4)::before { background: var(--green-soft); color: var(--green); }
.loop li small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; line-height: 1.35; margin-top: 2px; }

/* Sections */
main section.wrap { padding: 104px 22px; }
main section:nth-of-type(even) { background: var(--bg-alt); max-width: none; }
main section:nth-of-type(even) > * { max-width: 996px; margin-left: auto; margin-right: auto; }
.kicker { margin: 0 0 12px; color: var(--blue); font: 600 14px var(--sans); letter-spacing: 0.01em; }
h2 { font-size: clamp(30px, 4.6vw, 48px); line-height: 1.1; margin: 0 0 20px; letter-spacing: -0.03em; font-weight: 700; max-width: 900px; }
h3 { font-size: clamp(22px, 3vw, 28px); letter-spacing: -0.02em; margin: 52px 0 16px; }
section > p { color: var(--muted); font-size: 19px; line-height: 1.5; max-width: 760px; }

.counter { color: var(--red); font-variant-numeric: tabular-nums; }
.counter.good { color: var(--green); }
.ok { color: var(--green); }
.bad { color: var(--red); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-top: 36px; }
.card { position: relative; padding: 22px 24px 24px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); overflow: hidden; }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--red); }
.card.is-caught::before { background: #30d158; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.card-id { font: 700 17px var(--sans); letter-spacing: -0.01em; margin-right: 4px; }
.tag { font: 600 12px var(--sans); padding: 3px 10px; border-radius: 999px; background: var(--bg-alt); color: var(--muted); }
.tag-semantic { background: #e8f1fd; color: var(--blue); }
.tag-classic { background: #fff4e0; color: #b25e00; }
.tag-caught { background: var(--green-soft); color: var(--green); }
.tag-survived { background: var(--red-soft); color: var(--red); }
.card-pattern { margin: 0 0 14px; color: var(--muted); font: 13px var(--mono); }
.diff { margin: 0 0 14px; padding: 10px 0; border-radius: 12px; background: var(--bg-alt); font-size: 13px; line-height: 1.6; overflow-x: auto; white-space: pre; }
.diff span { display: block; padding: 0 14px; }
.diff .del { background: var(--red-soft); color: #b3172b; }
.diff .add { background: var(--green-soft); color: #17803a; }
.card-impact { margin: 0; color: #424245; font-size: 15px; line-height: 1.5; }

.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 36px; }
.pair-col { min-width: 0; }
.pair-label { margin: 0 0 12px; color: var(--muted); font-size: 16px; }

/* Scout */
.scout { margin: 32px 0 8px; padding: 24px; display: grid; gap: 10px; max-width: 780px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.scout-row { display: grid; grid-template-columns: 150px 1fr 44px; gap: 14px; align-items: center; font-size: 14px; color: var(--muted); }
.scout-row.is-target { color: var(--text); font-weight: 600; }
.scout-name { background: none; padding: 0; }
.scout-bar { height: 10px; border-radius: 999px; background: var(--bg-alt); position: relative; overflow: hidden; }
.scout-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 999px; background: #c7c7cc; }
.scout-row.is-target .scout-bar::after { background: linear-gradient(90deg, #ff9500, #ff5e3a); }
.scout-num { font-family: var(--mono); text-align: right; }

.example { margin-top: 32px; max-width: 780px; }
.example pre { margin: 0; padding: 18px 20px; border-radius: var(--radius); background: #1d1d1f; color: #f5f5f7; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.example .ok { color: #30d158; }
.example .bad { color: #ff6961; }

.button { display: inline-block; margin: 12px 10px 0 0; padding: 12px 22px; border-radius: 999px; background: var(--blue); color: #fff; font-weight: 600; font-size: 16px; }
.button:hover { text-decoration: none; background: #0077ed; }
.button.ghost { background: transparent; color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }

footer { padding: 56px 22px 80px; color: var(--muted); font-size: 13px; line-height: 1.6; border-top: 1px solid var(--line); }
footer b { color: var(--text); }
.muted { color: var(--muted); }
.load-error { margin: 0; padding: 12px 20px; background: var(--red-soft); color: var(--red); font-family: var(--mono); }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .hero { padding: 64px 0 52px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat { padding: 18px; }
  .loop { grid-template-columns: repeat(2, 1fr); }
  .pair { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .scout { padding: 16px; }
  .scout-row { grid-template-columns: 108px 1fr 34px; gap: 10px; }
  main section.wrap { padding: 64px 18px; }
  section > p { font-size: 17px; }
}

/* Run strip: one square per planted bug */
.runstrip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 28px 0 8px; }
.runstrip-label { width: 100%; margin-bottom: 4px; color: var(--muted); font: 500 13px var(--mono); }
.cell {
  display: inline-grid; place-items: center; min-width: 72px; height: 38px; padding: 0 10px; border-radius: 10px;
  font: 600 12px var(--mono); color: #fff; background: #c7c7cc;
}
.cell.is-caught { background: #30d158; }
.cell.is-survived { background: var(--red); box-shadow: 0 6px 18px rgba(224, 38, 58, 0.35); }
.motion .runstrip .cell {
  background: #e5e5ea; color: #8e8e93; box-shadow: none; transform: scale(0.92);
  transition: background 0.35s ease, color 0.35s ease, transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3), box-shadow 0.45s ease;
  transition-delay: var(--delay, 0ms);
}
.motion .runstrip.in .cell { transform: none; color: #fff; }
.motion .runstrip.in .cell.is-caught { background: #30d158; }
.motion .runstrip.in .cell.is-survived { background: var(--red); box-shadow: 0 6px 18px rgba(224, 38, 58, 0.35); animation: nudge 0.5s ease 1 both; animation-delay: calc(var(--delay, 0ms) + 0.35s); }
@keyframes nudge { 30% { transform: scale(1.12); } 55% { transform: translateX(-3px); } 80% { transform: translateX(3px); } 100% { transform: none; } }

/* Screenshots of IBM Bob */
.shot { margin: 40px 0 0; max-width: 820px; }
.shot img { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 24px 60px rgba(0, 0, 0, 0.18); }
.shot figcaption { margin-top: 14px; color: var(--muted); font-size: 14px; }

/* Feature chips */
.chips { list-style: none; padding: 0; margin: 32px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.chips li { padding: 18px 20px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); color: var(--muted); font-size: 14px; line-height: 1.4; }
.chips b { display: block; margin-bottom: 4px; color: var(--text); font-size: 17px; }

/* Reveal on scroll (only when motion is on; content is visible otherwise) */
.motion .reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.motion .reveal.in { opacity: 1; transform: none; }
.motion .scout .scout-bar::after { width: 0; transition: width 1.1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.motion .scout.in .scout-bar::after { width: var(--w); }

/* Hero entrance */
@media (prefers-reduced-motion: no-preference) {
  .hero .badge, .hero h1, .hero .lede, .hero .stats, .hero .loop { animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  .hero h1 { animation-delay: 0.08s; }
  .hero .lede { animation-delay: 0.18s; }
  .hero .stats { animation-delay: 0.28s; }
  .hero .loop { animation-delay: 0.38s; }
  .dot { animation: pulse 2s ease-in-out infinite; }
  h1 .grad { background-size: 200% 100%; animation: shimmer 6s ease-in-out infinite; }
}
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(48, 209, 88, 0); } }
@keyframes shimmer { 50% { background-position: 100% 0; } }

@media (max-width: 760px) {
  .chips { grid-template-columns: 1fr 1fr; }
  .cell { min-width: 64px; height: 34px; font-size: 11px; }
}
