/* /handshake/ tour theater and stage. Builds on /brand.css tokens and /cc.css.
   Motion is transform and opacity only; every area has a reserved size so nothing shifts while the tour plays.
   Reduced motion (the media query, or .is-rm set from script) gets the same states with no travel, shake or pulse. */

.tv-hero { padding-bottom: var(--lt-s2); }
.tv-hero .lt-h1 { margin-bottom: var(--lt-s3); }
.tv-band { padding-top: var(--lt-s3); }
.tv { position: relative; padding: clamp(14px, 2.4vw, 28px); }
.tv-keys { margin: 10px 4px 0 !important; }

/* ---------- tour bar: progress, counter, controls ---------- */
.tv-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "prog count" "ctl ctl"; align-items: center; gap: 6px 12px; margin-bottom: 12px; }
.tv-prog { grid-area: prog; }
.tv-count { grid-area: count; }
.tv-ctl { grid-area: ctl; }
@media (min-width: 900px) { .tv-bar { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "prog count ctl"; gap: 20px; } }
.tv-prog { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.tv-prog button {
  width: 100%; display: grid; gap: 6px; padding: 8px 0 4px; border: 0; background: none; cursor: pointer; text-align: left;
  font: 700 var(--lt-fs-xs)/1.2 var(--lt-font); color: var(--lt-ink-2); min-height: 44px; align-content: start;
}
.tv-prog button:disabled { cursor: default; color: var(--lt-muted); }
.tv-prog i { position: relative; display: block; height: 6px; border-radius: 99px; background: var(--lt-line); overflow: hidden; }
.tv-prog i::after {
  content: ""; position: absolute; inset: 0; border-radius: 99px; background: var(--seg, var(--lt-tide));
  transform: scaleX(0); transform-origin: left center; transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}
.tv-prog .is-done i::after { transform: scaleX(1); }
.tv-prog .is-cur i::after { transform: scaleX(.5); }
.tv-prog .is-cur.is-done i::after { transform: scaleX(1); }
.tv-prog .sig--match { --seg: var(--lt-tide); }
.tv-prog .sig--needs_yes { --seg: var(--lt-limit); }
.tv-prog .sig--no_match { --seg: var(--lt-kill); }
.tv-prog [aria-current="step"] { color: var(--lt-ink); }
.tv-prog .tv-seg-t { display: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 640px) { .tv-prog .tv-seg-t { display: block; } }

.tv-ctl { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.tv-count { font: 800 var(--lt-fs-sm)/1 var(--lt-font); color: var(--lt-ink); font-variant-numeric: tabular-nums; min-width: 6.2em; text-align: right; white-space: nowrap; }
.tv-live { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; font: 800 var(--lt-fs-xs)/1 var(--lt-font); color: var(--lt-kill-strong); text-transform: uppercase; letter-spacing: .08em; }
.tv-live[hidden] { display: inline-flex !important; visibility: hidden; }
.tv-live i { width: 9px; height: 9px; border-radius: 50%; background: var(--lt-kill); animation: tvLive 1s ease-in-out infinite; }
@keyframes tvLive { 50% { opacity: .25; } }
.tv-b {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--lt-line);
  background: #fff; color: var(--lt-ink); cursor: pointer; padding: 0; transition: background-color .15s ease, border-color .15s ease;
}
.tv-b:hover { border-color: var(--lt-ink-2); }
.tv-b:disabled { opacity: .45; cursor: default; border-style: dashed; }
.tv-b svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tv-b--play { width: 52px; height: 52px; background: var(--lt-primary); border-color: var(--lt-primary); color: #fff; }
.tv-b--play:hover { background: var(--lt-primary-hover); border-color: var(--lt-primary-hover); }
.tv-b--play svg { fill: currentColor; stroke: none; width: 22px; height: 22px; }
.tv-b--play .i-pause, .tv-b--play[aria-pressed="true"] .i-play { display: none; }
.tv-b--play[aria-pressed="true"] .i-pause { display: block; }
#sound .i-on, #sound[aria-pressed="true"] .i-off { display: none; }
#sound[aria-pressed="true"] .i-on { display: block; }
#sound[aria-pressed="true"] { background: var(--lt-surface-2); border-color: var(--lt-primary); color: var(--lt-primary); }

/* ---------- captions (always on) ---------- */
.tv-cap { height: 236px; overflow: hidden; padding: 14px 18px; border-radius: var(--lt-r); background: var(--lt-surface); margin-bottom: 12px; }
.tv-cap:focus { outline: none; }
.tv-cap-big { min-height: 3.75em; margin: 0 0 6px !important; font: 800 clamp(1.2rem, 1rem + 1vw, 1.7rem)/1.25 var(--lt-font); letter-spacing: -.01em; color: var(--lt-ink); }
.tv-cap-sub { margin: 0 !important; font-size: var(--lt-fs-sm); color: var(--lt-ink-2); font-weight: 600; }
.tv-cap-sub .cc-mono { font-weight: 500; }
@media (min-width: 560px) { .tv-cap { height: 168px; } .tv-cap-big { min-height: 2.5em; } }
@media (min-width: 1000px) { .tv-cap { height: 154px; } }
.tv-retry { margin-left: 8px; }

/* ---------- the screen: stage plus covers ---------- */
.tv-screen { position: relative; }
.tv-cover {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 20px; border-radius: var(--lt-r);
  background: rgba(255, 255, 255, .9); text-align: center;
}
.tv-cover[hidden] { display: none; }
.tv-cover-in { display: grid; gap: 14px; justify-items: center; max-width: 560px; }
.tv-cover-k { margin: 0 !important; font: 800 var(--lt-fs-xs)/1.3 var(--lt-font); letter-spacing: .1em; text-transform: uppercase; color: var(--lt-tide-ink); }
.tv-cover .lt-btn svg { width: 22px; height: 22px; fill: currentColor; margin-right: 10px; flex: none; }
.tv-cover .cc-fine { margin: 0 !important; }
.tv-end { background: rgba(255, 255, 255, .95); }
.tv-end-h { margin: 0 !important; font: 900 clamp(1.5rem, 1.1rem + 2vw, 2.4rem)/1.15 var(--lt-font); letter-spacing: -.02em; color: var(--lt-ink); }
.tv-end-h:focus { outline: none; }
.tv-end-acts { width: 100%; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tv-end-acts .lt-btn { flex: 1 1 200px; }
.tv-end-acts--q { align-items: center; }
.tv-end-acts--q .lt-btn { flex: 0 1 auto; }
.tv-quiet { min-height: 44px; padding: 8px 14px; border: 0; background: none; color: var(--lt-ink-2); font: 600 var(--lt-fs-sm)/1.2 var(--lt-font); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; border-radius: 99px; }
.tv-quiet:hover { color: var(--lt-ink); background: var(--lt-surface); }
.tv-end .cc-status { margin: 0 !important; min-height: 1.4em; }

/* ---------- the stage ---------- */
.tvs {
  position: relative; display: grid; gap: 10px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 388px 104px 364px 284px;
  grid-template-areas: "shop" "mid" "store" "out";
}
@media (min-width: 560px) { .tvs { grid-template-rows: 368px 104px 308px 208px; } }
@media (min-width: 860px) {
  .tvs { grid-template-columns: minmax(0, 1fr) 176px minmax(0, 1fr); grid-template-rows: 368px 176px; grid-template-areas: "shop mid store" "out out out"; gap: 12px; }
}
.tv-stage--free { margin-top: var(--lt-s4); }

.tvs-col { position: relative; min-width: 0; overflow: hidden; border-radius: var(--lt-r); border: 2px solid var(--lt-line); background: #fff; padding: 12px 14px; }
.tvs-shop { grid-area: shop; }
.tvs-store { grid-area: store; }
/* the result tint is a layer that fades in (opacity), not a repainted background */
.tvs-col::before { content: ""; position: absolute; inset: 0; background: var(--sig-bg, transparent); opacity: 0; transition: opacity .45s ease; pointer-events: none; }
.tvs-col::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 3px var(--sig-dot, transparent); opacity: 0; transition: opacity .45s ease; pointer-events: none; }
.tvs.is-done .tvs-col::before, .tvs.is-done .tvs-col::after { opacity: 1; }
.tvs-col > * { position: relative; }
.tvs-h { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; margin-bottom: 8px; min-height: 48px; }
.tvs-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--lt-surface-2); color: var(--lt-primary); }
.tvs-store .tvs-ico { color: var(--lt-ink); }
.tvs-ico svg { width: 24px; height: 24px; }
.tvs-h b { display: block; font: 800 var(--lt-fs-md)/1.2 var(--lt-font); overflow-wrap: anywhere; }
.tvs-h small { display: block; font-size: var(--lt-fs-xs); color: var(--lt-ink-2); line-height: 1.3; overflow-wrap: anywhere; }
.tvs-pass { font-weight: 800; color: var(--lt-match-ink); }
.tvs-pass[data-state="REVOKED"] { color: var(--lt-revoked-ink); }
.tvs-pass[data-state="HELD"] { color: var(--lt-held-ink); }
.tvs-trust { display: grid; justify-items: end; line-height: 1; }
.tvs-trust b { font: 900 1.9rem/1 var(--lt-font); color: var(--lt-primary); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.tvs-trust small { font-size: var(--lt-fs-xs); font-weight: 700; color: var(--lt-ink-2); }
.tvs-trust.is-up b { animation: tvUp .5s ease-out 2; }
@keyframes tvUp { 50% { transform: scale(1.18); } }
.tvs-store .tvs-h > :last-child { justify-self: end; }

.tvs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.tvs-chk { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 32px; padding: 3px 8px; border-radius: 10px; font: 700 var(--lt-fs-sm)/1.25 var(--lt-font); color: var(--lt-ink); opacity: .3; transition: opacity .25s ease; }
@media (max-width: 559px) { .tvs-chk { font-size: .875rem; min-height: 30px; } }
.tvs-chk[data-on="1"] { opacity: 1; }
.tvs-mark { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--lt-surface); color: transparent; font: 900 13px/1 var(--lt-font); transform: scale(.6); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.tvs-chk[data-on="1"] .tvs-mark { transform: none; }
.tvs-chk[data-on="1"][data-level="ok"] .tvs-mark { background: var(--lt-tide); color: #fff; }
.tvs-chk[data-on="1"][data-level="ask"] .tvs-mark { background: var(--lt-limit); color: #fff; }
.tvs-chk[data-on="1"][data-level="fail"] .tvs-mark { background: var(--lt-kill-strong); color: #fff; }
.tvs-chk[data-on="1"][data-level="ask"] { background: var(--lt-needs-bg); }
.tvs-chk[data-on="1"][data-level="fail"] { background: #fff; box-shadow: inset 0 0 0 2px var(--lt-kill); }
.tvs-skel { opacity: 1; }
.tvs-skel i { display: block; height: 10px; border-radius: 99px; background: var(--lt-line); }
.tvs-passcard { margin-top: 6px; padding: 16px; border-radius: 18px; background: linear-gradient(150deg, #0D2A2E 0%, #12454A 60%, #0B6656 100%); color: #E6F4F1; display: grid; gap: 4px; }
.tvs-passcard[hidden] { display: none; }
.tvs-pc-k { font: 800 var(--lt-fs-xs)/1.2 var(--lt-font); letter-spacing: .1em; text-transform: uppercase; color: #A9CBC5; }
.tvs-pc-s { font: 900 var(--lt-fs-2xl)/1 var(--lt-font); color: #fff; letter-spacing: .02em; }
.tvs-passcard p { margin: 0 !important; font-size: var(--lt-fs-sm); color: #CFE5E0; }
.tvs-passcard[data-state="REVOKED"] { background: var(--lt-revoked-bg); box-shadow: inset 0 0 0 2px var(--lt-revoked-line); color: var(--lt-ink); animation: tvFlip .45s ease-out; }
.tvs-passcard[data-state="REVOKED"] .tvs-pc-k { color: var(--lt-revoked-body); }
.tvs-passcard[data-state="REVOKED"] .tvs-pc-s { color: var(--lt-revoked-ink); }
.tvs-passcard[data-state="REVOKED"] p { color: var(--lt-revoked-body); font-weight: 700; }
.tvs-empty { margin: 8px 0 0 !important; color: var(--lt-muted); font-size: var(--lt-fs-sm); }

/* Stop all: the store column becomes every store at once */
.tvs-stores { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tvs-st { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 38px; padding: 6px 10px; border-radius: 12px; background: var(--lt-surface); font: 700 var(--lt-fs-sm)/1.2 var(--lt-font); overflow: hidden; }
.tvs-st > * { position: relative; }
.tvs-st::before { content: ""; position: absolute; inset: 0; background: var(--lt-revoked-bg); box-shadow: inset 0 0 0 2px var(--lt-revoked-line); border-radius: inherit; opacity: 0; transition: opacity .3s ease; }
.tvs-st em { font: 800 var(--lt-fs-xs)/1.2 var(--lt-font); font-style: normal; color: var(--lt-ink-2); text-align: right; }
.tvs-st.is-out::before { opacity: 1; }
.tvs-st.is-out em { color: var(--lt-revoked-ink); }
.tvs-st.is-out { animation: tvFlip .45s ease-out; }
@keyframes tvFlip { 0% { transform: rotateX(80deg); } 100% { transform: none; } }

/* middle: the lock, GuardPooch, and the Stop all button */
.tvs-mid { grid-area: mid; position: relative; display: grid; grid-template-columns: 64px 76px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 14px; border-radius: var(--lt-r); background: var(--lt-surface); }
@media (min-width: 860px) { .tvs-mid { grid-template-columns: 1fr; grid-template-rows: 72px 100px 64px; justify-items: center; align-content: center; text-align: center; padding: 10px; } }
.tvs-lock { position: relative; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: #fff; color: var(--lt-ink); box-shadow: var(--lt-shadow-1); }
.tvs-lock svg { width: 36px; height: 36px; }
.tvs-lock::after { content: ""; position: absolute; inset: -5px; border-radius: 24px; border: 3px solid var(--sig-dot, var(--lt-tide)); opacity: 0; transition: opacity .3s ease; }
.tvs.is-in .tvs-lock::after { opacity: 1; }
.tvs-pooch { position: relative; width: 76px; height: 76px; }
.tvs-pooch svg { width: 76px; height: 76px; }
@media (min-width: 860px) { .tvs-pooch, .tvs-pooch svg { width: 88px; height: 88px; } }
.tvs-woof { position: absolute; top: -10px; right: -22px; padding: 3px 9px; border-radius: 99px; background: var(--lt-kill-strong); color: #fff; font: 900 var(--lt-fs-xs)/1.3 var(--lt-font); opacity: 0; transform: scale(.4); transition: opacity .2s ease, transform .3s cubic-bezier(.3, 1.6, .5, 1); pointer-events: none; }
.tvs.is-bark .tvs-woof { opacity: 1; transform: rotate(-6deg); }
.tvs-gp { display: grid; align-content: center; height: 60px; margin: 0 !important; font: 700 var(--lt-fs-xs)/1.35 var(--lt-font); color: var(--lt-ink-2); min-width: 0; overflow-wrap: anywhere; }
.tvs-gp .cc-gp { margin-top: 2px; }
.tvs-pooch .estop { --estop-size: 76px; position: absolute; z-index: 2; left: 50%; top: 50%; margin: -38px 0 0 -38px; }
.tvs-pooch .estop[hidden] { display: none; }
.tvs.is-kill .tvs-pooch svg, .tvs.is-kill .tvs-woof { opacity: 0; }
.tvs.is-kill .tvs-gp { color: var(--lt-revoked-ink); font-weight: 800; }
.tvs.is-sniff .hsr-nose { animation: hsrSniff .45s ease-in-out infinite; transform-origin: 60px 72px; }
.tvs.is-sniff .hsr-head { animation: hsrTilt 1.2s ease-in-out infinite; transform-origin: 60px 60px; }

/* the key (Scout's Pass) travels from the shopper to the lock */
.tvs-key { position: absolute; z-index: 2; left: 0; top: 0; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--lt-primary); color: #fff; box-shadow: 0 8px 18px -8px rgba(11, 102, 86, .8); opacity: 0; pointer-events: none; will-change: transform, opacity; }
.tvs-key svg { width: 26px; height: 26px; }

/* outcome */
.tvs-out { grid-area: out; position: relative; overflow: hidden; border-radius: var(--lt-r); padding: 14px 18px; background: var(--lt-surface); color: var(--lt-ink); }
.tvs-out::before { content: ""; position: absolute; inset: 0; background: var(--sig-bg, transparent); opacity: 0; transition: opacity .4s ease; }
.tvs.is-done .tvs-out::before { opacity: 1; }
.tvs-out > * { position: relative; }
.tvs-out-in { display: grid; gap: 6px; align-content: start; }
.tvs-out .sig { justify-self: start; background: #fff; font-size: clamp(1rem, .95rem + .5vw, 1.25rem); padding: 7px 18px 7px 14px; }
.tvs-out h3 { margin: 0 !important; font: 800 var(--lt-fs-lg)/1.25 var(--lt-font); }
.tvs-out p, .tvs-out ul { margin: 0 !important; font-size: var(--lt-fs-sm); color: var(--lt-ink); }
.tvs-out ul { padding-left: 1.1rem; }
.tvs-out .tvs-pay { font-weight: 800; }
.tvs-out .lt-btn { min-height: 44px; padding: 8px 18px; justify-self: start; }
.tvs-out-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.tvs-out .is-tap { box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--lt-limit); }
.tvs-out .is-tap.is-pressed { transform: translateY(2px) scale(.97); }
.tvs-idle { color: var(--lt-ink-2); font-weight: 600; }
.tvs-chip { display: inline-block; padding: 2px 10px; border-radius: 99px; background: #fff; font: 800 var(--lt-fs-xs)/1.5 var(--lt-font); color: var(--lt-ink); }

/* outcome moments (motion only when allowed) */
@media (prefers-reduced-motion: no-preference) {
  .tvs:not(.is-rm).is-pulse .tvs-col::after { animation: tvPulse 1.1s ease-out 2; }
  .tvs:not(.is-rm).is-shake .tvs-store { animation: tvShake .5s cubic-bezier(.36, .07, .19, .97); }
  .tvs:not(.is-rm).is-bark .tvs-woof { animation: hsrBark .5s ease-in-out 3; }
  .tvs:not(.is-rm) .tvs-out .is-tap:not(.is-pressed) { animation: tvTap 1.2s ease-in-out infinite; }
}
@keyframes tvPulse { 0% { opacity: 1; transform: none; } 60% { opacity: .35; transform: scale(1.015); } 100% { opacity: 1; transform: none; } }
@keyframes tvShake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
@keyframes tvTap { 50% { transform: scale(1.04); } }
@keyframes hsrSniff { 50% { transform: scale(1.18); } }
@keyframes hsrTilt { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes hsrBark { 0%, 100% { transform: rotate(-6deg); } 50% { transform: scale(1.15) rotate(-3deg); } }
.tvs.is-paused *, .tvs.is-paused *::before, .tvs.is-paused *::after { animation-play-state: paused !important; }
.tvs.is-rm *, .tvs.is-rm *::before, .tvs.is-rm *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .tvs *, .tvs *::before, .tvs *::after, .tv-prog i::after, .tv-live i { animation: none !important; transition: none !important; }
}
/* The clay dog sits over the old drawn one; its pose follows the result (ui/handshake/handshake.js S.pose) */
.tvs-pooch svg { visibility: hidden; }
.tvs-dog { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #f4ead6; box-shadow: 0 4px 12px rgba(13, 42, 46, .18); }
.tvs.is-kill .tvs-dog { opacity: 0; }

/* "Working on it": shown while a real call is in flight for more than a moment */
.tv-cap { position: relative; height: 340px; }                 /* room for the Working pill under the caption */
@media (min-width: 560px) { .tv-cap { height: 216px; } }
@media (min-width: 1000px) { .tv-cap { height: 202px; } }
.tv-working { position: absolute; left: 18px; bottom: 12px; display: inline-flex; align-items: center; gap: 10px; margin: 0 !important; padding: 8px 14px 8px 10px; border-radius: 999px; background: #fff; border: 1px solid #cfe0da; color: #16292c; font-size: var(--lt-fs-sm); font-weight: 700; box-shadow: 0 1px 2px rgba(10, 27, 30, .08); }
.tv-working[hidden] { display: none; }
.tv-working i { width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%; border: 3px solid #cfe0da; border-top-color: #0f5a48; animation: tvSpin .8s linear infinite; }
@keyframes tvSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tv-working i { animation: none; border-color: #0f5a48; } }
