/* HorneSci demo: three methods race through one complete job, replayed from measured times. */

.demo .page-title { font-size: clamp(3rem, 9vw, 8rem); }

.race { row-gap: clamp(1.75rem, 3.5vw, 2.75rem); padding-bottom: clamp(5rem, 10vw, 8rem); }
.race > * { grid-column: 3 / span 8; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.chips button {
  padding: 0.5rem 0.95rem 0.55rem;
  border: 1px solid var(--rule);
  background: none;
  color: var(--gray);
  font: 700 0.9375rem/1 var(--text);
  cursor: pointer;
  transition: border-color 0.2s linear, color 0.2s linear, background-color 0.2s linear;
}

.chips button:hover { border-color: var(--ink); color: var(--ink); }
.chips button[aria-checked="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.chips button:focus-visible, .race-run:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Each bar is one job. The compute share appears when a lane finishes, so the race implies no
   order of stages: the dark part is compute, the light part start, load, save and check. */

.lanes { display: grid; gap: 1.5rem; }

.lane { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0.55rem 1rem; }
.lane-name { font-weight: 700; }
.lane-time { color: var(--gray); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.lane.is-done .lane-time { color: var(--ink); }
.lane-track { grid-column: 1 / -1; height: clamp(2.25rem, 5vw, 3.25rem); }
.lane-bar { display: flex; height: 100%; background: #e4e2dc; clip-path: inset(0 100% 0 0); }
.lane-bar .compute { display: block; height: 100%; background: var(--paper-dim); opacity: 0; transition: opacity 0.4s linear; }
.lane.is-done .lane-bar .compute { opacity: 1; }
.lane-bar { background: #d6d4ce; }
.lane[data-arm="candidate"] .lane-bar { background: #3a3b3c; }
.lane.is-done .lane-bar { background: #e4e2dc; }
.lane[data-arm="candidate"] .lane-bar .compute { background: var(--ink); }

.lane-key { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.5rem; color: var(--gray); font-size: 0.875rem; }
.lane-key i { display: inline-block; width: 0.8rem; height: 0.8rem; background: #e4e2dc; }
.lane-key i.compute { background: var(--paper-dim); }
.lane-key i + i, .lane-key i:not(.compute) { margin-left: 0.75rem; }

.race-result { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; min-height: 4.5rem; }

.race-figure {
  max-width: 14em;
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.5vw, 2.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  opacity: 0;
  transform: translateY(0.4em);
  transition: opacity 0.5s var(--ease), transform 0.7s var(--ease);
}

.race-figure span { display: block; font-size: 2.2em; letter-spacing: -0.045em; }
.race-result.is-shown .race-figure { opacity: 1; transform: none; }

.race-run { background: none; color: var(--ink); font: 700 0.9375rem/1 var(--text); cursor: pointer; }
.race-run:hover { background: var(--ink); color: var(--paper); }

.race-sub { margin-top: 0.75rem; color: var(--gray); font-size: 1rem; }
.race-sub span { color: var(--ink); font-weight: 700; }

.race-check { color: var(--gray); }

.proof { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0.5rem 1.5rem; padding: 1.75rem 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); }
.proof-figure { font-family: var(--display); font-size: clamp(2.75rem, 8vw, 5.5rem); line-height: 0.95; letter-spacing: -0.045em; }
.proof-text { max-width: 26em; font-size: 1.125rem; }
.proof-text a { font-weight: 700; white-space: nowrap; }
.proof-text a::after { content: " →"; }
@media (max-width: 40rem) { .proof { grid-template-columns: 1fr; } }

.why { padding-top: 1.5rem; border-top: 1px solid var(--ink); }
.why h2 { font-family: var(--display); font-weight: 400; font-size: clamp(1.75rem, 3.5vw, 2.5rem); letter-spacing: -0.03em; }
.why ol { margin: 1rem 0 0; padding-left: 1.4rem; }
.why li { max-width: 34em; font-size: 1.125rem; }
.why li + li { margin-top: 0.5rem; }
.why p { margin-top: 1.25rem; color: var(--gray); }
.why p a { color: var(--ink); font-weight: 700; }

.race-cta {
  justify-self: start;
  padding: 1rem 1.5rem 1.05rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}

.race-cta::after { content: " →"; }
.race-cta:hover { background: var(--charcoal); }

.race-notes { max-width: 46em; padding-top: 1.25rem; border-top: 1px solid var(--rule); color: var(--gray); font-size: 0.875rem; }

@media (max-width: 56rem) {
  .race > * { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .race-figure, .chips button { transition: none; }
}
