/* Utopia web revamp v3 — engraved outcome charts. The figure is the hero, on its own line; ink and hatching on paper. */
[data-module="chart"]{min-width:0}
/* once the figure is in, it is the card: the mount stops drawing a second card behind it */
[data-module="chart"]:has(>.ch){background:none;box-shadow:none}
.ch{position:relative;margin:0;display:flex;flex-direction:column;gap:6px;background:var(--surface);border-radius:var(--r-card);box-shadow:var(--shadow);padding:clamp(20px,2.4vw,28px);height:100%;box-sizing:border-box;color:var(--ink);container-type:inline-size}
.ch::before{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:var(--shadow-lift);opacity:0;pointer-events:none}
/* title: the plain subject, one line */
.ch-title{font:600 17px/1.35 var(--f-display);font-size:clamp(15px,6.2cqi,17px);letter-spacing:-.01em;color:var(--ink-2);margin:0;text-wrap:balance}
/* hero: the figure, its own line */
.ch-hero{margin:4px 0 0}
.ch-hero-n{display:block;width:fit-content;max-width:100%;font:700 44px/1.04 var(--f-display);font-size:clamp(36px,15.2cqi,60px);letter-spacing:-.035em;color:var(--blue-deep);text-wrap:balance;transform-origin:0 100%}
.ch-hero--sub{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;column-gap:12px}
.ch-hero-s{font:500 15px/1.3 var(--f-body);color:var(--mute);text-wrap:balance}
.ch-sup{font:600 15px/1.3 var(--f-body);color:var(--ink-2);margin:2px 0 0}
.ch-n{position:relative;display:inline-block}
.ch-n.is-counting{color:transparent}
.ch-n-live{position:absolute;right:0;top:0;color:var(--blue-deep);white-space:nowrap}
.ch-svg{display:block;width:100%;height:auto;margin-top:6px;overflow:visible}
.ch-note{font:400 15px/1.45 var(--f-body);color:var(--ink-2);margin:2px 0 0;text-wrap:balance}

/* phone swipe row: the four cards are one card. Title, the figure alone on one line, the sub-lines, then the drawing
   and the note pinned to the bottom, so every part sits at the same height in every card. */
@media (max-width:760px){
  .rail>[data-module="chart"]{display:flex;flex-direction:column}
  .rail .ch{flex:1;height:auto;gap:4px}
  .rail .ch-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:17px}
  .rail .ch-hero{display:block;margin:2px 0 0}
  .rail .ch-hero-n{font-size:min(10.6cqi,34px);line-height:1.15;white-space:nowrap;text-wrap:nowrap}
  .rail .ch-hero-s{display:block;margin-top:2px}
  .rail .ch-svg{margin-top:auto;padding-top:6px}
  .rail .ch--people .ch-svg{aspect-ratio:320/176}
  .rail .ch-cap{margin-top:-2px}
  .rail .ch-note{min-height:2.9em}
  .rail .ch-fb{height:100%}
}

/* JS-off fallback inside a mount: subject on one line, figure on the next */
.ch-fb{margin:0;padding:24px;border-radius:var(--r-card);font:500 16px/1.4 var(--f-body);color:var(--ink-2);text-wrap:balance}
.ch-fb-t{display:block;font:600 17px/1.35 var(--f-display);letter-spacing:-.01em;color:var(--ink-2)}
.ch-fb-n{display:block;width:fit-content;margin:4px 0 2px;font:700 36px/1.04 var(--f-display);letter-spacing:-.035em;color:var(--blue-deep);text-wrap:balance}

/* SVG parts */
.ch-axis{stroke:var(--ink);stroke-width:1.2;opacity:.35}
.ch-bar.is-after rect{fill:var(--blue-deep)}
.ch-edge{fill:none;stroke:var(--blue-mid);stroke-width:1.4;stroke-linejoin:round}
.ch-bar:has(+.ch-drop) .ch-edge,.ch--bars .ch-bar:not(.is-after) .ch-edge{stroke:var(--mute)}
.ch-bar.is-after .ch-edge{stroke:var(--blue-darker);stroke-width:1.6}
.ch-val{font:700 17px var(--f-display);letter-spacing:-.01em;fill:var(--ink-2)}
.ch-val.is-after{fill:var(--blue-deep);font-size:19px}
.ch-lab{font:500 14px var(--f-body);fill:var(--mute)}
/* a narrow card scales the 320-unit drawing down: the axis words are set larger so they still read at 14 px */
@container (max-width:330px){.ch-lab{font-size:16.5px}}
.ch-lab.is-after{fill:var(--blue-deep);font-weight:600}
.ch-line{fill:none;stroke:var(--blue-deep);stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 1;stroke-dashoffset:0}
.ch-area{opacity:.5}
.ch-pt{fill:var(--surface);stroke:var(--blue-deep);stroke-width:2}
.ch-pt.is-after{fill:var(--blue-deep)}
.ch-drop-g{fill:none;stroke:var(--mute);stroke-width:1.2;stroke-dasharray:3 4}
.ch-drop-a path{fill:none;stroke:var(--blue-deep);stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.ch-hr path,.ch-hr circle{stroke:var(--blue-darker);stroke-width:1.2;stroke-linejoin:round}
.ch-hr-lab{fill:var(--blue-deep);font-weight:600}
.ch-brace{fill:none;stroke:var(--blue-darker);stroke-width:1.2;stroke-linejoin:round;opacity:.6}
.ch-row circle{fill:var(--blue-pale);stroke:var(--blue-mid);stroke-width:.7}
.ch-cap{font:500 var(--label-min)/1.3 var(--f-body);color:var(--mute);margin:2px 0 4px 30.6%}

/* draw-in, slowly, once. JS adds .is-armed only when motion is allowed and takes it off for good when the chart
   first comes into view; --cd staggers charts that arrive together. The finished frame is the default state. */
.ch-bar,.ch-pt,.ch-hr,.ch-drop-a{transform-box:fill-box}
.ch-bar{transform-origin:50% 100%;transition:transform 1300ms var(--ease-io) calc(var(--cd,0ms) + var(--i,0) * 200ms)}
.ch-val{transition:opacity 500ms var(--ease-io) calc(var(--cd,0ms) + 900ms + var(--i,0) * 200ms)}
.ch-drop{transition:opacity 600ms var(--ease-io) calc(var(--cd,0ms) + 1300ms)}
.ch-line{transition:stroke-dashoffset 1800ms var(--ease-io) var(--cd,0ms)}
.ch-area{transition:opacity 900ms var(--ease-io) calc(var(--cd,0ms) + 900ms)}
.ch--line .ch-pt,.ch--line .ch-val{transition:opacity 500ms var(--ease-io) calc(var(--cd,0ms) + var(--t,0) * 1500ms)}
.ch-brace{transition:opacity 600ms var(--ease-io) calc(var(--cd,0ms) + 200ms)}
.ch-row{transform-box:fill-box;transition:opacity 500ms var(--ease-io) calc(var(--cd,0ms) + var(--i,0) * 90ms),transform 500ms var(--ease-io) calc(var(--cd,0ms) + var(--i,0) * 90ms)}
.ch-hero,.ch-sup{transition:opacity 700ms var(--ease-io) var(--cd,0ms),transform 700ms var(--ease-io) var(--cd,0ms)}
.ch.is-armed *{transition:none!important}
.ch.is-armed .ch-bar{transform:scaleY(.02)}
.ch.is-armed .ch-row{opacity:0;transform:translateY(3px)}
.ch.is-armed .ch-val,.ch.is-armed .ch-pt,.ch.is-armed .ch-area,.ch.is-armed .ch-brace,.ch.is-armed .ch-drop{opacity:0}
.ch.is-armed .ch-line{stroke-dashoffset:1}
.ch.is-armed .ch-hero,.ch.is-armed .ch-sup{opacity:0;transform:translateY(6px)}

/* hover (pointer devices): the card lifts a little, the figure leans in, the key mark answers once */
.ch,.ch-hero-n{transition:transform 320ms var(--ease)}
.ch::before{transition:opacity 320ms var(--ease)}
@keyframes ch-nudge{0%,100%{transform:none}45%{transform:scaleY(1.035)}}
@keyframes ch-pulse{0%,100%{transform:none}45%{transform:scale(1.7)}}
@keyframes ch-dip{0%,100%{transform:none}45%{transform:translateY(4px)}}
@keyframes ch-nod{0%,100%{transform:none}45%{transform:translateY(-2px)}}
@media (hover:hover){
  .ch:hover{transform:translateY(-4px)}
  .ch:hover::before{opacity:1}
  .ch:not(.is-armed):hover .ch-hero-n{transform:scale(1.04)}
  .ch:not(.is-armed):hover .ch-bar.is-after{animation:ch-nudge 720ms var(--ease-io) 1}
  .ch--steps:not(.is-armed):hover .ch-bar:first-of-type{animation:ch-nudge 720ms var(--ease-io) 1}
  .ch:not(.is-armed):hover .ch-pt.is-after{transform-origin:50% 50%;animation:ch-pulse 720ms var(--ease-io) 1}
  .ch:not(.is-armed):hover .ch-drop-a{animation:ch-dip 720ms var(--ease-io) 1}
  .ch:not(.is-armed):hover .ch-hr{animation:ch-nod 720ms var(--ease-io) 1}
}

/* after the first draw each chart keeps one very small, slow movement, so the row feels alive */
@keyframes ch-breathe{0%,100%{transform:none}50%{transform:scaleY(1.025)}}
@keyframes ch-beat{0%,100%{transform:none}50%{transform:scale(1.28)}}
@keyframes ch-bob{0%,100%{transform:none}50%{transform:translateY(-1.5px)}}
@keyframes ch-wave{0%,100%{opacity:1}50%{opacity:.62}}
.ch.is-in:not(.is-armed) .ch-bar.is-after{transform-origin:50% 100%;animation:ch-breathe 5.2s var(--ease-io) 2.4s infinite}
.ch.is-in:not(.is-armed) .ch-pt.is-after{transform-origin:50% 50%;animation:ch-beat 4.4s var(--ease-io) 2.4s infinite}
.ch.is-in:not(.is-armed) .ch-hr{animation:ch-bob 4.8s var(--ease-io) 2.4s infinite}
.ch.is-in:not(.is-armed) .ch-row{animation:ch-wave 6s var(--ease-io) calc(2.4s + var(--i,0) * 140ms) infinite}

/* paused or reduced motion: the finished frame, nothing moves */
body.paused .ch,body.paused .ch *,body.paused .ch::before{transition:none!important;animation:none!important}
body.paused .ch:hover,body.paused .ch:hover .ch-hero-n{transform:none}
body.paused .ch.is-armed .ch-bar,body.paused .ch.is-armed .ch-row,body.paused .ch.is-armed .ch-hero,body.paused .ch.is-armed .ch-sup{opacity:1;transform:none}
body.paused .ch.is-armed :is(.ch-val,.ch-pt,.ch-drop){opacity:1}
body.paused .ch.is-armed .ch-area{opacity:.5}
body.paused .ch.is-armed .ch-brace{opacity:.6}
body.paused .ch.is-armed .ch-line{stroke-dashoffset:0}
@media (prefers-reduced-motion:reduce){
  .ch,.ch *,.ch::before{transition:none!important;animation:none!important}
  .ch:hover,.ch:hover .ch-hero-n{transform:none}
  .ch.is-armed .ch-bar,.ch.is-armed .ch-row,.ch.is-armed .ch-hero,.ch.is-armed .ch-sup{opacity:1;transform:none}
  .ch.is-armed :is(.ch-val,.ch-pt,.ch-drop){opacity:1}
  .ch.is-armed .ch-area{opacity:.5}
  .ch.is-armed .ch-brace{opacity:.6}
  .ch.is-armed .ch-line{stroke-dashoffset:0}
}
