/* ---------- Motion on scroll ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition:
      opacity 0.9s var(--ease),
      transform 0.9s var(--ease);
  }
  .js .reveal.seen {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: clip;
  padding: clamp(6.2rem, 13vw, 8.6rem) 0 clamp(2.6rem, 5vw, 4.5rem);
  background:
    radial-gradient(60rem 38rem at 78% 30%, rgb(255 138 43 / 0.11), transparent 65%),
    radial-gradient(40rem 30rem at 10% 90%, rgb(47 211 176 / 0.07), transparent 70%),
    #040705;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgb(255 177 94 / 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 177 94 / 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(80% 70% at 60% 30%, #000 10%, transparent 75%);
  -webkit-mask-image: radial-gradient(80% 70% at 60% 30%, #000 10%, transparent 75%);
}
.hero-grid {
  position: relative;
  display: grid;
  gap: clamp(2.2rem, 4vw, 3.5rem);
  align-items: center;
}
@media (min-width: 1040px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: clamp(2.5rem, 4.5vw, 5rem);
    align-items: start;
  }
  .hero-copy {
    padding-top: clamp(1.5rem, 4vh, 3.5rem);
  }
}
@media (max-width: 599px) {
  .pill .wide-only,
  .pill .wide-only + i,
  .pill i:has(+ .wide-only) {
    display: none;
  }
}
.pill {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid rgb(255 138 43 / 0.26);
  border-radius: 99rem;
  background: rgb(26 14 4 / 0.6);
  font: 500 0.6875rem/1.3 var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--soft);
}
.pill i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}
.hero .d1 {
  margin-top: 1.4rem;
  font-size: clamp(2.7rem, 10.5vw, 4.9rem);
}
.hero .d1 > span {
  display: block;
}
@media (min-width: 1040px) {
  .hero .d1 {
    font-size: clamp(4rem, 5.6vw, 5.9rem);
  }
}
.hero .lede {
  max-width: 35rem;
  margin-top: 1.5rem;
}
.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  margin-top: 2rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.hero-facts b {
  font: 600 0.95rem/1 var(--mono);
  color: #fff;
  margin-right: 0.3rem;
}
@media (max-width: 479px) {
  .hero .cta {
    flex-wrap: nowrap;
    gap: 0.55rem;
  }
  .hero .cta .btn {
    flex: 1 1 auto;
    padding-inline: 0.7rem;
    font-size: 0.88rem;
  }
}

/* ---------- The bench: the hero's live trainer ---------- */
.bench {
  position: relative;
  display: grid;
  border: 1px solid var(--line-2);
  border-radius: 1.5rem;
  background: linear-gradient(180deg, rgb(14 26 20 / 0.86), rgb(6 12 9 / 0.92));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.06),
    0 40px 120px -40px rgb(255 120 30 / 0.28),
    0 30px 80px -30px #000;
  overflow: clip;
}
.bench-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding: 1rem 1.15rem 0.9rem;
}
.bench-head .todo {
  font-size: 1rem;
}
.field {
  position: relative;
  aspect-ratio: 1;
  margin-inline: 1.15rem;
  border-radius: 1rem;
  overflow: hidden;
  background: #050806;
  box-shadow: inset 0 0 0 1px var(--line);
}
.field canvas {
  width: 100%;
  height: 100%;
}
.field-step {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  padding: 0.25rem 0.55rem;
  border-radius: 0.5rem;
  background: rgb(5 8 6 / 0.72);
  font: 500 0.72rem/1.3 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--soft);
}
.field-quiet {
  position: absolute;
  inset: auto 1rem 1rem;
  color: var(--soft);
  font-size: 0.88rem;
}
.bench[data-busy] .field::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgb(255 209 102 / 0.08) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: shimmer 1.1s linear infinite;
}
@keyframes shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}
.curve {
  height: 3rem;
  margin: 0.6rem 1.15rem 0;
}
.curve svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.curve-line {
  fill: none;
  stroke: var(--flame-2);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}
.curve-at {
  stroke: var(--spark);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  vector-effect: non-scaling-stroke;
}
.console {
  display: grid;
  gap: 1rem;
  padding: 1rem 1.15rem 1.15rem;
}
.console-row .micro {
  margin-bottom: 0.45rem;
}
.console .seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
}
.console .seg button {
  padding-inline: 0.4rem;
}
.console-dials {
  display: grid;
  gap: 0.4rem 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}
.readouts {
  display: grid;
  grid-template-columns: 1fr 1fr 1.6fr;
  gap: 0.6rem;
  margin: 0;
}
.readouts div {
  min-width: 0;
  padding: 0.65rem 0.8rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgb(0 0 0 / 0.24);
}
.readouts dt {
  font-size: 0.74rem;
  color: var(--faint);
}
.readouts dd {
  margin: 0.15rem 0 0;
  font: 500 1.08rem/1.3 var(--mono);
  font-variant-numeric: tabular-nums;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.readouts .fp dd {
  color: var(--spark);
  font-size: 0.98rem;
}
@media (max-width: 479px) {
  .readouts {
    grid-template-columns: 1fr 1fr;
  }
  .readouts .fp {
    grid-column: span 2;
  }
}
.again {
  display: flex;
  align-items: center;
  gap: 0.6rem 1rem;
}
.again .btn {
  flex: none;
}
.runs {
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}
.runs b {
  color: #fff;
  font-weight: 650;
}
.runs .same {
  color: var(--ok);
}
.runs .diff {
  color: var(--bad);
}
@media (max-width: 479px) {
  .again {
    flex-direction: column;
    align-items: stretch;
  }
}
.bench-foot {
  padding: 0.85rem 1.15rem 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--faint);
}
.tagged {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--chapter) 32%, transparent);
  border-radius: 99rem;
  background: color-mix(in srgb, var(--chapter) 8%, transparent);
  font-size: 0.76rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--chapter) 55%, #fff);
  white-space: nowrap;
}
.tagged.live::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--chapter);
  box-shadow: 0 0 10px var(--chapter);
}
.tagged.example,
.tagged.record {
  border-color: var(--line-2);
  background: none;
  color: var(--soft);
}

/* ---------- Numbers band ---------- */
.stats-band {
  border-top: 1px solid var(--line);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr));
}
.stats li {
  border-left: 1px solid var(--line);
}
.stats li:first-child {
  border-left: 0;
}
.stats li:first-child a {
  padding-left: 0;
}
.stats a {
  display: block;
  height: 100%;
  padding: 1.5rem 1.2rem 1.7rem;
}
.stats a:hover strong {
  color: #fff;
}
.stats b {
  display: block;
  font-size: clamp(1.9rem, 2.8vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  color: #fff;
}
.stats strong {
  display: block;
  margin: 0.5rem 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--flame-2);
  transition: color 0.2s;
}
.stats span {
  display: block;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}
@media (min-width: 600px) and (max-width: 1099px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .stats li:nth-child(3n + 1) {
    border-left: 0;
  }
  .stats li:nth-child(3n + 1) a {
    padding-left: 0;
  }
  .stats li:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }
}
@media (max-width: 599px) {
  .stats li {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .stats li:first-child {
    border-top: 0;
  }
  .stats a {
    display: grid;
    grid-template-columns: 5.6rem 1fr;
    column-gap: 1rem;
    padding: 1rem 0;
  }
  .stats b {
    grid-row: span 2;
    font-size: 1.7rem;
  }
  .stats strong {
    margin: 0.1rem 0 0;
  }
  .stats a > span {
    grid-column: 2;
  }
}

/* ---------- Chapters and sections ---------- */
.chapter {
  position: relative;
  border-top: 1px solid var(--line);
}
.opener {
  position: relative;
  overflow: clip;
  background: radial-gradient(70rem 34rem at 12% 0%, color-mix(in srgb, var(--chapter) 9%, transparent), transparent 70%);
}
.opener > .wrap {
  padding-block: clamp(5rem, 10vw, 9rem) clamp(3rem, 6vw, 5rem);
  scroll-margin-top: 2rem;
}
.opener .lede {
  max-width: 44rem;
  margin-top: 1.5rem;
}
.kick.small {
  margin-bottom: 0.9rem;
  color: var(--muted);
}
.kick.small .joint {
  --c: var(--chapter);
}
.kick.small .num {
  color: var(--chapter);
  letter-spacing: 0.04em;
}
.kick.small i {
  width: 1.8rem;
  height: 1px;
  background: var(--line-2);
}
/* The chapter's contents: under the thesis on mid widths, its own column on wide ones. */
.opener-index {
  max-width: 30rem;
  margin-top: 2.4rem;
}
.opener-index .micro {
  margin-bottom: 0.7rem;
}
.opener-index a {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.3rem;
  border-top: 1px solid var(--line);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--soft);
  transition: color 0.2s;
}
.opener-index li:last-child a {
  border-bottom: 1px solid var(--line);
}
.opener-index .n {
  min-width: 1.9rem;
  font: 500 0.74rem/1 var(--mono);
  color: var(--chapter);
}
.opener-index svg {
  width: 1rem;
  height: 1rem;
  margin-left: auto;
  color: var(--faint);
  transition:
    transform 0.2s,
    color 0.2s;
}
.opener-index a:hover {
  color: #fff;
}
.opener-index a:hover svg {
  transform: translateX(3px);
  color: var(--chapter);
}
@media (min-width: 1100px) {
  .opener-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
    align-items: end;
    gap: 5rem;
  }
  .opener-index {
    margin-top: 0;
  }
}
@media (max-width: 899px) {
  .opener-index {
    display: none;
  }
}
.sec {
  position: relative;
  padding-block: clamp(3rem, 5.6vw, 5.2rem);
  border-top: 1px solid var(--line);
}
.sec-head.wide {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 0.9rem 3rem;
  margin-bottom: clamp(1.6rem, 3vw, 2.6rem);
}
.sec-head.wide > div {
  flex: 1 1 34rem;
  min-width: 0;
}
.sec-head.wide .kicker {
  margin-top: 1rem;
}
.sec-head.wide .more {
  flex: none;
  margin: 0;
}
.kicker {
  max-width: 46rem;
  font-size: clamp(1.04rem, 1.35vw, 1.22rem);
  line-height: 1.58;
  letter-spacing: -0.011em;
  color: var(--soft);
  text-wrap: pretty;
}
.split-grid {
  display: grid;
  gap: 2rem clamp(2.4rem, 6vw, 6rem);
}
.split .kicker {
  margin-top: 1.1rem;
}
@media (min-width: 1000px) {
  .split-grid {
    grid-template-columns: minmax(0, 4.4fr) minmax(0, 7.6fr);
  }
  .split .sec-head {
    position: sticky;
    top: 7.5rem;
    align-self: start;
  }
}
.sec-body {
  min-width: 0;
}
.sec-body > * + * {
  margin-top: 1.4rem;
}
.more {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.25rem 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--chapter) 62%, #fff);
  transition: color 0.2s;
}
.more svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.35s var(--ease);
}
.more:hover {
  color: #fff;
}
.more:hover svg {
  transform: translateX(0.25rem);
}
.sha {
  font: 500 0.74rem/1.4 var(--mono);
  color: color-mix(in srgb, var(--chapter) 60%, #fff);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--chapter) 35%, transparent);
  text-underline-offset: 0.2em;
}
.sha:hover {
  color: #fff;
}

/* ---------- Figures ---------- */
.sec .fig {
  position: relative;
  border: 1px solid var(--line-2);
  border-radius: 1.4rem;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.022), transparent 14rem), rgb(6 13 10 / 0.9);
  overflow: clip;
}
.sec .fig::before,
.sec .fig::after {
  content: "";
  position: absolute;
  top: 0.65rem;
  width: 0.6rem;
  height: 0.6rem;
  border: solid var(--line-3);
  border-width: 1px 0 0 1px;
  pointer-events: none;
}
.sec .fig::before {
  left: 0.65rem;
}
.sec .fig::after {
  right: 0.65rem;
  transform: scaleX(-1);
}
.fig-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem 1.4rem;
  padding: clamp(1.2rem, 2.4vw, 1.8rem) var(--inset) 0;
}
.todo {
  font-size: clamp(1rem, 1.3vw, 1.12rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #fff;
}
.fig-body {
  padding: clamp(1.2rem, 2.4vw, 1.8rem) var(--inset);
  min-width: 0;
}
.fig-body > * + * {
  margin-top: 1.2rem;
}
.js .fig:not([data-ready]) > .fig-body {
  min-height: var(--hp, auto);
}
@media (min-width: 640px) {
  .js .fig:not([data-ready]) > .fig-body {
    min-height: var(--ht, auto);
  }
}
@media (min-width: 1000px) {
  .js .fig:not([data-ready]) > .fig-body {
    min-height: var(--hd, auto);
  }
}
.fig-foot {
  padding: 0.95rem var(--inset) 1.05rem;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--muted);
}
.fig-error {
  margin: 0 var(--inset) 1.2rem;
  color: var(--warn);
  font-size: 0.9rem;
}

/* ---------- Controls ---------- */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  max-width: 100%;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(0 0 0 / 0.28);
}
.seg button {
  min-height: 2.5rem;
  padding: 0.3rem 0.95rem;
  border: 0;
  border-radius: 0.78rem;
  background: none;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--muted);
  transition:
    background-color 0.2s,
    color 0.2s;
}
.seg button:hover {
  color: #fff;
}
.seg button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--chapter) 18%, transparent);
  color: #fff;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chapter) 45%, transparent);
}
@media (max-width: 640px) {
  .seg button {
    min-height: 2.75rem;
    padding-inline: 0.65rem;
  }
}
.range {
  display: block;
}
.range > span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.84rem;
  color: var(--soft);
}
.range b {
  font-weight: 600;
}
.range output {
  font: 500 0.86rem/1.3 var(--mono);
  font-variant-numeric: tabular-nums;
  color: #fff;
}
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 2.4rem;
  margin: 0;
  background: none;
  cursor: pointer;
  touch-action: pan-y;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--chapter) var(--p, 50%), rgb(190 240 212 / 0.15) var(--p, 50%));
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--chapter) var(--p, 50%), rgb(190 240 212 / 0.15) var(--p, 50%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.3rem;
  height: 1.3rem;
  margin-top: calc(-0.65rem + 2px);
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1.5px var(--chapter);
  transition: transform 0.2s;
}
input[type="range"]::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1.5px var(--chapter);
}
input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.15);
}
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 0.15rem 0.7rem;
  border: 1px solid var(--line-2);
  border-radius: 0.6rem;
  background: none;
  font: 500 0.78rem/1.2 var(--mono);
  color: color-mix(in srgb, var(--chapter) 45%, #fff);
  transition:
    border-color 0.2s,
    background-color 0.2s;
}
button.tag:hover {
  border-color: var(--chapter);
  color: #fff;
}
[data-busy] .btn {
  cursor: progress;
}

/* ---------- Code beside code ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(0 0 0 / 0.28);
  width: fit-content;
  max-width: 100%;
}
@media (max-width: 599px) {
  .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
}
.tabs button {
  min-height: 2.6rem;
  padding: 0.3rem 1rem;
  border: 0;
  border-radius: 0.78rem;
  background: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}
.tabs button:hover {
  color: #fff;
}
.tabs button[aria-selected="true"] {
  background: color-mix(in srgb, var(--chapter) 18%, transparent);
  color: #fff;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chapter) 45%, transparent);
}
.pair-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 1100px) {
  .pair-grid {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }
}
.codebox.py > header > span:first-child::before,
.codebox.rs > header > span:first-child::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.55rem;
  border-radius: 50%;
  background: #6c9bd2;
}
.codebox.rs > header > span:first-child::before {
  background: var(--flame);
}
.codebox pre.code {
  max-height: 34rem;
}
.line[data-pair] {
  cursor: default;
}
/* ---------- Lookup ---------- */
.look .q {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.3rem 1.1rem;
  border: 1px solid var(--line-2);
  border-radius: 1rem;
  background: rgb(0 0 0 / 0.3);
}
.look .q:focus-within {
  border-color: var(--chapter);
}
/* The field draws no ring of its own; its box carries the same ring as every other control. */
.look .q:has(input:focus-visible) {
  outline: 2px solid var(--spark);
  outline-offset: 3px;
}
.look .q svg {
  width: 1.15rem;
  height: 1.15rem;
  color: var(--chapter);
  flex: none;
}
.look input {
  flex: 1;
  min-width: 0;
  min-height: 3rem;
  border: 0;
  outline: 0;
  background: none;
  font: 500 1.02rem/1.3 var(--mono);
}
.look input::placeholder {
  color: var(--faint);
}
.suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
}
.look-count {
  font-size: 0.9rem;
  color: var(--muted);
}
.look-hits {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 0.35rem 1rem;
  max-height: 24rem;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.look-hits li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.8rem;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--line);
}
.look-hits code {
  min-width: 0;
  overflow-wrap: anywhere;
  background: none;
  padding: 0;
  font-size: 0.84rem;
}
.look-hits span {
  flex: none;
  font-size: 0.74rem;
  color: var(--faint);
}
mark {
  background: rgb(255 209 102 / 0.22);
  color: #fff1c7;
  border-radius: 0.2rem;
}

/* ---------- Inventory ---------- */
.inventory {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr));
}
.card {
  padding: 1.15rem 1.2rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgb(255 255 255 / 0.03), rgb(255 255 255 / 0.006));
}
.card h4 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}
.card h4 small {
  font: 500 0.74rem/1.3 var(--mono);
  color: var(--chapter);
  text-align: right;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.8rem;
}
.chips code {
  padding: 0.15em 0.5em;
  font-size: 0.76rem;
  color: var(--soft);
}
.card .after {
  margin-top: 0.75rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- The tape ---------- */
.tape-graph {
  width: 100%;
  height: auto;
}
.tape-graph.v {
  max-width: 24rem;
  margin-inline: auto;
}
@media (min-width: 700px) {
  .tape-graph.v {
    display: none;
  }
}
@media (max-width: 699px) {
  .tape-graph.h {
    display: none;
  }
}
.tape-graph .edge {
  fill: none;
  stroke: rgb(205 235 215 / 0.2);
  stroke-width: 1.5;
  transition: stroke 0.4s;
}
.tape-graph .edge.flow {
  stroke: var(--grad);
  stroke-width: 2;
  stroke-dasharray: 5 5;
}
@media (prefers-reduced-motion: no-preference) {
  .tape-graph .edge.flow {
    animation: back 0.9s linear infinite;
  }
}
@keyframes back {
  to {
    stroke-dashoffset: 10;
  }
}
.tape-graph .node rect {
  fill: #0c1712;
  paint-order: stroke;
  stroke: rgb(205 235 215 / 0.28);
  stroke-width: 1.2;
  transition:
    fill 0.3s,
    stroke 0.3s;
}
.tape-graph .node.param rect {
  stroke: var(--flame);
}
.tape-graph .node.data rect {
  stroke-dasharray: 3 3;
}
.tape-graph .node text {
  font: 500 14px var(--mono);
  fill: var(--text);
  text-anchor: middle;
}
.tape-graph .node text.id {
  font-size: 10px;
  fill: var(--faint);
}
.tape-graph .node.done rect {
  fill: #0f2b24;
  stroke: var(--grad);
}
.tape-graph .node.now rect {
  fill: #14594a;
  stroke: var(--grad-2);
  stroke-width: 2.4;
}
.tape-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}
.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}
.tape-panels {
  display: grid;
  gap: 1rem;
}
@media (min-width: 900px) {
  .tape-panels {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }
}
.tape-now,
.tape-side {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(0 0 0 / 0.22);
  min-width: 0;
}
.tape-node {
  margin-top: 0.5rem;
  font-size: 1.1rem;
  color: #fff;
}
.tape-node b {
  font-family: var(--mono);
  color: var(--grad-2);
}
.tape-rule {
  margin-top: 0.7rem;
}
.tape-rule code {
  display: inline-block;
  padding: 0.4rem 0.6rem;
  font-size: 0.86rem;
  color: var(--spark);
}
.tape-grad {
  margin-top: 0.7rem;
  font-size: 0.9rem;
  color: var(--soft);
  overflow-wrap: anywhere;
}
.tape-side .micro + * {
  margin-top: 0.35rem;
}
.tape-side * + .micro {
  margin-top: 0.9rem;
}
.tape-order {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.tape-order li {
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  font: 500 0.74rem/1.5 var(--mono);
  color: var(--muted);
}
.tape-order li .num {
  color: var(--faint);
}
.tape-order li.done {
  border-color: rgb(47 211 176 / 0.4);
  color: var(--soft);
}
.tape-order li.on {
  border-color: var(--grad-2);
  background: rgb(47 211 176 / 0.2);
  color: #fff;
}
.tape-queue,
.tape-fp {
  font-size: 0.88rem;
  color: var(--soft);
}
.tape-fp {
  color: var(--spark);
}
.ledger {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(0 0 0 / 0.22);
}
.ledger summary {
  min-height: 2.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--soft);
}
.ledger summary span {
  color: var(--faint);
  font-weight: 400;
}
.ledger ol {
  display: grid;
  gap: 0.35rem;
  padding: 0 1.1rem 1rem;
  max-height: 20rem;
  overflow: auto;
}
.ledger li {
  font: 400 0.76rem/1.55 var(--mono);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.ledger li b {
  color: var(--grad-2);
  font-weight: 600;
  margin-right: 0.4rem;
}

/* ---------- Addition has an order ---------- */
.order-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem 2rem;
}
.order-lede {
  max-width: 40rem;
  color: var(--soft);
}
.workers {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.4rem;
}
.workers span {
  position: relative;
  height: 2rem;
  border-radius: 0.5rem;
  background: rgb(255 255 255 / 0.04);
  overflow: hidden;
}
.workers i {
  position: absolute;
  inset: 0;
  transform-origin: left;
  background: linear-gradient(90deg, rgb(47 211 176 / 0.25), rgb(47 211 176 / 0.55));
}
.go .workers i {
  animation: fill var(--t, 0.6s) var(--ease) both;
}
@keyframes fill {
  from {
    transform: scaleX(0);
  }
}
.workers b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 600 0.78rem/1 var(--mono);
  color: #fff;
}
.workers-note {
  margin-top: 0.5rem !important;
  font-size: 0.8rem;
  color: var(--faint);
}
.order-cols {
  display: grid;
  gap: 1rem;
}
@media (min-width: 760px) {
  .order-cols {
    grid-template-columns: 1fr 1fr;
  }
}
.order-col {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(0 0 0 / 0.22);
}
.order-count {
  margin-top: 0.3rem;
  color: var(--soft);
}
.order-count b {
  font: 700 1.9rem/1 var(--mono);
  margin-right: 0.35rem;
}
.order-col.bad b {
  color: var(--bad);
}
.order-col.good b {
  color: var(--ok);
}
.order-vals {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.8rem;
}
.order-vals li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.8rem;
  align-items: baseline;
  font-size: 0.84rem;
  color: var(--soft);
}
.order-vals code {
  background: none;
  padding: 0;
  font-size: 0.76rem;
  color: var(--faint);
}
.order-vals small {
  color: var(--muted);
  font: 500 0.76rem/1 var(--mono);
}
.order-vals .more {
  display: block;
  margin: 0;
  color: var(--faint);
  font-weight: 400;
  font-size: 0.8rem;
}

/* ---------- Casebook ---------- */
.cases {
  display: grid;
}
.case {
  display: grid;
  gap: 0.8rem 1.4rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--line);
}
.case-head {
  display: none;
}
.case-name h4 {
  font-size: 1.02rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.015em;
}
.case-name p {
  margin: 0.3rem 0 0.4rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
}
.case-in p {
  font: 400 0.8rem/1.6 var(--mono);
  color: var(--soft);
  overflow-wrap: anywhere;
}
.lbl {
  display: block;
  margin-bottom: 0.2rem;
  font: 500 0.66rem/1.4 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.vals {
  display: grid;
  gap: 0.1rem;
}
.vals li,
.val-text {
  font: 500 0.82rem/1.6 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--soft);
  overflow-wrap: anywhere;
}
.val-text small {
  display: block;
  font: 400 0.72rem/1.4 var(--sans);
  color: var(--faint);
}
.val-text code {
  font-size: 0.74rem;
}
.vals li.ok::before,
.val-text.ok::before,
.vals li.no::before,
.val-text.no::before {
  display: inline-block;
  width: 1.1em;
  font-family: var(--sans);
  font-weight: 700;
}
.vals li.ok,
.val-text.ok {
  color: #a7f3c0;
}
.vals li.ok::before,
.val-text.ok::before {
  content: "✓";
  color: var(--ok);
}
.vals li.no,
.val-text.no {
  color: #fecdd3;
}
.vals li.no::before,
.val-text.no::before {
  content: "✗";
  color: var(--bad);
}
.case-v.torch .vals li,
.case-v.torch .val-text {
  color: var(--spark);
}
@media (prefers-reduced-motion: no-preference) {
  .case-v.ft.fresh,
  .verdict.fresh {
    animation: flash 0.9s var(--ease);
  }
}
@keyframes flash {
  from {
    background: rgb(255 209 102 / 0.18);
  }
}
@media (min-width: 700px) and (max-width: 1099px) {
  .case {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .case-name,
  .case-in {
    grid-column: span 3;
  }
}
@media (min-width: 1100px) {
  .case {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.05fr) repeat(3, minmax(0, 0.9fr));
    align-items: start;
  }
  .case-head {
    display: grid;
    padding: 0 0 0.6rem;
    border-top: 0;
    font: 500 0.68rem/1.4 var(--mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--faint);
  }
  .case .lbl {
    display: none;
  }
}
.case-run {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.2rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.case-status {
  flex: 1 1 22rem;
  font-size: 0.86rem;
  color: var(--muted);
}

/* ---------- The oracle and the protocol ---------- */
.oracle {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  counter-reset: step;
}
.oracle li {
  position: relative;
  padding: 1.2rem 1.2rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, color-mix(in srgb, var(--chapter) 6%, transparent), transparent 60%);
}
.oracle li + li::before {
  content: "";
  position: absolute;
  top: 2rem;
  left: -0.9rem;
  width: 0.9rem;
  height: 1px;
  background: var(--line-3);
}
.oracle-n {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--chapter) 50%, transparent);
  font: 600 0.82rem/1 var(--mono);
  color: var(--chapter);
}
.oracle h4,
.protocol h4 {
  margin-top: 0.75rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: #fff;
}
.oracle p,
.protocol p {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
}
.oracle-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.oracle-facts b {
  font: 600 1.15rem/1 var(--mono);
  color: #fff;
  margin-right: 0.35rem;
}
.protocol {
  display: grid;
  gap: 0;
}
.protocol li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.protocol h4 {
  margin-top: 0.2rem;
}
.small-print {
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--faint);
}

/* ---------- In-place ---------- */
.inplace-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 1000px) {
  .inplace-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: start;
  }
}
.verdicts {
  display: grid;
  gap: 0.8rem;
  justify-items: start;
}
.verdict {
  justify-self: stretch;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-2);
  border-radius: 0.9rem;
  background: rgb(0 0 0 / 0.22);
}
.verdict.no {
  border-left-color: var(--bad);
}
.verdict.ok {
  border-left-color: var(--ok);
}
.verdict-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-weight: 700;
  color: #fff;
}
.verdict-head svg {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
}
.verdict.no .verdict-head svg {
  color: var(--bad);
}
.verdict.ok .verdict-head svg {
  color: var(--ok);
}
.verdict-text {
  margin-top: 0.5rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--soft);
}
.verdict-text code {
  white-space: normal;
}

/* ---------- Modes ---------- */
.modes {
  display: grid;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  overflow: hidden;
}
.mode-row {
  display: grid;
  gap: 0.6rem 1.2rem;
  padding: 1rem 1.15rem;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--soft);
}
.mode-row:first-child {
  border-top: 0;
}
.mode-row > span:first-child {
  font-weight: 650;
  color: #fff;
}
.mode-row.head {
  display: none;
}
@media (min-width: 700px) {
  .mode-row {
    grid-template-columns: 1fr 1fr 1.3fr;
  }
  .mode-row.head {
    display: grid;
    background: rgb(255 255 255 / 0.025);
    font: 500 0.68rem/1.4 var(--mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .mode-row.head > span {
    color: var(--faint);
    font-weight: 500;
  }
  .mode-row .lbl {
    display: none;
  }
}

/* ---------- Crates ---------- */
.crates {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr));
}
.crate a {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1rem 1.05rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(255 255 255 / 0.015);
  transition:
    border-color 0.2s,
    background-color 0.2s;
}
.crate a:hover {
  border-color: var(--line-3);
  background: rgb(255 255 255 / 0.035);
}
.crate h4 {
  font: 600 0.95rem/1.3 var(--mono);
  color: #fff;
}
.crate p {
  margin-top: 0.25rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}
.crate-meta {
  display: flex;
  gap: 1rem;
  margin-top: auto !important;
  padding-top: 0.6rem;
  font: 500 0.74rem/1.4 var(--mono);
}
.crate-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.crate-tags span {
  padding: 0.1rem 0.45rem;
  border-radius: 0.4rem;
  font: 500 0.68rem/1.5 var(--mono);
}
.policy {
  background: rgb(74 222 128 / 0.1);
  color: #a7f3c0;
}
.crate.deny .policy {
  background: rgb(251 191 36 / 0.12);
  color: #fde68a;
}
.crate.allow .policy {
  background: rgb(251 113 133 / 0.14);
  color: #fecdd3;
}
.pub {
  background: rgb(108 200 247 / 0.12);
  color: #bae6fd;
}
.crate.deny a {
  border-color: rgb(251 191 36 / 0.25);
}
.crate.allow a {
  border-color: rgb(251 113 133 / 0.3);
}

/* ---------- The board ---------- */
.brow.scale {
  padding: 0 0 0.5rem;
  border-top: 0;
}
.board-scale {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  font: 500 0.68rem/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.board-scale span:nth-child(2) {
  text-align: center;
}
.board-scale span:last-child {
  text-align: right;
}
.board {
  display: grid;
}
.brow {
  display: grid;
  gap: 0.5rem 1.2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.brow-name h4 {
  font: 600 0.98rem/1.3 var(--mono);
  color: #fff;
}
.brow-name p {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}
.brow-bar {
  position: relative;
  height: 1.4rem;
  border-radius: 0.4rem;
  background: rgb(255 255 255 / 0.03);
}
.brow-bar .axis {
  position: absolute;
  left: 50%;
  top: -0.25rem;
  bottom: -0.25rem;
  width: 1px;
  background: var(--line-3);
}
.brow-bar i {
  position: absolute;
  top: 0.2rem;
  bottom: 0.2rem;
  border-radius: 0.3rem;
}
.brow.fast i {
  background: linear-gradient(90deg, rgb(166 227 74 / 0.45), var(--lime));
}
.brow.slow i {
  background: linear-gradient(90deg, #fb7185, rgb(251 113 133 / 0.45));
}
.brow.even i {
  background: var(--soft);
}
.brow-val b {
  display: block;
  font: 700 1rem/1.3 var(--mono);
}
.brow.fast .brow-val b {
  color: var(--lime);
}
.brow.slow .brow-val b {
  color: #fda4af;
}
.brow-val span {
  font-size: 0.76rem;
  color: var(--faint);
}
@media (min-width: 900px) {
  .brow {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.1fr) minmax(0, 0.6fr);
    align-items: center;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .js .brow.reveal i {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1.1s 0.15s var(--ease);
  }
  .js .brow.slow.reveal i {
    transform-origin: right;
  }
  .js .brow.reveal.seen i {
    transform: none;
  }
}

/* ---------- A headline that got smaller ---------- */
.smaller {
  display: grid;
  gap: 1.5rem clamp(2rem, 5vw, 4rem);
}
@media (min-width: 1000px) {
  .smaller {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
  }
}
.shrink {
  display: grid;
  gap: 0.6rem;
}
.shrink li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(0 0 0 / 0.22);
}
.shrink b {
  font: 800 calc(2.8rem - var(--i) * 0.55rem) / 1 var(--sans);
  letter-spacing: -0.04em;
  color: var(--lime);
}
.shrink li:not(:last-child) b {
  color: var(--faint);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: rgb(251 113 133 / 0.7);
}
.shrink span {
  font-size: 0.9rem;
  color: var(--muted);
}
.quote {
  padding: 1.4rem 1.5rem;
  border-left: 3px solid var(--chapter);
  border-radius: 0 1rem 1rem 0;
  background: color-mix(in srgb, var(--chapter) 6%, transparent);
}
.quote p {
  font-size: clamp(1.02rem, 1.3vw, 1.16rem);
  line-height: 1.6;
  color: var(--text);
  text-wrap: pretty;
}
.quote footer {
  margin-top: 0.8rem;
  font-size: 0.84rem;
  color: var(--muted);
}

/* ---------- Start ---------- */
.install {
  display: grid;
  gap: 1rem;
}
.limits {
  display: grid;
}
.limits li {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.limits li:first-child {
  border-top: 0;
  padding-top: 0;
}
.limits h4 {
  font-size: 1.02rem;
  font-weight: 700;
  color: #fff;
}
.limits p {
  margin-top: 0.25rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
}
.users {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
}
/* Five projects sit three over two on wide screens rather than four over one. */
@media (min-width: 1000px) {
  .users:has(> li:nth-child(5):last-child) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .users:has(> li:nth-child(5):last-child) > li {
    grid-column: span 2;
  }
  .users:has(> li:nth-child(5):last-child) > li:nth-child(n + 4) {
    grid-column: span 3;
  }
}
.users a {
  display: block;
  height: 100%;
  padding: 1.1rem 1.2rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, color-mix(in srgb, var(--chapter) 7%, transparent), transparent 60%);
  transition: border-color 0.2s;
}
.users a:hover {
  border-color: color-mix(in srgb, var(--chapter) 60%, transparent);
}
.users h4 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font: 600 1rem/1.3 var(--mono);
  color: #fff;
}
.users h4 svg {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--faint);
}
.users p {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}
.closing {
  margin-top: clamp(3rem, 7vw, 5.5rem) !important;
  padding: clamp(2rem, 5vw, 3.5rem);
  border: 1px solid var(--line-2);
  border-radius: 1.5rem;
  text-align: center;
  background:
    radial-gradient(40rem 18rem at 50% 0%, rgb(255 138 43 / 0.14), transparent 70%),
    rgb(255 255 255 / 0.015);
}
.closing .d3 {
  --chapter: var(--flame);
}
.closing .cta {
  justify-content: center;
}
