@font-face {
  font-family: 'National Park Benchmarks';
  src: url('../assets/fonts/national-park.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 750;
  font-display: optional;
}

@font-face {
  font-family: 'Newsreader Benchmarks';
  src: url('../assets/fonts/newsreader.woff2') format('woff2');
  font-style: normal;
  font-weight: 350 400;
  font-display: optional;
}

@font-face {
  font-family: 'Newsreader Benchmarks';
  src: url('../assets/fonts/newsreader-italic.woff2') format('woff2');
  font-style: italic;
  font-weight: 500;
  font-display: optional;
}

.benchmarks-shell {
  --font-site: 'National Park Benchmarks', ui-sans-serif, sans-serif;
  --font-print: 'Newsreader Benchmarks', Georgia, serif;
  container-type: inline-size;
  grid-template-rows: auto 1fr;
  font-family: var(--font-site);
}

.benchmarks {
  padding-block: var(--page-content-top) 4rem;
}

.bench-intro h1,
.bench-results h2,
.bench-method h2 {
  font-family: var(--font-print);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.bench-intro h1 {
  font-size: var(--page-title-size);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.bench-intro p {
  margin-block-start: 0.75rem;
}

.bench-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: clamp(2.25rem, 6vw, 4.5rem);
  margin-block-start: clamp(1.75rem, 4vw, 2.75rem);
}

.bench-machine {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  column-gap: 2.25rem;
  padding-inline-end: 1.5rem;
}

.bench-machine figcaption {
  grid-column: 2;
  grid-row: 1;
  margin-block-end: 0.875rem;
  text-align: center;
}

.bench-machine h2 {
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.25;
}

.bench-x-label,
.bench-y-label {
  color: var(--brick);
  font-size: 0.875rem;
  font-weight: 600;
}

.bench-y-label {
  grid-column: 1;
  grid-row: 2;
  place-self: center;
  writing-mode: vertical-rl;
  rotate: 180deg;
  white-space: nowrap;
}

.bench-plot {
  --grid-rule: color-mix(in srgb, var(--rule) 40%, transparent);
  position: relative;
  container-type: inline-size;
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  min-height: 11rem;
  aspect-ratio: 1.7;
  border: 1px solid var(--grid-rule);
  border-inline-start-color: var(--muted);
  border-block-end-color: var(--muted);
  background-image:
    linear-gradient(to right, var(--grid-rule) 1px, transparent 1px),
    linear-gradient(to top, var(--grid-rule) 1px, transparent 1px);
  background-size: 50% 50%;
}

.bench-tick,
.bench-point {
  position: absolute;
}

.bench-tick {
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.bench-xtick {
  top: calc(100% + 0.5rem);
  transform: translateX(-50%);
}

.bench-ytick {
  right: calc(100% + 0.5rem);
  transform: translateY(50%);
}

.bench-x-label {
  grid-column: 2;
  margin-block-start: 1.875rem;
  text-align: center;
}

.bench-axis-note {
  margin-block-start: 1.25rem;
}

.bench-axis-note,
.bench-results > p {
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.5;
}

.bench-point {
  width: 0;
  height: 0;
  color: var(--ink);
}

.bench-point::before {
  content: '';
  position: absolute;
  width: 0.625rem;
  height: 0.625rem;
  transform: translate(-50%, -50%);
  border: 2px solid currentColor;
  background: var(--paper);
}

.bench-point.ring64 {
  color: var(--brick);
}

.bench-point.ring64::before {
  border-radius: 50%;
  background: currentColor;
}

.bench-point-label {
  position: absolute;
  left: 0.65rem;
  bottom: 0.25rem;
  font-size: 0.9375rem;
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
}

.label-left .bench-point-label {
  right: 0.65rem;
  left: auto;
  text-align: end;
}

.label-below .bench-point-label {
  top: 0.25rem;
  bottom: auto;
}

.bench-results,
.bench-method {
  margin-block-start: clamp(2.75rem, 6vw, 4.75rem);
}

.bench-results h2,
.bench-method h2 {
  color: var(--brick);
  font-size: clamp(1.875rem, 3.5vw, 2.5rem);
  line-height: 1.1;
}

.bench-results > p {
  margin-block-start: 0.5rem;
}

.bench-table-scroll {
  overflow-x: auto;
  margin-block-start: 0.75rem;
}

.bench-timings {
  width: min(100%, 56rem);
  min-width: 18rem;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 1.0625rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.bench-timings colgroup:first-child {
  width: 33%;
}

.bench-timings :is(th, td) {
  padding: 0.375rem 0;
  text-align: center;
}

.bench-timings th[scope='row'] {
  padding-inline-end: 0.5rem;
  text-align: start;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.bench-timings tbody td span {
  color: var(--brick);
  font-size: 0.8em;
}

.bench-timings thead tr:last-child {
  color: var(--muted);
  font-size: 0.9em;
}

.bench-timings thead tr:last-child > :nth-child(3),
.bench-timings tbody tr > :nth-child(4),
.bench-timings th[scope='colgroup']:last-child {
  padding-inline-start: clamp(0.25rem, 3cqi - 0.25rem, 2.5rem);
}

.bench-timings tbody tr:is(:first-child, :nth-child(3)) > * {
  padding-block-start: 0.875rem;
}

.bench-method {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) minmax(0, 3fr);
  gap: 0.75rem 2rem;
}

.bench-intro p,
.bench-method p {
  font: clamp(1.125rem, 2vw, 1.3125rem) / 1.45 var(--font-print);
}

.bench-method p {
  max-width: 56ch;
}

.bench-method p + p {
  margin-block-start: 0.625rem;
}

.bench-method a {
  display: inline-block;
  margin-block-start: 0.75rem;
  padding-block: 0.25rem;
  color: var(--brick);
}

@media (max-width: 44rem) {
  .bench-method {
    grid-template-columns: minmax(0, 1fr);
  }
}

@container (width < 5rem) {
  .bench-xtick:nth-child(2) {
    display: none;
  }
}

@container (max-width: 36rem) {
  .bench-timings {
    font-size: 0.8125rem;
  }

  .bench-timings colgroup:first-child {
    width: 26%;
  }

  .bench-timings thead tr:last-child > :nth-child(3),
  .bench-timings tbody tr > :nth-child(4),
  .bench-timings th[scope='colgroup']:last-child {
    padding-inline-start: 0;
  }
}
