/* Designloop — motion artifacts.
   The hero stage plays short product stories with UI cards (like a live product demo).
   Ink tiles are hand-drawn SVG scenes. Every scene shows a composed still frame
   without JavaScript, with reduced motion, offscreen and when paused. */

/* ───────── Stage ───────── */
/* Three rows straight on the page: the scenario tabs, the coloured
   screen where the story plays, and the steps underneath. */
.stage {
  --screen-pad: 32px;
  position: relative; width: 100%; max-width: 1120px; isolation: isolate;
  container-type: inline-size;
}

.stage-screen {
  padding: var(--screen-pad);
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--tile-clay);
  transition: background-color 700ms var(--ease-in-out);
}
.stage[data-scenario='modernise'] .stage-screen { background: var(--tile-sky); }
.stage-viewport {
  --canvas-w: 920px;
  --canvas-h: 530px;
  position: relative;
  width: calc(var(--canvas-w) * var(--k, 1));
  height: calc(var(--canvas-h) * var(--k, 1));
  margin: 0 auto;
}
.stage-canvas { position: absolute; left: 0; top: 0; width: var(--canvas-w); height: var(--canvas-h); transform: scale(var(--k, 1)); transform-origin: 0 0; }
.scenario { position: absolute; inset: 0; pointer-events: none; }

/* A short ink line above the selected tab marks the scenario.
   Pause stays at the right end of the same row. */
.stage-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 18px; }
.stage-tabs { position: relative; grid-column: 2; display: flex; gap: 28px; }
.stage-tabs button { padding: 14px 0 0; border: 0; background: transparent; color: var(--muted); font-size: var(--text-sm); font-weight: 500; white-space: nowrap; transition: color var(--dur-ui) ease; }
.stage-tabs button:hover, .stage-tabs button[aria-pressed='true'] { color: var(--ink); }
.tab-indicator { position: absolute; top: 0; height: 2px; left: var(--bl, 0); right: var(--br, 0); background: var(--ink); transition: left 520ms var(--ease-out), right 520ms var(--ease-out); }
html:not(.js) .tab-indicator { display: none; }
html:not(.js) .stage-tabs button[aria-pressed='true'] { box-shadow: inset 0 2px var(--ink); }
.tab-indicator.is-forward { transition-duration: 620ms, 360ms; }
.tab-indicator.is-back { transition-duration: 360ms, 620ms; }
.tab-indicator.is-instant { transition: none; }

/* Services stay readable independently of the product illustration. */
.stage-services { margin-top: 40px; }
.audience-services { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 36px; }
.audience-services[hidden] { display: none; }
.audience-services li { color: var(--muted); font-size: var(--text-sm); line-height: 1.6; }
.service-icon { width: 18px; height: 18px; margin-bottom: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.service-title { margin-bottom: 8px; font-family: var(--sans); font-size: var(--text-md); font-weight: 600; line-height: 1.4; color: var(--ink); }
.motion-toggle, .tile-toggle { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border: 1px solid rgb(23 23 22 / 10%); border-radius: 50%; background: rgb(255 255 255 / 70%); color: var(--ink); backdrop-filter: blur(6px); transition: background-color var(--dur-micro) ease, opacity var(--dur-ui) ease; }
.motion-toggle:hover, .tile-toggle:hover { background: #fff; }
.motion-toggle[hidden], .tile-toggle[hidden] { display: none; }
.motion-toggle svg, .tile-toggle svg { width: 14px; height: 14px; fill: currentColor; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.motion-toggle .icon-play, .tile-toggle .icon-play, .motion-toggle[aria-pressed='true'] .icon-pause, .tile-toggle[aria-pressed='true'] .icon-pause { display: none; }
.motion-toggle[aria-pressed='true'] .icon-play, .tile-toggle[aria-pressed='true'] .icon-play { display: block; }
.motion-toggle .icon-pause, .tile-toggle .icon-pause { fill: none; }
.tile-toggle { position: absolute; right: 14px; bottom: 14px; opacity: 0; }
.tile:hover .tile-toggle, .tile-toggle:focus-visible, .tile-toggle[aria-pressed='true'] { opacity: 1; }
@media (hover: none) { .tile-toggle { opacity: .8; } }
.tile-night .tile-toggle { background: rgb(255 255 255 / 14%); border-color: rgb(255 255 255 / 16%); color: #f3f1eb; }
.stage-head .motion-toggle { grid-column: 3; justify-self: end; width: 30px; height: 30px; margin-top: 14px; border-color: var(--line-strong); background: transparent; backdrop-filter: none; }
.stage-head .motion-toggle:hover { border-color: var(--ink); }
.stage-head .motion-toggle svg { width: 12px; height: 12px; }

/* ───────── Artifact cards ───────── */
.art-card {
  position: absolute; left: var(--x); top: var(--y); width: var(--w);
  padding: 16px 18px;
  background: var(--card); color: var(--ink);
  border: 1px solid rgb(23 23 22 / 8%); border-radius: 14px;
  box-shadow: 0 1px 2px rgb(23 23 22 / 5%), 0 22px 44px -24px rgb(23 23 22 / 34%);
  font-size: 13.5px; line-height: 1.5;
  opacity: 0; transform: translateY(14px) scale(.965);
  transition: opacity 500ms var(--ease-out), transform 650ms var(--ease-out);
}
.art-card.on { opacity: 1; transform: none; }
.art-card.is-dark { background: var(--night); color: #e9e7e0; border-color: rgb(255 255 255 / 8%); }
.card-row { display: flex; align-items: center; gap: 10px; }
.card-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.avatar { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, #d9cbb3, #b9a88c); }
.tags { display: flex; gap: 6px; margin-top: 12px; }
.tags span { padding: 3px 8px; border-radius: 6px; background: var(--paper-2); font-size: 11.5px; color: var(--ink-2); }
.pill { padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 500; white-space: nowrap; }

/* State swaps inside a card share one grid cell and crossfade. */
.status, .count { display: inline-grid; margin-left: auto; }
.status > *, .count > * { grid-area: 1 / 1; justify-self: end; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: opacity 300ms ease, transform 400ms var(--ease-out); }
.status > :not(.on), .count > :not(.on) { opacity: 0; transform: translateY(4px); }
.status { font-size: 12px; font-weight: 500; }
.status-live { color: var(--muted); }
.status-done { color: #2f6f4b; }
.status svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: #d08a3e; box-shadow: 0 0 0 0 rgb(208 138 62 / 50%); }
.is-playing .pulse { animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 6px rgb(208 138 62 / 0%); } 100% { box-shadow: 0 0 0 0 rgb(208 138 62 / 0%); } }
.count { font-size: 12px; font-weight: 500; }
.count-before { color: #b4483c; }
.count-after { color: #2f6f4b; }

/* Streamed text: words arrive like a live response. */
.stream .stream-word { opacity: 0; transition: opacity 260ms ease; }
.on .stream .stream-word, .stream.on .stream-word { opacity: 1; transition-delay: calc(var(--w) * 45ms + var(--stream-delay, 280ms)); }

/* Staggered children */
.flow > *, .tokens li, .checks li { opacity: 0; transform: translateY(6px); transition: opacity 400ms ease, transform 500ms var(--ease-out); }
.on .flow > *, .on .tokens li, .on .checks li { opacity: 1; transform: none; transition-delay: calc(var(--d, 0) * 150ms + 250ms); }

/* Scenario A — request */
.a-req { --x: 40px; --y: 34px; --w: 340px; }
.a-req .stream { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--ink); }

/* Scenario A — flow */
.a-flow { --x: 410px; --y: 34px; --w: 470px; }
.flow { display: flex; align-items: center; margin-top: 14px; }
.flow-node { padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--paper); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.flow-node.is-key { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.flow-edge { flex: 1; min-width: 18px; height: 1.5px; margin: 0 6px; background: var(--ink); opacity: 1 !important; transform: scaleX(0) !important; transform-origin: left center; transition: transform 500ms var(--ease-out) !important; }
.on .flow-edge { transform: scaleX(1) !important; transition-delay: calc(var(--d) * 150ms + 250ms) !important; }

/* Scenario A — interface */
.a-ui { --x: 380px; --y: 132px; --w: 500px; padding: 0; overflow: visible; }
.window-bar { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; }
.window-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--paper-3); }
.window-url { margin: 0 auto; padding-right: 40px; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.ui-body { display: grid; grid-template-columns: 112px 1fr; min-height: 290px; }
.ui-side { display: grid; align-content: start; gap: 12px; padding: 18px 16px; background: #fcfbf9; border-bottom-left-radius: 14px; }
.ui-side b { display: block; height: 8px; border-radius: 4px; background: var(--paper-3); }
.ui-side b:nth-child(2) { width: 70%; }
.ui-side b:nth-child(3) { width: 85%; }
.ui-side b:nth-child(4) { width: 55%; }
.ui-side b.is-active { background: #d9d4c8; }
.ui-main { display: grid; align-content: start; justify-items: start; padding: 20px 28px 24px; }
.ui-step { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.ui-title { margin: 6px 0 16px; font-family: var(--serif); font-weight: 400; font-size: 24px; letter-spacing: -0.015em; line-height: 1.15; }
.ui-label { font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.ui-input { display: flex; align-items: center; width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 14px; }
.ui-input .stream { --stream-delay: 900ms; white-space: nowrap; }
.caret { display: inline-block; width: 1.5px; height: 17px; margin-left: 2px; background: var(--ink); opacity: 0; }
.on .caret { opacity: 1; }
.is-playing .on .caret { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ui-segment { display: inline-flex; gap: 2px; margin-top: 12px; padding: 3px; border-radius: 9px; background: var(--paper-2); font-size: 12.5px; }
.ui-segment span { padding: 5px 12px; border-radius: 7px; color: var(--muted); }
.ui-segment .is-on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgb(23 23 22 / 10%); }
.ui-cta { margin-top: 34px; }
.ui-button { display: inline-flex; align-items: center; height: 38px; padding: 0 18px; border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 500; }

/* Design-tool selection around the primary button */
.sel { position: relative; display: inline-block; }
.sel-box { position: absolute; inset: -6px; border: 1.5px solid var(--accent); opacity: 0; transform: scale(1.08); transition: opacity 250ms ease, transform 400ms var(--ease-out); }
.sel-box i { position: absolute; width: 7px; height: 7px; background: #fff; border: 1.5px solid var(--accent); }
.sel-box i:nth-child(1) { left: -4px; top: -4px; }
.sel-box i:nth-child(2) { right: -4px; top: -4px; }
.sel-box i:nth-child(3) { left: -4px; bottom: -4px; }
.sel-box i:nth-child(4) { right: -4px; bottom: -4px; }
.sel-tag { position: absolute; left: -7px; top: -32px; padding: 3px 7px; border-radius: 4px; background: var(--accent); color: #fff; font-family: var(--mono); font-size: 10.5px; white-space: nowrap; opacity: 0; transform: translateY(4px); transition: opacity 250ms ease, transform 400ms var(--ease-out); }
.a-ui.on .sel-box, .a-ui.on .sel-tag { opacity: 1; transform: none; transition-delay: 2100ms; }

.cursor { position: absolute; left: 0; top: 0; width: 22px; height: 22px; overflow: visible; opacity: 0; transform: translate(470px, 330px); }
.cursor path { fill: var(--accent); stroke: #fff; stroke-width: 1.6; stroke-linejoin: round; }
.a-ui.on .cursor { opacity: 1; transform: translate(238px, 284px); transition: opacity 300ms ease 600ms, transform 1200ms var(--ease-in-out) 700ms; }
.is-playing .a-ui.on .cursor { animation: cursor-click 360ms ease 1950ms; }
@keyframes cursor-click { 50% { scale: .82; } }

/* Scenario A — code */
.a-code { --x: 40px; --y: 222px; --w: 410px; padding: 14px 18px 16px; }
.code-bar { padding-bottom: 10px; font-size: 11px; color: #8f8d85; }
.code { margin: 10px 0 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.75; color: #d9d7cf; }
.code code { white-space: normal; }
.code .ln { display: block; white-space: pre; overflow: hidden; text-overflow: clip; margin-inline: -18px; padding-inline: 18px; opacity: 0; transform: translateX(-4px); transition: opacity 300ms ease, transform 400ms var(--ease-out), background-color 400ms ease, box-shadow 400ms ease; }
.a-code.on .ln { opacity: 1; transform: none; transition-delay: calc(var(--l) * 90ms + 250ms); }
.a-code.on .ln.is-hl { background: rgb(59 91 219 / 26%); box-shadow: inset 2px 0 0 #8aa0ff; transition-delay: calc(var(--l) * 90ms + 250ms), calc(var(--l) * 90ms + 250ms), 1500ms, 1500ms; }
.code .k { color: #d7b1ea; }
.code .f { color: #f0c39a; }
.code .t { color: #a9bdf7; }
.code .p { color: #b9d2c6; }
.code .s { color: #e9dfcb; }

/* Scenario A — ship */
.a-ship { --x: 460px; --y: 452px; --w: 420px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.ship-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--ink); }
.ship-icon svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.a-ship strong { display: block; font-size: 13.5px; font-weight: 500; }
.ship-meta { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ship-meta ins { color: #2f7a4f; text-decoration: none; }
.ship-meta del { color: #b4483c; text-decoration: none; }
.a-ship .pill { margin-left: auto; }

/* Scenario B — audit */
.b-audit { --x: 30px; --y: 30px; --w: 420px; }
.audit-field { position: relative; height: 190px; margin-top: 14px; border-radius: 10px; background: var(--paper-2); overflow: hidden; }
.messy { position: absolute; inset: 0; transform-origin: 50% 50%; transition: transform 700ms var(--ease-in-out), opacity 500ms ease 150ms; }
.messy:not(.on) { transform: scale(.25); opacity: 0; }
.m { position: absolute; left: var(--l); top: var(--t); padding: 6px 12px; font-size: 12.5px; white-space: nowrap; rotate: var(--r); }
.is-playing .messy.on .m { animation: jitter 2.4s ease-in-out infinite alternate; }
.m:nth-child(2n) { animation-delay: -1.2s; }
.m:nth-child(3n) { animation-delay: -.7s; }
@keyframes jitter { to { translate: 0 -3px; rotate: calc(var(--r) * -0.6); } }
.m1 { --l: 7%; --t: 12%; --r: -6deg; background: #3b5bdb; color: #fff; border-radius: 4px; }
.m2 { --l: 48%; --t: 8%; --r: 4deg; background: #2f2f2c; color: #fff; border-radius: 20px; }
.m3 { --l: 80%; --t: 30%; --r: -3deg; background: #fff; border: 2px solid #7a7a75; border-radius: 0; }
.m4 { --l: 12%; --t: 46%; --r: 3deg; background: #6b8afd; color: #fff; border-radius: 8px; font-weight: 700; }
.m5 { --l: 44%; --t: 40%; --r: -2deg; background: #e1ded6; color: var(--ink-2); border-radius: 14px; }
.m6 { --l: 66%; --t: 62%; --r: 5deg; border: 1px dashed #3b5bdb; color: #3b5bdb; border-radius: 6px; }
.m7 { --l: 5%; --t: 76%; --r: -4deg; background: #222; color: #fff; border-radius: 2px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.m8 { --l: 38%; --t: 72%; --r: 2deg; background: #5d7bf0; color: #fff; border-radius: 999px; }
.tidy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; opacity: 0; transform: scale(.92); transition: opacity 400ms ease, transform 600ms var(--ease-out); }
.tidy.on { opacity: 1; transform: none; transition-delay: 450ms; }
.btn-primary, .btn-secondary, .btn-ghost { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 10px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-secondary { background: var(--card); border: 1px solid var(--line-strong); color: var(--ink); }
.btn-ghost { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }

/* Scenario B — tokens */
.b-tokens { --x: 520px; --y: 60px; --w: 340px; }
.tokens { margin-top: 10px; font-size: 12px; }
.tokens li { display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 10px; padding: 7px 0; }
.tokens li span { color: var(--muted); }
.sw { width: 16px; height: 16px; border-radius: 4px; background: var(--c); }
.sw.is-light { border: 1px solid var(--line-strong); }
.sw.is-radius { background: none; border-top: 1.5px solid var(--ink); border-left: 1.5px solid var(--ink); border-radius: 8px 0 0 0; }
.sw.is-space { background: linear-gradient(var(--accent), var(--accent)) center / 100% 4px no-repeat; border-inline: 1.5px solid var(--accent); border-radius: 0; height: 12px; }

/* Scenario B — documentation */
.b-doc { --x: 150px; --y: 262px; --w: 400px; }
.doc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.doc-head h4 { font-family: var(--serif); font-weight: 400; font-size: 22px; letter-spacing: -0.015em; }
.doc-path { font-size: 11px; color: var(--faint); }
.doc-tabs { display: flex; gap: 16px; margin: 10px 0 14px; padding-bottom: 8px; font-size: 12.5px; color: var(--muted); }
.doc-tabs span { position: relative; }
.doc-tabs .is-on { color: var(--ink); font-weight: 500; }
.doc-tabs .is-on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -9px; height: 1.5px; background: var(--ink); }
.doc-preview { display: flex; justify-content: center; gap: 10px; padding: 18px; border-radius: 10px; background: var(--paper-2); }
.doc-text { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.doc-props { margin-top: 4px; font-size: 11px; color: var(--muted); }

/* Scenario B — agent */
.b-agent { --x: 540px; --y: 300px; --w: 340px; }
.agent-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--ink); color: var(--paper); font-size: 10px; }
.agent-prompt { margin: 12px 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--paper-2); font-size: 13.5px; }
.checks { display: grid; gap: 7px; }
.checks li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checks svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.b-agent .checks li { transition-delay: 0ms; }
.b-agent.on .checks li { transition-delay: calc(var(--d) * 220ms + 1500ms); }

/* Medium stages keep service descriptions in two columns. */
@container (720px < width <= 900px) {
  .audience-services { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 24px; }
}

/* Compact stage: a taller canvas with cards stacked for phones. */
@media (max-width: 760px) {
  .stage { --screen-pad: 10px; }
}
@container (max-width: 720px) {
  .stage-viewport { --canvas-w: 360px; --canvas-h: 690px; }
  .stage-head { margin-bottom: 14px; }
  .stage-tabs { gap: 20px; }
  .stage-services { margin-top: 24px; }
  .audience-services { grid-template-columns: 1fr; gap: 24px; }
  .service-icon { margin-bottom: 8px; }
  .a-req { --x: 8px; --y: 6px; --w: 300px; }
  .a-req .tags { display: none; }
  .a-flow { display: none; }
  .a-ui { --x: 30px; --y: 118px; --w: 322px; }
  .ui-body { grid-template-columns: 1fr; min-height: 0; }
  .ui-side { display: none; }
  .ui-main { padding: 16px 20px 22px; }
  .a-ui.on .cursor { transform: translate(118px, 278px); }
  .a-code { --x: 4px; --y: 424px; --w: 330px; }
  .code { font-size: 11px; }
  .a-ship { --x: 28px; --y: 628px; --w: 326px; }
  .a-ship .pill { display: none; }
  .b-audit { --x: 8px; --y: 6px; --w: 330px; }
  .audit-field { height: 170px; }
  .b-tokens { --x: 46px; --y: 214px; --w: 306px; }
  .b-doc { display: none; }
  .b-agent { --x: 14px; --y: 452px; --w: 320px; }
}

/* ───────── Ink illustrations ───────── */
.ink { width: 86%; height: auto; overflow: visible; }
.ink .fill-paper { fill: #fff; stroke: var(--ink); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.ink .fill-ink { fill: var(--ink); }
.ink .fill-accent { fill: var(--accent); stroke: var(--ink); stroke-width: 2.6; stroke-linejoin: round; }
.ink .line { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ink .line-paper { fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.ink.is-light .line { stroke: #f3f1eb; }
.ink.is-light .fill-paper { fill: #f3f1eb; stroke: #f3f1eb; }
.ink.is-light .fill-accent { stroke: #f3f1eb; }
.ink .fill-ash { fill: var(--ash); stroke: #f3f1eb; stroke-width: 2.6; stroke-linejoin: round; }
.ink g, .ink path, .ink rect, .ink circle { transform-box: fill-box; transform-origin: center; }

/* Subscribe — the cursor picks the plan, a badge confirms it. */
.sub-card { rotate: -5deg; }
.sub-check { stroke-dasharray: 1; stroke-dashoffset: 0; }
.is-playing .sub-card { animation: sub-card 6s var(--ease-in-out) infinite; }
.is-playing .sub-cursor { animation: sub-cursor 6s var(--ease-in-out) infinite; }
.is-playing .sub-badge { animation: sub-badge 6s var(--ease-out) infinite; }
.is-playing .sub-check { animation: sub-check 6s ease infinite; }
@keyframes sub-card { 0%, 36% { translate: 0 0; scale: 1; } 40% { scale: .97; } 46% { scale: 1; } 70% { translate: 0 -4px; } 100% { translate: 0 0; } }
@keyframes sub-cursor { 0% { translate: 54px 46px; opacity: 0; } 10% { opacity: 1; } 34% { translate: 0 0; scale: 1; } 39% { scale: .84; } 45% { scale: 1; } 78% { translate: 0 0; opacity: 1; } 92%, 100% { translate: 54px 46px; opacity: 0; } }
@keyframes sub-badge { 0%, 40% { scale: 0; } 50% { scale: 1.14; } 56%, 86% { scale: 1; } 94%, 100% { scale: 0; } }
@keyframes sub-check { 0%, 48% { stroke-dashoffset: 1; } 60%, 100% { stroke-dashoffset: 0; } }

/* Request — a thought becomes a wireframe, line by line. */
.req-draw { stroke-dasharray: 1; stroke-dashoffset: 0; }
.is-playing .req-bubble { animation: float 4s var(--ease-in-out) infinite alternate; }
.is-playing .req-draw { animation: req-draw 7s ease infinite; }
.is-playing .req-d2 { animation-name: req-draw-2; }
.is-playing .req-d3 { animation-name: req-draw-3; }
.is-playing .req-d4 { animation-name: req-draw-4; }
.is-playing .req-pop { animation: req-pop 7s var(--ease-out) infinite; }
@keyframes float { to { translate: 0 -5px; } }
@keyframes req-draw { 0%, 6% { stroke-dashoffset: 1; opacity: 1; } 24%, 86% { stroke-dashoffset: 0; opacity: 1; } 94%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes req-draw-2 { 0%, 24% { stroke-dashoffset: 1; opacity: 1; } 34%, 86% { stroke-dashoffset: 0; opacity: 1; } 94%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes req-draw-3 { 0%, 34% { stroke-dashoffset: 1; opacity: 1; } 44%, 86% { stroke-dashoffset: 0; opacity: 1; } 94%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes req-draw-4 { 0%, 44% { stroke-dashoffset: 1; opacity: 1; } 52%, 86% { stroke-dashoffset: 0; opacity: 1; } 94%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes req-pop { 0%, 56% { scale: 0; } 62% { scale: 1.2; } 66%, 86% { scale: 1; } 94%, 100% { scale: 0; } }

/* Receive — code turns into interface. */
.rec-code { opacity: 0; }
.is-playing .rec-code { animation: rec-code 7s var(--ease-in-out) infinite; }
.is-playing .rec-ui { animation: rec-ui 7s var(--ease-in-out) infinite; }
@keyframes rec-code { 0%, 36% { opacity: 1; scale: 1; } 44%, 90% { opacity: 0; scale: .9; } 98%, 100% { opacity: 1; scale: 1; } }
@keyframes rec-ui { 0%, 40% { opacity: 0; scale: .94; } 50%, 86% { opacity: 1; scale: 1; } 94%, 100% { opacity: 0; scale: .94; } }

/* The wire-haired dachshund drums on the laptop, alternating its front paws. */
.ink .dog-camera { transform-box: view-box; transform-origin: 160px 118px; transform: scale(1.35); }
.ink .dog-head { transform-box: view-box; transform-origin: 207px 114px; }
.ink .dog-paw { transform-box: view-box; }
.ink .dog-paw-left { transform-origin: 189px 121px; }
.ink .dog-paw-right { transform-origin: 215px 123px; }
.ink .dog-keys { stroke-width: 1.6; }
.is-playing .dog-camera { animation: dog-zoom calc(var(--dur-micro) * 48) var(--ease-in-out) infinite; }
.is-playing .dog-paw { animation: dog-tap calc(var(--dur-micro) * 2) var(--ease-in-out) infinite; }
.is-playing .dog-paw-right { animation-delay: calc(var(--dur-micro) * -1); }
.is-playing .dog-head { animation: dog-nod calc(var(--dur-micro) * 4) var(--ease-in-out) infinite; }
@keyframes dog-tap { 0%, 10%, 55%, 100% { transform: rotate(0deg); } 25%, 40% { transform: rotate(20deg); } }
@keyframes dog-nod { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(1px) rotate(1.5deg); } }
@keyframes dog-zoom { 0%, 20%, 42.5%, 100% { transform: scale(1.35); } 27.5%, 35% { transform: scale(1.65); } }

/* Paused globally or by the visitor: freeze everything in place. */
.motion-paused .is-playing * { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) {
  .art-card, .art-card *, .stream .stream-word { transition: none !important; }
}
