/*
 * The wallet demo (Bold Stack): one real recording in a gold phone, which plays the whole flow on a loop of
 * 23.5 s, and one real still of Stacked Web in a larger phone in front of it (Simon, 6 and 7 Nov 2026). The
 * screens are the apps' own, never drawn here. The two phones' places are the homepage board agreed in October
 * (canvas page "Redesign", Main and HomeMobile), with the still in the front place. Its markup is templates/partials/wallet-demo.html, and js/hero-demo.js plays
 * it. It rests on its first frame until the recording can play (.is-on), so with no JS it stays still.
 * With reduced motion it shows the flow's last screen. Up to 860px wide there's one gold phone, 236 wide, with
 * the recording. From 861px there are two: the still 310 wide at the front, and the recording 262 wide behind it.
 *
 * Generated by preview-tools/record/hero-css.py from hero-demos.json, which also builds the recording, so
 * change the numbers there. Loaded after css/bold-stack.css, which holds the gold phone (.gp).
 */

/* The hero's columns, from the board's .hm-hero-inner, .hm-hero-copy and .hm-hero-visual. They wrap at the
   board's width, 600 + 420. The board shares that as 566 + 454 here, and the demo takes the spare room first, up
   to the board's 520, so that the phone behind shows as much as it can (Simon, 6 Nov 2026). */
.hp-hero-inner:has(.bd) { gap: clamp(40px, 5vw, 64px); }
.hp-hero-inner:has(.bd) > .hp-hero-copy { flex-basis: 566px; }
.hp-hero-demo:has(> .bd) { flex: 99 1 454px; }

/* Labels in fixed-height chips and badges sit on their capitals, like the pills in bold-stack.css. */
:is(.bd-tag, .bd-badge) > span {
  text-box: trim-both cap alphabetic;
}

.bd {
  position: relative; /* for the hidden checkbox at the bottom edge */
  container: bd / inline-size;
  width: 100%;
}
.bd:not(.is-on) * { animation-play-state: paused !important; }
.bd-stage { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 420px; margin: 0 auto; }
.bd-phone { --gp-n: 236; }
/* One phone up to 860px wide, as on the board: the recording. The still's phone isn't there, and the blank pixel
   in its <picture> keeps the still from loading. */
.bd-phone--still { display: none; }

/* The screens. The recording has the screen's whole shape, so it fills the phone. The hero's still, and a
   guide's still of Stacked Web, sit under the screen's top padding. A guide's still of the wallet brings its own
   status bar. */
.bd-rec { position: relative; height: 100%; }
.bd-rec img, .bd-rec video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
/* 1px over the still's top row, because the screen's top falls between pixels. */
.bd-rec video { top: -1px; height: calc(100% + 1px); opacity: 0; }
.bd.is-ready .bd-rec video { opacity: 1; }
.bd-phone--recording .gp-screen, .bd-phone--native .gp-screen { padding-top: 0; }

/* The four beats as captions, under the stage. */
.bd-foot { width: 100%; max-width: 420px; margin: 18px auto 0; display: flex; flex-direction: column; gap: 12px; }
.bd-foot-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.bd-foot-label { font-size: 10.5px; }
.bd-tag { height: 20px; padding: 0 8px; display: inline-flex; align-items: center; border: 1px solid var(--bs-outline); border-radius: 10px; font-size: 10px; font-weight: 500; }
.bd-pause { margin-left: auto; }
.bd-play-word { display: none; }
.bd-pause-input { position: absolute; bottom: 0; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; opacity: 0; }
.bd-pause-input:focus-visible ~ .bd-foot .bd-pause { outline: 2px solid var(--bs-teal); outline-offset: 3px; }
.bd-pause-input:checked ~ .bd-foot .hp-i-pause, .bd-pause-input:checked ~ .bd-foot .bd-pause-word { display: none; }
.bd-pause-input:checked ~ .bd-foot .hp-i-play { display: block; }
.bd-pause-input:checked ~ .bd-foot .bd-play-word { display: inline; }
.bd-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.bd-step { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 13px; font-weight: 700; line-height: 1.3; }
.bd-badge { flex: 0 0 auto; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--bs-teal); border-radius: 50%; background: var(--bs-teal); color: var(--bs-slate); font-size: 11px; font-weight: 800; }
.bd-risk { font-size: 12px; font-weight: 500; line-height: 1.5; }
/* Pause waits until there's something to pause. */
.bd:not(.is-ready) .bd-pause { visibility: hidden; }
.bd:not(.is-ready) .bd-pause-input { display: none; }
.bd-pause-input:checked ~ *, .bd-pause-input:checked ~ * * { animation-play-state: paused !important; }

/* The board's two places, from 861px: its .hm-hero-visual, .hm-phone-back and .hm-phone-front, to the pixel. The
   still has the front place and the recording the back place (Simon, 7 Nov 2026). */
@media (min-width: 861px) {
  .hp-hero-demo:has(> .bd) { max-width: 520px; }
  .bd-stage { display: block; max-width: none; height: 660px; }
  .bd-phone--recording { --gp-n: 262; position: absolute; left: 0; top: 70px; z-index: 0; }
  .bd-phone--still { --gp-n: 310; display: block; position: absolute; right: 0; top: 0; z-index: 1; }
  .bd-foot { max-width: none; }
  .bd-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Reduced motion: stills only, so there's nothing to pause. */
@media (prefers-reduced-motion: reduce) {
  .bd-pause, .bd-pause-input { display: none; }
}

/* This demo's loop. */
.bd--wallet { --bd-loop: 23.5s; }

/* The captions follow the recording. */
@keyframes bdWalletStep1 { 0% { background: transparent; color: var(--bs-white); border-color: var(--bs-outline); } 1.5%, 97.5% { background: var(--bs-teal); color: var(--bs-slate); border-color: var(--bs-teal); } 100% { background: transparent; color: var(--bs-white); border-color: var(--bs-outline); } }
@keyframes bdWalletStep2 { 0%, 9.43% { background: transparent; color: var(--bs-white); border-color: var(--bs-outline); } 10.43%, 97.5% { background: var(--bs-teal); color: var(--bs-slate); border-color: var(--bs-teal); } 100% { background: transparent; color: var(--bs-white); border-color: var(--bs-outline); } }
@keyframes bdWalletStep3 { 0%, 34.32% { background: transparent; color: var(--bs-white); border-color: var(--bs-outline); } 35.32%, 97.5% { background: var(--bs-teal); color: var(--bs-slate); border-color: var(--bs-teal); } 100% { background: transparent; color: var(--bs-white); border-color: var(--bs-outline); } }
@keyframes bdWalletStep4 { 0%, 48.93% { background: transparent; color: var(--bs-white); border-color: var(--bs-outline); } 49.93%, 97.5% { background: var(--bs-teal); color: var(--bs-slate); border-color: var(--bs-teal); } 100% { background: transparent; color: var(--bs-white); border-color: var(--bs-outline); } }

@media (prefers-reduced-motion: no-preference) {
  .bd--wallet .bd-st1 .bd-badge { animation: bdWalletStep1 var(--bd-loop) ease-out infinite; }
  .bd--wallet .bd-st2 .bd-badge { animation: bdWalletStep2 var(--bd-loop) ease-out infinite; }
  .bd--wallet .bd-st3 .bd-badge { animation: bdWalletStep3 var(--bd-loop) ease-out infinite; }
  .bd--wallet .bd-st4 .bd-badge { animation: bdWalletStep4 var(--bd-loop) ease-out infinite; }
}
