/* The install walkthrough (install-walkthrough.js): on install.html and, for the game, on /play/game. Its own file so the
   game page can load it without the site's stylesheet; the colours and fonts come from the page's tokens (the game page
   sets them on .gate-install in play/gate.css). */
/* ---------- The install walkthrough (install.html; install-walkthrough.js) ----------
   A silent drawn clip per device. Every box has a fixed size (the stage keeps its ratio, the caption
   keeps three lines, the controls keep their row before script), so nothing below moves. Reduced
   motion: no player, the numbered steps with still drawings instead. */
.iw { max-width: 760px; margin: 0 0 40px; padding: 0 0 32px; border-bottom: 1px solid var(--line); }
.iw-h { margin: 0 0 14px; font-family: var(--sub); font-weight: 400; font-size: var(--fs-h3, 1.4rem); line-height: 1.25; color: var(--text); }
.iw-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.iw-note { margin: 0 0 12px; font-family: var(--copy); font-size: var(--fs-small, .9rem); line-height: 1.5; color: var(--text-2, var(--text)); max-width: 520px; }
.iw-tab, .iw-btn { min-height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 0; background: transparent; color: var(--text-2, var(--text)); font-family: var(--sub); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.iw-tab[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.iw-tab:hover, .iw-btn:hover { border-color: var(--text); }
/* a phone: the tabs in two or three rows, so the clip for this device is on the first screen */
@media (max-width: 600px) { .iw-tabs { gap: 6px; } .iw-tab { padding: 0 9px; font-size: .7rem; letter-spacing: .06em; } }
.iw-tab:focus-visible, .iw-btn:focus-visible { outline: 1px solid var(--text); outline-offset: 2px; }
.iw-player { max-width: 520px; }
.iw-stage { aspect-ratio: 320 / 220; width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--text); overflow: hidden; }
.iw-art { display: block; width: 100%; height: auto; }
.iw-fill { fill: var(--bg); }
.iw-caption { margin: 12px 0 10px; font-family: var(--copy); font-size: var(--fs-body); line-height: 1.55; color: var(--text-2, var(--text)); }
.iw-count { display: block; font-family: var(--sub); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.iw-cap, .iw-sizer { display: grid; }
.iw-cap > *, .iw-sizer > * { grid-area: 1 / 1; }
.iw-sizer { visibility: hidden; }
.iw-bar { display: flex; gap: 4px; height: 3px; margin: 0 0 14px; }
.iw-seg { flex: 1; background: var(--line-strong); }
.iw-seg.is-done { background: var(--text); }
.iw-seg.is-on { background: linear-gradient(90deg, var(--text) 50%, var(--line-strong) 50%) right / 200% 100%; animation: iw-fill 3.8s linear forwards; }
/* paused: the current step is dashed, so it does not look finished */
.iw.is-paused .iw-seg.is-on { animation: none; background: repeating-linear-gradient(90deg, var(--text) 0 4px, transparent 4px 8px); }
@keyframes iw-fill { to { background-position: left; } }
.iw-controls { display: flex; flex-wrap: wrap; gap: 8px; visibility: hidden; }
.iw-ready .iw-controls { visibility: visible; }
.iw-live { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.iw-stage.is-in .iw-art { animation: iw-in .35s ease-out; }
@keyframes iw-in { from { opacity: 0; } to { opacity: 1; } }
.iw-tap { animation: iw-tap 1.6s ease-out .5s infinite both; transform-box: fill-box; }
.iw-tap circle:first-child { animation: iw-ring 1.6s ease-out .5s infinite both; transform-origin: center; transform-box: fill-box; }
@keyframes iw-tap { 0% { opacity: 0; } 15%, 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes iw-ring { 0% { transform: scale(.4); } 60%, 100% { transform: scale(1.3); } }
.iw-hi { animation: iw-hi 1.6s ease-in-out .5s infinite; }
@keyframes iw-hi { 50% { stroke-width: 1.2; } }
/* paused: the tap mark stays in view (a frozen pulse could stop at its invisible start) */
.iw.is-paused .iw-tap, .iw.is-paused .iw-tap circle, .iw.is-paused .iw-hi { animation: none; opacity: 1; }
/* off screen or in a hidden browser tab: everything waits with the timer */
.iw.is-held .iw-seg.is-on, .iw.is-held .iw-tap, .iw.is-held .iw-tap circle, .iw.is-held .iw-hi { animation-play-state: paused; }
/* without script nothing pulses for ever and the tabs, which would do nothing, are not shown */
.iw:not(.iw-ready) .iw-hi, .iw:not(.iw-ready) .iw-tap, .iw:not(.iw-ready) .iw-tap circle, .iw:not(.iw-ready) .iw-seg.is-on { animation: none; opacity: 1; }
.iw:not(.iw-ready) .iw-tabs { display: none; }
/* the steps as a numbered list: read by screen readers always, shown on screen only with reduced motion */
.iw-steps { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.iw-steps[hidden] { display: none; }
.iw-step > p { margin: 0; }
.iw-still { margin: 0 0 8px; max-width: 340px; color: var(--text); }
.iw-still .iw-art { border: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) {
  .iw-player, .iw-controls { display: none; }
  .iw-hi, .iw-tap, .iw-tap circle, .iw-stage.is-in .iw-art { animation: none; }
  .iw-steps { position: static; width: auto; height: auto; margin: 0; padding: 0 0 0 1.4em; overflow: visible; clip: auto; white-space: normal; }
  .iw-step { margin: 0 0 22px; padding-left: 6px; font-family: var(--copy); font-size: var(--fs-body); line-height: 1.55; color: var(--text-2, var(--text)); }
  .iw-step::marker { font-family: var(--sub); color: var(--muted); }
}
.iw-apps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
/* install.html with "The game" chosen: the written guide's Install buttons would install the website, so they go */
.iw-for-game [data-ig-prompt] { display: none; }
.iw-appsline a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
