/*
 * walk — a condition walk, group by group (ch. 4; charts/kit/walk.js).
 * Used by comp-phases (the mother: ink). Set --wk-ink on .wk to recolour.
 * State "all": the rail is a data bar (widths = share of coded cases), large,
 * in the middle of the stage. A group state: the rail rises to the top and
 * turns into navigation — equal parts, one tick per condition (done ticks
 * half ink, the current one solid) — and the feature area shows the group's
 * title card, then each condition's illustration.
 */
.wk {
  --wk-ink: var(--ink);
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  height: 100%;
  color: var(--ink);
}
.wk:not(.in-scrolly) { height: auto; }
.wk:not(.in-scrolly) .wk-feature { height: 440px; }

/* ---- the rail ----------------------------------------------------------------- */
.wk-rail { grid-row: 1; position: relative; z-index: 1; transition: transform .8s var(--rv-ease); }
.wk[data-state="all"] .wk-rail { transform: translateY(var(--wk-lift, 0px)); }
.wk-axis { display: flex; gap: 6px; padding-top: 44px; transition: padding .6s var(--rv-ease); }
.wk[data-state="all"] .wk-axis { padding-top: 84px; }
.wk-group { position: relative; min-width: 0; flex: 1 1 0; transition: flex-grow .8s var(--rv-ease); }
.wk[data-state="all"] .wk-group { flex-grow: var(--n); }

.wk-head {
  position: absolute; left: 0; bottom: calc(100% + 10px);
  display: flex; flex-direction: row-reverse; align-items: baseline; gap: 8px;
  padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: left; white-space: nowrap;
  background: none; border: 0; cursor: pointer;
  opacity: .42;
  transition: opacity .3s;
}
.wk-head:hover, .wk-head:focus-visible, .wk-group.cur .wk-head { opacity: 1; }
.wk-gl { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.wk-share {
  font-family: var(--font-mono); font-size: 12px; font-weight: 400; line-height: 1;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--muted);
  transition: font-size .6s var(--rv-ease);
}
/* state "all": big shares above the names; the last group is labelled from
   the right, and a narrow group under the bar */
.wk[data-state="all"] .wk-head { flex-direction: column-reverse; align-items: flex-start; gap: 6px; opacity: 1; cursor: default; }
.wk[data-state="all"] .wk-share { font-size: clamp(36px, 4.4vw, 56px); font-weight: 300; color: var(--wk-ink); }
.wk[data-state="all"] .wk-group.last .wk-head { left: auto; right: 0; align-items: flex-end; }
.wk[data-state="all"] .wk-group.narrow .wk-head { top: calc(100% + 12px); bottom: auto; flex-direction: column; }
.wk[data-state="all"] .wk-group.narrow:not(.first, .last) .wk-head { left: 50%; transform: translateX(-50%); align-items: center; }

.wk-bar { display: flex; gap: 2px; height: 10px; transition: height .6s var(--rv-ease); }
.wk[data-state="all"] .wk-bar { height: 34px; }
.wk-seg {
  flex: 1 1 0; min-width: 3px;
  padding: 0; margin: 0; border: 0; border-radius: 0;
  background: var(--wk-ink);
  opacity: .14;
  cursor: pointer;
  transition: flex-grow .8s var(--rv-ease), opacity .3s;
}
.wk-seg:first-child { border-radius: 3px 0 0 3px; }
.wk-seg:last-child { border-radius: 0 3px 3px 0; }
.wk[data-state="all"] .wk-seg { flex-grow: var(--n); opacity: .82; cursor: default; }
.wk-seg.group { opacity: .28; }
.wk-seg.done { opacity: .6; }
.wk-seg.now { opacity: 1; }
.wk:not([data-state="all"]) .wk-seg:hover { opacity: .85; }

.wk-nav {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  min-height: 30px; margin-top: 12px;
  transition: opacity .3s;
}
.wk[data-state="all"] .wk-nav { opacity: 0; visibility: hidden; }
.wk-now { margin: 0; min-width: 0; font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-now span { font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--wk-ink); margin-right: 6px; }
.wk-skip {
  flex: none;
  padding: 5px 12px;
  font-family: var(--font-mono); font-size: 12px; color: rgba(var(--ink-rgb), .75);
  background: none; border: 1px solid rgba(var(--ink-rgb), .22); border-radius: 96px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.wk-skip:hover { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.wk-note {
  position: absolute; left: 0; top: calc(100% - 22px);
  margin: 0; font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  opacity: 0; transition: opacity .3s;
}
.wk[data-state="all"] .wk-note { opacity: 1; }
/* a narrow first group is labelled under the bar, where the note sits */
.wk[data-state="all"]:has(.wk-group.first.narrow) .wk-note { left: auto; right: 0; }

/* ---- feature: a group title card, or one condition's illustration ------------ */
.wk-feature { grid-row: 2; position: relative; min-height: 0; margin-top: 18px; transition: opacity .4s; }
.wk[data-state="all"] .wk-feature { opacity: 0; }
.wk-title, .wk-fig {
  position: absolute; inset: 0;
  margin: 0;
  opacity: 0; visibility: hidden;
  transform: translateY(10px);
  transition: opacity .5s var(--rv-ease), transform .6s var(--rv-ease), visibility 0s .5s;
}
.wk-title.on, .wk-fig.on { opacity: 1; visibility: visible; transform: none; transition-delay: .08s, .08s, 0s; }

.wk-title { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; text-align: center; }
.wk-term { margin: 0; font-family: var(--font-mono); font-size: var(--fs-kicker); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.wk-big { margin: 0; font-family: var(--font-display); font-size: clamp(40px, 5.4vw, 72px); font-weight: 450; line-height: 1.05; letter-spacing: -.02em; }
.wk-sum { margin: 6px 0 0; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.wk-sum strong { font-weight: 500; color: var(--wk-ink); }

.wk-fig { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.wk-fig .vw-art-box {
  flex: 0 1 auto; min-height: 0;
  width: auto; max-width: min(560px, 100%) !important;
  height: min(100%, 400px);
  aspect-ratio: 1000 / 720;
}
.wk-fig .vw-art-box > .vw-art, .wk-fig .vw-art-stack { width: 100%; height: 100%; object-fit: contain; }
.wk-fig figcaption { flex: none; text-align: center; }
.wk-name { font-family: var(--font-display); font-size: 19px; font-weight: 550; }
.wk-code { font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; color: var(--muted); }

@media (width < 900px) {
  .wk.in-scrolly .wk-axis { padding-top: 34px; }
  .wk.in-scrolly .wk-gl { font-size: 11px; letter-spacing: .06em; }
  .wk.in-scrolly:not([data-state="all"]) .wk-share { display: none; }
  .wk.in-scrolly .wk-fig { justify-content: flex-start; padding-top: 8px; }
  .wk.in-scrolly .wk-fig .vw-art-box { height: min(100%, 250px); }
  .wk.in-scrolly .wk-title { justify-content: flex-start; padding-top: 40px; }
}
@container (width <= 600px) {
  .wk:not(.in-scrolly) .wk-feature { height: 300px; }
  .wk-gl { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .wk-rail, .wk-axis, .wk-group, .wk-head, .wk-share, .wk-bar, .wk-seg, .wk-nav, .wk-note, .wk-feature, .wk-title, .wk-fig { transition: none; }
}
