/* ------------------------------------------------------- the guided demo

   Seven chapters following one purchase order from the moment a retailer's
   file lands to the moment an invoice gets caught overcharging by $617.25.

   Built to be driven live on a sales call, which decided most of the design:
   it steps on a keypress rather than autoplaying by default, because the person
   talking needs to control the pace; the stage is a fixed height so nothing
   reflows under the cursor mid-sentence; and every chapter holds one idea, so
   there is never a moment where the speaker and the screen are saying different
   things.

   The pictures are not mockups. The printed documents and the carton label are
   generated by the product's own renderers and committed under demo-assets,
   so the demo cannot drift from what a customer actually gets. */

.wt {
  display: flex;
  flex-direction: column;
  min-height: 560px;
}

/* --- the chapter rail --------------------------------------------------- */

.wt-rail {
  display: flex;
  gap: 2px;
  padding: 10px 12px;
  background: var(--band);
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: thin;
}

.wt-step {
  flex: 1 1 0;
  min-width: 92px;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-align: left;
  color: var(--muted);
  cursor: pointer;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.wt-step:hover {
  color: var(--ink);
  border-color: var(--rule);
}

.wt-step b {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  opacity: 0.65;
}

.wt-step[aria-current='true'] {
  background: var(--paper);
  border-color: var(--rule-strong);
  color: var(--ink);
  font-weight: 600;
}

/* A chapter already seen reads as done rather than as pending. */
.wt-step.is-past {
  color: var(--ok);
}

/* --- the stage ---------------------------------------------------------- */

.wt-stage {
  position: relative;
  flex: 1;
  min-height: 390px;
  padding: 22px 24px;
  background: var(--paper);
  overflow: hidden;
}

.wt-scene {
  display: none;
}

.wt-scene.is-live {
  display: block;
}

.wt-h {
  margin: 0 0 4px;
  font-size: clamp(19px, 2.4vw, 25px);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.01em;
}

.wt-when {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ok);
}

.wt-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

/* --- chapter 1: the raw file ------------------------------------------- */

.wt-x12 {
  margin: 0;
  padding: 14px 16px;
  min-height: 210px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--band);
  border: 1px solid var(--band-edge);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--ink);
}

/* The tag at the head of a segment, which is the only part a human scans. */
.wt-x12 b {
  color: var(--ok);
  font-weight: 600;
}

.wt-caret::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 13px;
  margin-left: 1px;
  background: var(--ok);
  vertical-align: text-bottom;
  animation: wt-blink 1s steps(2, start) infinite;
}

@keyframes wt-blink {
  to {
    visibility: hidden;
  }
}

/* --- the readable order ------------------------------------------------- */

.wt-card {
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
}

.wt-card h4 {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.wt-field {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13.5px;
}

.wt-field:last-child {
  border-bottom: 0;
}

.wt-field span:first-child {
  color: var(--muted);
}

.wt-field span:last-child {
  font-weight: 600;
  text-align: right;
}

/* Each field lands a beat after the one above it, so the eye follows the fill
   rather than being handed a finished card. */
.wt-reveal {
  opacity: 0;
  transform: translateY(5px);
  animation: wt-in 0.42s ease forwards;
}

/*
 * The stagger, one class per step.
 *
 * Was an inline `animation-delay` built into the innerHTML string, which the
 * CSP's `style-src 'self'` blocked outright — so the fields all arrived
 * together and the animation looked like it had simply been written badly.
 * Delays in a stylesheet cannot be blocked.
 */
.wt-reveal--0 {
  animation-delay: 90ms;
}
.wt-reveal--1 {
  animation-delay: 160ms;
}
.wt-reveal--2 {
  animation-delay: 230ms;
}
.wt-reveal--3 {
  animation-delay: 300ms;
}
.wt-reveal--4 {
  animation-delay: 370ms;
}
.wt-reveal--5 {
  animation-delay: 440ms;
}
.wt-reveal--6 {
  animation-delay: 510ms;
}
.wt-reveal--7 {
  animation-delay: 580ms;
}
.wt-reveal--8 {
  animation-delay: 650ms;
}
.wt-reveal--9 {
  animation-delay: 720ms;
}
.wt-reveal--10 {
  animation-delay: 790ms;
}
.wt-reveal--11 {
  animation-delay: 860ms;
}

@keyframes wt-in {
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- the timeline ------------------------------------------------------- */

.wt-time {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.wt-time li {
  position: relative;
  padding: 0 0 20px 26px;
  border-left: 2px solid var(--rule);
}

.wt-time li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.wt-time li::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 3px;
  width: 12px;
  height: 12px;
  background: var(--paper);
  border: 2px solid var(--rule-strong);
  border-radius: 50%;
}

.wt-time li.is-done::before {
  background: var(--ok);
  border-color: var(--ok);
}

.wt-time b {
  display: block;
  font-size: 14px;
}

.wt-time span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* --- documents as pictures ---------------------------------------------- */

/*
 * The top of the page, not the whole page.
 *
 * A letter sheet scaled to fit a half-width column is a grey rectangle: the
 * warning band on the invoice — the one thing chapter six exists to show — came
 * out four pixels tall and unreadable. Cropping to the head of the document
 * keeps it at a size somebody can actually read across a conference table,
 * which is the only size that matters here.
 */
.wt-paper {
  display: block;
  width: 100%;
  height: 320px;
  object-fit: cover;
  object-position: top center;
  background: #ffffff;
  border: 1px solid var(--rule-strong);
}

/* A 4 by 6 label is small enough to show whole, and showing it whole is the
   point — the barcode is the part being demonstrated. */
.wt-paper--label {
  height: 320px;
  object-fit: contain;
  object-position: center;
  padding: 8px;
}

/* --- the catch ---------------------------------------------------------- */

.wt-catch {
  padding: 14px 16px;
  background: var(--band);
  border-left: 3px solid var(--fail);
}

.wt-catch b {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.wt-gap {
  display: block;
  margin: 10px 0 2px;
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 1;
  color: var(--fail);
  letter-spacing: -0.02em;
}

.wt-sums {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 12.5px;
}

.wt-sums div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--rule);
}

.wt-sums div:last-child {
  border-bottom: 0;
  font-weight: 600;
}

/* --- price -------------------------------------------------------------- */

.wt-price {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.wt-plan {
  padding: 16px;
  border: 1px solid var(--rule);
}

.wt-plan--now {
  border-color: var(--ok);
  border-width: 2px;
}

.wt-plan h4 {
  margin: 0 0 2px;
  font-size: 14px;
}

.wt-amount {
  display: block;
  margin: 6px 0 10px;
  font-size: 34px;
  font-weight: 800;
  font-stretch: 115%;
  line-height: 1;
}

.wt-amount small {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.wt-plan ul {
  margin: 0;
  padding-left: 16px;
  font-size: 13px;
  line-height: 1.6;
}

/* --- narration and controls --------------------------------------------- */

.wt-say {
  padding: 13px 24px;
  background: var(--band);
  border-top: 1px solid var(--band-edge);
  font-size: 14.5px;
  line-height: 1.55;
  min-height: 62px;
}

.wt-say strong {
  font-weight: 600;
}

.wt-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border-top: 1px solid var(--rule);
}

.wt-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.wt-key {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .wt-two,
  .wt-price {
    grid-template-columns: 1fr;
  }

  .wt-stage {
    padding: 18px 16px;
  }

  .wt-say,
  .wt-bar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .wt-key {
    display: none;
  }

  /*
   * Everything here is set below twelve pixels on a desktop, where it is fine
   * -- these are captions and labels sitting beside something larger, and the
   * reader is two feet from a big screen.
   *
   * On a phone it is the same text at arm's length on a screen a third of the
   * width, and the phone audit flags every one of them: 10.5px on the step
   * buttons, 9.5px on their numbers, 11px on the timestamps and the counter,
   * 11.5px on the X12 sample. Twelve is the floor the audit defends and the
   * point below which people start pinching.
   *
   * The X12 sample gets the smallest rise of the group. It is a fixed-width
   * record whose whole point is that the columns line up, and widening the
   * character badly enough will wrap it -- which destroys the thing the sample
   * exists to demonstrate. 12px is the floor, so 12px is what it gets.
   */
  .wt-step {
    font-size: 12.5px;
    /*
     * Widened to match the text, not for its own sake.
     *
     * The rail already scrolls sideways, so the steps were never all meant to
     * fit -- but each one's box was 92px, sized for 10.5px type, and raising
     * the type to 12.5 made "Acknowledged" wider than its box. It spilled into
     * the step beside it and the two words overlapped, which the audit does
     * not catch: nothing overflowed the viewport, no tap target shrank, and no
     * text went under the floor. It only shows up in a screenshot.
     */
    min-width: 116px;
  }

  .wt-step b {
    font-size: 12px;
  }

  .wt-when,
  .wt-count {
    font-size: 12.5px;
  }

  .wt-x12 {
    font-size: 12px;
  }
}

/* Somebody who has asked for less motion gets the content, not the theatre.
   Every scene is readable in its finished state, so this removes nothing. */
@media (prefers-reduced-motion: reduce) {
  .wt-reveal {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .wt-caret::after {
    animation: none;
  }
}

/*
 * The still that ships before the script runs.
 *
 * Shares `.wt-two` and `.wt-paper` with the interactive chapters, so the frame
 * a visitor sees first is laid out exactly like the one that replaces it and
 * there is no jump when the script takes over. Padded to match `.wt-stage`
 * rather than nesting inside one: the still has no rail above it, and an empty
 * rail reserved for a script that may never run is the problem this fixes.
 */
.wt-still {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  padding: 22px 24px;
  background: var(--paper);
}

.wt-still__note {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .wt-still {
    padding: 18px 16px;
  }
}

/*
 * The portal screenshots in the static still.
 *
 * Bordered and full-width rather than cropped into a device frame: these are
 * evidence, and a frame around evidence reads as decoration. The intrinsic
 * width and height are on the `img` so the page reserves the right box before
 * the file arrives — a section whose whole job is to show the product working
 * should not be the one that shifts under the reader.
 */
.wt-shot {
  margin: 0;
}

.wt-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.wt-shot figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}
