/* ─────────────────────────────────────────────────────────────────
   Andromeda — canvas motion styles
   Shared by the home hero constellation and the scrubbed layer
   diagrams. Every colour comes from the design-system tokens.
   Each host section sets --am-ground to its own background so the
   copy column can mask the canvas behind it.
   ─────────────────────────────────────────────────────────────── */

:root { --am-ground: var(--paper); }

/* ── Alert chips (hero) ───────────────────────────────────────── */
/* Frosted pills on dashed leader lines. Everything scales off one
   variable so the pill, its dot and its padding stay in proportion. */
.am-chip-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  --am-chip-size: 1;
}

.am-chip-leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.am-chip-leaders line {
  stroke-width: 1;
  stroke-dasharray: 4 4;
  fill: none;
  opacity: 0;
  transition: opacity 420ms var(--ease-out);
}
.am-chip-leaders line.is-alert { stroke: rgba(181, 58, 43, 0.72); }
.am-chip-leaders line.is-ok    { stroke: rgba(143, 168, 194, 0.75); }
.am-chip-leaders line.is-on { opacity: 1; }

.am-chip {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  will-change: transform;
}

/* Carries the JS offset only, so the CSS unfurl below never fights it. */
.am-chip__card {
  position: absolute;
  left: 0; top: 0;
  will-change: transform;
}

.am-chip__pill {
  display: inline-flex;
  align-items: center;
  gap: calc(10px * var(--am-chip-size));
  padding: calc(8px * var(--am-chip-size)) calc(15px * var(--am-chip-size));
  min-height: calc(30px * var(--am-chip-size));
  border-radius: calc(6px * var(--am-chip-size));
  background: rgba(17, 22, 31, 0.55);
  border: 1px solid rgba(143, 168, 194, 0.28);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: calc(11px * var(--am-chip-size));
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  white-space: nowrap;
  /* Unfurls from the leader line rather than fading in flat, and the
     resolved set cascades so the column assembles instead of popping. */
  transform-origin: left center;
  opacity: 0;
  transform: scaleY(0.4) translateX(-6px);
  transition: opacity 400ms var(--ease-out) calc(var(--am-i, 0) * 75ms),
              transform 560ms cubic-bezier(0.22, 1.2, 0.36, 1) calc(var(--am-i, 0) * 75ms);
}
.am-chip.is-on .am-chip__pill { opacity: 1; transform: scaleY(1) translateX(0); }

.am-chip__dot {
  width: calc(11px * var(--am-chip-size));
  height: calc(11px * var(--am-chip-size));
  border-radius: 50%;
  flex-shrink: 0;
}
/* Red is a problem nobody has picked up; steel is one that resolved. */
.am-chip--alert .am-chip__dot { background: var(--danger); }
.am-chip--alert .am-chip__pill { border-color: rgba(181, 58, 43, 0.42); }
.am-chip--ok .am-chip__dot { background: var(--steel-soft); }
.am-chip--ok .am-chip__pill { border-color: rgba(143, 168, 194, 0.34); }

@media (max-width: 1100px) { .am-chip-layer { --am-chip-size: 0.86; } }
/* Below 900px the copy moves to the top of the panel and the chips stack
   underneath it, so they stay on — hiding them cost the phone the whole
   point of the band. */
@media (max-width: 900px)  { .am-chip-layer { --am-chip-size: 0.86; } }

@media (prefers-reduced-motion: reduce) {
  .am-chip { will-change: auto; }
  .am-chip__pill { transition: none; transform: scaleY(1) translateX(0); }
  .am-chip-leaders line { transition: none; }
}

/* ── Scrubbed layer diagram ───────────────────────────────────── */
.am-track {
  display: grid;
  grid-template-columns: minmax(280px, 38%) minmax(0, 1fr);
  gap: 0 48px;
  height: 320vh;              /* scrub distance — ~3 viewports */
  align-items: stretch;
}

.am-track__copy {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-top: 12vh;
  padding-bottom: 18vh;
  background: var(--am-ground);
  /* Keep exploded plates from painting through the copy column. */
  box-shadow: 24px 0 40px 8px var(--am-ground);
}

.am-pin { position: relative; flex: 1 1 50%; min-height: 80vh; }

.am-card {
  position: sticky;
  top: 18vh;
  max-width: 440px;
  padding: 28px 28px 30px;
  border-radius: var(--r-md);
  background: var(--am-ground);
  border: 1px dashed rgba(10, 14, 20, 0.34);
  color: var(--ink);
  min-height: 232px;
  transition: background var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out);
}
.am-pin:nth-child(1) .am-card { z-index: 1; }
.am-pin:nth-child(2) .am-card { z-index: 2; }
.am-pin:nth-child(3) .am-card { z-index: 3; }

.am-card__kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--steel);
  margin: 0;
}

.am-card__title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(22px, 2.1vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 10px 0 12px;
  text-wrap: balance;
}

.am-card__desc {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-4);
  margin: 0;
}

/* Active card flips to solid ink — the swap is the sticky slide, not a fade. */
.am-card.is-active {
  background: var(--ink);
  border-color: var(--ink);
  border-style: solid;
  color: var(--paper);
}
.am-card.is-active .am-card__kicker { color: var(--steel-soft); }
.am-card.is-active .am-card__desc { color: var(--mist-3); }
.am-card.is-active .am-br { opacity: 0; }

/* Corner brackets — drafting marks, only while the card is inactive. */
.am-br {
  position: absolute;
  width: 12px; height: 12px;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
.am-br--tl { top: -1px; left: -1px; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.am-br--tr { top: -1px; right: -1px; border-top: 1px solid var(--ink); border-right: 1px solid var(--ink); }
.am-br--bl { bottom: -1px; left: -1px; border-bottom: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.am-br--br { bottom: -1px; right: -1px; border-bottom: 1px solid var(--ink); border-right: 1px solid var(--ink); }

.am-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  min-width: 0;
  align-self: start;
  z-index: 1;
  overflow: hidden;
  isolation: isolate;
}
.am-stage canvas { display: block; width: 100%; height: 100%; pointer-events: none; }

@media (max-width: 900px) {
  .am-track {
    grid-template-columns: 1fr;
    height: auto;
    gap: 24px;
  }
  .am-track__copy {
    padding-top: 0;
    padding-bottom: 0;
    box-shadow: none;
    gap: 16px;
  }
  .am-pin { min-height: 0; flex: 0 0 auto; }
  .am-card { position: static; min-height: 0; max-width: none; }
  .am-stage { position: relative; height: 58vh; order: -1; }
}

@media (prefers-reduced-motion: reduce) {
  .am-card { transition: none; }
}
