:root {
  --bg: #0F0F10;
  --text: #EDEDEC;
  --muted: #A1A1A6;
  --line: #26262A;
  --add: #4ADE80;
  --del: #F87171;
  --mod: #FBBF24;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  position: relative;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

/* Faint grid behind the top of the page, fading out. */
body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 560px;
  z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 80% 100% at 0 0, var(--bg), transparent 75%);
  mask-image: radial-gradient(ellipse 80% 100% at 0 0, var(--bg), transparent 75%);
  opacity: 0.6;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: calc(40rem + 32px);
  margin: 0 auto;
  padding: 24px 16px 32px;
}

::selection { background: var(--line); }

a {
  color: inherit;
  text-decoration: underline 1px var(--muted);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 1px solid var(--text); outline-offset: 3px; }

/* Header and logo */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 500 15px var(--mono);
  text-decoration: none;
}
.brand b { font-weight: 500; color: var(--muted); transition: color 0.2s; }
.brand:hover b { color: var(--text); }
.logo {
  width: 20px;
  height: 20px;
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
}
.logo .p { stroke: var(--add); }
.logo .m { stroke: var(--del); }
.brand:hover .logo { animation: flip 0.6s var(--ease); }
.top nav a { font-size: 13px; color: var(--muted); }
.top nav a, footer a { display: inline-block; padding: 8px 0; }

/* Type */
h1 {
  margin: 0 0 16px;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
h2 {
  margin: 0 0 16px;
  font: 500 13px/1.6 var(--mono);
  color: var(--muted);
}
h2::before { content: "## "; content: "## " / ""; color: var(--line); }
p { margin: 0 0 24px; }
.lead { color: var(--muted); margin-bottom: 0; max-width: 34rem; }
section { margin-bottom: 64px; }
code { font-family: var(--mono); }

/* Build status badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--mod) 35%, transparent);
  background: color-mix(in srgb, var(--mod) 8%, transparent);
  color: var(--mod);
  font: 500 13px/1.4 var(--mono);
}
.pulse {
  position: relative;
  width: 8px;
  height: 8px;
  background: var(--mod);
}
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--mod);
  animation: ping 1.8s var(--ease) infinite;
}
.caret {
  display: inline-block;
  width: 0.45em;
  height: 0.85em;
  margin-left: 0.12em;
  vertical-align: -0.06em;
  background: var(--add);
  animation: blink 1.1s steps(1) infinite;
}

/* Diff hunk */
.hunk { font: 13px/1.6 var(--mono); border: 1px solid var(--line); }
.hunk p { margin: 0; padding: 8px 12px 8px 3ch; text-indent: -2ch; }
.hunk .hh { color: var(--muted); border-bottom: 1px solid var(--line); text-indent: 0; padding-left: 12px; }
.hunk .del { background: color-mix(in srgb, var(--del) 10%, transparent); }
.hunk .add { background: color-mix(in srgb, var(--add) 10%, transparent); }
.hunk .del::before { content: "- "; color: var(--del); }
.hunk .add::before { content: "+ "; color: var(--add); }
.hunk .add { animation: added 2.4s var(--ease) 1.2s both; }

/* How it works: steps on a moving line */
.flow {
  position: relative;
  display: grid;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.flow::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: repeating-linear-gradient(to bottom, var(--muted) 0 4px, transparent 4px 10px);
  opacity: 0.5;
  animation: dash-y 0.8s linear infinite;
}
.flow::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 5px;
  height: 5px;
  background: var(--add);
  animation: travel-y 4s var(--ease) infinite;
}
.flow li { position: relative; padding-left: 28px; counter-increment: step; }
.flow li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 9px;
  height: 9px;
  background: var(--bg);
  border: 1px solid var(--muted);
}
.flow li:last-child::before { background: var(--add); border-color: var(--add); }
.flow .k { display: block; font: 500 13px/1.6 var(--mono); }
.flow .k::before {
  content: counter(step, decimal-leading-zero) " ";
  content: counter(step, decimal-leading-zero) " " / "";
  color: var(--muted);
}
.flow .v { display: block; font-size: 15px; color: var(--muted); }

/* Build log */
.log { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.log li {
  position: relative;
  display: grid;
  grid-template-columns: 2ch 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font: 13px/1.6 var(--mono);
}
.log li::before { content: "+"; color: var(--add); }
.log em { font-style: normal; color: var(--muted); }
.log .now::before { content: "~"; color: var(--mod); }
.log .now em { color: var(--mod); }
.log .next::before { content: "\00B7"; color: var(--muted); }
.log .next span { color: var(--muted); }
.bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  overflow: hidden;
}
.bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 30%;
  background: var(--mod);
  animation: slide 2.4s var(--ease) infinite;
}

/* Diff lists (about page) */
.diff {
  list-style: none;
  margin: 8px 0 40px;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  font: 13px/2 var(--mono);
  overflow-wrap: anywhere;
}
.diff li { padding-left: 2ch; text-indent: -2ch; }
.diff li::before { content: "+ "; color: var(--add); }
.diff li.del::before { content: "- "; color: var(--del); }
.about h2 { margin-top: 40px; margin-bottom: 0; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}
footer span { font-family: var(--mono); }

/* Entrance: each block rises in turn. */
.in { animation: rise 0.7s var(--ease) both; }
.d1 { animation-delay: 0.05s; }
.d2 { animation-delay: 0.15s; }
.d3 { animation-delay: 0.3s; }
.d4 { animation-delay: 0.45s; }
.d5 { animation-delay: 0.6s; }
.d6 { animation-delay: 0.75s; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes ping { to { transform: scale(2.6); opacity: 0; } }
@keyframes dash-y { to { background-position: 0 10px; } }
@keyframes dash-x { to { background-position: 10px 0; } }
@keyframes travel-y { 0% { top: 8px; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { top: calc(100% - 12px); opacity: 0; } }
@keyframes travel-x { 0% { left: 4px; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { left: calc(100% - 8px); opacity: 0; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@keyframes added { 0% { background: color-mix(in srgb, var(--add) 30%, transparent); } }
@keyframes flip { 50% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }

@media (min-width: 44rem) {
  body { padding: 48px 24px 32px; max-width: calc(46rem + 48px); }
  .top { margin-bottom: 96px; }
  h1 { font-size: 44px; }
  section { margin-bottom: 96px; }
  .flow { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .flow::before {
    left: 4px;
    right: 0;
    top: 4px;
    bottom: auto;
    width: auto;
    height: 1px;
    background: repeating-linear-gradient(to right, var(--muted) 0 4px, transparent 4px 10px);
    animation-name: dash-x;
  }
  .flow::after { top: 2px; left: 4px; animation-name: travel-x; }
  .flow li { padding: 28px 0 0; }
  .flow li::before { top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .flow::after { display: none; }
}
