/* Walkthrough player and its step-by-step list. Uses the tokens in site.css. */

.wt-wrap { margin-top: 28px; }

/* What the walkthrough's main app is (wt.about), between the summary and the player. */
.wt-about { margin-top: 32px; }
.wt-about > h2 { font-size: 20px; margin-bottom: 14px; }
.wt-about .cross-card p { line-height: 1.6; }
.wt-about__more { margin-top: 14px; font-size: 14px; }
.wt { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 1199px) { .wt { grid-template-columns: minmax(0, 1fr); } }

.wt__anchors { position: absolute; top: 0; left: 0; width: 0; height: 0; overflow: hidden; }
.wt__anchor { display: block; scroll-margin-top: calc(var(--header-h) + 16px); }

.wt__main { min-width: 0; display: grid; gap: 0; }
.wt__frame {
  border-radius: var(--r-xl) var(--r-xl) 0 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-bottom: 0; box-shadow: var(--shot-shadow);
}
.wt__frame .shot__bar .dim { font-variant-numeric: tabular-nums; }

/* The stage keeps the desktop capture's 16:10 shape; tablet and phone screens sit centered on a sunken ground. */
.wt__stage {
  position: relative; aspect-ratio: 16 / 10; background: var(--sunken); overflow: hidden;
  outline-offset: -3px; border-radius: 0;
}
.wt__layer {
  position: absolute; inset: 0; display: grid; place-items: center;
  opacity: 0; transition: opacity 0.35s ease; pointer-events: none;
}
.wt__layer.is-current { opacity: 1; pointer-events: auto; }
.wt--still .wt__layer { transition: none; }

.wt__shot { position: relative; aspect-ratio: var(--ar); }
.wt__shot.is-wide { width: 100%; height: auto; }
.wt__shot.is-tall { height: 100%; width: auto; }
.wt__shot img { display: block; width: 100%; height: 100%; object-fit: contain; }
.wt__shot--tablet.is-tall, .wt__shot--phone.is-tall { height: calc(100% - 32px); }
.wt__shot--tablet { border-radius: 14px; overflow: hidden; box-shadow: var(--shot-shadow); border: 6px solid var(--fg); }
.wt__shot--phone { border-radius: 26px; overflow: hidden; box-shadow: var(--shot-shadow); border: 6px solid var(--fg); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wt__shot--tablet, :root:not([data-theme="light"]) .wt__shot--phone { border-color: oklch(0.32 0.012 260); }
}
:root[data-theme="dark"] .wt__shot--tablet, :root[data-theme="dark"] .wt__shot--phone { border-color: oklch(0.32 0.012 260); }

/* Highlight rings: boxes recorded at capture time, in percent of the screen. */
.wt__mark {
  position: absolute; border-radius: 8px;
  box-shadow: 0 0 0 2px var(--primary), 0 0 0 6px oklch(0.6 0.16 var(--brand-h) / 0.25);
  pointer-events: none;
}
.wt--ready .wt__layer.is-current .wt__mark { animation: wt-ring 0.6s ease both; animation-delay: 0.25s; }
.wt--still .wt__layer.is-current .wt__mark { animation: none; }
@keyframes wt-ring { from { opacity: 0; transform: scale(1.08); } to { opacity: 1; transform: none; } }
.wt__mark-label {
  position: absolute; left: 0; top: calc(100% + 8px); white-space: nowrap;
  padding: 3px 8px; border-radius: var(--r-sm); background: var(--primary); color: var(--primary-fg);
  font-size: 12px; font-weight: 600; line-height: 1.3;
}

.wt__zoom {
  position: absolute; right: 12px; bottom: 12px;
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; cursor: zoom-in;
  border-radius: var(--r-md); background: var(--surface); color: var(--fg); border: 1px solid var(--border);
  box-shadow: var(--card-shadow); font-size: 12px; font-weight: 550;
  opacity: 0; transition: opacity 0.15s ease;
}
.wt__stage:hover .wt__zoom, .wt__zoom:focus-visible { opacity: 1; }
@media (hover: none) { .wt__zoom { opacity: 1; } }

/* Controls: hidden until the script runs, since without it the player is a still of the first screen. */
.wt__controls {
  display: none; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--r-xl) var(--r-xl);
  background: var(--surface); box-shadow: var(--shot-shadow); padding: 10px 12px 8px;
}
.wt--ready .wt__controls { display: block; }
.wt:not(.wt--ready) .wt__frame { border-bottom: 1px solid var(--border); border-radius: var(--r-xl); }

.wt__progress { display: flex; gap: 8px; height: 6px; margin: 2px 2px 8px; }
.wt__pch { display: flex; gap: 3px; min-width: 0; }
.wt__seg { flex: 1; min-width: 4px; height: 100%; border-radius: 3px; background: var(--muted); overflow: hidden; }
.wt__seg i { display: block; height: 100%; background: var(--primary); transform: scaleX(0); transform-origin: left center; }
.wt__seg.is-done i { transform: scaleX(1); }

.wt__bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.wt__bar .icon-btn { width: 36px; height: 36px; color: var(--fg); }
.wt__bar .icon-btn svg.fill { fill: currentColor; stroke: none; }
.wt__play { background: var(--primary-subtle); }
.wt__play:hover { background: var(--primary-subtle); color: var(--accent-fg); }
.wt__play > span { display: none; }
.wt__play[data-state="paused"] .wt__ico-play, .wt__play:not([data-state]) .wt__ico-play,
.wt__play[data-state="playing"] .wt__ico-pause, .wt__play[data-state="replay"] .wt__ico-replay { display: inline-flex; }
.wt__status { margin-left: 8px; font-size: 13px; color: var(--muted-fg); font-variant-numeric: tabular-nums; }

.wt__caption { padding: 16px 4px 0; display: grid; gap: 4px; }
.wt__caption .k { font-family: var(--mono); font-size: 12px; color: var(--muted-fg); }
.wt__caption .t { font-size: clamp(18px, 2vw, 21px); }
.wt__caption .c { color: var(--muted-fg); max-width: 72ch; line-height: 1.6; }

/* Chapters beside the stage (1200 px and up), below it otherwise. */
.wt__chapters { border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); overflow: hidden; display: flex; flex-direction: column; }
@media (min-width: 1200px) { .wt__chapters { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); } }
.wt__chapters-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600; }
.wt__chapters-head .num { font-size: 12px; font-weight: 500; color: var(--muted-fg); }
.wt__chapters ol { list-style: none; overflow-y: auto; padding: 6px; display: grid; gap: 2px; }
.wt__ch {
  display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 2px 10px; padding: 9px 10px 10px;
  border-radius: var(--r-md); color: var(--fg); position: relative;
}
.wt__ch:hover { background: var(--muted); text-decoration: none; }
.wt__ch[aria-current="true"] { background: var(--primary-subtle); }
.wt__ch[aria-current="true"] .wt__ch-t { color: var(--accent-fg); }
.wt__ch-n { font-family: var(--mono); font-size: 12px; color: var(--muted-fg); padding-top: 2px; grid-row: span 2; }
.wt__ch-t { font-size: 14px; font-weight: 550; line-height: 1.35; }
.wt__ch-a { font-size: 12px; color: var(--muted-fg); }
.wt__ch-p { display: none; grid-column: 2; height: 3px; margin-top: 6px; border-radius: 2px; background: oklch(0.6 0.16 var(--brand-h) / 0.18); overflow: hidden; }
.wt--ready .wt__ch[aria-current="true"] .wt__ch-p { display: block; }
.wt__ch-p i { display: block; height: 100%; background: var(--primary); transform: scaleX(0); transform-origin: left center; }

/* Step by step */
.wts .tstep__tc { display: grid; gap: 4px; align-content: start; }
.wts__n { font-family: var(--mono); font-size: 13px; color: var(--accent-fg); }
.wts__body { min-width: 0; }
.wts__body > p:not(.where) { max-width: 68ch; line-height: 1.65; }
.wts .where .chip { text-decoration: none; }
.wts .where a.chip:hover { color: var(--fg); background: var(--border); }
.wts__shots { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin-top: 18px; }
.wts__shot { display: grid; gap: 8px; align-content: start; }
.wts__shot .thumb { cursor: zoom-in; padding: 0; width: 100%; }
.wts__shot p { font-size: 13px; line-height: 1.5; color: var(--muted-fg); }
.thumb--crop img { width: 125%; max-width: none; height: auto; margin: -5.5% 0 0 -25%; }
.thumb--phone { aspect-ratio: 16 / 10; background: var(--sunken); }
.thumb--phone img { object-fit: contain; object-position: center; }
.wts__goto {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none;
  font-size: 13px; font-weight: 550; color: var(--primary); cursor: pointer;
}
.wts__goto svg.fill { fill: currentColor; stroke: none; }
.wts__goto:hover { text-decoration: underline; }
@media (max-width: 599px) { .wts__shots { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .wt__layer { transition: none; }
  .wt__mark { animation: none !important; }
}

/* Accessibility review fixes */
.wt__stage:focus-visible { outline: none; }
.wt__stage:focus-visible::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; box-shadow: inset 0 0 0 3px var(--ring); }
.wt:not(.wt--ready) .wt__zoom { display: none; }
.wt__caption .t { font-weight: 650; letter-spacing: -0.01em; line-height: 1.25; }
