/* Scroll story. Dark tokens — it continues the hero band. */
.morph {
  --bg: #10132c;
  --surface: #191e42;
  --ink: #e8e9f0;
  --muted: #a6a9c2;
  --accent: #c4d93a;
  --accent-tint: rgba(196, 217, 58, 0.14);
  --line: #2f3565;
  --brass: #e0a542;
  --brass-ink: #e0a542;
  --brass-tint: rgba(224, 165, 66, 0.2);
  position: relative;
  background: var(--bg);
  color: var(--ink);
}

html:not(.rm) .morph.is-live {
  height: 420vh;
}

html.rm .morph {
  height: auto;
}

.morph .stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: calc(var(--header-h) + 0.75rem) clamp(16px, 4vw, 56px) clamp(14px, 3vh, 32px);
  max-width: 1200px;
  margin: 0 auto;
  background: var(--bg);
}

html.rm .morph .stage {
  display: none;
}

.morph .cap {
  position: relative;
  min-height: 9em;
  margin-right: 64px;
}

.morph .cap .c {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.morph .cap .c.on {
  opacity: 1;
  transform: none;
}

.morph .cap .n {
  font: 500 13px/1.3 "IBM Plex Mono", monospace;
  color: var(--accent);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.morph .cap .num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  font-size: 12px;
}

.morph .cap h2 {
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
  font-weight: 500;
  letter-spacing: -0.015em;
  font-size: clamp(21px, 2.9vw, 34px);
  line-height: 1.14;
  margin: 0;
  max-width: 30ch;
  color: var(--ink);
}

.morph .grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  grid-template-rows: minmax(0, 1fr);
  gap: clamp(16px, 3vw, 56px);
  align-items: stretch;
  margin-right: 56px;
}

.morph svg.scene {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  overflow: visible;
}

.morph .panel {
  position: relative;
  align-self: center;
  min-height: 300px;
}

.morph .pstate {
  position: absolute;
  inset: 0 0 auto 0;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.morph .pstate.on {
  opacity: 1;
  pointer-events: auto;
}

.morph .ptitle {
  font: 500 13px/1.3 "IBM Plex Mono", monospace;
  color: var(--muted);
  margin: 0 0 12px;
}

.morph .row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}

.morph .row:last-of-type {
  border-bottom: 1px solid var(--line);
}

.morph .row b {
  font: 500 14px/1.4 "IBM Plex Mono", monospace;
  text-align: right;
  font-weight: 500;
}

.morph .row b.hot {
  color: var(--brass-ink);
}

.morph .row b.good {
  color: var(--accent);
}

.morph .bars {
  margin: 0 0 6px;
}

.morph .bl {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14.5px;
  margin: 12px 0 6px;
}

.morph .bl b {
  font: 500 14px/1.3 "IBM Plex Mono", monospace;
}

.morph .track {
  height: 12px;
  background: var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.morph .track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 6px;
  transition: width 0.9s ease 0.15s;
}

.morph .pstate.on .track i {
  width: var(--w);
}

.morph .b-today {
  background: var(--brass);
}

.morph .b-after {
  background: var(--accent);
}

.morph .bars + .row {
  margin-top: 16px;
}

.morph .note {
  font-size: 12.5px;
  color: var(--muted);
  margin: 14px 0 0;
}

.morph .rail {
  position: absolute;
  right: clamp(10px, 2vw, 28px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 2;
}

.morph .rail button {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row-reverse;
  font: 500 12px/1 "IBM Plex Mono", monospace;
  color: var(--muted);
}

.morph .rail button span.d {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  transition: background 0.3s, border-color 0.3s;
}

.morph .rail button.on {
  color: var(--ink);
}

.morph .rail button.on span.d {
  background: var(--accent);
  border-color: var(--accent);
}

.morph .rail button span.t {
  opacity: 0;
  transition: opacity 0.2s;
}

.morph .rail:hover button span.t,
.morph .rail button:focus-visible span.t {
  opacity: 1;
}

.morph .rail button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.morph .edge {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.3;
  stroke-dasharray: 1 1;
}

.morph .loop {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.1;
  stroke-dasharray: 3 4;
}

.morph .node .body {
  fill: var(--surface);
  stroke: var(--line);
  stroke-width: 1.4;
}

.morph .icon {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.morph .lbl {
  fill: var(--ink);
  font: 500 12.5px Inter, system-ui, sans-serif;
}

.morph .meta {
  fill: var(--muted);
  font: 500 10.5px "IBM Plex Mono", monospace;
}

.morph .hot {
  fill: var(--brass-ink);
}

.morph .ring {
  fill: var(--brass-tint);
  stroke: var(--brass);
  stroke-width: 2;
}

.morph .rw {
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.6;
  stroke-dasharray: 4 4;
}

.morph .rnode circle {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-dasharray: 4 3;
}

.morph .rnode.person circle {
  stroke: var(--ink);
}

.morph .redesign.solid .rnode circle {
  stroke-dasharray: none;
  fill: var(--accent-tint);
}

.morph .redesign.solid .rnode.person circle {
  fill: var(--surface);
  stroke-width: 2;
}

.morph .rnode.flag circle {
  stroke: var(--brass) !important;
  stroke-width: 2.4;
}

.morph .rlink {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-dasharray: 4 3;
}

.morph .redesign.solid .rlink {
  stroke-dasharray: none;
}

.morph .monitor line {
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-dasharray: 2 5;
}

.morph .mdot {
  fill: var(--accent);
}

.morph .fdot {
  fill: var(--accent);
}

.morph .fdot.exc {
  fill: var(--brass);
}

.morph .tok circle {
  fill: var(--brass);
}

.morph .tok path {
  fill: none;
  stroke: #1b1e2b;
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.story-static {
  display: none;
}

html.rm .story-static {
  display: block;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 56px) 3rem;
}

.story-static .static-step {
  padding: 2.5rem 0;
  border-top: 1px solid var(--line);
}

.story-static .cap {
  min-height: 0;
  margin: 0 0 1.25rem;
}

.story-static .cap .c {
  position: static;
  opacity: 1;
  transform: none;
}

.story-static .grid {
  min-height: 0;
  margin-right: 0;
  align-items: center;
}

.story-static svg.scene {
  height: min(68vh, 34rem);
}

.story-static .panel {
  min-height: 0;
}

.story-static .pstate {
  position: static;
  opacity: 1;
}

.story-noscript {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

@media (max-width: 860px) {
  .morph .stage {
    padding: calc(var(--header-h) + 0.5rem) 16px 12px;
  }

  .morph .cap {
    min-height: 7.4em;
    margin-right: 0;
  }

  .morph .grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
    margin-right: 0;
    margin-bottom: 26px;
  }

  .morph .panel {
    min-height: 128px;
  }

  .morph .ptitle {
    display: none;
  }

  .morph .pstate {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    column-gap: 12px;
  }

  .morph .row {
    padding: 5px 0;
    font-size: 12px;
    flex-direction: column;
    gap: 0;
    border-bottom: 0;
  }

  .morph .row:last-of-type {
    border-bottom: 0;
  }

  .morph .row b {
    text-align: left;
    font-size: 12px;
  }

  .morph .note {
    display: none;
  }

  .morph .dk {
    display: none !important;
  }

  .morph .bars {
    grid-column: 1 / -1;
    margin: 0;
  }

  .morph .bl {
    font-size: 12.5px;
    margin: 4px 0;
  }

  .morph .bl b {
    font-size: 12.5px;
  }

  .morph .track {
    height: 9px;
  }

  .morph .bars + .row {
    margin-top: 6px;
  }

  .morph .lbl {
    font-size: 17px;
  }

  .morph .meta {
    font-size: 14px;
  }

  .morph .rail {
    top: auto;
    bottom: 10px;
    right: 50%;
    transform: translateX(50%);
    flex-direction: row;
    gap: 14px;
  }

  .morph .rail button span.t {
    display: none;
  }

  .story-static .grid {
    grid-template-columns: 1fr;
  }

  .story-static svg.scene {
    height: 26rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .morph .cap .c,
  .morph .pstate,
  .morph .track i {
    transition: none;
  }
}
