/* Layout and motion only; every colour is a token from theme.css. */
:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-glide: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --sans: "Fennia Sans", "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

.poster { position: relative; background: var(--wh-ground); color: var(--wh-ink); border-radius: 24px; padding: 20px 32px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; isolation: isolate; font-family: var(--sans); }
@media (max-width: 640px) { .poster { padding: 28px 20px 20px; border-radius: 18px; } }
.poster button:focus-visible { outline: 2px solid var(--wh-focus); outline-offset: 2px; }

.headrow { display: flex; justify-content: flex-end; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--wh-switch-track); box-shadow: inset 0 0 0 1px var(--wh-rule); position: relative; }
.seg button { position: relative; z-index: 1; font: 700 13px/1 var(--sans); color: var(--wh-ink-soft); background: none; border: 0; padding: 9px 14px; border-radius: 999px; cursor: pointer; transition: color 200ms ease; }
.seg button[aria-pressed="true"] { color: var(--wh-switch-on); }
.seg .thumb { position: absolute; top: 3px; bottom: 3px; left: 0; border-radius: 999px; background: var(--wh-switch-thumb); box-shadow: inset 0 0 0 1px var(--wh-switch-thumb-ring); transition: transform 250ms var(--ease-out), width 250ms var(--ease-out); }

.p-chart { position: relative; }
.p-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.p-chart text { font-family: var(--sans); }
/* Each order has its own row under the blocks: the moments in path order, the three biggest and the rest by size, the agents by agent. */
.path-row, .agent-row, .size-row { transition: opacity 300ms ease; }
.p-chart.ranked .path-row, .p-chart.agents .path-row, .p-chart:not(.agents) .agent-row, .p-chart:not(.ranked) .size-row { opacity: 0; }
.moment.lead { fill: var(--wh-ink); }
/* In the opening the journey stands before the rest of the finished chart, and its brackets stretch from their own left end. */
.p-chart.journey:not(.final) .path-row { opacity: 1; }
.jr { transform-box: fill-box; transform-origin: 0 50%; }
.ref { stroke: var(--wh-rule); stroke-width: 1; shape-rendering: crispEdges; }
.ref-t { font-size: 12px; fill: var(--wh-muted); }
.ruler { stroke: var(--wh-ink); stroke-width: 1; opacity: 0.5; shape-rendering: crispEdges; }
.ruler-t { font-size: 12px; fill: var(--wh-muted); font-variant-numeric: tabular-nums; }
.ruler-t.strong { fill: var(--wh-ink); font-weight: 700; }
/* The cost ruler arrives before the blocks widen, so the reader sees the scale the widths will be read against. */
.rl { opacity: 0; transition: opacity 350ms var(--ease-out) 250ms; }
.rl-line { transform: scaleX(0); transform-box: fill-box; transform-origin: 0 50%; transition: transform 700ms var(--ease-in-out), opacity 200ms ease; }
.p-chart.costs .rl, .p-chart.final .rl { opacity: 1; }
.p-chart.costs .rl-line, .p-chart.final .rl-line { transform: scaleX(1); }

/* The claim's colour change eases in rather than snapping. */
.blk .face, .blk .cap { transition: fill 400ms ease; }
.blk .face { fill: var(--wh-block); }
.blk .cap { fill: var(--wh-block-cap); }
.final .blk.first .face { fill: var(--wh-answer); }
.final .blk.first .cap { fill: var(--wh-answer-cap); }
/* Once the answer lands, the other blocks step back a tone: more tones, never more hues. */
.blk { transition: opacity 400ms ease; }
.final .blk:not(.first) { opacity: var(--wh-rest); }
.dim .blk:not(.on) { opacity: var(--wh-dim); }
/* The claim's own text rises in line by line once it turns green: the case page's word reveal (up 0.22em, 380ms), without its blur, which is costly to repaint on SVG text this large. */
.rise { opacity: 0; transform: translateY(0.22em); }
.final .rise { animation: wh-rise 380ms cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0ms) both; }
@keyframes wh-rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .final .rise { animation: none; opacity: 1; transform: none; } }
.big-in { font-size: 64px; font-weight: 700; fill: var(--wh-answer-ink); letter-spacing: -0.03em; }
.in-sub { font-size: 13px; fill: var(--wh-answer-ink); }
.in-name { font-size: 20px; letter-spacing: -0.01em; font-weight: 700; fill: var(--wh-answer-ink); }
/* While a block is measured, the printed labels step back so the measure reads alone. */
.share, .path-only, .rank-only { transition: opacity 150ms ease; }
.final.dim .path-only text.share, .final.dim .rank-only text, .final.dim .rank-only .cum, .final.dim .agent-only text, .final.dim .agent-only .cum { opacity: 0.35; }
.final.dim text.share.under { opacity: 0; }
.lab { font-size: 12px; fill: var(--wh-ink); pointer-events: none; }
/* The other bars' names come last in the opening, a plain fade, so they never pull the eye from the claim. */
.p-chart.final:not(.labels) .lab.late { opacity: 0; }
.lab.late { transition: opacity 300ms var(--ease-out); }
.blk.first .lab { fill: var(--wh-answer-ink); font-weight: 700; }
.moment { font-size: 13px; font-weight: 700; fill: var(--wh-ink-soft); transition: opacity 300ms ease; }
.bracket { stroke: var(--wh-ink); stroke-width: 1; opacity: 0.35; shape-rendering: crispEdges; transition: opacity 300ms ease; }
.big { font-size: 76px; font-weight: 700; fill: var(--wh-accent); letter-spacing: -0.03em; }
.big-sub { font-size: 15px; fill: var(--wh-ink-soft); }
.share { font-size: 15px; font-weight: 700; fill: var(--wh-ink-soft); }
.share.lead { fill: var(--wh-accent); font-size: 22px; }
.share-n { font-size: 12px; fill: var(--wh-muted); }
.lead-line { stroke: var(--wh-accent); stroke-width: 1.5; }
.late { opacity: 0; transition: opacity 400ms var(--ease-out); }
.final .late { opacity: 1; }
.final.ranked .path-only, .final.agents .path-only, .final:not(.ranked) .rank-only, .final:not(.agents) .agent-only { opacity: 0; }
.rank-only, .path-only, .agent-only { transition: opacity 350ms ease; }
.cum { stroke: var(--wh-group); stroke-width: 1.5; fill: none; }
.cum-t { font-size: 13px; font-weight: 700; fill: var(--wh-group); }

/* the measure: drawn on the hovered block, like a dimension on a plan */
.meas { opacity: 0; transition: opacity 150ms var(--ease-out); pointer-events: none; }
.meas.on { opacity: 1; }
/* In the opening the claim's measure waits for its key, so the claim's colour and words land alone. */
.p-chart.final:not(.settled) .meas.on { opacity: 0; }
.meas line { stroke: var(--wh-measure); stroke-width: 1.25; shape-rendering: crispEdges; }
.meas text { font-size: 13px; font-weight: 700; fill: var(--wh-measure); }
.meas .bg { fill: var(--wh-ground); }
/* the step's card, an HTML layer over the chart so the customer's words can wrap */
.step-card { position: absolute; left: 0; top: 0; z-index: 3; width: max-content; max-width: 240px; overflow: hidden; padding: 12px 14px; background: var(--wh-card); border-radius: var(--wh-card-radius); box-shadow: var(--wh-card-shadow); font-size: 14px; line-height: 1.35; color: var(--wh-ink-soft); pointer-events: none; opacity: 0; transition: opacity 150ms var(--ease-out); }
.step-card b { color: var(--wh-ink); }
.step-card .ag { margin-top: 4px; color: var(--wh-muted); }
.carded .step-card { opacity: 1; }
.sc-body { display: flex; flex-direction: column; gap: 2px; }
/* Gliding: one width so the card only travels, the move retargets mid-way as the pointer crosses bars, and the new words slide in. */
.step-card.glide { width: 240px; transition: opacity 150ms var(--ease-out), transform 300ms var(--ease-out), height 200ms var(--ease-out); }
/* As in Stripe's menus: the new words come in from 40px on the side the card travels from and settle over 450ms on an even ease-out (easeOutQuad), so the glide stays visible, while the old ones fade out under them in 160ms. The card clips both. */
.sc-body.slide { animation: sc-in 450ms var(--ease-glide) both; }
.sc-body.leaving { position: absolute; top: 12px; left: 14px; right: 14px; pointer-events: none; animation: sc-out 160ms var(--ease-out) forwards; }
@keyframes sc-in { from { opacity: 0; transform: translateX(var(--from, 0)); } 45% { opacity: 1; } }
@keyframes sc-out { to { opacity: 0; transform: translateX(var(--to, 0)); } }
.hitzone { fill: transparent; cursor: crosshair; }
/* The keyboard stops sit over the blocks but let the pointer through to the layer that reads it. */
.focusstop { fill: transparent; pointer-events: none; outline: none; }

.readout { max-width: none; min-height: 3.1em; margin: 0; font-size: 15px; line-height: 1.45; color: var(--wh-ink-soft); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.readout[hidden] { display: none; }
.readout b { color: var(--wh-ink); font-size: 16px; }
.readout .ag { color: var(--wh-muted); }
.p-foot { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; justify-content: space-between; font-size: 14px; color: var(--wh-ink-soft); }

.legend { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 10px; transition: opacity 400ms var(--ease-out); }
.legend li.off { opacity: 0; }
.legend .l { width: 12px; height: 12px; background: var(--wh-answer); box-shadow: inset 0 2px 0 var(--wh-answer-cap); display: block; }
/* The key draws the same measures the chart uses, so the reader meets them once and knows them. */
.legend .mk-w { position: relative; display: block; width: 24px; height: 10px; border-left: 1.25px solid var(--wh-measure); border-right: 1.25px solid var(--wh-measure); }
.legend .mk-w::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); border-top: 1.25px solid var(--wh-measure); }
.legend .mk-h { position: relative; display: block; width: 10px; height: 18px; border-top: 1.25px solid var(--wh-measure); border-bottom: 1.25px solid var(--wh-measure); }
.legend .mk-h::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); border-left: 1.25px solid var(--wh-measure); }

.controls { display: flex; gap: 8px; }
.controls button { font: 700 13px/1 var(--sans); padding: 9px 14px; border-radius: 999px; border: 1px solid var(--wh-rule); background: transparent; color: var(--wh-ink); cursor: pointer; transition: border-color 150ms ease; }
@media (hover: hover) and (pointer: fine) { .controls button:hover { border-color: var(--wh-ink); } }


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