/* cu-steps.css — /child-custody/ section 7, the five-step timeline (src/components/custody/Timeline.astro).
   DEFAULT = FINAL STATE (no JS, reduced motion): the rail full, every node lit, every card shown, no
   counter. cu-steps.js adds [data-cst-armed] and then owns, from ONE rAF: the fill's transform (scaleY),
   each node's .is-lit, each card's one-shot .is-in, and the counter number. Nothing here transitions the
   fill's transform (the scroll IS its timeline); the node and card changes are class-keyed tweens.
   The section is the opaque cover that slides over the pinned section 6 (position + z-index + ground). */
.cu-steps {
  --cst-rail-x: 27px;          /* the rail's centre inside .cst-main (node centre) */
  --cst-node: 18px;
  position: relative; z-index: 1; background: var(--paper); color: var(--ink);
  border-radius: var(--r-sec) var(--r-sec) 0 0; padding: var(--sec) 0 40px;  /* the cases block below brings its own top padding */
}
.cu-steps .cst-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 96px); align-items: start; }
.cu-steps .cst-side { align-self: stretch; }  /* the sticky block needs a column as tall as the row to travel in */
.cu-steps .cst-side-in { position: sticky; top: calc(var(--nav-h) + 32px); }
.cu-steps .cst-sub { margin-top: 16px; max-width: 30em; font-size: 16px; line-height: 1.8; color: var(--mute); }
.cu-steps .cst-counter { display: none; align-items: baseline; gap: 8px; margin-top: 32px; font-size: 15px; color: var(--mute); }
.cu-steps .cst-counter b { font-size: 44px; font-weight: 400; color: var(--ink); min-width: .7em; text-align: center; }
.cu-steps[data-cst-armed] .cst-counter { display: flex; }

.cu-steps .cst-main { position: relative; min-width: 0; }
/* the rail: from the first node's centre to the last node's (top/height written on measure only) */
.cu-steps .cst-rail { position: absolute; left: calc(var(--cst-rail-x) - 1px); top: var(--cst-rail-t, 40px); height: var(--cst-rail-h, calc(100% - 80px)); width: 2px; border-radius: 2px; background: rgba(16,32,27,.10); }
/* edit round 1 (#83 row 7): the filled line is 4px of amber over the quieter 2px track, with a small glowing
   head at the fill's end (cu-steps.js writes the head's translateY from the same number as the scaleY) */
.cu-steps .cst-fill { position: absolute; top: 0; bottom: 0; left: -1px; width: 4px; border-radius: 4px; background: var(--amber); transform-origin: 50% 0; transform: scaleY(1); will-change: transform; }
.cu-steps .cst-head { display: none; position: absolute; left: 1px; top: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(233,169,58,.22), 0 0 16px 3px rgba(233,169,58,.55); will-change: transform; pointer-events: none; }
.cu-steps[data-cst-armed] .cst-head { display: block; }

.cu-steps .cst-list { display: grid; gap: 28px; margin: 0; padding: 0; list-style: none; }
.cu-steps .cst-item { position: relative; padding-left: calc(var(--cst-rail-x) * 2 + 10px); }
.cu-steps .cst-node {
  position: absolute; left: calc(var(--cst-rail-x) - var(--cst-node) / 2); top: 36px; width: var(--cst-node); height: var(--cst-node);
  border-radius: 50%; border: 2px solid rgba(16,32,27,.28); background: var(--paper); box-sizing: border-box;
  transition: border-color .3s ease, background-color .3s ease, transform .3s cubic-bezier(.22, 1, .36, 1);
}
.cu-steps .cst-item.is-lit .cst-node { border-color: var(--amber); background: var(--amber); transform: scale(1.12); box-shadow: 0 0 0 4px rgba(233,169,58,.18); }
.cu-steps .cst-item.is-near .cst-node { border-color: var(--amber); }

.cu-steps .cst-card { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 22px; align-items: start; padding: 22px 24px; border-radius: var(--r-card); background: var(--white); box-shadow: 0 1px 0 rgba(16,32,27,.04); }
.cu-steps .cst-art { margin: 0; aspect-ratio: 1; }
.cu-steps .cst-art img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cu-steps .cst-k { display: block; font-size: 13px; font-weight: 500; letter-spacing: .12em; color: rgba(16,32,27,.62); }
.cu-steps .cst-title { margin-top: 6px; color: var(--ink); }
.cu-steps .cst-body { margin-top: 8px; font-size: 15px; line-height: 1.75; color: var(--mute); }
.cu-steps .cst-prep { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.cu-steps .cst-prep-label { font-size: 13px; font-weight: 500; color: var(--ink); }
.cu-steps .cst-prep ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.cu-steps .cst-prep li { padding: 4px 12px; border-radius: 999px; background: var(--sand); color: var(--ink); font-size: 13px; }

/* armed: cards wait below their final place until their node lights, then rise once and stay */
.cu-steps[data-cst-armed] .cst-card { opacity: 0; transform: translateY(24px); transition: opacity .55s cubic-bezier(.22, 1, .36, 1), transform .55s cubic-bezier(.22, 1, .36, 1); }
.cu-steps[data-cst-armed] .cst-item.is-in .cst-card { opacity: 1; transform: none; }
/* edit round 1 (#83 row 6): the picture eases in with its card (500ms, a beat after the card), and is at full
   strength (opacity 1, no filter) from then on; .is-in is one-shot, so reverse scrolling never re-hides it */
.cu-steps[data-cst-armed] .cst-art img { opacity: 0; transform: scale(.94) translateY(6px); transition: opacity .5s cubic-bezier(.22, 1, .36, 1) .12s, transform .55s cubic-bezier(.22, 1, .36, 1) .12s; }
.cu-steps[data-cst-armed] .cst-item.is-in .cst-art img { opacity: 1; transform: none; }
.cu-steps[data-cst-armed] .cst-item.is-in .cst-card { box-shadow: 0 1px 0 rgba(16,32,27,.04), 0 10px 26px rgba(16,32,27,.06); }

/* desktop display-numeral sizing (edit round 3, row: 「第 4 步 / 5」 too small) moved to the shared,
   page-agnostic public/components/step-counter.css (GitHub #91 row 3) -- link it after this file. */
/* tablet: one column, the side block on top (not sticky) */
@media (max-width: 1023px) {
  .cu-steps .cst-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .cu-steps .cst-side-in { position: static; }
  .cu-steps .cst-counter { margin-top: 18px; }
}
/* phone: the rail on the left edge (24px), cards full width to its right */
@media (max-width: 767px) {
  .cu-steps { --cst-rail-x: 12px; --cst-node: 14px; padding: 72px 0 88px; }
  .cu-steps .cst-item { padding-left: 34px; }
  .cu-steps .cst-node { top: 24px; }
  .cu-steps .cst-list { gap: 18px; }
  .cu-steps .cst-card { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 16px; }
  .cu-steps .cst-body { font-size: 14px; line-height: 1.7; }
  .cu-steps .cst-counter b { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  .cu-steps .cst-node, .cu-steps .cst-card, .cu-steps .cst-art img { transition: none !important; }
}
