/* Escape Velocity — styles for soc-pulse.js. Colours come from the theme variables, never fixed values (the one exception is the gold
   that marks "you", as on the map). Sizes are in rem, em and cqw, so each chart and its words grow together with the text size. */

/* ---------- the pair: the title, the chart and the key are three rows the two cards share, so side by side they line up ---------- */
.wf-card, .gg-card { display: grid; grid-template-rows: auto auto 1fr; row-gap: 1.2rem; align-content: start; }
.g-pulse > .wf-card, .g-pulse > .gg-card { grid-row: span 3; grid-template-rows: subgrid; }
.wf-head .sub, .gg-head .sub { margin-bottom: 0; }
.wf-body, .gg-body, .wf-foot, .gg-foot { min-width: 0; }
.wf-foot, .gg-foot { display: flex; flex-direction: column; }

/* ---------- how many members are on track: the strip of dots ---------- */
.wf-card { --wf-gold: #fbbf24; --wf-ring: color-mix(in srgb, #fbbf24 55%, var(--ink)); }
.wf-lead { font-size: 1.15rem; font-weight: 650; line-height: 1.3; }
.wf-big { font-size: 2.3rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; color: var(--pos-ink); margin-right: .08em; }
.wf-lead.wf-wait { color: var(--muted); font-weight: 600; }
.wf-what { margin-top: .4rem; color: var(--muted); }
.wf-what a { font-weight: 650; }
.wf-bar { margin-top: 1.1rem; }
.wf-ends { display: flex; justify-content: space-between; gap: .8rem; margin: 0 0 .4rem; font-size: .9rem; line-height: 1.35; color: var(--muted); }
.wf-track { position: relative; padding-bottom: 2.6rem; }                                   /* the room under the strip is for the "You" pointer */
.wf-split { container: wf-dots / inline-size; display: flex; gap: .2rem; height: 2.8rem; --dot: clamp(6px, calc(52cqw / 20), 1.15rem); }          /* (a dot is about half the room each of the 20 has, never wider than that, whatever the text size) */
.wf-seg { flex: var(--w) 1 0; min-width: .45rem; display: flex; align-items: center; justify-content: space-evenly; padding-inline: .1rem; border-radius: .3rem; }
.wf-seg:first-child { border-top-left-radius: 1.4rem; border-bottom-left-radius: 1.4rem; }
.wf-seg:last-child { border-top-right-radius: 1.4rem; border-bottom-right-radius: 1.4rem; }
/* the three kinds: a solid colour, stripes, and a ring (the same in the key, in the dots and in the picture of each, so colour is never the only difference) */
.wf-on { background: var(--pos); }
.wf-over { background: repeating-linear-gradient(-45deg, var(--warn) 0 19%, color-mix(in srgb, var(--warn) 38%, var(--card-solid)) 19% 32%); }
.wf-short { background: radial-gradient(circle, var(--card-solid) 0 27%, transparent calc(27% + .6px)), var(--neg); }
.wf-dot { flex: none; width: var(--dot); height: var(--dot); border-radius: 50%; }
/* a zone is the kind's colour, lightly: the target (the plan ends close to zero) has the heavier outline */
.wf-seg.wf-on { background: color-mix(in srgb, var(--pos) 17%, transparent); box-shadow: inset 0 0 0 .14rem color-mix(in srgb, var(--pos) 80%, transparent); }
.wf-seg.wf-over { background: color-mix(in srgb, var(--warn) 15%, transparent); }
.wf-seg.wf-short { background: color-mix(in srgb, var(--neg) 15%, transparent); }
.wf-held, .wf-none { border: 2px dashed color-mix(in srgb, var(--muted) 72%, transparent); }
.wf-none { border-color: color-mix(in srgb, var(--muted) 52%, transparent); }
/* the viewer's own verdict: a gold pointer under the middle of its part, kept inside the bar at either end */
.wf-you { position: absolute; top: 2.95rem; left: clamp(1.7rem, calc(var(--at) * 1%), calc(100% - 1.7rem)); transform: translateX(-50%); display: grid; justify-items: center; gap: .1rem; }
.wf-you i { width: 0; height: 0; border-left: .5rem solid transparent; border-right: .5rem solid transparent; border-bottom: .6rem solid var(--wf-gold); }
.wf-you b { background: var(--wf-gold); color: #1b1300; border-radius: 99px; padding: .1rem .75rem; font-size: .95rem; font-weight: 800; line-height: 1.4; }
.wf-note { margin-top: .75rem; font-size: .92rem; color: var(--muted); text-align: center; text-wrap: balance; }
.wf-note .wf-sw { display: inline-block; width: .95em; height: .95em; vertical-align: -.14em; margin-right: .45em; }
.wf-note a { font-weight: 650; }
.wf-disc { margin-top: auto; font-size: .85rem; color: var(--muted); }

/* ---------- the keys under both charts: a row for each part, with its share and how many members ---------- */
.wf-legend, .gg-rows { list-style: none; margin: 0 0 .9rem; padding: 0; }
.wf-legend { container: wf-key / inline-size; }
.gg-rows { container: gg-key / inline-size; }
.wf-row, .gg-row { display: grid; column-gap: .75rem; row-gap: .1rem; align-items: start; padding: .6rem 0; border-top: 1px solid var(--line); }
.wf-row { grid-template-columns: 1.1rem minmax(0, 1fr) auto; }
.gg-row { grid-template-columns: 1.6rem minmax(0, 1fr) auto; }
.wf-row:first-child, .gg-row:first-child { border-top: 0; padding-top: 0; }
.wf-row > .wf-sw, .gg-row > .gg-sw { grid-column: 1; grid-row: 1; align-self: center; display: block; }
.wf-name, .gg-name { grid-column: 2; grid-row: 1; min-width: 0; line-height: 1.4; }
.wf-mean, .gg-mean { grid-column: 2; grid-row: 2; min-width: 0; color: var(--muted); font-size: .92rem; line-height: 1.4; }
.wf-figs, .gg-figs { grid-column: 3; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.wf-pct, .gg-pct { font-size: 1.2rem; font-weight: 750; line-height: 1.25; }
.wf-n, .gg-n { color: var(--muted); font-size: .92rem; white-space: nowrap; }
.wf-sw { width: 1.1rem; height: 1.1rem; border-radius: 28%; }
.gg-sw { width: 1.6rem; border-radius: 99px; }
/* a narrow key (a phone, or big text): the share and the count go under the name, so the name keeps the width */
@container wf-key (max-width: 22rem) {
  .wf-row { grid-template-columns: 1.1rem minmax(0, 1fr); }
  .wf-row > .wf-figs { grid-column: 2; grid-row: 2; flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: .6rem; text-align: left; }
  .wf-row > .wf-mean { grid-row: 3; }
}
@container gg-key (max-width: 22rem) {
  .gg-row { grid-template-columns: 1.6rem minmax(0, 1fr); }
  .gg-row > .gg-figs { grid-column: 2; grid-row: 2; flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: .6rem; text-align: left; }
  .gg-row > .gg-mean { grid-row: 3; }
}

/* ---------- how many members updated this month: the dial ---------- */
.gg-dial { position: relative; container: gg-dial / inline-size; width: min(100%, clamp(17rem, 80%, 25rem)); margin: 0 auto; }
.gg-svg { display: block; width: 100%; height: auto; overflow: visible; }
.gg-svg path { fill: none; }
.gg-track { stroke: color-mix(in srgb, var(--muted) 14%, transparent); stroke-width: 20; }
/* the three parts fade as they get older: strong and thick, lighter, then grey and thin (the same in the key). Each is mixed with the
   card's own colour, so it fades towards the card in a light theme and in a dark one, and still stands clear of the track */
.gg-card { --gg-c0: var(--brand); --gg-c1: color-mix(in srgb, var(--brand) 62%, var(--card-solid)); --gg-c2: color-mix(in srgb, var(--muted) 62%, var(--card-solid)); }
.gg-s0 { stroke: var(--gg-c0); stroke-width: 20; }
.gg-s1 { stroke: var(--gg-c1); stroke-width: 14; }
.gg-s2 { stroke: var(--gg-c2); stroke-width: 9; }
.gg-sw.gg-s0 { height: .72rem; background: var(--gg-c0); }
.gg-sw.gg-s1 { height: .52rem; background: var(--gg-c1); }
.gg-sw.gg-s2 { height: .34rem; background: var(--gg-c2); }
.gg-held, .gg-empty { stroke: color-mix(in srgb, var(--muted) 75%, transparent); stroke-width: 2.5; stroke-dasharray: 5 4.2; }
.gg-cut { stroke: var(--card-solid); stroke-width: 2.6; }
.gg-tick { stroke: color-mix(in srgb, var(--muted) 70%, transparent); stroke-width: 2; stroke-linecap: round; }
.gg-knob { transform-box: view-box; transform-origin: 120px 120px; }
.gg-knob circle { fill: var(--card-solid); stroke: var(--brand); stroke-width: 5; }
/* the big number sits inside the half circle, just above its base line (the base line is half the dial's width down) */
.gg-mid { position: absolute; inset: 0 0 auto; height: 48cqw; margin: 0; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.gg-big { font-size: clamp(1.7rem, 15cqw, 3.3rem); font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--brand-text); }
.gg-mid .under-k { font-size: 1.1rem; }
.gg-scale { display: grid; grid-template-columns: 23.4cqw minmax(0, 1fr) 23.4cqw; align-items: start; margin: .15rem 0 0; color: var(--muted); font-size: .8rem; }
.gg-scale > span:not(.gg-cap) { text-align: center; white-space: nowrap; }
.gg-cap { text-align: center; color: var(--ink); font-size: 1rem; font-weight: 650; line-height: 1.3; text-wrap: balance; }
/* a narrow dial (a phone, or big text): the words under the number get a line of their own, under the two ends of the scale */
@container gg-dial (max-width: 18rem) {
  .gg-scale > :first-child { grid-column: 1; grid-row: 1; }
  .gg-scale > :last-child { grid-column: 3; grid-row: 1; }
  .gg-scale > .gg-cap { grid-column: 1 / -1; grid-row: 2; }
}
.gg-lead { margin-top: 1rem; font-size: 1.05rem; font-weight: 600; }
.gg-lead.gg-wait { color: var(--muted); }
.gg-rhythm { margin-top: .35rem; color: var(--muted); font-size: .95rem; }
.gg-note { margin-top: .5rem; color: var(--muted); font-size: .92rem; }
/* the viewer's own status, from this device */
.gg-me { margin: auto 0 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .9rem; padding: .65rem .85rem; border-radius: 12px; font-weight: 600; line-height: 1.4; }
.gg-me0 { background: var(--pos-soft); color: var(--pos-ink); }
.gg-me1 { background: var(--brand-soft); color: var(--ink); }
.gg-me2 { background: var(--warn-soft); color: var(--warn-ink); }
.gg-me .btn { flex: none; }

/* ---------- the entrances (soc-pulse.js decides when; nothing here runs for reduced motion or with Animations off) ---------- */
@media (prefers-reduced-motion: no-preference) {
  body:not(.no-anim) .wf-anim .wf-split { clip-path: inset(0 100% 0 0 round 1.4rem); }
  body:not(.no-anim) .wf-anim.wf-go .wf-split { clip-path: inset(0 0 0 0 round 1.4rem); animation: wfWipe 1s cubic-bezier(.3, .7, .2, 1) both; animation-delay: var(--wf-skip, 0ms); }
  body:not(.no-anim) .wf-anim .wf-you { opacity: 0; }
  body:not(.no-anim) .wf-anim.wf-go .wf-you { opacity: 1; animation: wfRise .45s ease-out both; animation-delay: calc(var(--wf-skip, 0ms) + 900ms); }
  body:not(.no-anim) .gg-anim .gg-seg, body:not(.no-anim) .gg-anim .gg-knob, body:not(.no-anim) .gg-anim .gg-held { opacity: 0; }
  body:not(.no-anim) .gg-anim.gg-go .gg-seg { opacity: 1; animation: ggSweep var(--gg-t) linear both; animation-delay: calc(var(--gg-skip, 0ms) + var(--gg-d)); }
  body:not(.no-anim) .gg-anim.gg-go .gg-knob { opacity: 1; animation: ggKnob var(--gg-t) linear both; animation-delay: var(--gg-skip, 0ms); }
  body:not(.no-anim) .gg-anim.gg-go .gg-held { opacity: 1; animation: ggFade .4s ease-out both; animation-delay: calc(var(--gg-skip, 0ms) + 900ms); }
}
@keyframes wfWipe { from { clip-path: inset(0 100% 0 0 round 1.4rem); } }
@keyframes wfRise { from { opacity: 0; transform: translate(-50%, .6rem); } }
@keyframes ggSweep { from { stroke-dasharray: 0 200; } }
@keyframes ggKnob { from { transform: rotate(calc(var(--gg-f) * -180deg)); } }
@keyframes ggFade { from { opacity: 0; } }
