/* ==========================================================================
   ANTIHORIZN landing page: the benchmark wall (section #model).
   Loaded after launch.css on index.html. The 3D wall is drawn by
   assets/js/bench-wall.js into .bw__gl, which fills the stage; the type sits
   over it on the left and the counter under it on the right.
     W1  Stage and head
     W2  The table of runs
     W3  The counter
     W4  Figures and method, below the stage
     W5  Narrow screens and reduced motion
   ========================================================================== */

.bw {
  --bw-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --bw-line: rgba(244, 244, 245, 0.14);
  --bw-dim: rgba(244, 244, 245, 0.56);
  position: relative;
  overflow: hidden;
  scroll-margin-top: var(--nav-h);
}

/* --- W1. Stage and head --------------------------------------------------- */

/* One screen under the nav, so the table, the wall and the counter are all in
   view together on a laptop as well as on a desktop monitor. The section's
   scroll margin lands a link to #model with the stage directly under the nav. */
.bw__stage {
  position: relative;
  min-height: clamp(520px, calc(100svh - var(--nav-h)), 900px);
  display: flex;
  isolation: isolate;
}
.bw__gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: -1;
  opacity: 0;
  transition: opacity 600ms var(--bw-ease);
}
.bw__stage[data-ready="true"] .bw__gl { opacity: 1; }
/* A floor of light under the wall, so the parts sit in a room, not a void. */
.bw__stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: radial-gradient(54% 60% at 71% 44%, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.025) 46%, rgba(255, 255, 255, 0) 74%);
}

.bw__ui {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 0.39fr) minmax(0, 0.61fr);
  grid-template-rows: auto 1fr;
  column-gap: clamp(28px, 4vw, 72px);
  padding-top: clamp(40px, 6.4vh, 64px);
  padding-bottom: clamp(24px, 3.6vh, 40px);
}
/* The headline runs the full width on one line; the wall starts under it. */
.bw__head { grid-column: 1 / -1; grid-row: 1; }
.bw__title { margin-top: 18px; color: var(--on-dark); max-width: none; }
.bw__title em { font-style: normal; background: none; padding: 0; color: var(--hot); white-space: nowrap; }
.bw__left {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-top: clamp(18px, 2.8vh, 28px);
}
.bw__lede {
  max-width: 46ch;
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  color: var(--bw-dim);
}

/* --- W2. The table of runs ------------------------------------------------- */

.bw__panel { align-self: stretch; margin-top: auto; padding-top: clamp(18px, 3vh, 32px); }
.bw__cols,
.bw__pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 176px;
  align-items: center;
  column-gap: 14px;
}
.bw__cols {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(244, 244, 245, 0.3);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
  color: var(--bw-dim);
}
.bw__cols span { white-space: nowrap; }
.bw__cols span:nth-child(n + 2) { text-align: right; }

/* Every row can be read at every moment of the loop: names, scores and costs
   are never dimmed. A run that has not played yet is shown by its mark and
   its empty strip of cells, not by fading its text. */
.bw__run {
  position: relative;
  border-bottom: 1px solid var(--bw-line);
}
.bw__run:nth-child(2) { --i: 1; }
.bw__run:nth-child(3) { --i: 2; }
.bw__run:nth-child(4) { --i: 3; }

.bw__pick {
  width: 100%;
  padding: 14px 0 12px;
  text-align: left;
  color: var(--on-dark);
  grid-template-columns: 24px minmax(0, 1fr) 76px 176px;
  cursor: pointer;
}
.bw__pick:focus-visible { outline: 1.5px solid var(--hot); outline-offset: 2px; }
.bw__logo { width: 19px; height: 19px; color: var(--on-dark); opacity: 0.4; transition: opacity 240ms var(--bw-ease); }
.bw__logo--us { width: 24px; height: 19px; }
.bw__run[data-shown="true"] .bw__logo,
.bw__run--us .bw__logo,
.bw__stage[data-state="cost"] .bw__logo,
.bw__stage[data-costs="on"] .bw__logo { opacity: 1; }
.bw__name {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.008em;
  white-space: nowrap;
  color: rgba(244, 244, 245, 0.8);
  transition: color 240ms var(--bw-ease), transform 140ms var(--bw-ease);
}
.bw__name small { display: block; margin-top: 3px; font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--bw-dim); }
.bw__run[data-on="true"] .bw__name,
.bw__run--us .bw__name,
.bw__stage[data-state="cost"] .bw__name,
.bw__stage[data-costs="on"] .bw__name { color: var(--on-dark); }
.bw__score,
.bw__cost {
  text-align: right;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--bw-dim);
}
.bw__score b { font-weight: 600; color: var(--on-dark); }
/* The cost is on the table from the start, in the quiet grey. The closing
   beat brings it forward a row at a time, with its bar. */
.bw__cost { transition: color 320ms var(--bw-ease) calc(var(--i, 0) * 90ms); }
.bw__stage[data-state="cost"] .bw__cost,
.bw__stage[data-costs="on"] .bw__cost { color: var(--on-dark); }
.bw__run--us .bw__name { font-weight: 700; }
.bw__run--us .bw__score b,
.bw__stage[data-state="cost"] .bw__run--us .bw__cost,
.bw__stage[data-costs="on"] .bw__run--us .bw__cost { color: var(--hot); font-weight: 700; }
@media (hover: hover) and (pointer: fine) {
  .bw__pick:hover .bw__name { color: var(--on-dark); }
  .bw__pick:hover .bw__logo { opacity: 1; }
}
.bw__pick:active .bw__name { transform: translateX(2px); }

/* Under each row: one cell per part during the runs, a cost bar at the end. */
.bw__cells,
.bw__money {
  position: absolute;
  left: 38px;
  right: 0;
  bottom: -2px;
  height: 4px;
}
.bw__cells { display: grid; grid-template-columns: repeat(48, minmax(0, 1fr)); gap: 1px; transition: opacity 320ms var(--bw-ease); }
.bw__cells i { background: rgba(244, 244, 245, 0.09); transition: background-color 140ms linear; }
.bw__cells i.lit { background: rgba(244, 244, 245, 0.66); }
.bw__run--us .bw__cells i.lit { background: var(--hot); }
.bw__money { opacity: 0; transition: opacity 320ms var(--bw-ease); }
.bw__money i {
  position: absolute;
  inset: 0 auto 0 0;
  width: max(4px, calc(var(--v) * 100%));
  background: rgba(244, 244, 245, 0.66);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 900ms var(--bw-ease) calc(120ms + var(--i, 0) * 90ms);
}
.bw__run--us .bw__money i { background: var(--hot); }
.bw__stage[data-state="cost"] .bw__cells { opacity: 0; }
.bw__stage[data-state="cost"] .bw__money { opacity: 1; }
.bw__stage[data-state="cost"] .bw__money i { transform: scaleX(1); }
/* Reduced motion: the wall holds on our finished run and the table shows the
   costs at full strength beside the counts, with nothing drawn in. */
.bw__stage[data-costs="on"] .bw__cells { opacity: 0; }
.bw__stage[data-costs="on"] .bw__money { opacity: 1; }
.bw__stage[data-costs="on"] .bw__money i { transform: scaleX(1); }

/* --- W3. The counter -------------------------------------------------------- */

.bw__count {
  margin-top: clamp(18px, 3vh, 32px);
  pointer-events: none;
}
.bw__who {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
  color: var(--bw-dim);
}
.bw__big {
  display: flex;
  align-items: baseline;
  gap: 0.14em;
  margin-top: 6px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(84px, min(10.4vw, 18vh), 168px);
  line-height: 0.9;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  color: var(--on-dark);
}
.bw__big b { display: inline-block; transform-origin: 100% 85%; }
.bw__big span { font-size: 0.3em; font-weight: 500; letter-spacing: -0.01em; color: var(--bw-dim); }
/* The counter answers once when our last part seats. */
.bw__stage[data-done="true"] .bw__big b { animation: bwLand 480ms var(--bw-ease); }
@keyframes bwLand {
  from { transform: scale(1.07); }
  to { transform: none; }
}
.bw__stage[data-state="ours"] .bw__big b,
.bw__stage[data-state="cost"] .bw__big b { color: var(--hot); }
.bw__cap {
  margin-top: 12px;
  max-width: 40ch;
  min-height: 2.9em;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.008em;
  color: var(--bw-dim);
}

/* --- W4. Figures and method -------------------------------------------------- */

.bw__after { padding-bottom: var(--stack); }
.bw__facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid rgba(244, 244, 245, 0.3);
}
.bw__facts > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 12px; padding: 22px 24px 4px 0; }
.bw__facts > div + div { padding-left: 24px; border-left: 1px solid var(--bw-line); }
.bw__facts dt { max-width: 24ch; font-size: 14px; line-height: 1.4; color: var(--bw-dim); }
.bw__facts dd {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.14em;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(40px, 4.2vw, 64px);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--on-dark);
}
.bw__facts dd span { margin: 0 0.3em; font-size: 0.3em; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--bw-dim); }
.bw__facts dd small { margin-left: 0.6em; font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--bw-dim); }
.bw__note {
  margin-top: clamp(28px, 4vh, 44px);
  max-width: 96ch;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(244, 244, 245, 0.46);
}
.bw__note b { font-weight: 600; color: rgba(244, 244, 245, 0.72); }

/* --- W5. Short, narrow and reduced-motion screens ---------------------------- */

/* A laptop: 1366 x 768 and 1280 x 720 leave 590 to 700 px under the nav once
   the browser's own bars are counted. The stage keeps to one screen there. */
@media (min-width: 901px) and (max-height: 820px) {
  .bw__ui { padding-top: clamp(28px, 5vh, 44px); padding-bottom: 20px; }
  .bw__title { margin-top: 16px; font-size: clamp(30px, 3vw, 40px); }
  .bw__lede { margin-top: 14px; font-size: 16px; line-height: 1.45; }
  .bw__pick { padding: 9px 0 8px; }
  .bw__count { margin-top: 16px; }
  .bw__cap { margin-top: 8px; font-size: 14px; min-height: 2.8em; }
  .bw__big { font-size: clamp(64px, 6.6vw, 92px); }
  .bw__panel { margin-top: auto; padding-top: 14px; }
}
@media (min-width: 901px) and (max-height: 700px) {
  .bw__ui { padding-top: 26px; padding-bottom: 16px; }
  .bw__title { font-size: clamp(28px, 2.5vw, 34px); }
  .bw__lede { max-width: 52ch; font-size: 15px; }
  .bw__pick { padding: 6px 0 6px; }
  .bw__name small { margin-top: 1px; }
  .bw__lede { display: none; }
  .bw__big { font-size: 72px; }
  .bw__count { margin-top: 6px; }
}

@media (max-width: 900px) {
  .bw__stage { min-height: 0; display: block; }
  .bw__stage::before { background: radial-gradient(70% 34% at 50% 20%, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0) 80%); }
  .bw__gl { position: relative; inset: auto; height: 78vw; max-height: 520px; z-index: 0; margin-top: 56px; }
  .bw__ui { display: block; padding-top: 28px; }
  .bw__count { justify-self: stretch; text-align: left; margin-top: 34px; }
  .bw__big { justify-content: flex-start; }
  .bw__big b { transform-origin: 0 85%; }
  .bw__cap { margin-left: 0; }
  .bw__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 40px; }
  .bw__facts > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .bw__facts > div:nth-child(n + 3) { border-top: 1px solid var(--bw-line); }
}
@media (max-width: 520px) {
  .bw__cols, .bw__pick { grid-template-columns: 24px minmax(0, 1fr) 58px 104px; column-gap: 8px; }
  .bw__cols { grid-template-columns: minmax(0, 1fr) 58px 104px; align-items: end; }
  .bw__cols span:last-child { white-space: normal; }
  .bw__name, .bw__score, .bw__cost { font-size: 14px; }
  .bw__facts dd { flex-wrap: wrap; font-size: 30px; }
  .bw__facts dd small { flex-basis: 100%; margin: 6px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .bw__gl, .bw__logo, .bw__name, .bw__cost, .bw__cells, .bw__cells i, .bw__money, .bw__money i { transition: none; }
  .bw__stage[data-done="true"] .bw__big b { animation: none; }
}
