/* SITE-STORY-MOTION: ambient motion for the /testhomepage preview of the story homepage.
   The restored pieces (live bridge, crew parade, typing memory terminal, warp and crewline) use their
   original site.css rules; this file places them in the story layout and adds small idle loops between
   the scenes. Loops are transform/opacity only; site.js pauses them off screen (.paused on .hero, .deck,
   .chap, .closing); none run under prefers-reduced-motion, and the resting frame is always complete. */

/* ---------- hero: the live TES bridge on the monitor, cropped to the crew deck (scene y 118-578 of 772) ---------- */
.monitor-screen .lv-crop { position: relative; aspect-ratio: 580 / 460; overflow: hidden; }
.monitor-screen .lv-crop .live { position: absolute; top: 0; left: 0; right: 0; max-width: none; margin: 0; transform: translateY(-15.28%); }

/* ---------- scene 5: the memory terminal under Blob's line ---------- */
.mem-term { max-width: 460px; font-size: .78rem; line-height: 1.6; }
/* the scene copy styles its own paragraphs (size, colour); keep the terminal's */
.mem-term p { font-size: inherit; line-height: inherit; color: var(--term-ink); max-width: none; }
.mem-term p.out { color: var(--term-muted); }

/* ---------- Make it yours: the crew parade on a deck ---------- */
.th-crew.deck { flex-wrap: nowrap; justify-content: space-around; gap: 6px; margin: 24px 0 8px; padding: 0 6px 16px; }
.th-crew.deck .crew, .th-crew.deck .crew .mate { width: 64px; }
.th-crew.deck .crew b { font-size: .66rem; padding: 4px 6px; }
@media (max-width: 599px) {
  /* two rows on a phone, each sprite on its own strip of deck */
  .th-crew.deck { flex-wrap: wrap; justify-content: center; column-gap: 10px; row-gap: 12px; padding-bottom: 4px; }
  .th-crew.deck::before { display: none; }
  .th-crew.deck .crew, .th-crew.deck .crew .mate { width: 60px; }
  .th-crew.deck .crew { padding-bottom: 12px; }
  .th-crew.deck .crew::before { content: ""; position: absolute; left: -4px; right: -4px; bottom: 0; height: 22px; background: repeating-linear-gradient(90deg, var(--deck) 0 22px, var(--deck-line) 22px 24px); border-radius: 4px; z-index: -1; }
  .th-crew.deck .crew b { font-size: .64rem; padding: 3px 5px; }
}

/* ---------- FAQ: Blob sits by the heading ---------- */
.faq #faq-title { display: inline-block; vertical-align: middle; }
.faq-face { display: inline-block; width: 44px; height: 44px; margin-left: 10px; vertical-align: middle; }
.faq-face svg { display: block; width: 100%; height: 100%; }

/* ---------- close: the warp streaks behind, the crew on the deck below ---------- */
.th-close .crewline { margin-top: 40px; }

/* ---------- status lights on every kicker and proof tag ---------- */
.tour .kicker::before, #proof .tag::before { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 8px 1px 0; border-radius: 2px; background: var(--accent); vertical-align: middle; }
#proof .card { position: relative; overflow: hidden; }
#proof .card::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent); transform: scaleX(0); transform-origin: left; opacity: 0; }

/* ---------- scroll reveals: site.js hides (.rv, set by JS only, so JS-off shows everything) and shows (.in), once;
   assets/js/reveal.js marks the groups. Here: a slower stagger, pictures after the copy, some variety ---------- */
.rv { transition-delay: calc(var(--rv-i, 0) * 110ms); }
.shot.rv, .blob-stage.rv { transition-delay: .3s; }
/* the scroll-reveal slides must never widen the page (tablets would pan sideways); clip is not a scroll container, so sticky and anchors still work */
main { overflow-x: clip; }
.rv.rv-s { transform: scale(.94); }
@media (min-width: 761px) {
  /* side slides on wider screens only, so nothing pokes past a phone's edge */
  .rv.rv-r { transform: translateX(36px); }
  .rv.rv-l { transform: translateX(-36px); }
}
.rv.in.rv-r, .rv.in.rv-l, .rv.in.rv-s { transform: none; }

@media (prefers-reduced-motion: no-preference) {
  /* idle Blob: every face breathes and sways between its scene moments (the face's own blink and gaze keep running) */
  .hero-face > svg, .mini-face > svg, .perch > svg, .wave-face > svg, .faq-face > svg, .blob-core > svg { transform-origin: 50% 90%; animation: mv-idle 3.4s ease-in-out infinite alternate; }
  .mini-face > svg { animation-duration: 2.9s; animation-delay: -1.2s; }
  .perch > svg { animation-duration: 3.1s; animation-delay: -.6s; }
  .faq-face > svg { animation: mv-peek 7s ease-in-out infinite; }
  .hero-blob .say { animation: mv-float 4.2s ease-in-out infinite alternate; }
  @keyframes mv-idle { from { transform: translateY(0) rotate(-2.5deg); } to { transform: translateY(-4%) rotate(2.5deg); } }
  @keyframes mv-float { from { transform: translateY(0); } to { transform: translateY(-5px); } }
  @keyframes mv-peek { 0%, 62%, 100% { transform: none; } 70% { transform: translateY(-8%) rotate(-8deg); } 78% { transform: translateY(-8%) rotate(8deg); } 86% { transform: none; } }

  /* status lights blink, each a little out of step */
  .tour .kicker::before, #proof .tag::before { animation: mv-led 2.4s ease-in-out infinite; }
  #proof .card:nth-child(2) .tag::before { animation-delay: -.8s; }
  #proof .card:nth-child(3) .tag::before { animation-delay: -1.6s; }
  @keyframes mv-led { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

  /* proof cards: a scan line runs across the top of each, one after another */
  #proof .card::after { animation: mv-scan 6s ease-in-out infinite; }
  #proof .card:nth-child(2)::after { animation-delay: 2s; }
  #proof .card:nth-child(3)::after { animation-delay: 4s; }
  @keyframes mv-scan { 0% { transform: scaleX(0); opacity: 1; } 25% { transform: scaleX(1); opacity: 1; } 33%, 100% { transform: scaleX(1); opacity: 0; } }

  /* screenshots drift a few px, as on phones */
  .tour .chap .shot img { animation: shot-drift 7s ease-in-out infinite alternate; }
  .tour #looks .shot img { animation-delay: -3s; }
  @keyframes shot-drift { from { transform: translateY(0); } to { transform: translateY(-6px); } }

  /* FAQ: each closed question's + glows in turn, inviting a tap */
  .faq details:not([open]) > summary::after { animation: mv-glow 9s ease-in-out infinite; }
  .faq details:nth-of-type(2) > summary::after { animation-delay: 1.5s; }
  .faq details:nth-of-type(3) > summary::after { animation-delay: 3s; }
  .faq details:nth-of-type(4) > summary::after { animation-delay: 4.5s; }
  .faq details:nth-of-type(5) > summary::after { animation-delay: 6s; }
  .faq details:nth-of-type(6) > summary::after { animation-delay: 7.5s; }
  @keyframes mv-glow { 0%, 20%, 100% { opacity: 1; } 8% { opacity: .2; } }
}
/* a typed request's line: an invisible copy of the full line holds its height, the typing runs on top (reveal.js) */
.tl { position: relative; }
.tl-ghost { visibility: hidden; }
.tl-live { position: absolute; inset: 0; }
/* the typed request once reveal.js owns its playback (tour.css styles it as .typed) */
.typed-r { display: inline; }

/* the clinic demo (a Claude agent builds, a Gemini agent audits): its booking times, the double booking the audit
   finds and the fix. Both labels on 10:30 share one grid cell from the start, so showing one never moves anything. */
.slots { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0 !important; }
.slots > span { display: inline-grid; grid-auto-flow: column; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); font: 600 .78rem/1.4 var(--mono); }
.sl-x, .sl-ok { display: none; grid-area: 1 / 2; justify-self: start; font: 700 .66rem/1.5 var(--font); border-radius: 4px; padding: 0 5px; }
.sl-x { background: var(--brand-maroon); color: var(--term-ink); }
.sl-ok { background: var(--line-soft); color: var(--muted); }
.clinic.fixed .sl-ok { display: inline-block; }
.clinic.fixed .sl-t { color: var(--muted); }
.dl.bad { background-color: color-mix(in srgb, var(--brand-maroon) 35%, transparent); color: var(--term-ink); }
.dl.bad .sg { color: var(--term-ink); }
.dl.fail { color: var(--brand-gold); font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  html.armed .s-audit:not(.play) .sl-ok { opacity: 0; }
  .s-audit.play .busy { animation: th-blink .6s ease-in-out infinite alternate; }
  /* the audit's failing line types in at 1.1s; the fix's last line at 2.7s; the passing re-run from 3.1s */
  .s-audit.play .sl-x { display: inline-block; animation: mv-flag 1.9s 1.2s ease-out both; }
  .s-audit.play .sl-t { animation: mv-alarm .45s 1.2s ease-in-out 4 alternate; }
  .s-audit.play .sl-ok { animation: mv-show .4s 3.1s cubic-bezier(.3,1.5,.5,1) both; }
  .s-audit.play .cf-bar { animation: th-reload .5s 3s ease-out; }
  .s-audit.play .perch { animation: th-cheer .9s 4.5s ease-out; }
  @keyframes mv-flag { 0% { opacity: 0; transform: scale(.6); } 12%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }
  @keyframes mv-alarm { to { border-color: var(--brand-maroon); } }
  @keyframes mv-show { from { opacity: 0; transform: scale(.6); } }
}
/* a node's label (now naming its AI) can be wider than its station: keep the sprite at the station's width */
.net .node { grid-template-columns: minmax(0, 1fr); }
