/* ==========================================================================
   stage.css — the demo on /how-it-works/. See stage.js.
   Everything is placed in the stage's own pixels; the stage is scaled as one
   picture. Colours come from css/tokens.css (--tour-* for the pretend chat).
   ========================================================================== */

html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper-2); }
/* On a phone any sliver left over is the colour of the tree's own ground. */
html.is-phone, html.is-phone body { background: var(--surface); }
body { position: fixed; inset: 0; touch-action: manipulation; -webkit-user-select: none; user-select: none;
  font: 400 16px/1.5 var(--font-sans); color: var(--ink); -webkit-tap-highlight-color: transparent; }

.stage { position: absolute; top: 0; left: 0; overflow: hidden; transform-origin: 0 0; background: var(--surface);
  box-shadow: var(--shadow-modal); }
.stage__pic { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none;
  visibility: hidden; background: var(--surface); }
.stage__pic.on { visibility: visible; }

/* ---- Spotlight ---------------------------------------------------------- */
.spot { position: absolute; inset: 0; pointer-events: none; z-index: 30; transition: opacity .6s ease; }
/* Time to look: no darkness. The window moves while it is invisible. */
.spot.off { opacity: 0; }
.spot.off .spot__hole { transition: none; }
.spot__hole { position: absolute; border-radius: 50%; box-shadow: 0 0 0 3000px var(--tour-dim);
  transition: left .5s cubic-bezier(.2,.7,.2,1), top .5s cubic-bezier(.2,.7,.2,1),
              width .5s cubic-bezier(.2,.7,.2,1), height .5s cubic-bezier(.2,.7,.2,1), border-radius .3s ease; }
.spot__hole::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; border: 2px solid var(--ink-inverse); opacity: .75; }
.spot__hole.is-rect { border-radius: 18px; }

/* Takes every tap, except the one target. */
.catcher { position: absolute; inset: 0; z-index: 31; }
.hot { position: absolute; z-index: 32; display: none; margin: 0; padding: 0; border: 0; background: transparent;
  border-radius: 999px; cursor: pointer; }
.hot:focus-visible { outline: 3px solid var(--ink-inverse); }

.arrow { position: absolute; z-index: 33; width: 24px; height: 30px; margin: -15px 0 0 -12px; opacity: 0;
  transform: rotate(var(--rot, 0deg)); transition: opacity .3s ease; pointer-events: none; }
.arrow.on { opacity: 1; }
.arrow svg { display: block; width: 100%; height: 100%; fill: none; stroke: var(--surface); stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
  animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(3px); } 50% { transform: translateY(-3px); } }

/* ---- Card ---------------------------------------------------------------- */
.card { position: absolute; z-index: 33; width: max-content; max-width: min(320px, 80%);
  background: var(--surface); color: var(--ink); border-radius: 12px; box-shadow: var(--shadow-modal);
  padding: 14px 16px; transition: left .4s ease, top .4s ease, opacity .2s ease; }
.card--hidden { opacity: 0; pointer-events: none; }
.card__text { margin: 0; font-size: 16px; }
.card__pulse + .card__text { margin-top: 6px; }
.card__pulse { display: flex; align-items: center; gap: 8px; font: 700 13px/1 var(--font-sans);
  letter-spacing: .06em; text-transform: uppercase; color: var(--primary); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--primary-tint); } 100% { box-shadow: 0 0 0 11px transparent; } }
.card__next { display: block; margin: 10px 0 0 auto; font: 600 15px/1 var(--font-sans); color: var(--ink-inverse);
  background: var(--primary); border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer; }
.card > .card__next:first-child { margin-top: 0; }
.card__next:hover { background: var(--primary-strong); }
.card--end { max-width: min(420px, 90%); padding: 24px; text-align: center; }
.card__title { margin: 0; font: 700 24px/1.2 var(--font-sans); }
.card__ctas { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.card__cta { font: 600 16px/1 var(--font-sans); text-decoration: none; border-radius: 999px; padding: 13px 20px;
  color: var(--primary); border: 1.5px solid var(--primary); }
.card__cta--primary { background: var(--primary); color: var(--ink-inverse); }

/* ---- «Open an AI service» ---------------------------------------------- */
.picker { position: absolute; z-index: 25; left: 50%; top: 50%; width: 300px; max-width: 86%;
  transform: translate(-50%, -46%) scale(.97); opacity: 0; transition: opacity .25s ease, transform .25s ease;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-modal); padding: 18px; pointer-events: none; }
.picker.on { opacity: 1; transform: translate(-50%, -50%); }
.picker__title { margin: 0 0 12px; font: 700 18px/1.3 var(--font-sans); color: var(--ink); }
.picker__list { display: grid; gap: 8px; }
.picker__opt img { flex: none; width: 22px; height: 22px; }
.picker__opt { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--rule-strong); border-radius: 10px;
  font: 600 15px/1.2 var(--font-sans); color: var(--ink-2); background: var(--surface); }
.picker__opt--demo { border-color: var(--tour-chat-logo); color: var(--tour-chat-logo); }

/* ---- The pretend AI chat ------------------------------------------------ */
.chat { position: absolute; z-index: 20; display: flex; flex-direction: column;
  background: var(--tour-chat-bg); color: var(--tour-chat-ink); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.28), 0 0 0 1px rgba(0,0,0,.06); font: 15px/1.5 var(--font-sans);
  overflow: hidden; opacity: 0; transform: translateY(14px) scale(.97); transition: opacity .3s ease, transform .3s ease; }
.chat.on { opacity: 1; transform: none; }
.stage--desktop .chat { right: 28px; top: 50px; width: 440px; height: 640px; }
.stage--mobile .chat { left: 8px; right: 8px; bottom: 8px; top: 72px; }
.chat__hd { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--tour-chat-line); }
.chat__logo { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--tour-chat-logo); color: var(--tour-chat-bg);
  display: grid; place-items: center; font-size: 13px; }
.chat__name { font-weight: 650; }
.chat__sub { font-size: 12px; color: var(--tour-chat-muted); }
.chat__x { margin-left: auto; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--tour-chat-muted); font-size: 15px; }
.chat__msgs { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.chat__empty { margin: auto; color: var(--tour-chat-ink); font-size: 20px; font-weight: 600; text-align: center; }
.chat__u { align-self: flex-end; max-width: 82%; background: var(--tour-chat-user); border-radius: 16px 16px 4px 16px; padding: 9px 14px; }
.chat__u.is-paste { background: none; padding: 0; }
.chat__b { display: flex; gap: 10px; max-width: 95%; }
.chat__b .chat__logo { width: 24px; height: 24px; font-size: 12px; margin-top: 2px; }
.chat__t { min-width: 0; }
.chat__h { display: block; font-size: 16px; margin: 2px 0 4px; }
.chat__hr { border: 0; border-top: 1px solid var(--tour-chat-line); margin: 6px 0; }
.chat__row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; padding: 2px 0; border-bottom: 1px solid var(--tour-chat-line); }
.chat__li { display: block; padding-left: 1em; text-indent: -.7em; }
.chat__li::before { content: "• "; }
.chat__chip { background: var(--tour-chat-bg); border: 1px solid var(--tour-chat-line); border-radius: 10px; padding: 8px 10px;
  font-size: 12px; color: var(--tour-chat-muted); width: 250px; max-width: 100%; box-sizing: border-box; }
.chat__chip i { font-style: normal; font-weight: 600; color: var(--tour-chat-ink); display: block; margin-bottom: 3px; }
.chat__chip pre { margin: 0; font: 11px/1.35 ui-monospace, Menlo, monospace; white-space: pre-wrap; max-height: 44px; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent); }
.chat__chip[hidden] { display: none; }
.chat__dots span { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: var(--tour-chat-send); animation: dots 1s infinite; }
.chat__dots span:nth-child(2) { animation-delay: .15s; } .chat__dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.chat__in { margin: 8px 12px 4px; border: 1px solid var(--tour-chat-line); border-radius: 14px; padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 6px; }
.chat__field { min-height: 24px; font-size: 15px; color: var(--tour-chat-ink); }
.chat__field.ph { color: var(--tour-chat-muted); }
.chat__bar { display: flex; align-items: center; gap: 8px; color: var(--tour-chat-muted); font-size: 18px; }
.chat__pastebtn { margin-right: auto; font: 600 14px/1 var(--font-sans); color: var(--tour-chat-ink); background: var(--tour-chat-user);
  border: 1px solid var(--tour-chat-line); border-radius: 999px; padding: 8px 14px; }
.chat__pastebtn[hidden] { display: none; }
.chat__pastebtn[hidden] + .chat__send { margin-left: auto; }
.chat__send { width: 32px; height: 32px; border-radius: 50%; background: var(--tour-chat-send); color: var(--tour-chat-bg);
  font-size: 16px; display: grid; place-items: center; }
.chat__send.ready { background: var(--tour-chat-ink); }
.chat__note { margin: 0 12px 10px; font-size: 11.5px; color: var(--tour-chat-muted); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .spot__hole, .card, .chat { transition: none; }
  .arrow svg { animation: none; }
}

/* ---- «Facts, concepts and skills»: each word boxed like its node type -- */
/* Same fill, border and corners as .node-box.type-* in the engine's tree.css
   (fact 2px, concept 10px, skill 26px), only small: just around the word. */
.nt { display: inline-block; padding: 0 .4em; line-height: 1.35; border: 1.5px solid; white-space: nowrap; }
.nt--fact    { border-radius: 2px;  background: color-mix(in srgb, var(--blue) 24%, var(--surface));  border-color: var(--blue); }
.nt--concept { border-radius: 10px; background: var(--primary-tint); border-color: color-mix(in srgb, var(--primary) 55%, transparent); }
.nt--skill   { border-radius: 26px; background: color-mix(in srgb, var(--amber) 40%, var(--surface)); border-color: var(--amber); padding: 0 .55em; }
