/* /testhomepage (Concept B, "Watch it work"). Loaded only by that page.
   Rule of the page: every element's resting style IS the finished frame. The motion lives only under
   .play (added once by tour.js when a scene scrolls into view) and only without reduced motion, so with
   JS off, before the observer fires, or under prefers-reduced-motion each scene is a complete still. */

/* ---------- layout ---------- */
.th-grid, .scene-grid, .duo { display: grid; gap: 36px; align-items: center; }
@media (min-width: 960px) { .th-grid { grid-template-columns: 5fr 6fr; gap: 48px; } }
@media (min-width: 900px) {
  .scene-grid { grid-template-columns: 5fr 7fr; gap: 56px; }
  .duo { grid-template-columns: 1fr 1fr; gap: 56px; }
  .scene-grid.flip > :first-child, .duo.flip > :first-child { order: 2; }
}
.th-status { margin-top: 18px; }
.scene-copy p { font-size: 1.1rem; color: var(--ink-2); }
.scene-copy .chips { margin: 4px 0 6px; }
.step { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 800 1.15rem/1 var(--mono); margin-bottom: 14px; }
.h3 { font-size: 1.3rem; }
.big { font: 800 1.7rem/1.15 var(--font); margin: 0 0 10px; color: var(--ink); }
.md-block { margin-top: 32px; }
.md-block p:last-child { margin-bottom: 0; }

/* ---------- speech ---------- */
.say { display: inline-block; background: var(--bubble); color: var(--bubble-ink); border: 2px solid var(--bubble-line); border-radius: 14px 14px 14px 4px; padding: 8px 13px; font: 600 .92rem/1.35 var(--font); box-shadow: var(--shadow); max-width: 30ch; }
.scene-say { display: flex; align-items: center; gap: 10px; margin: 20px 0 0; }
.mini-face { flex: none; display: block; width: 56px; height: 56px; }

/* ---------- hero: the floor on a monitor, Blob on its edge ---------- */
.monitor { position: relative; margin: 0 0 44px; }
.monitor-screen { border: 10px solid var(--bridge-2); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--bridge-line), 0 18px 50px var(--glow); overflow: hidden; background: var(--term); }
.monitor-screen img { display: block; width: 100%; height: auto; }
.monitor::after { content: ""; display: block; width: 26%; height: 14px; margin: 0 auto; background: var(--bridge-2); border-radius: 0 0 10px 10px; }
.hero-blob { position: absolute; right: -4px; bottom: -40px; display: flex; align-items: flex-end; gap: 8px; }
.hero-blob .say { border-radius: 14px 14px 4px 14px; margin-bottom: 30px; max-width: 24ch; }
.hero-face { display: block; width: 92px; height: 92px; flex: none; }
.hero-face .mo-eyes { --mo-track-travel: 3px; }


/* ---------- shared stage ---------- */
.stage { margin: 0; position: relative; }
.stage figcaption { font-size: .88rem; color: var(--muted); margin-top: 10px; }
.typed { display: inline; }
.demo .term { margin-top: 0; box-shadow: var(--shadow); }
.demo .ask-term { margin-top: 14px; }
.terms { display: grid; gap: 12px; margin-top: 14px; }
@media (min-width: 600px) { .terms { grid-template-columns: 3fr 2fr; align-items: start; } .done-demo .terms { grid-template-columns: 1fr 1fr; } }
.term.mini { font-size: .74rem; line-height: 1.55; padding: 0 10px 10px; }
.term.mini .term-bar { margin: 0 -10px 8px; padding: 7px 10px; }
.busy { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--led); box-shadow: 0 0 6px var(--led-glow); }
.replay { position: absolute; right: 0; bottom: -2px; font: 700 .8rem/1 var(--font); color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; min-height: 32px; cursor: pointer; }
.replay:hover { color: var(--ink); border-color: var(--accent); }
.replay:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.stage:has(.replay) figcaption { padding-right: 104px; }

/* terminal diff lines: '+' green, '-' red, '✓' pass. Fixed colours: the terminal is dark in both themes. */
.diff p { white-space: pre; overflow: hidden; text-overflow: ellipsis; border-radius: 3px; padding: 0 4px; margin: 0 -4px; }
.dl .sg { display: inline-block; width: 1.4em; color: var(--term-muted); }
.dl.add { background-color: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--term-ink); } .dl.add .sg { color: var(--ok); }
.dl.del { background-color: color-mix(in srgb, var(--brand-maroon) 35%, transparent); color: var(--term-muted); text-decoration: line-through; text-decoration-color: var(--term-muted); } .dl.del .sg { color: var(--term-muted); }
.dl.cmd .sg { color: var(--term-accent); }
.dl.ok { color: var(--term-ink); } .dl.ok .sg { color: var(--ok); }
.dl.note { color: var(--ok); font-weight: 700; }

/* ---------- the sample cafe site in a browser frame (fictional; fixed light colours, like a real page) ---------- */
.cafe { position: relative; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--card); color: var(--ink); }
.cf-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--band); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.cf-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.cf-url { flex: 1; min-width: 0; margin-left: 8px; padding: 3px 10px; border-radius: 999px; background: var(--page); color: var(--muted); font: 500 .72rem/1.3 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-live { display: none; font: 700 .66rem/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--card); background: var(--ok); border-radius: 999px; padding: 4px 7px; font-style: normal; }
.cafe.is-live .cf-live { display: inline-block; }
.cf-page { padding: 14px 18px 12px; font: 400 .8rem/1.45 var(--font); border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.cf-nav { display: flex; gap: 14px; align-items: baseline; margin-bottom: 14px; color: var(--muted); font-size: .74rem; }
.cf-nav b { margin-right: auto; color: var(--ink); font: 800 .9rem/1.2 Georgia, serif; }
.cf-hero { padding: 14px 0 16px; }
.cf-h { margin: 0 0 4px; font: 700 1.35rem/1.15 Georgia, serif; color: var(--ink); }
.cf-s { margin: 0 0 12px; color: var(--muted); }
.cf-book { display: inline-block; padding: 6px 13px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); font-weight: 500; font-size: .78rem; transform-origin: 0 50%; }
.cf-hours { display: none; background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; margin: 0 0 10px; max-height: 7em; overflow: hidden; transform-origin: 50% 0; }
.cf-hours p { margin: 0; }
.cf-h2 { font: 700 .9rem/1.3 Georgia, serif; margin-bottom: 2px !important; }
.cf-foot { margin: 0; color: var(--muted); font-size: .7rem; border-top: 1px solid var(--line-soft); padding-top: 8px; }
/* after the change: hours section shown, Book button bold and orange */
.cafe.after .cf-hours { display: block; }
.cafe.after .cf-book { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: 0 4px 14px var(--glow); transform: scale(1.08); }
.cafe.dim .cf-page { opacity: .45; }
.perch { position: absolute; right: -10px; top: -30px; width: 58px; height: 58px; }

/* ---------- approve: the card over the preview ---------- */
.appr-demo { display: grid; }
.appr-demo > * { grid-area: 1 / 1; }
.appr-demo .approval { align-self: center; justify-self: center; position: relative; width: calc(100% - 28px); margin: 44px 0; }
.stamp { position: absolute; right: 14px; top: 14px; font: 800 .8rem/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ok); border: 2px solid var(--ok); border-radius: 6px; padding: 5px 7px; transform: rotate(-7deg); background: var(--card); }
.pointer { position: absolute; left: 88px; bottom: 6px; width: 20px; height: 27px; fill: var(--card); stroke: var(--ink); stroke-width: 1.3; filter: drop-shadow(0 2px 3px var(--glow)); }

/* ---------- scene 2: the mail goes out ---------- */
.net { position: relative; aspect-ratio: 100 / 62; background: var(--bridge) radial-gradient(var(--bridge-line) 1px, transparent 1.5px) 0 0 / 22px 22px; border: 1px solid var(--bridge-line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.routes { position: absolute; inset: 0; width: 100%; height: 100%; }
.routes path { fill: none; stroke: var(--bridge-accent); stroke-width: 2; stroke-dasharray: 7 6; vector-effect: non-scaling-stroke; opacity: .7; }
.node { position: absolute; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 4px; width: 17%; }
.node .mate { width: 100%; }
.node b, .memo { font: 700 .72rem/1 var(--mono); border-radius: 999px; padding: 5px 9px; white-space: nowrap; }
.node b { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.memo { position: absolute; transform: translate(-50%, -50%); background: var(--bubble); color: var(--bubble-ink); border: 1px solid var(--bubble-line); }
.m1 { left: 46%; top: 10%; }
.m2 { left: 46%; top: 91%; }
.env { position: absolute; width: 7%; min-width: 26px; aspect-ratio: 4 / 3; transform: translate(-50%, -50%); }
.env i { position: absolute; inset: 0; background: linear-gradient(to bottom right, transparent calc(50% - 1px), var(--mail-line) 50%, transparent calc(50% + 1px)) left top / 50% 60% no-repeat, linear-gradient(to bottom left, transparent calc(50% - 1px), var(--mail-line) 50%, transparent calc(50% + 1px)) right top / 50% 60% no-repeat, var(--mail); border: 1px solid var(--mail-line); border-radius: 2px; }

/* ---------- scene 4: the approval card ---------- */
.approval { max-width: 440px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.appr-tag { display: block; font: 700 .74rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent-strong); margin-bottom: 10px; }
.appr-demo .appr-tag { padding-right: 8.5em; }
.appr-title { font-size: 1.3rem; font-weight: 800; margin: 0 0 6px; color: var(--ink); }
.appr-from { color: var(--ink-2); margin: 0 0 16px; }
.appr-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.appr-btns .btn { cursor: default; pointer-events: none; }

/* ---------- scene 5: results come back, memory remembers ---------- */
.back { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px 16px; margin: 0 0 16px; }
.back .env { position: relative; transform: none; width: 46px; }
.back .r1 { order: 0; } .back-lead { order: 1; display: block; width: 76px; } .back .r2 { order: 2; }
.back .memo.done { position: static; transform: none; order: 3; }

/* ---------- looks and close ---------- */
.th-crew { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.th-crew .crew, .th-crew .crew .mate { width: 72px; }
.th-crew .crew b { font-size: .7rem; padding: 4px 7px; }
.th-close { padding-bottom: 88px; }
.wave-blob { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin-bottom: 18px; }
.wave-face { display: block; width: 100px; height: 100px; transform-origin: 50% 90%; }

/* ---------- phones ---------- */
@media (max-width: 599px) {
  .hero-blob { bottom: -46px; right: -6px; }
  .hero-face { width: 76px; height: 76px; }
  .hero-blob .say { font-size: .84rem; max-width: 20ch; margin-bottom: 24px; }
  .monitor { margin-bottom: 56px; }
  .monitor-screen { border-width: 6px; }
  .node b, .memo { font-size: .62rem; padding: 4px 6px; }
  .node { width: 19%; }
  .mini-face { width: 48px; height: 48px; }
  .th-crew .crew, .th-crew .crew .mate { width: 60px; }
  .perch { width: 48px; height: 48px; right: -4px; top: -26px; }
  .cf-page { padding: 12px 14px 10px; }
  .appr-demo .approval { padding: 18px; }
  .appr-title { font-size: 1.1rem; }
}

/* ---------- motion: only after .play, only when motion is welcome ---------- */
@media (prefers-reduced-motion: no-preference) {
  .play .say { animation: th-pop .5s .45s cubic-bezier(.3,1.6,.5,1) both; transform-origin: 0 100%; }
  .th-hero.play .say { transform-origin: 100% 100%; animation-delay: .7s; }
  .play .mini-face, .th-hero.play .hero-face { animation: th-hop .5s .3s ease-out 2 alternate; }

  /* start frames: only once tour.js has armed the page (JS on, motion welcome) and only until a scene
     plays, so a scene waiting below the fold is never seen finished and then rewound. No JS or reduced
     motion: the page is never armed, so every scene stays a complete still. Each matches its keyframe's from. */
  html.armed [data-scene]:not(.play) .say, html.armed .th-close:not(.play) .say { transform: scale(.6); opacity: .2; transform-origin: 0 100%; }
  html.armed [data-scene]:not(.play) .reply, html.armed .s-remember:not(.play) .done { opacity: .15; transform: translateY(6px); }
  html.armed .s-split:not(.play) .env { left: 24% !important; top: 54% !important; }
  html.armed .s-split:not(.play) .memo { opacity: .15; transform: translate(-50%, calc(-50% + 6px)); }
  html.armed [data-scene]:not(.play) .dl { clip-path: inset(0 100% 0 0); background-color: transparent; }
  html.armed .s-work:not(.play) .cf-hours { opacity: 0; transform: translateY(-10px) scaleY(.4); }
  html.armed .s-work:not(.play) .cf-book { background: transparent; border-color: var(--line); color: var(--muted); font-weight: 500; box-shadow: none; transform: none; }
  html.armed .s-approve:not(.play) .approval { opacity: .2; transform: translateY(18px); }
  html.armed .s-approve:not(.play) .stamp { opacity: 0; transform: rotate(-7deg) scale(1.8); }
  html.armed .s-approve:not(.play) .pointer { opacity: 0; transform: translate(150px, -110px); }
  html.armed .s-remember:not(.play) .r1 { transform: translate(-70px, -24px) rotate(-12deg); opacity: .3; }
  html.armed .s-remember:not(.play) .r2 { transform: translate(70px, -24px) rotate(12deg); opacity: .3; }
  html.armed .s-remember:not(.play) .cf-live { opacity: .2; transform: scale(.6); }

  /* 1: the request types itself (tour.js), the reply follows; Blob peeks at the site */
  .s-ask.play .reply { animation: th-in .5s 3.1s ease-out both; }
  .s-ask .caret { margin-left: 2px; }
  .s-ask.play .perch { animation: th-peek 1.6s .6s ease-in-out both; }

  /* 2: routes draw, envelopes fly from the lead agent, notes land */
  .s-split.play .routes path { animation: th-flow 1.2s linear infinite; }
  .s-split.play .e1 { animation: th-fly1 1.3s .5s cubic-bezier(.5,0,.3,1) both; }
  .s-split.play .e2 { animation: th-fly2 1.3s .9s cubic-bezier(.5,0,.3,1) both; }
  .s-split.play .m1 { animation: th-in-c .5s 1.7s ease-out both; }
  .s-split.play .m2 { animation: th-in-c .5s 2.1s ease-out both; }
  .s-split.play .lead .mate { animation: th-hop .3s .4s ease-out 2 alternate; }

  /* 3 and 5: terminal lines type in one by one, then turn green (or red) */
  .play .dl { --t: calc(var(--d0, .3s) + var(--i) * .4s); animation: th-type .35s var(--t) steps(22, end) both, th-tint .4s calc(var(--t) + .35s) ease-out both; }
  .s-remember { --d0: 1.3s; }

  /* 3: the hours section slides into the preview, then the Book button restyles; Blob cheers each time */
  .s-work.play .busy { animation: th-blink .6s ease-in-out infinite alternate; }
  .s-work.play .cf-hours { animation: th-open .7s 2.1s cubic-bezier(.2,.8,.2,1) both; }
  .s-work.play .cf-book { animation: th-book .5s 3.9s cubic-bezier(.3,1.5,.5,1) both; }
  .s-work.play .cf-bar { animation: th-reload .5s 2s ease-out, th-reload .5s 3.8s ease-out; }
  .s-work.play .perch { animation: th-cheer .9s 2.5s ease-out, th-cheer .9s 4.3s ease-out; }

  /* 4: the card arrives, the pointer clicks Approve, the stamp lands */
  .s-approve.play .approval { animation: th-rise .6s .2s cubic-bezier(.2,.8,.2,1) both; }
  .s-approve.play .kinds .accent { animation: th-hop .4s 1s ease-out 2 alternate; }
  .s-approve.play .pointer { animation: th-point 1s 1.1s cubic-bezier(.4,0,.2,1) both; }
  .s-approve.play .appr-yes { animation: th-press .3s 2.15s ease-out; }
  .s-approve.play .stamp { animation: th-stamp .35s 2.4s cubic-bezier(.3,1.5,.5,1) both; }

  /* 5: the envelopes come home, the site goes live, the check passes, the note is saved; Blob cheers */
  .s-remember.play .r1 { animation: th-home-l .9s .2s cubic-bezier(.5,0,.3,1) both; }
  .s-remember.play .r2 { animation: th-home-r .9s .45s cubic-bezier(.5,0,.3,1) both; }
  .s-remember.play .done { animation: th-in .4s 1.1s ease-out both; }
  .s-remember.play .cf-live { animation: th-pop .4s .9s cubic-bezier(.3,1.5,.5,1) both; }
  .s-remember.play .perch { animation: th-cheer .9s 3.2s ease-out 3; }

  /* close: Blob waves */
  .th-close.play .wave-face { animation: th-wave 1.8s .3s ease-in-out both; }
}
@keyframes th-pop { from { transform: scale(.6); opacity: .2; } }
@keyframes th-hop { to { transform: translateY(-6px); } }
@keyframes th-type { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes th-tint { from { background-color: transparent; } }
@keyframes th-in { from { opacity: .15; transform: translateY(6px); } }
@keyframes th-in-c { from { opacity: .15; transform: translate(-50%, calc(-50% + 6px)); } }
@keyframes th-rise { from { opacity: .2; transform: translateY(18px); } }
@keyframes th-flow { to { stroke-dashoffset: -13; } }
@keyframes th-fly1 { from { left: 24%; top: 54%; } }
@keyframes th-fly2 { from { left: 24%; top: 54%; } }
@keyframes th-blink { from { opacity: .35; } }
@keyframes th-home-l { from { transform: translate(-70px, -24px) rotate(-12deg); opacity: .3; } }
@keyframes th-home-r { from { transform: translate(70px, -24px) rotate(12deg); opacity: .3; } }
@keyframes th-wave { 0%, 100% { transform: none; } 15%, 45%, 75% { transform: rotate(-14deg); } 30%, 60% { transform: rotate(14deg); } }
@keyframes th-open { from { opacity: 0; transform: translateY(-10px) scaleY(.4); } }
@keyframes th-book { from { background-color: transparent; border-color: var(--line); color: var(--muted); box-shadow: none; transform: none; } 60% { transform: scale(1.18); } }
@keyframes th-reload { 30% { background-color: var(--accent-soft); } }
@keyframes th-cheer { 0%, 100% { transform: none; } 30% { transform: translateY(-14px) rotate(-8deg); } 60% { transform: translateY(-4px) rotate(6deg); } }
@keyframes th-peek { 0%, 100% { transform: none; } 40%, 70% { transform: translate(-6px, 4px) rotate(-10deg); } }
@keyframes th-point { from { opacity: 0; transform: translate(150px, -110px); } 20% { opacity: 1; } }
@keyframes th-press { 50% { transform: scale(.92); filter: brightness(.85); } }
@keyframes th-stamp { from { opacity: 0; transform: rotate(-7deg) scale(1.8); } }
