/* Mød Milo — scroll-driven explainer for the coming family agent (milo-agent-motion.js).
   Same sticker language as Milos rejse: ink outlines, cream paper, hard shadows. */

.milo-agent {
  --ink: #172033;
  --cream: #fff8ec;
  --butter: #ffe7b0;
  --muted: #5a6479;
  --blue: #2563eb;
  --gold: #fbbf24;
  --coral: #f26b5b;
  --green: #22c55e;
  --gutter: clamp(1rem, 4vw, 2.75rem);
  --tx: 0;
  --ty: 0;
  position: relative;
  color: #fff;
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(60rem 40rem at 78% 40%, rgba(127, 176, 255, 0.35), transparent 60%),
    radial-gradient(40rem 30rem at 10% 90%, rgba(251, 191, 36, 0.14), transparent 60%),
    linear-gradient(160deg, #1f55dc 0%, #1a3fae 55%, #142f86 100%);
}

.milo-agent__stage {
  position: relative;
  overflow: hidden;
  padding: 4rem var(--gutter);
}

/* The homepage hero wrapper clips with overflow: hidden, which makes it the
   sticky container and freezes the stage. clip clips the same without that. */
.site-ui.homepage .homepage-blue-stack:has(> .milo-agent) {
  overflow: clip;
}

/* dotted paper grid + grain */
.milo-agent__stage::before,
.milo-agent__stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.milo-agent__stage::before {
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1.3px, transparent 1.5px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse at 65% 50%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at 65% 50%, #000 30%, transparent 75%);
}

.milo-agent__stage::after {
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.milo-agent__fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  display: none;
}

.milo-agent.is-live .milo-agent__fx {
  display: block;
}

.milo-agent__layout {
  position: relative;
  z-index: 1;
  max-width: 76rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
  grid-template-areas: "copy demo" "foot demo";
  grid-template-rows: auto auto;
  gap: 1.5rem clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.milo-agent__copy { grid-area: copy; align-self: end; }
.milo-agent__demo { grid-area: demo; }
.milo-agent__foot { grid-area: foot; align-self: start; }

/* ---------- copy ---------- */

.milo-agent__kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem 0.32rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 2px 2px 0 var(--ink);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.milo-agent__kicker::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 2px var(--ink);
  animation: ma-pulse 1.6s ease-in-out infinite;
}

.milo-agent__copy h2 {
  margin: 0.85rem 0 0;
  max-width: 12ch;
  font-size: clamp(2.1rem, 1.1rem + 3.3vw, 3.9rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: #fff;
  text-wrap: balance;
  text-shadow: 0 2px 0 rgba(23, 32, 51, 0.5), 0 12px 40px rgba(6, 12, 36, 0.4);
}

.milo-agent .milo-agent__lead {
  margin: 0.9rem 0 0;
  max-width: 30ch;
  font-size: 1.08rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
}

.milo-agent__steps {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.milo-agent__step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: start;
  padding: 0.95rem 1.1rem 1.05rem;
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  background: var(--cream);
  box-shadow: 5px 6px 0 var(--ink);
  color: var(--ink);
}

.milo-agent__num {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

.milo-agent__step[data-step="1"] .milo-agent__num { background: var(--gold); color: var(--ink); }
.milo-agent__step[data-step="2"] .milo-agent__num { background: #7fb0ff; color: var(--ink); }
.milo-agent__step[data-step="3"] .milo-agent__num { background: var(--coral); }
.milo-agent__step[data-step="4"] .milo-agent__num { background: var(--green); color: var(--ink); }

.milo-agent .milo-agent__step h3 {
  margin: 0.12rem 0 0.28rem;
  font-size: 1.15rem;
  line-height: 1.2;
  font-weight: 800;
  color: var(--ink);
}

.milo-agent .milo-agent__step p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- footer ---------- */

.milo-agent__bar {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
}

.milo-agent .milo-agent__note {
  margin: 0.85rem 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.86);
}

.milo-agent .milo-agent__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-sizing: border-box;
  min-height: 2.75rem;
  margin-top: 1rem;
  padding: 0.6rem 1.15rem;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 4px 5px 0 var(--ink);
  color: var(--ink);
  font-weight: 800;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.milo-agent .milo-agent__cta::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.milo-agent .milo-agent__cta:hover {
  transform: translate(-1px, -2px);
  box-shadow: 5px 7px 0 var(--ink);
  color: var(--ink);
}

.milo-agent .milo-agent__cta:active {
  transform: translate(3px, 4px);
  box-shadow: 1px 1px 0 var(--ink);
}

.milo-agent .milo-agent__cta:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

/* ---------- demo window ---------- */

.milo-agent__demo {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
}

.milo-agent__rive {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.milo-agent.is-rive .ma-window,
.milo-agent.is-rive .ma-milo {
  display: none;
}

.milo-agent.is-rive .milo-agent__demo { min-height: 0; aspect-ratio: 900 / 640; }

.ma-window {
  position: relative;
  width: min(100%, 37rem);
  height: min(30rem, calc(100svh - 12rem));
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: var(--cream);
  box-shadow: 9px 11px 0 var(--ink);
  color: var(--ink);
  overflow: hidden;
  transform: perspective(1400px) rotateY(calc(var(--tx) * -5deg)) rotateX(calc(var(--ty) * 4deg));
  transition: transform 0.4s ease-out;
}

.ma-window__bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  height: 2.75rem;
  padding: 0 0.95rem;
  border-bottom: 2.5px solid var(--ink);
  background: var(--butter);
  font-size: 0.85rem;
  font-weight: 800;
}

.ma-window__bar i {
  width: 0.8rem;
  height: 0.8rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--coral);
}

.ma-window__bar i:nth-child(2) { background: var(--gold); }
.ma-window__bar i:nth-child(3) { background: #7fb0ff; margin-right: 0.35rem; }

.ma-status {
  margin-left: auto;
  padding: 0.16rem 0.55rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--green);
  font-size: 0.72rem;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.b-done .ma-status { opacity: 1; transform: none; }

.ma-window__body {
  position: relative;
  height: calc(100% - 2.75rem);
}

.ma-scene {
  position: absolute;
  inset: 1.35rem 1.4rem;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.milo-agent[data-step="0"] .ma-scene[data-scene="0"],
.milo-agent[data-step="1"] .ma-scene[data-scene="1"],
.milo-agent[data-step="2"] .ma-scene[data-scene="2"],
.milo-agent[data-step="3"] .ma-scene[data-scene="3"],
.milo-agent[data-step="4"] .ma-scene[data-scene="4"] {
  opacity: 1;
  transform: none;
}

.milo-agent .ma-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.milo-agent .ma-title {
  margin: 0 0 0.9rem;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* scene 0: the wish */
.ma-input {
  position: relative;
  min-height: 7.5rem;
  padding: 1rem 3.75rem 1rem 1.05rem;
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 -3px 0 rgba(23, 32, 51, 0.06);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.4;
}

.ma-caret {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  margin-left: 2px;
  vertical-align: -0.2em;
  background: var(--blue);
  animation: ma-blink 1s steps(1) infinite;
}

.ma-send {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  width: 2.5rem;
  height: 2.5rem;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.2s ease;
}

.ma-send::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.6rem;
  height: 0.6rem;
  border-left: 3px solid #fff;
  border-top: 3px solid #fff;
  transform: translate(-50%, -25%) rotate(45deg);
}

.b-sent .ma-send {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
  background: var(--gold);
}

.ma-ideas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.ma-ideas span {
  padding: 0.35rem 0.75rem;
  border: 2px dashed rgba(23, 32, 51, 0.35);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

/* beat-driven items: hidden until their beat class lands on the section */
.ma-req,
.ma-option,
.ma-bubble {
  opacity: 0;
  transform: translateX(-14px);
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.b-req1 [data-beat="req1"], .b-req2 [data-beat="req2"], .b-req3 [data-beat="req3"], .b-req4 [data-beat="req4"],
.b-opt1 [data-beat="opt1"], .b-opt2 [data-beat="opt2"], .b-opt3 [data-beat="opt3"],
.b-reply1 [data-beat="reply1"], .b-reply2 [data-beat="reply2"], .b-reply3 [data-beat="reply3"] {
  opacity: 1;
  transform: none;
}

/* scene 1: requirements */
.ma-reqs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.ma-req {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.8rem;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  font-weight: 700;
  font-size: 0.98rem;
}

.ma-check {
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3L15 6.5' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat,
    var(--green);
}

/* scene 2: research */
.ma-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  padding: 0.6rem 0.85rem;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease, box-shadow 0.3s ease;
}

.ma-option__name {
  display: grid;
  font-weight: 800;
  font-size: 0.95rem;
}

.ma-option__name small {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}

.ma-price {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ma-badge {
  position: absolute;
  top: -0.6rem;
  right: 0.7rem;
  padding: 0.08rem 0.5rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  opacity: 0;
  transform: scale(0.5) rotate(-6deg);
  transition: opacity 0.25s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.is-best .ma-badge { background: var(--gold); }
.is-out .ma-badge { background: var(--coral); color: #fff; }

.b-judged .ma-option.is-out {
  opacity: 0.5;
  transform: scale(0.97);
}

.b-judged .ma-option.is-out .ma-option__name,
.b-judged .ma-option.is-out .ma-price {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.b-judged .is-out .ma-badge,
.b-best .is-best .ma-badge {
  opacity: 1;
  transform: rotate(-3deg);
}

.b-best .ma-option.is-best {
  background: #fff6d6;
  box-shadow: 4px 4px 0 var(--ink);
  transform: translate(-2px, -2px);
}

.ma-draft {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding: 0.7rem 0.85rem 0.8rem;
  border: 2px dashed var(--ink);
  border-radius: 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.4s ease;
}

.b-draft .ma-draft { opacity: 1; transform: none; }

.ma-draft__title {
  font-size: 0.8rem;
  font-weight: 800;
}

.ma-draft i {
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(23, 32, 51, 0.16);
  transform-origin: left center;
  transform: scaleX(calc(var(--draft, 1) * 1));
}

.ma-draft i:nth-of-type(2) { width: 86%; transform: scaleX(clamp(0, calc(var(--draft, 1) * 2 - 0.5), 1)); }
.ma-draft i:nth-of-type(3) { width: 58%; transform: scaleX(clamp(0, calc(var(--draft, 1) * 3 - 2), 1)); }

/* scene 3: approval */
.ma-approval {
  position: relative;
  padding: 1.1rem 1.15rem 1.2rem;
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  background: #fff;
  box-shadow: 5px 6px 0 var(--ink);
}

.milo-agent .ma-approval .ma-title { margin-bottom: 0.6rem; }

.ma-approval dl {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.ma-approval dl div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1.5px dashed rgba(23, 32, 51, 0.2);
  font-size: 0.92rem;
}

.ma-approval dt { color: var(--muted); font-weight: 600; }
.ma-approval dd { margin: 0; font-weight: 800; text-align: right; }

.ma-actions {
  display: flex;
  gap: 0.6rem;
}

.ma-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.1rem;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--cream);
  box-shadow: 3px 4px 0 var(--ink);
  font-weight: 800;
  font-size: 0.95rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.2s ease;
}

.ma-btn--yes { background: var(--blue); color: #fff; }

.b-press .ma-btn--yes {
  transform: translate(3px, 4px);
  box-shadow: 0 0 0 var(--ink);
}

.b-approved .ma-btn--yes { background: var(--green); color: var(--ink); }

.ma-cursor {
  position: absolute;
  left: 60%;
  top: 55%;
  width: 2rem;
  height: 2.3rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 30'%3E%3Cpath d='M3 2l19 11.5-8.2 1.6 4.6 9.2-3.6 1.8-4.6-9.3L4 22.5z' fill='white' stroke='%23172033' stroke-width='2.4' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0;
  transform: translate(calc((1 - var(--cur, 1)) * 160px), calc((1 - var(--cur, 1)) * 110px));
  transition: opacity 0.25s ease;
  filter: drop-shadow(2px 3px 0 rgba(23, 32, 51, 0.35));
}

.b-cursor .ma-cursor { opacity: 1; }
.b-press .ma-cursor { scale: 0.88; }
.b-approved .ma-cursor { opacity: 0; transition-delay: 0.5s; }

.ma-stamp {
  position: absolute;
  right: 1rem;
  bottom: 0.9rem;
  padding: 0.2rem 0.7rem;
  border: 3px solid #15803d;
  border-radius: 8px;
  color: #15803d;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  transform: rotate(-12deg) scale(1.8);
  transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.b-approved .ma-stamp {
  opacity: 0.92;
  transform: rotate(-12deg) scale(1);
}

/* scene 4: replies + receipt */
.ma-count {
  padding: 0.15rem 0.55rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}

.ma-bubble {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: fit-content;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.9rem 0.5rem 0.5rem;
  border: 2px solid var(--ink);
  border-radius: 18px 18px 18px 6px;
  background: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.ma-bubble:nth-of-type(odd) { margin-left: 1.25rem; }

.ma-bubble i {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--c);
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 800;
}

.ma-receipt {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.9rem;
  padding: 0.8rem 0.95rem;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: #e9fbe9;
  box-shadow: 4px 5px 0 var(--ink);
  opacity: 0;
  transform: translateY(14px) rotate(1.5deg);
  transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.b-receipt .ma-receipt { opacity: 1; transform: rotate(-1deg); }

.ma-receipt b { display: block; font-size: 0.98rem; }
.ma-receipt small { font-size: 0.8rem; font-weight: 600; color: var(--muted); }

.ma-receipt__check {
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3L15 6.5' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 75% no-repeat,
    var(--green);
}

/* Milo beside the window */
.ma-milo {
  position: absolute;
  left: max(-3rem, calc(50% - 18.5rem - 4.75rem));
  bottom: -1.75rem;
  width: 10rem;
  height: 10rem;
  z-index: 2;
  pointer-events: none;
  animation: ma-bob 3.2s ease-in-out infinite;
}

.ma-milo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.8) rotate(-6deg);
  transform-origin: 50% 90%;
  transition: opacity 0.25s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 10px 12px rgba(6, 12, 36, 0.3));
}

.milo-agent[data-step="0"] .ma-milo [data-pose="0"],
.milo-agent[data-step="1"] .ma-milo [data-pose="1"],
.milo-agent[data-step="2"] .ma-milo [data-pose="2"],
.milo-agent[data-step="3"] .ma-milo [data-pose="3"],
.milo-agent[data-step="4"] .ma-milo [data-pose="4"] {
  opacity: 1;
  transform: none;
}

.b-done .ma-milo [data-pose="4"] { animation: ma-hop 1.4s ease-in-out infinite; }

/* ---------- JS running: sticky scroll story ---------- */

.milo-agent.is-live:not(.is-still) .milo-agent__track {
  height: 260vh;
}

.milo-agent.is-live:not(.is-still) .milo-agent__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  min-height: 36rem;
  padding: 0 var(--gutter);
}

.milo-agent.is-live:not(.is-still) .milo-agent__layout {
  height: 100%;
  padding: clamp(5rem, 11vh, 6.5rem) 0 clamp(1.5rem, 5vh, 2.75rem);
  box-sizing: border-box;
  align-content: center;
}

.milo-agent.is-live:not(.is-still) .milo-agent__steps {
  position: relative;
  display: block;
  min-height: 8.75rem;
}

.milo-agent.is-live:not(.is-still) .milo-agent__step {
  position: absolute;
  inset: 0 0 auto 0;
  opacity: 0;
  transform: translateY(22px) rotate(-2.5deg) scale(0.94);
  transition: opacity 0.3s ease, transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.milo-agent[data-step="0"] .milo-agent__step[data-step="0"],
.milo-agent[data-step="1"] .milo-agent__step[data-step="1"],
.milo-agent[data-step="2"] .milo-agent__step[data-step="2"],
.milo-agent[data-step="3"] .milo-agent__step[data-step="3"],
.milo-agent[data-step="4"] .milo-agent__step[data-step="4"] {
  opacity: 1;
  transform: rotate(-1deg);
}

.milo-agent.is-live:not(.is-still) .milo-agent__bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.milo-agent .milo-agent__bar li {
  --fill: 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 0 rgba(23, 32, 51, 0.6);
}

.milo-agent .milo-agent__bar li::before {
  content: "";
  height: 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) calc(var(--fill) * 100%), var(--cream) calc(var(--fill) * 100%));
}

/* Reduced motion: final state, every step listed. */
.milo-agent.is-still .ma-window { transform: none; }

@keyframes ma-blink { 50% { opacity: 0; } }
@keyframes ma-pulse { 50% { transform: scale(1.35); } }
@keyframes ma-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@keyframes ma-hop {
  0%, 100% { transform: none; }
  30% { transform: translateY(-14px) rotate(-3deg); }
  55% { transform: translateY(0) scale(1.04, 0.96); }
}

@media (max-width: 859px) {
  .milo-agent.is-rive .milo-agent__demo { min-height: 0; aspect-ratio: 900 / 640; }

  .milo-agent__layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "copy" "demo" "foot";
    gap: 1rem;
  }

  .milo-agent.is-live:not(.is-still) .milo-agent__layout {
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-content: stretch;
    padding-top: clamp(4.5rem, 10vh, 5.75rem);
  }

  .milo-agent.is-live:not(.is-still) .milo-agent__track { height: 240vh; }

  .milo-agent__copy h2 {
    margin-top: 0.6rem;
    max-width: 16ch;
    font-size: clamp(1.8rem, 1.1rem + 3.6vw, 2.5rem);
  }

  .milo-agent .milo-agent__lead { display: none; }

  .milo-agent__steps { margin-top: 0.9rem; }

  .milo-agent.is-live:not(.is-still) .milo-agent__steps {
    min-height: 7.25rem;
    width: calc(100% - 6px);
  }

  .milo-agent__step {
    padding: 0.75rem 0.9rem 0.85rem;
    gap: 0.7rem;
    border-radius: 15px;
    box-shadow: 4px 5px 0 var(--ink);
  }

  .milo-agent .milo-agent__step h3 { font-size: 1rem; }
  .milo-agent .milo-agent__step p { font-size: 0.85rem; }
  .milo-agent__num { width: 2rem; height: 2rem; font-size: 0.9rem; }

  .milo-agent__demo {
    align-self: stretch;
    padding: 0.5rem 0 0.75rem;
  }

  .ma-window {
    width: 100%;
    height: 100%;
    max-height: 24rem;
    min-height: 15rem;
    border-radius: 18px;
    box-shadow: 6px 7px 0 var(--ink);
  }

  .milo-agent.is-still .ma-window { height: 23rem; }

  .ma-window__bar { height: 2.4rem; font-size: 0.78rem; }
  .ma-window__body { height: calc(100% - 2.4rem); }
  .ma-scene { inset: 0.9rem 1rem; }
  .milo-agent .ma-title { font-size: 1.08rem; margin-bottom: 0.6rem; }
  .milo-agent .ma-label { margin-bottom: 0.5rem; font-size: 0.68rem; }
  .ma-input { min-height: 5.5rem; font-size: 1rem; padding: 0.8rem 3.2rem 0.8rem 0.85rem; }
  .ma-send { width: 2.2rem; height: 2.2rem; }
  .ma-ideas { margin-top: 0.7rem; }
  .ma-reqs { gap: 0.4rem; }
  .ma-req { padding: 0.45rem 0.65rem; font-size: 0.86rem; }
  .ma-option { padding: 0.45rem 0.7rem; margin-bottom: 0.45rem; }
  .ma-option__name { font-size: 0.86rem; }
  .ma-draft { margin-top: 0.55rem; padding: 0.5rem 0.7rem 0.6rem; }
  .ma-approval { padding: 0.8rem 0.9rem 0.9rem; }
  .ma-approval dl { margin-bottom: 0.7rem; gap: 0.3rem; }
  .ma-approval dl div { font-size: 0.82rem; }
  .ma-btn { padding: 0.45rem 0.95rem; font-size: 0.86rem; }
  .ma-stamp { font-size: 0.9rem; }
  .ma-bubble { font-size: 0.85rem; padding: 0.35rem 0.75rem 0.35rem 0.4rem; margin-bottom: 0.4rem; }
  .ma-bubble i { width: 1.5rem; height: 1.5rem; }
  .ma-receipt { margin-top: 0.6rem; padding: 0.6rem 0.75rem; }

  .ma-milo {
    left: auto;
    right: 0.4rem;
    top: -2.1rem;
    bottom: auto;
    width: 5.25rem;
    height: 5.25rem;
  }

  .milo-agent .milo-agent__bar li { font-size: 0.6rem; }
  .milo-agent .milo-agent__note { margin-top: 0.55rem; font-size: 0.75rem; }
}

/* Short phones: keep the window readable by trimming the step card and bar labels. */
@media (max-width: 859px) and (max-height: 720px) {
  .milo-agent.is-live:not(.is-still) .milo-agent__step p {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .milo-agent.is-live:not(.is-still) .milo-agent__steps { min-height: 3.6rem; }
  .milo-agent.is-live:not(.is-still) .milo-agent__step { align-items: center; }
  .milo-agent.is-live:not(.is-still) .milo-agent__step h3 { margin: 0; }
  .milo-agent .milo-agent__bar li { font-size: 0; gap: 0; }
  .ma-window { min-height: 0; }
  .ma-scene { inset: 0.7rem 0.85rem; }
  .ma-ideas,
  .ma-req[data-beat="req4"],
  .ma-option[data-beat="opt3"],
  .ma-approval dl div:nth-child(2),
  .ma-bubble[data-beat="reply3"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .milo-agent *,
  .milo-agent *::before,
  .milo-agent *::after {
    animation: none !important;
    transition: none !important;
  }
}
