.wh {
  --paper: #ffffff;
  --ink: #0c0c0d;
  --spot: #ee3b12;
  --hair: #0c0c0d59;
  --edge: 24px; /* page margin */
  --tab: 224px; /* where the label columns end */
  --plot-x: 236px; /* where time starts */
  --plot-w: 280px;
  --head: 42px;
  --row: 42px;
  position: relative;
  width: 540px;
  height: 540px;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Bodoni Moda Variable", "Times New Roman", serif;
  font-optical-sizing: auto;
  font-variant-numeric: lining-nums tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

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

/* the stock: bright white, uncoated, its fibres just visible under the ink */
.wh::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: url("./paper.jpg") 0 0 / 540px 540px;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* everything under about 20 px is cut at the smallest optical size, so the hairlines hold at reading sizes */
.wh-copy,
.wh-unit,
.wh-tick,
.wh-mark,
.wh-mark b,
.wh-note,
.wh-size,
.wh-split,
.wh-cap {
  font-variation-settings: "opsz" 6;
}

.wh-name,
.wh-figno {
  font-variation-settings: "opsz" 14;
}

.wh p {
  margin: 0;
}

/* the column of the article the figure sits in: the last line of the paragraph above it, whole */
.wh-copy {
  position: absolute;
  left: var(--edge);
  top: 11px;
  font-size: 15.5px;
  line-height: 21px;
  font-weight: 480;
  white-space: nowrap;
}

/* ───────── the figure ───────── */

.wh-fig {
  position: absolute;
  left: 0;
  right: 0;
  top: 44px;
  outline: none;
}

/* table rules: a heavy one over the head, a hair under it, a heavy one under the last row */
.wh-fig::before,
.wh-fig::after,
.wh-head::after {
  content: "";
  position: absolute;
  left: var(--edge);
  right: var(--edge);
  border-top: 2px solid var(--ink);
  pointer-events: none;
}

.wh-fig::before {
  top: 0;
}

.wh-fig::after {
  bottom: -2px;
}

.wh-head::after {
  top: calc(var(--head) - 1px);
  border-top-width: 1px;
}

.wh-head,
.wh-row {
  display: grid;
  grid-template-columns: 178px 46px 1fr;
}

.wh-head {
  height: var(--head);
  font-weight: inherit;
}

.wh-head > * {
  padding: 0;
  font-weight: inherit;
  text-align: left;
}

.wh-corner {
  padding-left: var(--edge);
}

.wh-figno {
  display: block;
  margin-top: 11px;
  font-size: 22px;
  line-height: 26px;
  font-style: italic;
  font-weight: 560;
  letter-spacing: -0.01em;
}

.wh-unit,
.wh-tick,
.wh-mark {
  font-family: "Bodoni Moda SC Variable", "Bodoni Moda Variable", serif;
  font-size: 14px;
  line-height: 14px;
  font-weight: 620;
  letter-spacing: 0.07em;
}

.wh-head > .wh-unit {
  padding: 20px 12px 0 0;
  text-align: right;
}

/* the time axis and its marks are set once, over the whole height of the plot */
.wh-timeline {
  position: static;
}

.wh-plot {
  position: absolute;
  left: var(--plot-x);
  top: 0;
  width: var(--plot-w);
  height: calc(var(--head) + 8 * var(--row));
  z-index: 1;
  pointer-events: none;
}

.wh-axis {
  position: absolute;
  inset: 0;
}

.wh-tick {
  position: absolute;
  left: var(--waterfall-tick);
  top: 20px;
  width: 0;
  height: 22px;
  font-family: "Bodoni Moda Variable", serif;
  letter-spacing: 0.02em;
}

.wh-tick span {
  position: absolute;
  top: 0;
  left: 0;
  translate: -50% 0;
  white-space: nowrap;
}

.wh-tick::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 5px;
  border-left: 1px solid var(--ink);
}

.wh-tick:first-child span {
  translate: 0 0;
}

/* First and Largest Contentful Paint: a rule down every row, flagged in the head */
.wh-mark {
  position: absolute;
  left: var(--waterfall-mark);
  top: 0;
  bottom: 0;
  width: 0;
}

.wh-mark::before {
  content: "";
  position: absolute;
  left: 0;
  top: 19px;
  bottom: 0;
  border-left: 1px dashed var(--ink);
}

.wh-mark span {
  position: absolute;
  top: 5px;
  left: 0;
  translate: -50% 0;
  white-space: nowrap;
}

.wh-mark {
  font-size: 15.5px;
}

.wh-mark b {
  font-size: 14px;
  margin-left: 3px;
  font-family: "Bodoni Moda Variable", serif;
  font-weight: inherit;
  letter-spacing: 0.02em;
}

.wh-mark-spot {
  color: var(--spot);
}

/* the second plate overprints the first */
.wh-mark-spot,
.wh-chain {
  mix-blend-mode: multiply;
}

.wh-mark-spot::before {
  border-left: 1px solid var(--spot);
}

/* the blocking line: from the end of the stylesheet's bar down to the hero image's row */
.wh-chain {
  position: absolute;
  left: var(--waterfall-mark);
  top: calc(var(--head) + 2.5 * var(--row));
  height: calc(3 * var(--row) + 0.5px);
  width: 0;
  border-left: 1.5px solid var(--spot);
  translate: -0.75px 0;
}

/* the margin note, flush against that line, in the space where nothing could start */
.wh-note {
  position: absolute;
  right: calc(100% - 38.125% + 9px);
  top: calc(var(--head) + 3 * var(--row) + 6px);
  width: 100px;
  color: var(--spot);
  font-size: 14.5px;
  line-height: 17.5px;
  font-style: italic;
  font-weight: 520;
  text-align: right;
  /* the screen tint of a selected row is knocked out round the note's letters */
  -webkit-text-stroke: 5px var(--paper);
  paint-order: stroke fill;
}

/* ───────── rows ───────── */

.wh-row {
  position: relative;
  height: var(--row);
  outline: none;
  cursor: default;
}

.wh-name,
.wh-size,
.wh-bar {
  height: var(--row);
  padding: 0;
  outline: none;
}

.wh-name {
  padding-left: var(--edge);
  font-size: 24px;
  line-height: 41px;
  font-style: italic;
  font-weight: 560;
  letter-spacing: -0.012em;
  text-align: left;
  white-space: nowrap;
  transition: font-weight 140ms ease-out;
}

/* a hair under each label, as far as the labels go */
.wh-row + .wh-row .wh-name::before,
.wh-row + .wh-row .wh-size::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  border-top: 1px solid var(--hair);
}

.wh-name,
.wh-size {
  position: relative;
}

.wh-row + .wh-row .wh-name::before {
  left: var(--edge);
}

.wh-row + .wh-row .wh-size::before {
  right: 12px;
}

/* sizes, to the nearest kilobyte; the caption has the decimal */
.wh-size {
  padding-right: 12px;
  text-align: right;
  font-size: 16px;
  line-height: 45px;
  font-weight: 560;
  font-variant-numeric: lining-nums proportional-nums;
}

.wh-bar {
  position: relative;
}

.wh-track {
  position: absolute;
  left: calc(var(--plot-x) - var(--tab));
  right: var(--edge);
  top: 4px;
  bottom: 4px;
}

/* a request drawn like the type it sits in: a hairline while it waits, a full stroke while it downloads */
.wh-wait,
.wh-load {
  position: absolute;
  background: var(--ink);
}

.wh-wait {
  left: var(--waterfall-start);
  width: calc(var(--waterfall-size) * var(--wh-wait));
  top: calc(50% - 0.75px);
  height: 1.5px;
}

.wh-wait::before {
  content: "";
  position: absolute;
  left: 0;
  top: -4.5px;
  width: 1.5px;
  height: 10.5px;
  background: inherit;
}

.wh-load {
  left: calc(var(--waterfall-start) + var(--waterfall-size) * var(--wh-wait));
  width: calc(var(--waterfall-size) * (1 - var(--wh-wait)));
  top: calc(50% - 11px);
  height: 22px;
}

/* the three requests that start on the blocking line take it as their start mark */
.wh-row[data-chained] .wh-wait::before {
  display: none;
}

.wh-row[data-chained] .wh-wait {
  left: calc(var(--waterfall-start) - var(--wh-lead));
  width: calc(var(--waterfall-size) * var(--wh-wait) + var(--wh-lead));
}

.wh-row[data-spot] .wh-wait,
.wh-row[data-spot] .wh-load {
  background: var(--spot);
}

/* the page arrives: each bar is drawn from its start, a row at a time */
.wh-track {
  animation: wh-draw 620ms cubic-bezier(0.3, 0, 0.1, 1) backwards;
  animation-delay: calc(140ms + var(--wh-i) * 70ms);
}

@keyframes wh-draw {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* the request being read: its label reversed out of a tab that runs off the edge of the page */
.wh-row:hover .wh-name {
  font-weight: 760;
}

.wh-row[data-selected] .wh-name,
.wh-row[data-selected] .wh-size {
  background: var(--ink);
  color: var(--paper);
}

.wh-row[data-selected] .wh-name {
  font-weight: 760;
}

.wh-row[data-selected] .wh-name::before,
.wh-row[data-selected] .wh-size::before,
.wh-row[data-selected] + .wh-row .wh-name::before,
.wh-row[data-selected] + .wh-row .wh-size::before {
  display: none;
}

/* and the tab carries on across the bar lane as a ten per cent screen of the black, to the figure's right edge */
.wh-bar[data-selected]::before {
  content: "";
  position: absolute;
  inset: 0 var(--edge) 0 0;
  background-image: radial-gradient(circle, var(--ink) 0.42px, transparent 0.56px), radial-gradient(circle, var(--ink) 0.42px, transparent 0.56px);
  background-size: 4px 4px;
  background-position: 0 0, 2px 2px;
}

/* keyboard focus: a keyline inside the tab, open where it leaves the page */
.wh-row:focus-visible::after {
  content: "";
  position: absolute;
  left: -2px;
  top: 4px;
  bottom: 4px;
  width: calc(var(--tab) - 2px);
  border: 1px solid var(--paper);
  pointer-events: none;
}

/* focus inside a row, cell by cell */
.wh-name:focus-visible::after,
.wh-size:focus-visible::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--paper);
}

.wh-name:focus-visible::after {
  left: 14px;
}

.wh-bar:focus-visible .wh-track::after {
  content: "";
  position: absolute;
  left: calc(var(--waterfall-start) - 6px);
  width: calc(var(--waterfall-size) + 12px);
  top: 0;
  bottom: 0;
  border: 1px solid var(--ink);
}

/* ───────── the caption reads out the request ───────── */

.wh-read {
  position: absolute;
  left: var(--edge);
  right: var(--edge);
  top: 432px;
  height: 100px;
}

.wh-took {
  position: absolute;
  left: -6px;
  top: 0;
  display: flex;
  align-items: baseline;
  font-style: italic;
  white-space: nowrap;
}

.wh-num {
  font-variant-numeric: lining-nums proportional-nums;
  font-size: 68px;
  line-height: 68px;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.wh-s {
  margin-left: 7px;
  font-size: 30px;
  font-weight: 500;
}

.wh-read[data-spot] .wh-took {
  color: var(--spot);
}

.wh-split {
  position: absolute;
  left: 0;
  top: 72px;
  display: flex;
  align-items: center;
  font-family: "Bodoni Moda SC Variable", "Bodoni Moda Variable", serif;
  font-size: 15px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.wh-key {
  flex: none;
  background: var(--ink);
}

.wh-key-wait {
  position: relative;
  width: 14px;
  height: 1.5px;
  margin-right: 6px;
}

.wh-key-wait::before {
  content: "";
  position: absolute;
  left: 0;
  top: -3.5px;
  width: 1.5px;
  height: 8.5px;
  background: inherit;
}

.wh-key-load {
  width: 10px;
  height: 10px;
  margin: 0 6px 0 14px;
}

.wh-read[data-spot] .wh-key {
  background: var(--spot);
}

.wh-cap {
  position: absolute;
  left: calc(var(--plot-x) - var(--edge));
  right: 0;
  top: 9px;
  font-size: 15px;
  line-height: 21px;
  font-weight: 500;
}

.wh-cap p {
  white-space: nowrap;
}

.wh-cap-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.wh-cap-name {
  font-family: "Bodoni Moda SC Variable", "Bodoni Moda Variable", serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.wh-cap-file,
.wh-cap-note {
  font-style: italic;
}

.wh-took,
.wh-split,
.wh-cap {
  animation: wh-turn 200ms cubic-bezier(0.2, 0.6, 0.2, 1) both;
}

@keyframes wh-turn {
  from {
    opacity: 0;
    translate: 0 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wh-track,
  .wh-took,
  .wh-split,
  .wh-cap {
    animation: none;
  }
}
