/*
 * Walkthrough rail, walkthrough intro and board step (Phase B). Loaded after
 * till-screen.css. Colours come only from the tokens in till.css plus the
 * proposed --accent-maple, which is declared here for decorative inline-SVG art
 * only (TOKEN_ADDITIONS.md) and never colours text, a state or an error. No
 * motion: step changes are instant.
 */

:root {
  /* Proposed addition, for review (TOKEN_ADDITIONS.md). Decorative only. */
  --accent-maple: #c43a1e;
  --rail-h: 3.25rem;
}

/* The rail: a real list of links and buttons, after the ribbon, before the bar. */
.walk-rail {
  margin: 0 -1rem;
  padding: 0.35rem 1rem 0.5rem;
  border-bottom: 1px solid var(--ink);
  background: var(--paper);
}

.walk-now {
  margin: 0 0 0.25rem;
  font: 600 0.85rem/1.4 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.03em;
}

.walk-now .walk-public {
  font-weight: 800;
}

.walk-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.walk-step {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  min-height: 44px;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: 600 0.95rem/1.2 ui-sans-serif, system-ui, sans-serif;
  text-decoration: none;
}

.walk-step .walk-n {
  margin-right: 0.3rem;
  font-weight: 800;
}

.walk-step.is-current {
  border-width: 2px;
  background: var(--lift);
  font-weight: 800;
}

.walk-step.is-done .walk-mark {
  color: var(--till-paid);
  font-weight: 800;
}

.walk-step.is-locked {
  border-style: dashed;
  cursor: not-allowed;
}

.walk-why {
  font-weight: 400;
  font-size: 0.8rem;
}

.walk-hint {
  margin: 0.5rem 0 0;
  font-size: 1rem;
}

.walk-alt {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
}

.till-demo-video {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  margin: 0.75rem 1rem;
  padding: 0 1.1rem;
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-weight: 700;
  text-decoration: none;
}

.board-note {
  margin: 0.5rem 1rem 0.75rem;
}

.walk-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
}

.walk-actions button {
  padding: 0 0.8rem;
  font: 600 0.85rem/1 ui-sans-serif, system-ui, sans-serif;
}

/* Phones and tablets: the chip strip stays in view under the ribbon. */
@media (max-width: 63.98rem) {
  .walk-now {
    position: sticky;
    top: var(--ribbon-h);
    z-index: 4;
    margin: 0 -1rem;
    padding: 0.45rem 1rem;
    border-bottom: 1px solid var(--ink);
    background: var(--paper);
  }

  .walk-step {
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: 0.4rem;
  }

  .walk-why {
    flex-basis: 100%;
  }
}

@media (max-width: 40rem) {
  .walk-now,
  .walk-rail {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* From 64 rem the rail is a left column; the ribbon spans both columns. */
@media (min-width: 64rem) {
  body[data-walk] main[data-intent="till-checkout"],
  body[data-walk] main.verify,
  body[data-walk] main.board {
    display: grid;
    grid-template-columns: 17rem minmax(0, 1fr);
    column-gap: 2rem;
    max-width: 84rem;
  }

  body[data-walk] main > * {
    grid-column: 2;
  }

  body[data-walk] main > .cluster-ribbon {
    grid-column: 1 / -1;
  }

  body[data-walk] main > .walk-now {
    grid-column: 1;
    grid-row: 2;
    margin: 1rem 0 0;
    padding: 0.4rem 0;
  }

  body[data-walk] main > .walk-rail {
    grid-column: 1;
    grid-row: 3 / span 12;
    position: sticky;
    top: calc(var(--ribbon-h) + 0.75rem);
    align-self: start;
    margin: 0;
    padding: 0.75rem 0.9rem 0.9rem;
    border: 1px solid var(--ink);
    background: var(--lift);
  }

  body[data-walk] .walk-steps {
    flex-direction: column;
    align-items: stretch;
  }

  body[data-walk] .walk-step {
    background: var(--paper);
  }

  body[data-walk] .walk-below {
    display: none;
  }
}

/* Under the sticky now-line, focus on the state word never lands beneath the strips. */
@media (max-width: 63.98rem) {
  body[data-walk] .till-state {
    scroll-margin-top: calc(var(--ribbon-h) + var(--rail-h) + 0.5rem);
  }
}

/* The board step in REPLAY: the REPLAY ribbon sits above the devnet ribbon and
   both stay in view; the strips under them move down by its height. */
main[data-replay] {
  --replay-h: 2.35rem;
}

main[data-replay] > .replay-ribbon {
  min-height: var(--replay-h);
}

main[data-replay] > .cluster-ribbon {
  top: var(--replay-h);
}

@media (max-width: 63.98rem) {
  main[data-replay] > .walk-now {
    top: calc(var(--replay-h) + var(--ribbon-h));
  }
}

@media (min-width: 64rem) {
  body[data-walk] main > .replay-ribbon {
    grid-column: 1 / -1;
  }

  body[data-walk] main[data-replay] > .walk-now {
    grid-row: 3;
  }

  body[data-walk] main[data-replay] > .walk-rail {
    grid-row: 4 / span 12;
    top: calc(var(--replay-h) + var(--ribbon-h) + 0.75rem);
  }
}

/* Full-screen till mode is the counter view: the rail steps aside until Escape. */
main[data-till-view="screen"] .walk-now,
main[data-till-view="screen"] .walk-rail {
  display: none;
}

/* Walkthrough intro page. */
.walk-intro h1 {
  font-size: 2rem;
}

.walk-intro .walk-steps-preview {
  margin: 1rem 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
}

.walk-intro .walk-steps-preview li {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--lift);
  border-bottom: 1px solid var(--ink);
}

.walk-intro .walk-steps-preview .n {
  font: 800 1.4rem/1.2 ui-sans-serif, system-ui, sans-serif;
  color: var(--till-paid);
}

.walk-intro .walk-steps-preview .pub {
  font: 600 0.8rem/1.4 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.03em;
}

.walk-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.walk-cta a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 1.1rem;
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-weight: 700;
  text-decoration: none;
}

.walk-cta a.primary {
  background: var(--ink);
  color: var(--paper);
}

.built-by {
  margin: 0.5rem 0 1rem;
  font-weight: 600;
}

/* Theme art on a product page: inline SVG, aria-hidden, decorative only. */
.row-houses {
  display: block;
  width: 100%;
  height: auto;
  margin: 1rem 0 0;
}

/* Board step. */
.board-caption {
  margin: 0.5rem 0 0.25rem;
  font-weight: 600;
}

.board-caption.is-replay {
  padding: 0.4rem 0.6rem;
  background: var(--dusk);
  color: var(--till-replay);
}

.board-list li {
  min-height: 56px;
}

/* The rows arrive with the receipts index or the REPLAY file: hold some room. */
.board-list:empty {
  min-height: 36rem;
}

.board-open {
  margin: 1rem 0;
}

/* Verify page additions. */
.recorded-line {
  padding: 0.5rem 0.75rem;
  border-left: 4px solid var(--till-paid);
  background: var(--lift);
  font-weight: 600;
}

.handoff {
  margin: 1rem 0;
  font-weight: 600;
}

.verify-footer a {
  margin-left: 0.75rem;
}

/* QoL pass (2026-10). Wide screens: the walk uses the room (was 84 rem) and
   the rail grows with the type (17 rem is rem-based already). */
@media (min-width: 64rem) {
  body[data-walk] main[data-intent="till-checkout"],
  body[data-walk] main.verify,
  body[data-walk] main.board {
    max-width: 96rem;
  }
}

.walk-step {
  min-height: max(44px, 2.45rem);
}

/* The rail's options (the no-wallet link, Start over, Leave) sit in a toggle:
   open beside the till from 64 rem, closed above it on phones and tablets. */
.walk-more {
  margin: 0.35rem 0 0;
}

.walk-more > summary {
  padding: 0.5rem 0;
  font: 600 0.9rem/1.3 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
}

.walk-actions {
  flex-wrap: wrap;
}

.walk-actions button {
  white-space: nowrap;
}

/* Only the next locked step says why; later ones keep the reason for screen
   readers. */
.walk-steps li:has(> .is-locked) ~ li .walk-why {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Phones and tablets: a compact stepper. One row of numbered chips under the
   sticky now-line, which names the step; each chip keeps its name and any
   locked reason for screen readers; the hint shows its short half only. */
@media (max-width: 63.98rem) {
  .walk-rail {
    padding-top: 0.4rem;
    padding-bottom: 0.25rem;
  }

  .walk-steps {
    flex-wrap: nowrap;
    gap: 0.3rem;
  }

  .walk-steps > li {
    flex: 0 0 auto;
  }

  .walk-step {
    align-items: center;
    justify-content: center;
    min-width: 2.45rem;
    padding: 0.2rem 0.4rem;
  }

  .walk-step > span {
    font-size: 0;
  }

  .walk-step .walk-n,
  .walk-step .walk-mark {
    margin: 0;
    font-size: 0.95rem;
  }

  .walk-board .walk-step > span::before {
    content: "B";
    content: "B" / "";
    font-size: 0.95rem;
    font-weight: 800;
  }

  .walk-why {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .walk-hint {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
  }

  .walk-hint-more {
    display: none;
  }
}
