@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Fragment Mono";
  src: url("/fonts/fragment-mono.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #f1efe7;
  --paper-high: #f8f7f2;
  --ink: #242821;
  --muted: #565c4c;
  --rule: #9b9f94;
  --rule-soft: #cfd0c6;
  --red: #a03923;
  --focus: #1f56a8;
  --add-bg: #e1ead3;
  --add-ink: #2d5419;
  --del-bg: #f1dcd4;
  --del-ink: #8a2a17;

  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "Fragment Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: clamp(1rem, 3vw, 2rem);
  --max: 1440px;

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

h1,
h2,
p,
ul,
ol,
figure,
pre {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
}

.skip:focus {
  top: 0.75rem;
}

/* Masthead */

.masthead {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.9rem var(--gutter);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}

.lockup img {
  width: 150px;
}

.running-head,
.para-number,
.para-heading,
.caption,
.box-label,
.tabs button {
  font-family: var(--mono);
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 400;
}

.running-head {
  justify-self: center;
}

.masthead-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.masthead-nav a:not(.button) {
  text-decoration: none;
  font-size: 1rem;
}

.masthead-nav a:not(.button):hover {
  text-decoration: underline;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.7rem 1.6rem;
  border: 1.5px solid var(--ink);
  font-weight: 650;
  font-size: 1.0625rem;
  text-decoration: none;
  transition:
    background-color 160ms ease-out,
    color 160ms ease-out;
}

.button-solid {
  background: var(--ink);
  color: var(--paper);
}

.button-solid:hover {
  background: #111410;
}

.button-outline {
  background: transparent;
}

.button-outline:hover {
  background: var(--ink);
  color: var(--paper);
}

.button-small {
  min-height: 2.5rem;
  padding: 0.45rem 1.1rem;
  font-size: 1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

/* Opening: 1-1 and Figure 1-1 */

.opening {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(22rem, 1fr) 2.1fr;
  border-bottom: 1px solid var(--rule);
}

.opening-copy {
  padding: 1.75rem 2.25rem 2.5rem 0;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

h1 {
  font-size: clamp(3rem, 4.15vw, 4.75rem);
  font-weight: 820;
  line-height: 0.96;
  letter-spacing: -0.03em;
  text-wrap: balance;
  margin-top: 0.5rem;
}

.lede {
  max-width: 34em;
  font-size: 1.125rem;
}

.actions {
  margin-top: 0.5rem;
}

.figure {
  padding: 1.75rem 0 2.25rem 2.25rem;
  min-width: 0;
}

.caption-note {
  color: var(--muted);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 1.25rem 0 1.5rem;
  padding-left: calc(7.25rem + 1.5rem);
}

.tabs[hidden] {
  display: none;
}

.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 0.4rem 0.1rem 0.45rem;
  color: var(--ink);
  font-size: 0.875rem;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.tabs button:hover {
  border-bottom-color: var(--rule);
}

.tabs button[aria-selected="true"] {
  border-bottom-color: var(--red);
  font-weight: 700;
}

.job[hidden] {
  display: none;
}

.plate {
  position: relative;
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.js .plate {
  margin-top: 0;
}

.legend {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding-top: 0.5rem;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1rem;
  line-height: 1.25;
}

.js .plate {
  grid-template-columns: 7.25rem minmax(0, 1fr) 7.5rem;
}

.legend.is-placed {
  position: absolute;
  inset: 0;
  padding: 0;
}

.legend.is-placed li {
  position: absolute;
  width: max-content;
  max-width: 7.5rem;
  transform: translateY(-50%);
  transition: top 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.js .jobs {
  grid-column: 2;
}

.dot {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.875rem;
}

.leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.leaders line {
  stroke: var(--red);
  stroke-width: 1.25;
}

.jobs {
  min-width: 0;
}

.job {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  background: var(--paper-high);
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
}

.job:not([hidden]) {
  animation: settle 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes settle {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 1;
  }
}

.thread {
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  border-right: 1px solid var(--rule-soft);
  font-size: 0.875rem;
  min-width: 0;
}

.msg {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.msg p {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  background: #fff;
}

.chip {
  display: block;
  width: max-content;
  margin-top: 0.5rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--rule-soft);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.tools {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tools li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  background: #fff;
  font-family: var(--mono);
  font-size: 0.8125rem;
  min-width: 0;
}

.tool-verb {
  font-weight: 700;
  font-family: var(--sans);
}

.ok,
.delta {
  margin-left: auto;
  font-size: 0.75rem;
  white-space: nowrap;
}

.ok {
  color: var(--add-ink);
}

ins {
  color: var(--add-ink);
  text-decoration: none;
}

del {
  color: var(--del-ink);
  text-decoration: none;
}

.diff {
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  background: #fff;
  padding: 0.5rem 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
  white-space: normal;
}

.diff span {
  display: block;
  padding: 0 0.75rem 0 2.1em;
  text-indent: -1.35em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.diff .ctx {
  color: var(--muted);
}

.diff .add {
  background: var(--add-bg);
  color: var(--add-ink);
}

.diff .del {
  background: var(--del-bg);
  color: var(--del-ink);
}

.author {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.app {
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
  font-size: 0.875rem;
}

.url {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  background: #fff;
  font-family: var(--mono);
  font-size: 0.8125rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lock {
  flex: none;
  width: 0.6rem;
  height: 0.5rem;
  border-radius: 1px;
  background: var(--ink);
  position: relative;
  margin-top: 0.25rem;
}

.lock::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  bottom: 0.45rem;
  width: 0.4rem;
  height: 0.35rem;
  border: 1.5px solid var(--ink);
  border-bottom: 0;
  border-radius: 0.3rem 0.3rem 0 0;
}

.app-body {
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  background: #fff;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.app-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
}

.app-button {
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.75rem;
  font-weight: 600;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  table-layout: auto;
}

.app-table th {
  white-space: nowrap;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  padding: 0.35rem 0.3rem;
  border-bottom: 1px solid var(--rule-soft);
}

.app-table td {
  padding: 0.4rem 0.3rem;
  border-bottom: 1px solid #ebeae3;
}

.app-table .flag {
  color: var(--del-ink);
  font-weight: 700;
}

.app-field {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--rule-soft);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.muted {
  color: var(--muted);
}

.app-error {
  color: var(--del-ink);
  font-weight: 600;
}

.app-output {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.status-ok {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--add-ink);
}

/* 1-2 What it does */

.does {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(22rem, 1fr) 2.1fr;
  border-bottom: 1px solid var(--rule);
}

.note,
.caution {
  align-self: start;
  border: 1px solid var(--ink);
  padding: 0.9rem 1.1rem 1rem;
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.note {
  margin: 1.75rem 2.25rem 2.5rem 0;
}

.box-label {
  padding-bottom: 0.6rem;
  margin-bottom: 0.7rem;
  border-bottom: 1px solid var(--rule);
}

.does-body {
  padding: 1.75rem 0 3rem 2.25rem;
  border-left: 1px solid var(--rule);
}

.lines {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lines li {
  padding: 0.25rem 1.75rem 1.75rem;
  border-left: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lines li:nth-child(3n + 1) {
  padding-left: 0;
  border-left: 0;
}

.lines li:nth-child(n + 4) {
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

.line {
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 760;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lines li p:not(.line) {
  color: var(--muted);
  max-width: 30em;
}

/* 1-3, 1-4 */

.pair {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--rule);
}

.para {
  padding: 2.5rem 2.25rem 3rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.para + .para {
  padding-left: 2.25rem;
  border-left: 1px solid var(--rule);
}

.para p {
  font-size: clamp(1.25rem, 1.7vw, 1.5rem);
  line-height: 1.4;
  max-width: 30em;
}

/* 1-5 Status */

.status {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 3rem;
  border-bottom: 1px solid var(--rule);
}

.status-grid {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.1fr;
  gap: 2.25rem;
  align-items: start;
}

.status-lede {
  font-size: clamp(1.75rem, 2.6vw, 2.5rem);
  font-weight: 780;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.status-more {
  font-size: 1.125rem;
  max-width: 30em;
}

/* Close */

.close {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6rem) var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  border-bottom: 1px solid var(--ink);
}

.close h2 {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 820;
  line-height: 0.98;
  letter-spacing: -0.03em;
  max-width: 14em;
  text-wrap: balance;
}

.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 2.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  font-size: 0.9375rem;
}

.footer-note {
  color: var(--muted);
}

/* Narrower desktops */

@media (max-width: 1180px) {
  .opening,
  .does {
    grid-template-columns: 1fr;
  }

  .opening-copy {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding-right: 0;
  }

  .opening-copy .lede {
    max-width: 40em;
  }

  .figure {
    padding-left: 0;
  }

  .note {
    margin-right: 0;
    margin-bottom: 0;
    max-width: 36rem;
  }

  .does-body {
    padding-left: 0;
    border-left: 0;
  }
}

/* Tablets and phones */

@media (max-width: 820px) {
  .masthead {
    grid-template-columns: auto auto;
    row-gap: 0.6rem;
  }

  .running-head {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
    font-size: 0.8125rem;
  }

  .masthead-nav {
    justify-self: end;
    gap: 1rem;
  }

  .masthead-nav a:not(.button) {
    display: none;
  }

  .lockup img {
    width: 128px;
  }

  .tabs {
    padding-left: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 1.25rem;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    scrollbar-width: thin;
  }

  .tabs button {
    white-space: nowrap;
  }

  .plate,
  .js .plate {
    grid-template-columns: 1fr;
  }

  .js .jobs {
    grid-column: auto;
  }

  .legend {
    order: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem 1rem;
    padding-top: 0;
  }

  .legend li:last-child {
    grid-column: 1 / -1;
  }

  .leaders {
    display: none;
  }

  .job {
    grid-template-columns: 1fr;
  }

  .thread {
    border-right: 0;
    border-bottom: 1px solid var(--rule-soft);
  }

  .lines {
    grid-template-columns: 1fr;
  }

  .lines li,
  .lines li:nth-child(3n + 1) {
    padding: 1.5rem 0;
    border-left: 0;
    border-top: 1px solid var(--rule);
  }

  .lines li:first-child {
    border-top: 0;
    padding-top: 0.5rem;
  }

  .pair {
    grid-template-columns: 1fr;
  }

  .para,
  .para + .para {
    padding: 2rem 0;
    border-left: 0;
  }

  .para + .para {
    border-top: 1px solid var(--rule);
  }

  .status-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Numbered dots mark figure parts only when JS has placed them. */
.thread [data-target],
.app[data-target] {
  position: relative;
}

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

.app-search {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--rule-soft);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.app-search span {
  color: var(--ink);
}

.app-pager {
  color: var(--muted);
  font-size: 0.8125rem;
}

.routes {
  border-top: 1px solid var(--ink);
}

.routes li {
  display: grid;
  gap: 0.25rem;
  padding: 1.1rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.routes a {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  text-decoration: none;
}

.routes a:hover .route-name {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.route-name {
  font-size: clamp(1.5rem, 2.4vw, 2.125rem);
  font-weight: 760;
  letter-spacing: -0.02em;
}

.route-to {
  font-family: var(--mono);
  font-size: 0.9375rem;
}

.routes li p {
  color: var(--muted);
}

@media (min-width: 900px) {
  .close {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    align-items: end;
    gap: 3rem;
  }
}
