/* The first-run walkthrough (walkthrough.js), shared by the scorers.
   One source: apps/shared/walkthrough.css, copied into each app by
   scripts/sync-brand.sh. Needs brand/tokens.css (and its .btn styles). */

.wt {
  width: min(calc(100vw - 24px), 460px);
  max-height: calc(100dvh - 24px);
  min-height: min(560px, calc(100dvh - 24px)); /* (much the same size on every step) */
  margin: max(12px, calc((100dvh - 600px) / 2)) auto auto; /* (its top stays put from step to step) */
  padding: 0;
  border: var(--border-width) solid var(--color-line-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-pop-lg);
  overflow: auto;
  overscroll-behavior: contain;
}
.wt[open] { display: flex; flex-direction: column; }
.wt::backdrop { background: rgb(27 23 18 / 0.6); }

.wt__top { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-3) 0 var(--space-4); }
.wt__guide { width: 34px; height: 34px; flex: none; }
.wt__count { flex: 1; min-width: 0; margin: 0; display: flex; flex-direction: column; line-height: 1.2; }
.wt__label { font: var(--weight-semibold) var(--text-xs)/1.2 var(--font-display); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--color-ink-muted); }
.wt__of { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.wt__skip { min-height: 44px; padding-inline: var(--space-3); font-size: var(--text-base); }

.wt__track { touch-action: pan-y; padding: var(--space-3) var(--space-4) 0; }
.wt__art {
  aspect-ratio: 8 / 5;
  border-radius: var(--radius-md);
  background: var(--color-felt);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12);
  overflow: hidden;
}
.wt-svg { display: block; width: 100%; height: 100%; }
.wt__title { margin: var(--space-4) 0 var(--space-2); font-size: var(--text-2xl); font-weight: var(--weight-bold); }
.wt__body { color: var(--color-ink-muted); font-size: var(--text-base); }
.wt__body p { margin: 0 0 var(--space-2); }
.wt__body strong { color: var(--color-ink); }
.wt__body a { font-weight: var(--weight-semibold); }

.wt__nav { display: flex; align-items: center; gap: var(--space-2); margin-top: auto; padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom)); }
.wt__back[hidden] { display: inline-flex !important; visibility: hidden; }
.wt__nav .btn { padding-inline: var(--space-4); white-space: nowrap; }
.wt__next { margin-left: auto; min-width: 8rem; }
.wt__title:focus { outline: none; }
.wt__dots { display: flex; gap: 6px; margin: 0 auto; padding: 0; list-style: none; }
.wt__dots li { width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--color-line); transition: width var(--dur) var(--ease-out), background-color var(--dur); }
.wt__dots li.is-on { width: 22px; background: var(--color-ink); }
@media (max-width: 359px) { .wt__dots { display: none; } }

/* A new step slides in from the side it came from. */
.wt-in-next { animation: wt-in-next var(--dur) var(--ease-out); }
.wt-in-back { animation: wt-in-back var(--dur) var(--ease-out); }
@keyframes wt-in-next { from { opacity: 0; transform: translateX(28px); } }
@keyframes wt-in-back { from { opacity: 0; transform: translateX(-28px); } }

/* ---- The diagrams: each part rests in its finished place; .is-playing plays it in. */
.wt-svg g[class^="a-"], .wt-svg rect[class^="a-"] { transform-box: fill-box; transform-origin: center; }
.a-flash, .a-tap { opacity: 0; }
.is-playing .a-drop  { animation: wt-drop .6s var(--ease-bounce) var(--d, 0s) both; }
.is-playing .a-deal  { animation: wt-deal .45s var(--ease-out) var(--d, 0s) both; }
.is-playing .a-pop   { animation: wt-pop .45s var(--ease-bounce) var(--d, 0s) both; }
.is-playing .a-fade  { animation: wt-fade .5s var(--ease-out) var(--d, 0s) both; }
.is-playing .a-frame { animation: wt-frame .7s var(--ease-out) var(--d, 0s) both; }
.is-playing .a-flash { animation: wt-flash .6s ease-out var(--d, 0s) both; }
.is-playing .a-tap   { animation: wt-tap .9s ease-out var(--d, 0s) both; }
.is-playing .a-press { animation: wt-press .5s var(--ease-out) var(--d, 0s) both; }
.is-playing .a-hide  { animation: wt-hide .35s ease-in var(--d, 0s) both; }
@keyframes wt-drop  { from { opacity: 0; transform: translateY(-34px) scale(1.25); } }
@keyframes wt-deal  { from { opacity: 0; transform: translate(-46px, 18px) rotate(-14deg); } }
@keyframes wt-pop   { from { opacity: 0; transform: scale(.3); } }
@keyframes wt-fade  { from { opacity: 0; } }
@keyframes wt-frame { from { opacity: 0; transform: scale(1.3); } }
@keyframes wt-flash { 0% { opacity: 0; } 25% { opacity: .85; } 100% { opacity: 0; } }
@keyframes wt-tap   { 0% { opacity: 0; transform: scale(.3); } 25% { opacity: 1; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes wt-press { 0%, 100% { transform: none; } 45% { transform: translate(2px, 2px); } }
@keyframes wt-hide  { from { opacity: 1; } to { opacity: 0; } }
.a-hide { opacity: 0; }

/* Reduced motion: still pictures, each the finished scene (tokens.css only shortens
   animations; an infinite one would flicker, so these are switched off). */
@media (prefers-reduced-motion: reduce) {
  .wt *, .wt *::before, .wt *::after { animation: none !important; transition: none !important; }
}
