/* ════════════════════════════════════════════════════════════════ tour ══
   InsideTour, on /waiting and under the front page's list: a small drawing
   of the member app, its sidebar, and a sheet holding three scenes stacked
   in one cell, so the window is as tall as the tallest and nothing moves
   when the scene changes. Today's list, the lead's page, the lead's money:
   the front page's first three promises in its order; the fourth closes
   the steps with no scene (.tour-next). tour.js sets data-scene and
   "on". Every element's resting style is its scene's finished frame, so
   reduced motion, or no script, shows a picture that already makes sense.
   Loaded after scene.css, whose stage, toggle and steps it reuses.         */
.tour { --scene: 8s; container: tour / inline-size; }
.tour-why { margin: 0 0 12px; font-size: var(--t-small); color: var(--ink-soft); }

.tw {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  overflow: clip;
  background: var(--chrome);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--lift);
  font-size: 14px;
  line-height: 1.4;
}

.tw-side { display: flex; flex-direction: column; gap: 2px; padding: 16px 10px; font-size: 12.5px; color: var(--ink-soft); }
.tw-brand { display: flex; align-items: center; gap: 7px; margin: 0 6px 12px; color: var(--ink); font-size: 12px; font-weight: 650; line-height: 1.2; }
.tw-brand i { flex: none; width: 12px; height: 12px; border-radius: 2px; background: var(--kraft); }
.tw-side > span:not(.tw-brand) { padding: 6px 8px; border-radius: 6px; transition: background-color 320ms ease-out, color 320ms ease-out; }
/* The page each scene draws, marked as the real sidebar marks it: the screen's name, learned here.
   Products holds two scenes, so a link names every scene it draws. */
.tour[data-scene="0"] [data-for~="0"],
.tour[data-scene="1"] [data-for~="1"],
.tour[data-scene="2"] [data-for~="2"] { background: var(--card); color: var(--ink); font-weight: 600; }

.tw-sheet { display: grid; min-width: 0; padding: 18px 22px 22px; background: var(--card); border-left: 1px solid var(--line); }
.tw-scene { grid-area: 1 / 1; min-width: 0; opacity: 0; visibility: hidden; transition: opacity 320ms ease-out, visibility 0s 320ms; }
.tw-scene.on { opacity: 1; visibility: visible; transition: opacity 320ms ease-out; }

.tw-date, .tw-crumb { font-size: 12px; color: var(--ink-soft); }
.tw-crumb b { color: var(--ink); font-weight: 600; }
.tw-h { margin: 2px 0 14px; font-size: 19px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; text-wrap: balance; }
.tw-note { display: block; font-size: 12px; line-height: 1.35; color: var(--ink-soft); text-wrap: pretty; }

/* The one thing a scene is about: an ink ring, drawn in after the scene has settled. */
.tw-focus { position: relative; }
.tw-focus::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2px solid var(--ink);
  border-radius: 13px;
  pointer-events: none;
}

/* Today */
.tw-needs { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; }
.tw-needs > b { font-size: 28px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tw-needs span { font-size: 12.5px; color: var(--ink-soft); }
.tw-needs strong { display: block; color: var(--ink); font-size: 14px; font-weight: 650; }
.tw-needs em { font-size: 12.5px; font-style: normal; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.tw-list { margin-top: 18px; }
.tw-list-h { margin: 0 0 2px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.tw-rows { list-style: none; margin: 0; padding: 0; }
.tw-rows li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 10rem); gap: 6px 18px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.tw-name b { display: block; font-weight: 650; }
.tw-name span { display: block; font-size: 12.5px; color: var(--ink-soft); text-wrap: pretty; }

/* A kraft square a shop: the front page's and the adverts' picture. */
.tw-marks { display: flex; flex-wrap: wrap; gap: 3px; }
.tw-marks i { display: block; width: 8px; height: 8px; border-radius: 1.5px; background: var(--parcel); }
.tw-marks i.was { opacity: .5; }

/* The lead's page, at "are shops still paying?" */
.tw-pile { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 26px; padding: 18px; background: var(--well); border: 1px solid var(--line); border-radius: 10px; }
/* Stacked from the floor up, last month's at the bottom, so the shops read as the front page's
   pile; about as wide as tall (InsideTour sets --cols). */
.tw-big { flex-wrap: wrap-reverse; gap: 4px; width: calc(var(--cols, 5) * 24px - 4px); }
.tw-big i { width: 20px; height: 20px; border-radius: 2.5px; }
.tw-count { display: grid; gap: 4px; justify-items: start; }
.tw-count b { font-size: 46px; font-weight: 650; letter-spacing: -.05em; line-height: .9; font-variant-numeric: tabular-nums; }
.tw-count span { max-width: 20ch; font-size: 12.5px; color: var(--ink-soft); }
.tw-count .growth { font-size: 13px; text-align: start; }
.tw-run { margin-top: 16px; }
/* The page's Save, drawn as its button, on the crumb's line so the scene grows no taller. */
.tw-saving { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tw-save { flex: none; padding: 4px 14px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 600; }
.js .tw-scene.on .tw-save { animation: tw-fade 400ms ease-out 3.3s both; }
.tw-stats { display: flex; flex-wrap: wrap; gap: 10px 32px; margin: 0; }
.tw-stats dt { font-size: 11.5px; color: var(--ink-faint); }
.tw-stats dd { margin: 0; }
.tw-stats dd b { display: block; font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tw-stats dd span { display: block; font-size: 12px; color: var(--ink-soft); }
.tw-run .tw-note { margin-top: 8px; }

/* The lead's money, as the product page's boxes and price bar before anyone types (costs.css's
   look). The bar's parts rest at full width and grow in, one after another, while the scene plays. */
.tw-boxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tw-split { margin-top: 16px; }
.tw-split .price-split { margin: 0 0 6px; }
.tw .split-part { animation: none; }
.tw-verdict .answer-figure { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.tw-verdict .answer-line { font-size: 14px; color: var(--ink); }
.tw-box { display: grid; gap: 4px; align-content: start; min-width: 0; }
.tw-box-l { font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.tw-field { display: flex; align-items: center; height: 34px; padding: 0 10px; overflow: hidden; background: var(--card); border: 1px solid var(--line-hi); border-radius: var(--r-sm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tw-field b { font-weight: 600; }
/* Where the product page's supplier search links go: link-styled, since they are links there. */
.tw-links { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-overflow: ellipsis; }
.tw-verdict { margin-top: 18px; padding: 8px 10px; font-size: 15px; font-weight: 500; line-height: 1.35; text-wrap: pretty; }
.tw-verdict strong { font-weight: 700; }
.tw-best { margin: 10px 10px 0; }

/* ── the scenes playing: each element starts from its first frame and settles on the resting one ── */
.js .tw-scene.on .tw-rows li { animation: tw-rise 480ms var(--ease) calc(200ms + var(--i) * 140ms) both; }
.js .tw-scene.on .tw-list::after { animation: tw-ring 520ms var(--ease) 1.3s both; }

.js .tw-scene.on .tw-big i { animation: tw-drop 420ms cubic-bezier(.34, 1.45, .6, 1) calc(min(var(--k), 30) * 45ms) both; }
.js .tw-scene.on .tw-count { animation: tw-fade 400ms ease-out 1.3s both; }
.js .tw-scene.on .tw-run { animation: tw-fade 400ms ease-out 2.1s both; }
.js .tw-scene.on .tw-run::after { animation: tw-ring 520ms var(--ease) 2.9s both; }

.js .tw-scene.on .tw-box { animation: tw-rise 480ms var(--ease) 200ms both; }
.js .tw-scene.on .tw-box:nth-child(2) { animation-delay: 320ms; }
.js .tw-scene.on .tw-field b { animation: tw-fade 400ms ease-out 1s both; }
.js .tw-scene.on .split-part { animation: tw-grow 520ms var(--ease) calc(1.1s + var(--k, 0) * 110ms) both; }
.js .tw-scene.on .tw-verdict { animation: tw-fade 400ms ease-out 1.8s both; }
.js .tw-scene.on .tw-best { animation: tw-fade 400ms ease-out 2.1s both; }
.js .tw-scene.on .tw-verdict::after { animation: tw-ring 520ms var(--ease) 2.7s both; }

@keyframes tw-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes tw-fade { from { opacity: 0; } }
@keyframes tw-ring { from { opacity: 0; transform: scale(1.06); } }
@keyframes tw-drop { from { opacity: 0; transform: translateY(-10px) scale(.6); } }
@keyframes tw-grow { from { opacity: 0; transform: scaleX(0); } }

/* ── the steps: buttons, each bar filling while its scene plays ── */
/* A step not playing is soft ink rather than faded: at 60% opacity its title measured 3.8–4.1:1
   and its number 2.5, under the 4.5 text needs; soft ink is 5.3 or more on every ground it sits on. */
.tour-steps .step { padding-top: 0; }
.tour-steps .step:not(.on) { color: var(--ink-soft); }
.tour-steps .step:hover { color: var(--ink); }
.step-go { display: block; width: 100%; padding: 16px 0 4px; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.step-go .step-t { display: block; }
.step-said { display: block; font-size: var(--t-small); line-height: 1.45; color: var(--ink-soft); }
.step-go:focus-visible { outline-offset: 2px; }

/* The fourth promise: no scene, so not a step. A dashed rule where the steps have bars, and no
   button, so it never looks like a step the tour forgot to play. Soft ink, like a step not
   playing, so it never outshines the one that is. */
.tour-next { margin: 0; padding: 16px 0 4px; border-top: 2px dashed var(--line-hi); color: var(--ink-soft); }
.tour-next .step-t { display: block; font-weight: 600; }

.tour .step-bar::after { transform: none; }
.js .tour .step-bar::after { transform: scaleX(0); }
.js .tour .step.done .step-bar::after,
.js .tour.is-still .step.on .step-bar::after { transform: none; }
.js .tour:not(.is-still) .step.on .step-bar::after { animation: tw-fill var(--scene) linear both; }
@keyframes tw-fill { from { transform: scaleX(0); } to { transform: none; } }

/* Paused by the button, off screen, or in a hidden tab: everything holds where it is. Important
   because every playing rule above sets the `animation` shorthand, which resets the play state to
   running, and most of them are more specific than this. */
.tour.is-paused .tw *, .tour.is-paused .tw *::after, .tour.is-paused .step-bar::after,
.tour.is-held .tw *, .tour.is-held .tw *::after, .tour.is-held .step-bar::after { animation-play-state: paused !important; }

/* Still (reduced motion, or a step pressed): each scene's finished frame, set by tour.js rather
   than a media query so Play can still play it on purpose. Important because the playing rules
   above are as specific as anything here, and still must beat every one. */
.tour.is-still .tw *, .tour.is-still .tw *::after { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .tw-scene, .tw-side > span:not(.tw-brand) { transition: none; }
}

/* Narrow: the drawing drops its sidebar, the rows put the squares under the name, the pile's
   squares shrink so the count stays beside them, and the money boxes stack with only the price's
   note, so no scene is taller than Today's. Only the step being shown keeps its sentence, so
   three steps fit a phone. */
@container tour (max-width: 560px) {
  .tw { grid-template-columns: minmax(0, 1fr); }
  .tw-side { display: none; }
  .tw-sheet { padding: 16px; border-left: 0; }
  .tw-rows li { grid-template-columns: minmax(0, 1fr); }
  .tw-big { width: calc(var(--cols, 5) * 18px - 4px); }
  .tw-big i { width: 14px; height: 14px; }
  .tw-boxes { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .tw-box { grid-template-columns: 5.5rem minmax(0, 1fr); align-items: center; column-gap: 10px; }
  .tw-box .tw-note { grid-column: 2; }
  .tw-box + .tw-box .tw-note { display: none; }
  .tw-split > .tw-note { display: none; }
}
@media (max-width: 560px) {
  .tour-steps { gap: 4px; }
  .tour-steps .step:not(.on) .step-said, .tour-next .step-said { display: none; }
}