/* LMSysDojo project page: the story. A pinned, scroll-scrubbed walk through one real playground (vLLM 4696).
 * Without JS (or if story.js fails) the section is a plain list of five captions. story.js adds .is-live to pin it
 * and draw the stage, or .is-still (reduced motion, short viewports) to show a static snapshot beside each step.
 * Everything is scoped under #story. */

#story { position: relative; border-top: 1px solid var(--line); }
#story .story-track { position: relative; }
#story .story-sticky { position: relative; }
#story .story-grid { padding-top: 112px; padding-bottom: 104px; }
#story .story-title { font-size: clamp(32px, 3.6vw, 48px); font-weight: 540; letter-spacing: -.032em; line-height: 1.06; margin: 0 0 28px; }
#story .story-steps { list-style: none; margin: 0; padding: 0; max-width: 640px; }
#story .story-step { padding: 18px 0; border-top: 1px solid var(--line); }
#story .story-step-k { display: block; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--blue-ink); margin-bottom: 8px; }
#story .story-step p { margin: 0; color: var(--ink-2); font-size: 16px; line-height: 1.6; }
#story .story-step p b { color: var(--ink); }
#story .story-note { margin: 22px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-3); max-width: 520px; }
#story .story-stage:empty { display: none; }

/* ------------------------------------------------------------------ pinned (desktop) */
#story.is-live .story-track { height: 540vh; }
#story.is-live .story-sticky {
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h)); height: calc(100svh - var(--nav-h));
  display: flex; align-items: center; overflow: hidden; overflow: clip;
}
/* one bounded row: the stage fills the pinned height and never pushes past it (story.js scales its drawing to fit) */
#story.is-live .story-grid {
  width: 100%; height: 100%; padding-top: 28px; padding-bottom: 28px;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: minmax(0, 1fr);
  gap: clamp(28px, 4vw, 72px); align-items: center;
}
#story.is-live .story-copy { align-self: center; min-width: 0; }
#story.is-live .story-stage { position: relative; height: 100%; max-height: 720px; min-height: 0; align-self: center; }
#story.is-live .story-stage:empty { display: block; }

/* ------------------------------------------------------------------ the stage: a light instrument panel */
#story .story-stage {
  border-radius: var(--rad-lg); border: 1px solid var(--line); overflow: hidden;
  background-color: var(--bg-soft);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.3px);
  background-size: 22px 22px; background-position: 11px 11px;
}
#story .st-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
#story .st-svg text { font-family: var(--sans); font-variant-numeric: tabular-nums; }
#story .st-svg .st-k { font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; fill: var(--ink-3); }
#story .st-svg .st-v { font-family: var(--mono); font-size: 12.5px; font-weight: 600; fill: var(--ink); }
#story .st-svg .st-big { font-size: 15px; font-weight: 560; letter-spacing: -.01em; }
#story .st-svg .st-sm { font-size: 11.5px; }
#story .st-svg .st-sub { font-size: 12.5px; fill: var(--ink-3); }
#story .st-svg .st-lab { font-size: 13px; font-weight: 560; fill: var(--ink); }
#story .st-svg .st-blue { fill: var(--blue-ink); }
#story .st-svg .st-violet { fill: var(--violet); }
#story .st-rule { stroke: var(--line-2); stroke-width: 1; shape-rendering: crispEdges; }
#story .st-tick { stroke: var(--ink-4); stroke-width: 1; shape-rendering: crispEdges; }
#story .st-lane { fill: var(--bg); stroke: var(--line); stroke-width: 1; }
/* the shared .tag-note, placed by story.js under the time axis */
#story .st-note { position: absolute; transform-origin: 100% 0; pointer-events: none; }
#story .st-live { fill: var(--blue); }
#story .st-req { fill: var(--blue-2); }
#story .st-cpu { fill: var(--ink-4); }
#story .st-hot { fill: var(--block); }
#story .st-gpu { fill: var(--blue); }
#story .st-hatch-bg { fill: color-mix(in srgb, var(--blue) 7%, transparent); }
#story .st-hatch { stroke: var(--blue-2); stroke-width: 1.4; }
#story .st-end { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 3; }
#story .st-endg { stroke: var(--ink-4); stroke-width: 1; stroke-dasharray: 2 3; }
#story .st-saved { fill: color-mix(in srgb, var(--blue) 22%, transparent); }
#story .st-scan-line { stroke: var(--blue); stroke-width: 1.25; }
#story .st-g0 { stop-color: var(--blue); stop-opacity: 0; }
#story .st-g1 { stop-color: var(--blue); stop-opacity: .14; }
#story .st-lead { stroke: var(--ink-2); stroke-width: 1; }
#story .st-svg .st-xs { font-size: 11.5px; }
#story .st-svg .st-xl { font-size: 22px; font-weight: 560; letter-spacing: -.02em; }
#story .st-blk { fill: var(--line-2); }
#story .st-blk-u { fill: var(--blue-2); }
#story .st-blk-n { fill: var(--ink-2); }
#story .st-track { fill: var(--line); }
#story .st-stair { fill: color-mix(in srgb, var(--ink-4) 72%, var(--line-2)); }
#story .st-chain { fill: var(--blue); }
#story .st-arrow { fill: none; stroke: var(--blue); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
#story .st-card { fill: var(--bg); stroke: var(--line); stroke-width: 1; }
#story .st-ring { fill: none; stroke: var(--blue); stroke-width: 2; }
#story .st-nb { fill: var(--blue); }
#story .st-svg .st-nbt { font-family: var(--mono); font-size: 10.5px; font-weight: 600; fill: #fff; }
#story .st-svg .st-sel { fill: var(--blue); }
#story .st-tabbg { fill: var(--blue); }
#story .st-svg .st-tabt { font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: .04em; fill: #fff; }
#story .st-pill { fill: var(--block); }
#story .st-svg .st-pillt { font-family: var(--mono); font-size: 15px; font-weight: 650; fill: var(--on-block); }
#story .st-svg .st-pilli { font-size: 13px; font-weight: 500; }
#story .st-vdot { fill: var(--violet); }
#story .st-bar0 { fill: var(--line-2); }
#story .st-bar1 { fill: var(--s-expert); }
#story .st-bar2 { fill: var(--blue); }
#story .st-exl { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; }
#story .st-svg .st-dim { fill: var(--ink-3); }
#story .st-svg .st-gainv { font-size: 52px; font-weight: 540; letter-spacing: -.04em; fill: var(--violet); }
#story .st-svg .st-md { font-size: 13px; }
/* compact stages (story.js uses them below 560px wide or 450px tall and marks them .st-n) use smaller type */
#story .st-n .st-gainv { font-size: 34px; }
#story .st-n .st-tabt { font-size: 8.5px; letter-spacing: .02em; }
#story .st-n .st-pillt { font-size: 13px; }
#story .st-n .st-pilli { font-size: 11.5px; }

/* ------------------------------------------------------------------ captions (pinned): a step index and one caption */
#story.is-live .story-title { margin-bottom: 30px; }
#story.is-live .story-steps {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr); max-width: 470px;
  --p: 0;
}
#story.is-live .story-step { display: contents; }
#story.is-live .story-step-k { grid-column: 1; margin: 0; }
#story.is-live .story-step:nth-child(1) .story-step-k { grid-row: 1; }
#story.is-live .story-step:nth-child(2) .story-step-k { grid-row: 2; }
#story.is-live .story-step:nth-child(3) .story-step-k { grid-row: 3; }
#story.is-live .story-step:nth-child(4) .story-step-k { grid-row: 4; }
#story.is-live .story-step:nth-child(5) .story-step-k { grid-row: 5; }
/* the rail behind the five nodes; its blue fill follows the timeline */
#story.is-live .story-steps::before {
  content: ""; position: absolute; grid-row: 1 / 6; grid-column: 1; left: 4px; top: 17px; bottom: 17px; width: 1px;
  background: linear-gradient(var(--blue), var(--blue)) 0 0 / 100% calc(var(--p) * 100%) no-repeat, var(--line-2);
}
/* the rule above the caption stays put while the captions change */
#story.is-live .story-steps::after { content: ""; grid-row: 6; grid-column: 1; align-self: start; height: 1px; margin-top: 22px; background: var(--line); }
#story .story-jump {
  position: relative; display: block; width: 100%; padding: 8px 0 8px 26px; border: 0; background: none; cursor: pointer; text-align: left;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--ink-3); border-radius: 8px;
  transition: color .4s var(--ease-out);
}
#story .story-jump::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%; z-index: 1;
  background: var(--bg); box-shadow: inset 0 0 0 1px var(--ink-4);
  transition: background-color .4s var(--ease-out), box-shadow .4s var(--ease-out), transform .5s var(--ease-out);
}
#story .story-jump:hover { color: var(--ink); }
#story .is-past .story-jump::before { background: var(--blue-2); box-shadow: inset 0 0 0 1px var(--blue-2); }
#story .is-active .story-jump { color: var(--blue-ink); }
#story .is-active .story-jump::before { background: var(--blue); box-shadow: inset 0 0 0 1px var(--blue), 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent); transform: scale(1.12); }
/* one caption at a time: the old one leaves quickly (up when moving on, down when going back), then the new one enters */
#story.is-live .story-step p {
  grid-row: 6; grid-column: 1; margin: 22px 0 0; padding-top: 21px;
  font-size: 16.5px; line-height: 1.62;
  opacity: 0; transform: translate3d(0, 8px, 0); pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
#story.is-live .story-step.is-past p { transform: translate3d(0, -6px, 0); }
#story.is-live .story-step.is-active p { opacity: 1; transform: none; pointer-events: auto; transition: opacity .45s var(--ease-out) .16s, transform .6s var(--ease-out) .16s; }
#story.is-live .story-note { margin-top: 26px; font-size: 13px; max-width: 470px; }

/* step dots (narrow screens) and the skip link */
#story .story-ctl { display: none; }
#story.is-live .story-ctl { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; max-width: 470px; }
#story .story-dots { display: none; gap: 7px; align-items: center; }
#story .story-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); transition: background-color .4s var(--ease-out), transform .5s var(--ease-out); }
#story .story-dots i.on { background: var(--blue); transform: scale(1.25); }
#story .story-dots i.past { background: var(--blue-2); }
#story .story-skip {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); text-decoration: none; padding: 6px 0; border-radius: 6px;
}
#story .story-skip:hover { color: var(--ink); }
#story .story-skip span { display: inline-block; transition: transform .3s var(--ease-out); }
#story .story-skip:hover span { transform: translateY(2px); }

/* small laptops and tablets: keep the stage wide enough for its full layout */
@media (min-width: 990px) and (max-width: 1080px) {
  #story.is-live .story-grid, #story.is-still .story-step { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); }
}
/* short laptop screens (and the narrower copy column up to 1080px): a tighter copy column that fits the pinned view */
@media (min-width: 861px) and (max-height: 780px), (min-width: 861px) and (max-width: 1080px) and (max-height: 820px) {
  #story.is-live .story-grid { padding-top: 14px; padding-bottom: 14px; }
  #story.is-live .story-title { font-size: clamp(30px, 5.2vh, 44px); margin-bottom: 14px; }
  #story.is-live .story-steps::before { top: 13px; bottom: 13px; }
  #story.is-live .story-jump { padding-top: 4px; padding-bottom: 4px; }
  #story.is-live .story-steps::after { margin-top: 12px; }
  #story.is-live .story-step p { margin-top: 12px; padding-top: 13px; font-size: 15px; }
  #story.is-live .story-ctl { margin-top: 12px; }
  #story.is-live .story-note { display: none; }
}

/* ------------------------------------------------------------------ narrow: title, stage, then the active caption */
@media (max-width: 860px) {
  #story.is-live .story-track { height: 500vh; }
  #story.is-live .story-grid {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    gap: 0; align-items: stretch; padding-top: 14px; padding-bottom: 14px;
  }
  #story.is-live .story-copy { display: contents; }
  #story.is-live .story-copy .eyebrow { order: 1; margin: 0 0 6px; font-size: 11px; }
  #story.is-live .story-title { order: 2; margin: 0 0 14px; font-size: clamp(24px, 6.4vw, 34px); }
  #story.is-live .story-stage { order: 3; max-height: none; }
  #story.is-live .story-steps { order: 4; max-width: none; margin-top: 14px; }
  #story.is-live .story-ctl { order: 5; max-width: none; margin-top: 10px; }
  #story.is-live .story-note { display: none; }
  #story.is-live .story-steps::before, #story.is-live .story-steps::after { display: none; }
  #story.is-live .story-steps .story-step .story-step-k { grid-row: 1; opacity: 0; visibility: hidden; transition: opacity .16s var(--ease), visibility 0s linear .16s; }
  #story.is-live .story-steps .story-step.is-active .story-step-k { opacity: 1; visibility: visible; transition: opacity .45s var(--ease-out) .16s; }
  #story .story-jump { padding: 0; pointer-events: none; }
  #story .story-jump::before { display: none; }
  #story.is-live .story-step p { grid-row: 2; margin: 6px 0 0; padding: 0; font-size: 15px; line-height: 1.55; }
  #story .story-dots { display: flex; }
}
/* short phones: the stage's own header names the playground, so the eyebrow gives its line to the stage */
@media (max-width: 860px) and (max-height: 760px) {
  #story.is-live .story-grid { grid-template-rows: auto minmax(0, 1fr) auto auto; }
  #story.is-live .story-copy .eyebrow { display: none; }
}

/* ------------------------------------------------------------------ stills: each caption beside a snapshot of its scene */
#story.is-still .story-grid { display: block; }
#story.is-still .story-steps { max-width: none; }
#story.is-still .story-step {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: auto auto;
  column-gap: clamp(28px, 4vw, 72px); padding: 36px 0;
}
#story.is-still .story-step-k { grid-column: 1; grid-row: 1; align-self: end; }
#story.is-still .story-step p { grid-column: 1; grid-row: 2; align-self: start; max-width: 460px; }
#story.is-still .story-shot { grid-column: 2; grid-row: 1 / span 2; position: relative; height: 580px; }
#story.is-still .story-note { max-width: none; }
@media (max-width: 860px) {
  #story.is-still .story-step { grid-template-columns: minmax(0, 1fr); }
  #story.is-still .story-shot { grid-column: 1; grid-row: 3; height: 480px; margin-top: 20px; }
}

/* the section top lands on the pin line when linked to (#story, the gallery's "told above") */
#story { scroll-margin-top: -16px; }
/* print safety net: if the stills did not take over, unpin and show every caption */
@media print {
  #story.is-live .story-track { height: auto; }
  #story.is-live .story-sticky { position: static; height: auto; overflow: visible; }
  #story.is-live .story-grid { display: block; height: auto; }
  #story.is-live .story-stage, #story .story-ctl { display: none; }
  #story.is-live .story-step { display: block; }
  #story.is-live .story-step p { opacity: 1 !important; transform: none !important; margin: 6px 0 18px; padding: 0; }
}
