/* Tour player: prototype. Shares site.css tokens; started from the Player block of tours.css. */

.player { --bar-h: 60px; display: grid; grid-template-rows: var(--bar-h) minmax(0, 1fr); height: calc(100svh - var(--head-h)); }
.player[hidden] { display: none; }
.tour-msg { max-width: 60ch; margin: 88px auto; padding: 0 var(--gutter); font-size: 1.125rem; color: var(--ink-700); }

/* Bar: all tours, the tour's name and the step rail, in one row above the picture. */
.bar { display: flex; align-items: center; gap: 24px; padding: 0 var(--edge); border-bottom: 1px solid var(--ink); min-width: 0; }
.bar .back { font-size: .875rem; font-weight: 600; color: var(--ink-500); text-decoration: none; white-space: nowrap; }
.bar .back:hover { color: var(--blue-700); }
.bar h1 { font-size: 1.125rem; font-weight: 700; white-space: nowrap; padding-left: 24px; border-left: 1px solid var(--line); }
.bar nav { flex: 1; min-width: 0; }

.progress { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; list-style: none; padding: 0; margin: 0; }
.progress button { display: block; width: 100%; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
/* Steps to come: thin grey (5.9:1 on white); steps seen: thicker blue; this step: thicker still. */
.progress button::before { content: ""; display: block; height: 2px; background: var(--ink-500); transition: background .2s; }
.progress button.done::before { height: 4px; background: var(--blue); }
.progress button[aria-current]::before { height: 8px; }
.progress button:hover::before { background: var(--blue-300); }
.progress button.done:hover::before { background: var(--blue-700); }

/* Stage: the screenshot fits the space under the bar, wide or tall, with no scrolling. The card floats on it. */
.stage { --room: calc(100svh - var(--head-h) - var(--bar-h) - 64px); position: relative; background: var(--canvas); display: grid; place-items: center; padding: 32px; overflow: hidden; min-width: 0; }
.frame { max-width: 100%; }
.frame.screen { border: 1px solid var(--ink); background: var(--white); }
.frame.phone { --room-in: calc(var(--room) - 20px); }
.pin { position: relative; overflow: hidden; }
.frame.phone .pin { border-radius: 25px; }
.pin img { display: block; width: auto; height: auto; max-width: 100%; max-height: var(--room); }
.frame.phone .pin img { max-height: var(--room-in); border-radius: 0; }

/* The mark is the button that moves the tour on, as if you clicked that part of the app. */
.mark { position: absolute; margin: 0; padding: 0; background: transparent; border: 3px solid var(--blue); border-radius: 2px; box-shadow: 0 0 0 9999px rgba(17, 22, 28, .38); cursor: pointer; }
.mark::after { content: ""; position: absolute; inset: -3px; border: 3px solid var(--blue); pointer-events: none; animation: mark-ping 1.8s var(--ease-out) infinite; }
@keyframes mark-ping { 0% { opacity: .9; } 70%, 100% { opacity: 0; transform: scale(1.06, 1.25); } }
.mark:hover { border-color: var(--blue-800); background: rgba(47, 95, 196, .08); }
/* Ring outside the mark (white then deep blue) so it shows on any screenshot; the dimming stays. */
.mark:focus-visible { outline: none; border-color: var(--blue-800); box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--blue-800), 0 0 0 9999px rgba(17, 22, 28, .38); }
.mark[hidden] { display: none; }

/* Card: the step's words, beside the mark. player.js sets left/top and the side it faces. */
.card { position: absolute; z-index: 2; left: 0; top: 0; width: 340px; padding: 20px 22px 22px; background: var(--white); border: 1px solid var(--ink); border-top: 4px solid var(--blue); box-shadow: 0 18px 36px -18px rgba(17, 22, 28, .6); }
.card[hidden] { display: none; }
.card[data-side]::before { content: ""; position: absolute; width: 14px; height: 14px; background: var(--white); border: 1px solid var(--ink); transform: rotate(45deg); }
.card[data-side="right"]::before { left: -8px; top: calc(var(--arrow) - 7px); border-top: 0; border-right: 0; }
.card[data-side="left"]::before { right: -8px; top: calc(var(--arrow) - 7px); border-bottom: 0; border-left: 0; }
.card[data-side="below"]::before { top: -10px; left: calc(var(--arrow) - 7px); border-color: var(--blue); border-width: 3px; border-right: 0; border-bottom: 0; }
.card[data-side="above"]::before { bottom: -8px; left: calc(var(--arrow) - 7px); border-top: 0; border-left: 0; }
.stage.is-ready .mark, .stage.is-ready .card { transition: left .45s var(--ease-out), top .45s var(--ease-out), width .45s var(--ease-out), height .45s var(--ease-out); }
/* Until the step's picture is in, show neither. Not display:none, which would drop focus off Next. */
.stage.is-loading .mark, .stage.is-loading .card { opacity: 0; pointer-events: none; }

.count { font-size: .8125rem; font-weight: 600; color: var(--ink-500); }
.card h2 { font-size: 1.375rem; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.say { margin-top: 10px; color: var(--ink-700); font-size: 1rem; }
.say strong { color: var(--ink); font-weight: 700; }
.say:empty { display: none; }
.hint { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .8125rem; color: var(--ink-500); }
.hint[hidden] { display: none; }
.card .nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.card .nav .btn { min-height: 44px; padding: 0 16px; font-size: .9375rem; }
.card .nav .btn:disabled { opacity: .4; cursor: default; pointer-events: none; }
kbd { font: 600 .75rem var(--font); border: 1px solid var(--ink-500); border-radius: 2px; padding: 1px 6px; }

/* End card: takes the middle of the stage over the dimmed last screen. */
.end { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100% - 32px)); padding: 32px; background: var(--white); border: 1px solid var(--ink); border-top: 4px solid var(--blue); }
.end[hidden] { display: none; }
.end h2 { font-size: 2rem; line-height: 1.1; font-weight: 800; letter-spacing: -.025em; }
.end h2:focus { outline: none; }
.end-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.end-actions #tour-demo { grid-column: 1 / -1; }
.player.is-end .frame { opacity: .3; }

@media (max-width: 1100px) {
  .bar { gap: 16px; padding: 0 var(--gutter); }
  .bar h1 { padding-left: 16px; }
  .card { width: 300px; }
}
/* Narrow or short: no room for a card over the picture, so the words sit below it (the mark still clicks).
   Keep this query the same as `narrow` in player.js. */
@media (max-width: 700px), (max-height: 560px) {
  .player { --bar-h: auto; display: block; height: auto; }
  .bar { flex-wrap: wrap; gap: 4px 16px; padding: 12px var(--gutter) 6px; }
  .bar h1 { border-left: 0; padding-left: 0; }
  .bar nav { flex-basis: 100%; }
  .stage { --room: 52svh; display: block; padding: 16px; overflow: visible; }
  .frame.phone { --room: 44svh; } /* a phone screenshot is tall: leave Next in view */
  .hint { display: none; } /* Next sits under the picture here; the hint would push it off the screen */
  .frame { margin-inline: auto; width: fit-content; }
  .card, .end { position: static; width: auto; margin-top: 16px; transform: none; box-shadow: none; }
  .card[data-side]::before { display: none; }
  .card h2 { font-size: 1.5rem; }
  .end-actions { grid-template-columns: 1fr; }
  .player.is-end .frame { display: none; }
}
/* Touch screens: the hint's click and arrow keys don't apply. */
@media (hover: none) { .hint { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .mark::after { animation: none; display: none; }
  .stage.is-ready .mark, .stage.is-ready .card, .progress button::before { transition: none; }
}
