/* ============================================================
   Click-through walkthrough, shared by every article that has one.
   Read by site/walkthrough.js, which builds it from the JSON block inside
   <div class="walkthrough">. The look copies the StudioHub phone demo
   (projects/phone-demo/studiohub-demo.html): one phone-width card, a
   "StudioHub" bar with a step counter, a thin progress bar, and a caption
   bar at the bottom with "‹ Back" and "Next ›".
   Code/build_directory.py links this file, stamped with a hash of its
   contents, into every page that has a walkthrough.
   ============================================================ */

.walkthrough, .wt-versions {
  --wt-blue: #4FBDFF;
  --wt-blue-ink: #1180E8;
  --wt-deep: #188BF6;
  --wt-ink: #2B333F;
  --wt-ground: #F5F2FF;
  --wt-card: #FFFFFF;
  --wt-muted: #405561;
  --wt-line: #E2DEF2;
  --wt-violet: #6748F0;
  --wt-red: #e11d48;
  --wt-good: #1E9E62;
  --wt-good-soft: #E3F6ED;
}
.walkthrough {
  max-width: 430px;
  margin: 8px auto 34px;
}
.walkthrough:empty { display: none; }

.wt-app {
  background: var(--wt-ground);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(43, 51, 63, .22), 0 0 0 1px rgba(43, 51, 63, .06);
  color: var(--wt-ink);
  user-select: none;
  -webkit-user-select: none;
}
.wt-app:focus { outline: none; }
.wt-app:focus-visible { outline: 3px solid var(--wt-deep); outline-offset: 3px; }

/* ---- top bar ---------------------------------------------------------- */
.wt-top {
  display: flex; align-items: center; gap: 10px;
  background: var(--wt-card); border-bottom: 1px solid var(--wt-line);
  padding: 13px 18px 11px;
}
.wt-logo { font-weight: 800; font-size: 17px; letter-spacing: -.3px; color: var(--wt-deep); line-height: 1.2; }
.wt-count { margin-left: auto; font-size: 13px; color: var(--wt-muted); font-variant-numeric: tabular-nums; line-height: 1.2; }
.wt-full {
  font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--wt-deep);
  background: var(--wt-card); border: 1px solid var(--wt-line); border-radius: 999px;
  padding: 5px 11px; cursor: pointer; line-height: 1.2; white-space: nowrap;
}
.wt-full:hover { border-color: var(--wt-blue); }
.wt-full:focus-visible { outline: 3px solid var(--wt-deep); outline-offset: 2px; }
.wt-sound {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--wt-muted);
  background: var(--wt-card); border: 1px solid var(--wt-line); border-radius: 999px;
  padding: 5px 11px 5px 8px; cursor: pointer; line-height: 1.2; white-space: nowrap;
}
.wt-sound[hidden] { display: none; }   /* only voiced walkthroughs show it */
.wt-sound svg { width: 15px; height: 15px; flex: none; }
.wt-sound .wt-wave { opacity: .3; }
.wt-sound[aria-pressed="true"] { color: #fff; background: var(--wt-deep); border-color: var(--wt-deep); }
.wt-sound[aria-pressed="true"] .wt-wave { opacity: 1; }
.wt-sound:hover { border-color: var(--wt-blue); }
.wt-sound:focus-visible { outline: 3px solid var(--wt-violet); outline-offset: 2px; }
/* on a phone the top bar has no room for the word: the speaker alone,
   which still says "Sound on/off" to a screen reader */
.wt-sound + .wt-full, .wt-count { white-space: nowrap; }
@media (max-width: 520px) {
  .wt-sound { padding: 5px 8px; }
  .wt-sound span { display: none; }
}
.wt-progress { height: 3px; background: var(--wt-line); }
.wt-progress b {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--wt-blue), var(--wt-violet));
  transition: width .35s ease;
}

/* ---- stage: the welcome, one screenshot per step, done ----------------- */
/* square, and no min-height: through aspect-ratio a min-height also sets a
   min-width, which pushed the stage wider than a phone's card and cut off its
   right edge */
.wt-stage { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--wt-ground); }
.wt-screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: 13px;
  padding: 20px 24px 22px;
  overflow-y: auto;
  animation: wt-fade .3s ease both;
}
/* centred when it fits, scrollable from the top when it doesn't; the extra
   .walkthrough keeps these ahead of the "margin: 0" on headings and text */
.walkthrough .wt-screen > :first-child { margin-top: auto; }
.walkthrough .wt-screen > :last-child { margin-bottom: auto; }
.wt-screen > * { flex-shrink: 0; }
@keyframes wt-fade { from { opacity: 0; } to { opacity: 1; } }

.walkthrough .wt-kicker { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--wt-deep); margin: 0; line-height: 1.3; }
.walkthrough .wt-h { font-size: 26px; line-height: 1.18; margin: 0; letter-spacing: -.5px; font-weight: 800; color: var(--wt-ink); text-wrap: balance; }
.walkthrough .wt-sub { font-size: 16px; line-height: 1.55; color: var(--wt-muted); margin: 0; }
.wt-howto {
  background: var(--wt-card); border: 1px solid var(--wt-line); border-radius: 16px;
  padding: 15px 17px; display: flex; flex-direction: column; gap: 11px;
}
.wt-howto div { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.45; color: var(--wt-ink); }
.wt-howto .wt-ic { font-size: 19px; line-height: 1.2; flex: 0 0 auto; }

/* a step: the screenshot, zoomed in around the thing to click */
.wt-screen.wt-shot { padding: 0; display: block; overflow: hidden; background: #fff; }
.wt-img { position: absolute; left: 0; top: 0; transition: left .35s ease, top .35s ease; }
.wt-img img { display: block; width: 100%; height: auto; margin: 0; max-width: none; pointer-events: none; }
.wt-hot {
  position: absolute; transform: translate(-50%, -50%);
  min-width: 40px; min-height: 40px;
  padding: 0; margin: 0; border: 0; background: transparent;
  border-radius: 10px; cursor: pointer;
  animation: wt-pulse 1.6s ease-out infinite;
}
.wt-hot:focus-visible { outline: 3px solid var(--wt-deep); outline-offset: 4px; }
@keyframes wt-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(225, 29, 72, .55); }
  70%  { box-shadow: 0 0 0 16px rgba(225, 29, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); }
}
.wt-missing { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--wt-muted); font-size: 15px; }

/* done */
.wt-tick {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--wt-good-soft); color: var(--wt-good); border: 1px solid #BEE7D2;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; line-height: 1;
}

/* a choice, and "See the other option" on an ending */
.wt-choices { display: flex; flex-direction: column; gap: 10px; }
.wt-choice {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left;
  font-family: inherit; font-size: 16px; font-weight: 700; line-height: 1.35; color: var(--wt-ink);
  background: var(--wt-card); border: 1px solid var(--wt-line); border-radius: 14px;
  padding: 14px 16px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(43, 51, 63, .06);
}
.wt-choice:hover { border-color: var(--wt-blue); }
.wt-choice:focus-visible { outline: 3px solid var(--wt-deep); outline-offset: 2px; }
.wt-choice .wt-chev { color: var(--wt-deep); font-size: 22px; line-height: 1; flex: 0 0 auto; }

/* ---- caption bar -------------------------------------------------------- */
/* walkthrough.js gives .wt-captext a min-height equal to the longest caption,
   so the bar is the same height on every screen and the buttons never move */
.wt-caption {
  position: relative;
  background: var(--wt-card); border-top: 1px solid var(--wt-line);
  padding: 14px 18px 16px; min-height: 104px;
  display: flex; flex-direction: column; gap: 10px; justify-content: center;
}
.walkthrough .wt-captext { font-size: 16px; line-height: 1.5; color: var(--wt-ink); margin: 0; display: flex; align-items: center; }
.wt-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wt-back {
  font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--wt-muted);
  background: var(--wt-ground); border: 1px solid var(--wt-line); border-radius: 999px;
  padding: 8px 16px; cursor: pointer; line-height: 1.2;
}
.wt-back:disabled { opacity: .35; cursor: default; }
.wt-back:focus-visible { outline: 3px solid var(--wt-deep); outline-offset: 2px; }
.wt-next {
  font-family: inherit; font-size: 14.5px; font-weight: 800; color: #fff;
  background: linear-gradient(180deg, #35A7F2, var(--wt-blue-ink)); border: 0; border-radius: 999px;
  padding: 10px 24px; cursor: pointer; letter-spacing: .02em; line-height: 1.2;
  box-shadow: 0 6px 16px rgba(24, 139, 246, .35);
}
.wt-next:focus-visible { outline: 3px solid var(--wt-violet); outline-offset: 2px; }
/* on a choice screen: gone from view, but still holding its space */
.wt-next.wt-off { visibility: hidden; }

/* ---- full screen: the walkthrough fills the window, and each step shows its
   whole screen (walkthrough.js places it) instead of the zoomed-in part ---- */
html.wt-lock, html.wt-lock body { overflow: hidden; }
.walkthrough.wt-is-full .wt-app {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column;
  border-radius: 0; box-shadow: none;
}
.walkthrough.wt-is-full .wt-stage { aspect-ratio: auto; flex: 1 1 auto; min-height: 0; }
.walkthrough.wt-is-full .wt-screen { max-width: 640px; margin: 0 auto; }
.walkthrough.wt-is-full .wt-screen.wt-shot { max-width: none; background: var(--wt-ground); }
.walkthrough.wt-is-full .wt-caption { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.walkthrough.wt-is-full .wt-captext,
.walkthrough.wt-is-full .wt-nav { width: 100%; max-width: 640px; margin-left: auto; margin-right: auto; }
.walkthrough.wt-is-full .wt-top { padding-top: max(13px, env(safe-area-inset-top)); }

/* ---- phone ("device": "phone"): the whole phone screen in a phone frame,
   and a glowing spot to tap instead of a zoomed-in picture ---------------- */
.walkthrough.wt-phone .wt-stage { aspect-ratio: 3 / 4; }
.walkthrough.wt-is-full.wt-phone .wt-stage { aspect-ratio: auto; }
.walkthrough.wt-phone .wt-screen.wt-shot {
  background: radial-gradient(120% 80% at 50% 0%, #fff 0%, var(--wt-ground) 70%);
}
.walkthrough.wt-phone .wt-img {
  border-radius: 26px; cursor: pointer;
  box-shadow: 0 0 0 7px #1d1f24, 0 0 0 8px #44474f, 0 22px 44px rgba(43, 51, 63, .28);
}
.walkthrough.wt-phone .wt-img img { border-radius: 26px; }
.walkthrough.wt-phone .wt-hot {
  width: 34px; height: 34px; min-width: 0; min-height: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(24, 139, 246, .9) 0 28%, rgba(24, 139, 246, .28) 31% 100%);
  box-shadow: 0 0 0 0 rgba(24, 139, 246, .6);
  outline: 2px solid rgba(255, 255, 255, .95); outline-offset: -2px;
  animation: wt-glow 1.5s ease-out infinite;
}
.walkthrough.wt-phone .wt-hot:focus-visible { outline: 3px solid var(--wt-violet); outline-offset: 3px; }
@keyframes wt-glow {
  0%   { box-shadow: 0 0 0 0 rgba(24, 139, 246, .6); }
  70%  { box-shadow: 0 0 0 18px rgba(24, 139, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(24, 139, 246, 0); }
}
.walkthrough.wt-phone .wt-hot.wt-tapped { animation: wt-ripple .26s ease-out forwards; }
@keyframes wt-ripple { to { transform: translate(-50%, -50%) scale(2.2); opacity: 0; } }
.walkthrough.wt-phone .wt-hot.wt-nudge { animation: wt-nudge .5s ease, wt-glow 1.5s ease-out .5s infinite; }
@keyframes wt-nudge {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  30%      { transform: translate(-50%, -50%) scale(1.5); }
  60%      { transform: translate(-50%, -50%) scale(.9); }
}

.walkthrough.wt-phone .wt-drawn { overflow: hidden; }

/* ---- the switch between a computer and a phone version of one task ---- */
.wt-switch {
  display: flex; gap: 4px; width: fit-content; max-width: 100%; margin: 0 auto 14px;
  padding: 4px; border-radius: 999px; background: var(--wt-ground); box-shadow: inset 0 0 0 1px rgba(43, 51, 63, .12);
}
.wt-pick {
  font: inherit; font-size: 15px; font-weight: 600; color: var(--wt-ink, #2b333f);
  border: 0; border-radius: 999px; padding: 9px 16px; background: transparent; cursor: pointer;
}
.wt-pick[aria-pressed="true"] { background: #fff; color: var(--wt-deep); box-shadow: 0 1px 4px rgba(43, 51, 63, .18); }
.wt-pick:focus-visible { outline: 3px solid var(--wt-violet); outline-offset: 2px; }
.wt-versions > [hidden] { display: none; }

/* the steps as text, for screen readers and search; not shown on screen */
.wt-text {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* phones: use the article card's full width, not the width inside its padding */
@media (max-width: 640px) {
  .walkthrough { margin-left: -16px; margin-right: -16px; }
  .wt-app { border-radius: 20px; }
  .walkthrough .wt-h { font-size: 24px; }
  .wt-screen { padding: 18px 18px 20px; gap: 11px; }
  .wt-tick { width: 46px; height: 46px; font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .wt-screen { animation: none; }
  .wt-img, .wt-progress b { transition: none; }
  .wt-hot { animation: none; box-shadow: 0 0 0 4px rgba(225, 29, 72, .45); }
  .walkthrough.wt-phone .wt-hot, .walkthrough.wt-phone .wt-hot.wt-nudge { animation: none; box-shadow: 0 0 0 5px rgba(24, 139, 246, .45); }
}
