/* Scenes: page backdrops, the overview's live cards, and section illustrations.
   Lessons and laboratories use the plain scene, so none of this reaches them. */

/* ---------------------------------------------------------------------------
   Backdrops: a fixed layer behind the workspace
   --------------------------------------------------------------------------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 62% 18%, #000 35%, transparent 100%);
  mask-image: radial-gradient(ellipse 85% 75% at 62% 18%, #000 35%, transparent 100%);
}
.backdrop canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
body:not([data-scene='plain']) .backdrop {
  opacity: 1;
}
body[data-scene='network'] .backdrop,
body[data-scene='grid'] .backdrop {
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size:
    100px 100px,
    100px 100px,
    20px 20px,
    20px 20px;
}
body[data-scene='network'] .backdrop:before {
  content: '';
  position: absolute;
  inset: -20% -10% auto 30%;
  height: 70%;
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--green) 14%, transparent), transparent),
    radial-gradient(
      closest-side at 80% 70%,
      color-mix(in srgb, var(--acid) 10%, transparent),
      transparent
    );
  filter: blur(10px);
  animation: aurora 18s ease-in-out infinite alternate;
}
body[data-scene='constellation'] .backdrop {
  background-image: radial-gradient(circle, var(--grid-major) 1.2px, transparent 1.6px);
  background-size: 24px 24px;
}
body[data-scene='waves'] .backdrop {
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size:
    100px 100px,
    100px 100px,
    20px 20px,
    20px 20px;
  background-position: 0 50px;
}
body[data-scene='waves'] .backdrop canvas {
  -webkit-mask-image: linear-gradient(transparent 260px, #000 420px);
  mask-image: linear-gradient(transparent 260px, #000 420px);
}
body[data-scene='blueprint'] .backdrop {
  background-color: color-mix(in srgb, var(--green) 3%, transparent);
  background-image:
    linear-gradient(color-mix(in srgb, var(--green) 14%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--green) 14%, transparent) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--green) 6%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--green) 6%, transparent) 1px, transparent 1px);
  background-size:
    100px 100px,
    100px 100px,
    20px 20px,
    20px 20px;
}
body[data-scene='ruled'] .backdrop {
  background-image:
    linear-gradient(
      90deg,
      transparent calc(var(--sidebar-width) + 22px),
      color-mix(in srgb, var(--orange) 35%, transparent) calc(var(--sidebar-width) + 22px),
      color-mix(in srgb, var(--orange) 35%, transparent) calc(var(--sidebar-width) + 23px),
      transparent calc(var(--sidebar-width) + 23px)
    ),
    linear-gradient(transparent 31px, var(--grid-major) 31px, var(--grid-major) 32px);
  background-size:
    100% 100%,
    100% 32px;
}
@keyframes aurora {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-8%, 6%, 0) scale(1.12);
  }
}

/* ---------------------------------------------------------------------------
   Entrance: staggered on arrival, then sections reveal as they scroll in
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .is-entering .reveal {
    animation: reveal-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: calc(var(--i, 0) * 90ms + 60ms);
  }
}
@keyframes reveal-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.stage-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 30px;
}
.stage-card {
  display: flex;
  flex-direction: column;
  padding: 18px 18px 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-width: 0;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    border-color 0.2s;
}
.stage-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--green) 35%, var(--line));
}
.stage-card > span:first-child {
  font-size: 15px;
  color: var(--muted);
}
.stage-card h2 {
  font-size: 20px;
  letter-spacing: -0.015em;
  margin-top: 2px;
}
.stage-meter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px;
  font: 600 13px var(--mono);
}
.stage-meter > span {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-hover);
  overflow: hidden;
}
.stage-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--acid);
  transform-origin: left;
}
.stage-card.is-next .stage-meter i {
  background: var(--subtle);
}
.is-entering .stage-meter i {
  animation: meter-fill 1.2s 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes meter-fill {
  from {
    transform: scaleX(0);
  }
}
.status-pill {
  align-self: flex-start;
  font: 500 12px var(--sans);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--muted);
  border: 1px solid var(--line);
}
.status-pill.is-done {
  background: var(--emerald-soft);
  color: var(--emerald-ink);
  border-color: color-mix(in srgb, var(--acid) 35%, transparent);
}
.status-pill.is-active {
  background: var(--primary-soft);
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 28%, transparent);
}
.stage-card footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.meta-tag {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 8px;
}

/* ---------------------------------------------------------------------------
   Overview: the live cache simulation card
   --------------------------------------------------------------------------- */
.sim-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px 22px 18px;
  position: relative;
  overflow: hidden;
}
.sim-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sim-head h2 {
  font-size: 17px;
  letter-spacing: -0.01em;
}
.sim-controls {
  display: flex;
  gap: 6px;
}
.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink);
  transition:
    background 0.15s,
    border-color 0.15s;
}
.icon-btn:hover {
  background: var(--surface-hover);
}
.icon-btn[aria-pressed='true'] {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--green) 35%, transparent);
  color: var(--green);
}
.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn [d^='M7 5v14l11'],
.icon-btn [d^='M5 5v14l9'] {
  fill: currentColor;
}
.sim-body {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 26px 0 8px;
  flex-wrap: wrap;
}
.sim-lane {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.sim-label {
  font: 600 11px var(--mono);
  letter-spacing: 0.06em;
  color: var(--muted);
}
.sim-cache,
.sim-queue {
  display: flex;
  gap: 7px;
  position: relative;
  padding-top: 18px;
}
.sim-slot {
  width: 44px;
  height: 48px;
  display: grid;
  place-items: center;
  font: 600 20px var(--mono);
  border-radius: 9px;
  border: 1.5px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  position: relative;
  flex: none;
}
.sim-cache .sim-slot {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--green) 55%, transparent);
  color: var(--green);
}
.sim-slot.is-empty {
  background: transparent;
  border-style: dashed;
  color: var(--line-strong);
}
.sim-slot[data-badge]:after,
.sim-evicted:after {
  content: attr(data-badge);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  font: 700 10px var(--mono);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.sim-slot.is-hit {
  border-color: var(--green);
  background: var(--green);
  color: var(--on-accent);
  animation: slot-hit 0.6s ease;
}
.sim-slot.is-hit:after {
  color: var(--green);
}
.sim-slot.is-new {
  border-color: var(--orange);
  background: var(--warning-surface);
  color: var(--warning-ink);
  animation: slot-new 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.sim-slot.is-new:after {
  color: var(--warning-ink);
}
.sim-evicted {
  position: absolute;
  left: 0;
  top: 18px;
  width: 44px;
  height: 48px;
  display: grid;
  place-items: center;
  font: 600 20px var(--mono);
  border-radius: 9px;
  border: 1.5px dashed var(--orange);
  color: var(--warning-ink);
  background: var(--white);
  pointer-events: none;
  animation: slot-evict 1.1s ease forwards;
}
.sim-evicted:after {
  color: var(--warning-ink);
}
.sim-queue.is-shifting {
  animation: queue-shift 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.sim-request.is-arriving {
  animation: slot-arrive 0.5s ease;
}
.sim-axis {
  display: flex;
  justify-content: space-between;
  font: 10px var(--mono);
  color: var(--subtle);
}
.sim-flow {
  color: var(--subtle);
  width: 36px;
  margin-top: 30px;
}
.sim-flow svg {
  width: 36px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: 4 3;
  animation: flow-dash 0.8s linear infinite;
}
.sim-event {
  font: 500 12px var(--mono);
  color: var(--muted);
  min-height: 20px;
  margin: 10px 0 0;
  max-width: none;
}
.sim-event.is-hit {
  color: var(--green);
}
.sim-event.is-miss {
  color: var(--warning-ink);
}
.sim-stats {
  display: flex;
  align-items: end;
  gap: 22px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.sim-stat {
  display: grid;
  font: 11px var(--mono);
  color: var(--muted);
  letter-spacing: 0.04em;
}
.sim-stat strong {
  font: 700 18px var(--mono);
  color: var(--ink);
}
.sim-history {
  margin-left: auto;
  display: flex;
  align-items: end;
  gap: 3px;
  height: 30px;
}
.sim-history i {
  width: 5px;
  border-radius: 2px;
  height: 30px;
  background: var(--acid);
}
.sim-history i.is-miss {
  height: 12px;
  background: var(--orange);
}
.sim-history i:last-child {
  animation: bar-grow 0.4s ease;
  transform-origin: bottom;
}
.sim-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
}
@keyframes slot-hit {
  40% {
    transform: translateY(-4px) scale(1.06);
    box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--green) 70%, transparent);
  }
}
@keyframes slot-new {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
}
@keyframes slot-evict {
  to {
    transform: translate(-14px, 26px) rotate(-12deg);
    opacity: 0;
  }
}
@keyframes queue-shift {
  from {
    transform: translateX(51px);
  }
}
@keyframes slot-arrive {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
}
@keyframes flow-dash {
  to {
    stroke-dashoffset: -7;
  }
}
@keyframes bar-grow {
  from {
    transform: scaleY(0);
  }
}

/* ---------------------------------------------------------------------------
   Overview: the animated Python workbench (a dark IDE card in both themes)
   --------------------------------------------------------------------------- */
.bench-card {
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid var(--code-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
}
.bench-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--code-bar);
  border-bottom: 1px solid var(--code-line);
}
.bench-head h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  color: #f8fafc;
}
.bench-dots {
  display: flex;
  gap: 6px;
}
.bench-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
}
.bench-dots i:nth-child(2) {
  background: #f59e0b;
}
.bench-dots i:nth-child(3) {
  background: #10b981;
}
.bench-file {
  margin-left: auto;
  font: 11px var(--mono);
  color: var(--code-muted);
}
.bench-code {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: none;
  padding: 16px 20px;
  font-size: 12.5px;
  line-height: 1.8;
  min-height: calc(7 * 1.8em + 32px);
  white-space: pre;
  overflow-x: auto;
}
.bench-caret {
  display: inline-block;
  width: 7px;
  height: 1.15em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--code-name);
  animation: caret-blink 1s steps(2, start) infinite;
}
.bench-terminal {
  border-top: 1px solid var(--code-line);
  background: var(--code-bar);
}
.bench-term-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid var(--code-line);
}
.bench-status {
  font: 600 10px var(--mono);
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
}
.bench-status.is-running {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}
.bench-status.is-done {
  color: var(--code-pass);
  background: rgba(52, 211, 153, 0.12);
}
.bench-term-body {
  padding: 12px 18px 14px;
  font: 12.5px/1.75 var(--mono);
  min-height: calc(4 * 1.75em + 26px);
}
.bench-term-body > div {
  animation: term-line 0.3s ease;
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-prompt {
  color: var(--code-muted);
}
.term-pass {
  color: var(--code-pass);
}
.term-summary {
  color: var(--code-pass);
  font-weight: 700;
}
.bench-link {
  position: absolute;
  right: 16px;
  bottom: 14px;
  font: 500 12px var(--sans);
  color: #93c5fd;
  text-decoration: underline;
  text-decoration-color: rgba(147, 197, 253, 0.4);
  text-underline-offset: 4px;
}
.bench-link:hover {
  text-decoration-color: currentColor;
}
@keyframes caret-blink {
  to {
    visibility: hidden;
  }
}
@keyframes term-line {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

/* ---------------------------------------------------------------------------
   Heading veil: a soft wash of the canvas color behind heading text, so grid
   lines and animated traces never cross the letters. It has no visible edge.
   --------------------------------------------------------------------------- */
.heading-copy,
.la-hero-copy,
.la-section-head {
  position: relative;
  isolation: isolate;
}
.heading-copy:before,
.la-hero-copy:before,
.la-section-head:before {
  content: '';
  position: absolute;
  /* Horizontal reach stays inside the page padding (24px at its narrowest above phones). */
  inset: -28px -24px;
  z-index: -1;
  pointer-events: none;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  -webkit-mask-image:
    linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 72px), transparent),
    linear-gradient(transparent, #000 28px, #000 calc(100% - 28px), transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 72px), transparent),
    linear-gradient(transparent, #000 28px, #000 calc(100% - 28px), transparent);
  mask-composite: intersect;
}

/* ---------------------------------------------------------------------------
   Section headings with an illustration
   --------------------------------------------------------------------------- */
.page-heading.has-art {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  align-items: center;
  gap: 32px;
  margin-bottom: 36px;
}
.page-art {
  position: relative;
  isolation: isolate;
  aspect-ratio: 372 / 190;
}
.page-art:before {
  content: '';
  position: absolute;
  inset: -10% -6%;
  background: radial-gradient(
    closest-side,
    color-mix(in srgb, var(--green) 12%, transparent),
    transparent
  );
  z-index: -1;
}
.page-art svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.page-art text {
  font: 600 11px var(--mono);
  fill: var(--muted);
  stroke: none;
}
.art-grid-line {
  stroke: var(--grid-major);
  stroke-width: 1;
}
.art-window {
  fill: var(--code-bg);
  stroke: var(--code-line);
}

/* Path: a transit line through the stages. */
.art-track {
  stroke: var(--line-strong);
  stroke-width: 6;
}
.art-track-done {
  stroke: var(--acid);
  stroke-width: 6;
}
.art-signal {
  stroke: var(--green);
  stroke-width: 6;
  stroke-dasharray: 5 95;
  animation: signal-run 4.5s linear infinite;
}
.art-station circle {
  fill: var(--white);
  stroke: var(--line-strong);
  stroke-width: 3;
}
.art-station.is-done circle {
  fill: var(--acid);
  stroke: var(--white);
}
.art-station.is-current circle {
  fill: var(--green);
  stroke: var(--white);
}
.art-station.is-current text {
  fill: var(--green);
}
.art-station .art-ring {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: ring-pulse 2s ease-out infinite;
}
@keyframes signal-run {
  from {
    stroke-dashoffset: 100;
  }
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes ring-pulse {
  from {
    transform: scale(1);
    opacity: 0.9;
  }
  to {
    transform: scale(2.4);
    opacity: 0;
  }
}

/* Experiments: an oscilloscope. */
.art-screen {
  fill: #06101f;
}
.art-wave {
  animation: wave-scroll 3.2s linear infinite;
}
.art-wave-line {
  stroke: #34d399;
  stroke-width: 2.2;
}
.art-wave-glow {
  stroke: rgba(52, 211, 153, 0.3);
  stroke-width: 8;
}
.art-knob {
  fill: var(--white);
  stroke: var(--line-strong);
  stroke-width: 2;
}
.art-knob-mark {
  stroke: var(--green);
  stroke-width: 3;
  transform-box: view-box;
}
.art-knob-a {
  transform-origin: 316px 60px;
  animation: knob-turn 6s ease-in-out infinite alternate;
}
.art-knob-b {
  transform-origin: 316px 128px;
  animation: knob-turn 4.5s ease-in-out infinite alternate-reverse;
}
.art-led {
  fill: var(--acid);
  animation: led-blink 1.6s ease-in-out infinite;
}
@keyframes wave-scroll {
  to {
    transform: translateX(-120px);
  }
}
@keyframes knob-turn {
  to {
    transform: rotate(110deg);
  }
}
@keyframes led-blink {
  50% {
    opacity: 0.25;
  }
}

/* Projects: Relay's architecture with requests in flight. */
.art-box rect {
  fill: var(--white);
  stroke: var(--line-strong);
  stroke-width: 1.5;
}
.art-box.is-primary rect {
  fill: var(--primary-soft);
  stroke: var(--green);
}
.page-art .art-box text {
  font: 600 12px var(--mono);
  fill: var(--ink);
}
.art-link {
  stroke: var(--line-strong);
  stroke-width: 2;
}
.art-packet {
  stroke: var(--green);
  stroke-width: 4;
  stroke-dasharray: 8 92;
  animation: signal-run 2.4s linear infinite;
}
.art-packet:nth-of-type(4) {
  animation-delay: -0.6s;
}
.art-packet:nth-of-type(6) {
  animation-delay: -1.2s;
  stroke: var(--acid);
}
.art-packet:nth-of-type(8) {
  animation-delay: -1.8s;
  stroke: var(--acid);
}
.art-progress rect {
  fill: var(--surface-hover);
}
.art-progress rect.is-done {
  fill: var(--acid);
}

/* Notebook: lines written by a moving pencil. */
.art-page {
  fill: var(--white);
  stroke: var(--line-strong);
  stroke-width: 1.5;
}
.art-rule {
  stroke: var(--line);
  stroke-width: 1.5;
}
.art-margin {
  stroke: color-mix(in srgb, var(--orange) 45%, transparent);
  stroke-width: 1.5;
}
.art-ink {
  stroke: var(--green);
  stroke-width: 2;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: ink-write 7s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.9s);
}
.art-pencil path {
  fill: var(--orange);
  stroke: var(--warning-ink);
  stroke-width: 1;
}
.art-pencil {
  animation: pencil-move 3.5s ease-in-out infinite alternate;
}
@keyframes ink-write {
  0% {
    stroke-dashoffset: 100;
  }
  30%,
  80% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 0;
  }
}
@keyframes pencil-move {
  to {
    transform: translate(-24px, 70px);
  }
}

/* ---------------------------------------------------------------------------
   Experiment cards: small diagrams that loop gently and quicken on hover
   --------------------------------------------------------------------------- */
.mini-graphic svg {
  width: 100%;
  max-width: 150px;
  height: 40px;
  overflow: visible;
}
.mini-graphic text {
  font: 600 13px var(--mono);
  fill: var(--green);
  text-anchor: middle;
}
.experiment-card:hover .mini-graphic * {
  animation-duration: 1.6s !important;
}
.xg-line {
  stroke: var(--line-strong);
  stroke-width: 2;
  stroke-dasharray: 4 4;
  animation: flow-dash 1.2s linear infinite;
}
.xg-bar {
  fill: color-mix(in srgb, var(--green) 30%, transparent);
  animation: none 3.6s steps(1) infinite;
}
.xg-probe {
  fill: var(--orange);
  animation: xg-probe 3.6s ease-in-out infinite;
}
@keyframes xg-probe {
  0%,
  22% {
    transform: translateX(-21px);
  }
  33%,
  55% {
    transform: translateX(21px);
  }
  66%,
  100% {
    transform: translateX(0);
    fill: var(--acid);
  }
}
.xg-bar:nth-child(-n + 4) {
  animation-name: xg-bar-out-low;
}
.xg-bar:nth-child(n + 6) {
  animation-name: xg-bar-out-high;
}
.xg-bar:nth-child(5) {
  animation-name: xg-bar-found;
}
@keyframes xg-bar-out-low {
  0%,
  30% {
    opacity: 1;
  }
  31%,
  100% {
    opacity: 0.25;
  }
}
@keyframes xg-bar-out-high {
  0%,
  63% {
    opacity: 1;
  }
  64%,
  100% {
    opacity: 0.25;
  }
}
@keyframes xg-bar-found {
  0%,
  65% {
    fill: color-mix(in srgb, var(--green) 30%, transparent);
  }
  66%,
  100% {
    fill: var(--acid);
  }
}
.xg-slot {
  fill: var(--primary-soft);
  stroke: var(--green);
  stroke-width: 1.5;
}
.xg-strip {
  animation: xg-strip 3s cubic-bezier(0.5, 0, 0.2, 1) infinite;
}
@keyframes xg-strip {
  0%,
  45% {
    transform: translateX(36px);
  }
  70%,
  100% {
    transform: translateX(0);
  }
}
.xg-job {
  fill: var(--green);
  opacity: 0;
  animation: xg-job 3s linear infinite;
  animation-delay: calc(var(--i) * -1s);
}
@keyframes xg-job {
  0% {
    opacity: 0;
    transform: translateX(0);
  }
  10%,
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(104px);
  }
}
.xg-worker {
  fill: var(--surface-raised);
  stroke: var(--green);
  stroke-width: 1.5;
  animation: led-blink 1s ease-in-out infinite;
}
.xg-check {
  stroke: var(--acid);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.xg-leader {
  fill: var(--green);
}
.xg-packet {
  fill: var(--acid);
  animation: xg-packet 3s ease-in-out infinite;
}
@keyframes xg-packet {
  0%,
  10% {
    transform: translateX(0);
    opacity: 1;
  }
  60% {
    transform: translateX(88px);
    opacity: 1;
  }
  61%,
  100% {
    transform: translateX(88px);
    opacity: 0;
  }
}
.xg-replica {
  stroke-width: 2;
  animation: xg-replica 3s steps(1) infinite;
}
@keyframes xg-replica {
  0%,
  59% {
    fill: var(--warning-surface);
    stroke: var(--orange);
  }
  60%,
  100% {
    fill: var(--emerald-soft);
    stroke: var(--acid);
  }
}
.xg-decision {
  fill: var(--primary-soft);
  stroke: var(--green);
  stroke-width: 1.5;
}
.xg-option {
  fill: var(--surface-hover);
  animation: xg-option 3s steps(1) infinite;
  animation-delay: calc(var(--i) * 1s);
}
@keyframes xg-option {
  0%,
  32% {
    fill: var(--green);
  }
  33%,
  100% {
    fill: var(--surface-hover);
  }
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .stage-cards {
    grid-template-columns: 1fr;
  }
  .page-heading.has-art {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
}
@media (max-width: 900px) {
  .stage-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page-heading.has-art {
    grid-template-columns: 1fr;
  }
  .page-art {
    max-width: 380px;
    order: -1;
  }
}
@media (max-width: 650px) {
  .heading-copy:before,
  .la-hero-copy:before,
  .la-section-head:before {
    inset: -20px -12px;
    -webkit-mask-image: linear-gradient(
      transparent,
      #000 20px,
      #000 calc(100% - 20px),
      transparent
    );
    mask-image: linear-gradient(transparent, #000 20px, #000 calc(100% - 20px), transparent);
  }
  .backdrop {
    -webkit-mask-image: linear-gradient(#000 20%, transparent 80%);
    mask-image: linear-gradient(#000 20%, transparent 80%);
  }
  .stage-cards {
    grid-template-columns: 1fr;
  }
  .sim-card {
    padding: 16px;
  }
  .sim-body {
    gap: 10px;
  }
  .sim-slot,
  .sim-evicted {
    width: 38px;
    height: 42px;
    font-size: 17px;
  }
  .sim-flow {
    display: none;
  }
  .sim-stats {
    gap: 14px;
    flex-wrap: wrap;
  }
  .sim-history {
    margin-left: 0;
    width: 100%;
  }
  .bench-code {
    font-size: 11px;
    padding: 14px;
  }
  .bench-term-body {
    font-size: 11px;
    padding-inline: 14px;
  }
  .bench-link {
    position: static;
    display: block;
    padding: 0 14px 14px;
  }
  .page-art {
    display: none;
  }
}
@media print {
  .backdrop {
    display: none;
  }
}
