/* Escape Velocity — styles for soc-forecast.js. Colours come from the theme variables, never fixed values. The one exception is the
 * gold of the viewer's own mark (#fbbf24, the same gold as their pin on the map), with a ring that follows the theme's ink. */

/* ===== both cards: the parts stack, and the small print sits at the foot, so two cards side by side end level ===== */
.dp-card, .rs-card { display: flex; flex-direction: column; min-width: 0; }
.dp-head, .rs-head { font-size: 1.3rem; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; margin: 0 0 .2rem; text-wrap: balance; }
.dp-head b, .rs-head b { color: var(--brand); font-weight: 800; white-space: nowrap; }
.dp-key, .rs-key { font-size: .92rem; color: var(--muted); margin: 0 0 .5rem; }
.dp-key.soc-none, .rs-key.soc-none { margin: .2rem 0 .5rem; }

/* ===== Growth members assume: how members set it (one bar in three parts) ===== */
.rs-card { --gh-gold: #fbbf24; --gh-c0: var(--brand); --gh-c1: color-mix(in srgb, var(--brand) 52%, var(--card-solid)); }
.gh-block { margin: .5rem 0 0; }
.gh-lead { font-size: 1.1rem; font-weight: 650; line-height: 1.3; margin: 0; }
.gh-lead.gh-wait { color: var(--muted); font-weight: 600; }
.gh-big { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; color: var(--brand-text); margin-right: .08em; }
.gh-bar { position: relative; margin-top: .9rem; padding-bottom: 2.4rem; }                   /* the room under the bar is for the "You" pointer */
.gh-split { display: flex; gap: .2rem; height: 2rem; }
.gh-seg { flex: var(--w) 1 0; min-width: .45rem; border-radius: .3rem; }
.gh-seg:first-child { border-top-left-radius: 1rem; border-bottom-left-radius: 1rem; }
.gh-seg:last-child { border-top-right-radius: 1rem; border-bottom-right-radius: 1rem; }
.gh-start { background: var(--gh-c0); }
.gh-history { background: repeating-linear-gradient(-45deg, var(--gh-c0) 0 19%, var(--gh-c1) 19% 32%); }
.gh-seg.gh-history { background: repeating-linear-gradient(-45deg, var(--gh-c0) 0 .45rem, var(--gh-c1) .45rem .9rem); }
.gh-own { background: radial-gradient(circle, var(--card-solid) 0 27%, transparent calc(27% + .6px)), var(--gh-c0); }
.gh-seg.gh-own { background: radial-gradient(circle at center, var(--card-solid) 0 .18rem, transparent calc(.18rem + .6px)) 0 0 / .8rem .8rem, var(--gh-c0); }
.gh-seg.gh-held, .gh-seg.gh-none { border: 2px dashed color-mix(in srgb, var(--muted) 72%, transparent); }
.gh-seg.gh-none { border-color: color-mix(in srgb, var(--muted) 52%, transparent); }
.gh-you { position: absolute; top: 2.05rem; left: clamp(1.7rem, calc(var(--at) * 1%), calc(100% - 1.7rem)); transform: translateX(-50%); display: grid; justify-items: center; gap: .1rem; }
.gh-you i { width: 0; height: 0; border-left: .5rem solid transparent; border-right: .5rem solid transparent; border-bottom: .6rem solid var(--gh-gold); }
.gh-you b { background: var(--gh-gold); color: #1b1300; border-radius: 99px; padding: .1rem .75rem; font-size: .95rem; font-weight: 800; line-height: 1.4; }
.gh-legend { margin-top: .4rem; }
.wf-sw.gh-sw { border-radius: 28%; }
.rs-sub { margin: 1.3rem 0 .15rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: 1.05rem; font-weight: 700; }
.rs-subnote { margin: 0 0 .6rem; font-size: .95rem; }

/* ===== Years to goal: the dot plot =====
 * A narrow card has one row for each range: its name, how many members and their share, and its dots on a line under it. A card wide
 * enough for eight columns has one column for each range, the stack of dots standing on a line, the short name and the share under
 * it, and the counts in a list under the plot. */
.dp-body { container: dp / inline-size; }
.dp-plot { --dp-d: .74rem; --dp-g: .2rem; display: grid; grid-template-columns: minmax(0, 1fr); row-gap: .15rem; margin: .3rem 0 0; }
/* (a row: the name, then the count at the end of the line, or on a line of its own when both do not fit, then the dots) */
.dp-band { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .7rem; row-gap: .1rem; padding: .4rem .6rem .45rem; border-radius: 10px; min-width: 0; }
.dp-lab { order: 1; flex: 1 1 auto; font-size: .92rem; font-weight: 600; min-width: 0; }
.dp-l { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .15rem .35rem; }
.dp-l .you-tag, .dp-yc .you-tag, .dp-ln .you-tag { margin: 0; }
.dp-pct { order: 2; margin-left: auto; text-align: right; font-size: .92rem; color: var(--muted); white-space: nowrap; }
.dp-pct b { color: var(--ink); }
.dp-dots { order: 3; flex: 1 0 100%; display: grid; grid-template-columns: repeat(var(--dp-rows), minmax(0, var(--dp-d))); gap: var(--dp-g); align-items: center; margin-top: .25rem; min-height: var(--dp-d); }
.dp-dot { display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--brand); }
.dp-dot.dp-you { background: #fbbf24; box-shadow: 0 0 0 2px var(--card-solid), 0 0 0 3.6px var(--ink); position: relative; z-index: 1; }      /* the ring keeps it apart where the theme's own colour is a gold too */
.dp-tags, .dp-yc, .dp-s, .dp-ps, .dp-axis, .dp-list { display: none; }
.dp-typ { background: color-mix(in srgb, var(--brand) 11%, transparent); }
.dp-tag { font-style: normal; font-size: .8rem; font-weight: 700; line-height: 1.35; padding: .05rem .5rem; border-radius: 99px; background: var(--chip); color: var(--ink); white-space: nowrap; }
@container dp (min-width: 22rem) {
  .dp-plot { grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(4, auto); row-gap: 0; column-gap: 0; }
  .dp-band { display: grid; grid-row: span 4; grid-template-columns: minmax(0, 1fr); grid-template-rows: subgrid; row-gap: .3rem; align-items: center; justify-items: center; text-align: center; padding: .45rem .12rem .5rem; }
  .dp-tags { display: flex; grid-row: 1; grid-column: 1; justify-content: center; }
  .dp-tags .dp-tag { padding-inline: .35rem; }
  .dp-dots { grid-row: 2; grid-column: 1; align-self: stretch; justify-self: stretch; display: flex; flex-direction: column-reverse; align-items: center; justify-content: flex-start; gap: var(--dp-g); margin: 0;
    height: calc(var(--dp-rows) * (var(--dp-d) + var(--dp-g)) + 1.8rem); padding-bottom: .3rem; border-bottom: 2px solid color-mix(in srgb, var(--muted) 45%, transparent); }
  .dp-dot { flex: none; width: var(--dp-d); height: var(--dp-d); aspect-ratio: auto; }
  .dp-lab { grid-row: 3; grid-column: 1; font-size: .8rem; line-height: 1.2; color: var(--muted); text-wrap: balance; }
  .dp-typ .dp-lab { color: var(--ink); }
  .dp-pct { grid-row: 4; grid-column: 1; justify-self: center; margin: 0; font-size: .9rem; color: var(--ink); }
  .dp-l, .dp-pl { display: none; }
  .dp-s, .dp-yc, .dp-ps { display: block; }
  .dp-yc { margin-bottom: .1rem; }
  .dp-axis { display: block; margin: .3rem 0 0; text-align: center; font-size: .82rem; font-weight: 600; color: var(--muted); }
  .dp-list { display: grid; }
}
/* the counts as words, under the columns: one range to a line, and two columns of them on a wide card */
.dp-list { list-style: none; margin: .9rem 0 0; padding: .4rem 0 0; border-top: 1px solid var(--line); grid-template-columns: minmax(0, 1fr); column-gap: 1.6rem; }
.dp-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .2rem .8rem; padding: .3rem 0; font-size: .92rem; }
.dp-list li + li { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.dp-ln { min-width: 0; display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.dp-lv { margin-left: auto; white-space: nowrap; color: var(--muted); }
.dp-lv b { color: var(--ink); }
@container dp (min-width: 34rem) {
  .dp-list { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(4, auto); grid-auto-flow: column; }
  .dp-list li:nth-child(5) { border-top: 0; }
}
.dp-foot { margin-top: auto; padding-top: .3rem; }
.dp-note { margin: .5rem 0 0; font-size: .92rem; }
/* the dots drop in, column by column and bottom first */
@media (prefers-reduced-motion: no-preference) {
  body:not(.no-anim) .dp-wait .dp-dot, body:not(.no-anim) .dp-wait .dp-yc { opacity: 0; }
  body:not(.no-anim) .dp-play .dp-dot, body:not(.no-anim) .dp-play .dp-yc { animation: dpDrop .36s cubic-bezier(.3, .9, .4, 1.25) both; animation-delay: min(calc(var(--c, 0) * 45ms + var(--i, 0) * 28ms), 620ms); }
}
@keyframes dpDrop { from { opacity: 0; transform: translateY(-.9rem) scale(.6); } }

/* ===== Growth members assume: the range strip =====
 * Rows, top to bottom: the viewer's gold pointer, the strip on its ruler line, the ruler's figures, and the typical figure under them.
 * Everything is placed along the ruler with --x (0 to 100). A label that could run past an end slides along it instead (it is shifted
 * by --x of its own width), so it always stays inside. */
.rs-body { container: rs / inline-size; }
.rs-plot { position: relative; padding: .1rem .85rem 0; margin: .3rem 0 0; }
.rs-you, .rs-track, .rs-axis, .rs-typ { position: relative; }
.rs-you { height: 2.6rem; }
.rs-you-l { position: absolute; bottom: .75rem; left: calc(var(--x) * 1%); transform: translateX(calc(var(--x) * -1%)); display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; font-size: .95rem; }
.rs-you-l .you-tag { margin: 0; }
.rs-ptr { position: absolute; bottom: .02rem; left: calc(var(--x) * 1%); width: 1rem; height: .66rem; margin-left: -.5rem; overflow: visible; }
.rs-ptr path { fill: #fbbf24; stroke: color-mix(in srgb, #fbbf24 50%, var(--ink)); stroke-width: 1.5; stroke-linejoin: round; }
.rs-track { height: 2.2rem; }
.rs-track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; border-radius: 2px; background: color-mix(in srgb, var(--muted) 60%, transparent); }
.rs-tk { position: absolute; top: 50%; left: calc(var(--x) * 1%); width: 2px; height: .5rem; margin-left: -1px; border-radius: 1px; background: color-mix(in srgb, var(--muted) 75%, transparent); }
.rs-b80, .rs-b50 { position: absolute; top: 50%; left: calc(var(--a) * 1%); width: calc(var(--w) * 1%); min-width: .55rem; margin-left: calc((min(var(--w) * 1%, .55rem) - .55rem) / 2);
  border-radius: 99px; transform-origin: calc(var(--o, 50) * 1%) 50%; }
.rs-b80 { height: .9rem; margin-top: -.45rem; background: color-mix(in srgb, var(--brand) 30%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--brand) 75%, transparent); }
.rs-b50 { height: 1.65rem; margin-top: -.825rem; background: var(--brand); }
.rs-ymk { position: absolute; top: .05rem; bottom: .05rem; left: calc(var(--x) * 1%); width: 3px; margin-left: -1.5px; border-radius: 2px; background: #fbbf24; box-shadow: 0 0 0 1.5px var(--card-solid); }
.rs-mid { position: absolute; top: -.25rem; bottom: -.25rem; left: calc(var(--x) * 1%); width: 4px; margin-left: -2px; border-radius: 3px; background: var(--ink); box-shadow: 0 0 0 2px var(--card-solid); }
.rs-axis { height: 1.4rem; margin-top: .3rem; }
.rs-tl { position: absolute; top: 0; left: calc(var(--x) * 1%); transform: translateX(-50%); font-size: .78rem; line-height: 1.4rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rs-typ { height: 2.4rem; }
.rs-car { position: absolute; top: .15rem; left: calc(var(--x) * 1%); width: 0; height: 0; margin-left: -.34rem; border: .34rem solid transparent; border-top: 0; border-bottom: .44rem solid var(--ink); }
.rs-typ-l { position: absolute; top: .65rem; left: calc(var(--x) * 1%); transform: translateX(calc(var(--x) * -1%)); font-size: .88rem; font-weight: 650; white-space: nowrap; }
/* the ruler's figures, every 2% while each has room, then every 4%, then every 8% (rs-gN: the ruler has N steps of 2%) */
@container rs (max-width: 14.3rem) { .rs-g6 .rs-tl:nth-child(even) { visibility: hidden; } }
@container rs (max-width: 16.4rem) { .rs-g7 .rs-tl:nth-child(even) { visibility: hidden; } }
@container rs (max-width: 18.5rem) { .rs-g8 .rs-tl:nth-child(even) { visibility: hidden; } }
@container rs (max-width: 20.6rem) { .rs-g9 .rs-tl:nth-child(even) { visibility: hidden; } }
@container rs (max-width: 22.7rem) { .rs-g10 .rs-tl:nth-child(even) { visibility: hidden; } }
@container rs (max-width: 24.8rem) { .rs-g11 .rs-tl:nth-child(even) { visibility: hidden; } }
@container rs (max-width: 26.9rem) { .rs-g12 .rs-tl:nth-child(even) { visibility: hidden; } }
@container rs (max-width: 29rem) { .rs-g13 .rs-tl:nth-child(even) { visibility: hidden; } }
@container rs (max-width: 31.1rem) { .rs-g14 .rs-tl:nth-child(even) { visibility: hidden; } }
@container rs (max-width: 33.2rem) { .rs-g15 .rs-tl:nth-child(even) { visibility: hidden; } }
@container rs (max-width: 8rem) { .rs-g6 .rs-tl:not(:nth-child(4n+1)) { visibility: hidden; } }
@container rs (max-width: 9.05rem) { .rs-g7 .rs-tl:not(:nth-child(4n+1)) { visibility: hidden; } }
@container rs (max-width: 10.1rem) { .rs-g8 .rs-tl:not(:nth-child(4n+1)) { visibility: hidden; } }
@container rs (max-width: 11.15rem) { .rs-g9 .rs-tl:not(:nth-child(4n+1)) { visibility: hidden; } }
@container rs (max-width: 12.2rem) { .rs-g10 .rs-tl:not(:nth-child(4n+1)) { visibility: hidden; } }
@container rs (max-width: 13.25rem) { .rs-g11 .rs-tl:not(:nth-child(4n+1)) { visibility: hidden; } }
@container rs (max-width: 14.3rem) { .rs-g12 .rs-tl:not(:nth-child(4n+1)) { visibility: hidden; } }
@container rs (max-width: 15.35rem) { .rs-g13 .rs-tl:not(:nth-child(4n+1)) { visibility: hidden; } }
@container rs (max-width: 16.4rem) { .rs-g14 .rs-tl:not(:nth-child(4n+1)) { visibility: hidden; } }
@container rs (max-width: 17.45rem) { .rs-g15 .rs-tl:not(:nth-child(4n+1)) { visibility: hidden; } }
/* the three readouts: side by side when there is room (their labels, figures and notes in line), else one under the other */
.rs-read { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto auto; gap: 0 .7rem; margin: .9rem 0 0; }
.rs-ro { grid-row: span 3; display: grid; grid-template-rows: subgrid; row-gap: .15rem; align-content: start; margin: 0; padding: .7rem .8rem .75rem; border-radius: 12px; background: var(--chip); min-width: 0; }
.rs-ro dt { display: flex; align-items: center; gap: .45rem; font-size: .88rem; font-weight: 650; color: var(--muted); }
.rs-ro dd { margin: 0; min-width: 0; }
.rs-fig { font-size: 1.2rem; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; }
.rs-note { font-size: .82rem; line-height: 1.4; color: var(--muted); }
.rs-sw { flex: none; display: inline-block; width: 1.15rem; border-radius: 99px; }
.rs-sw50 { height: .78rem; background: var(--brand); }
.rs-sw80 { height: .5rem; background: color-mix(in srgb, var(--brand) 30%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--brand) 75%, transparent); }
.rs-swmid { width: 4px; height: 1rem; margin-inline: .3rem; border-radius: 3px; background: var(--ink); }
@container rs (max-width: 30rem) {
  .rs-read { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: .5rem; }
  .rs-ro { grid-row: auto; display: flex; flex-wrap: wrap; align-items: center; column-gap: .8rem; row-gap: .15rem; padding: .55rem .8rem .6rem; }
  .rs-ro dt { flex: 1 1 auto; }
  .rs-fig { margin-left: auto; text-align: right; }
  .rs-note { flex: 1 0 100%; }
}
.rs-me { margin: 1rem 0 0; padding: .7rem .95rem; border-radius: 12px; border-left: 4px solid #fbbf24; background: color-mix(in srgb, #fbbf24 10%, transparent); font-size: 1rem; line-height: 1.5; }
.rs-goal { margin: .9rem 0 0; }
.rs-fine { margin: 0; margin-top: auto; padding-top: .9rem; font-size: .82rem; color: var(--muted); }
/* the bars grow out from the typical figure; the tick and the pointer follow */
@media (prefers-reduced-motion: no-preference) {
  body:not(.no-anim) .rs-wait :is(.rs-b80, .rs-b50) { transform: scaleX(0); }
  body:not(.no-anim) .rs-wait :is(.rs-mid, .rs-typ, .rs-you, .rs-ymk) { opacity: 0; }
  body:not(.no-anim) .rs-play :is(.rs-b80, .rs-b50) { animation: rsGrow .45s cubic-bezier(.2, .8, .25, 1) both; }
  body:not(.no-anim) .rs-play .rs-b50 { animation-delay: .08s; }
  body:not(.no-anim) .rs-play :is(.rs-mid, .rs-typ) { animation: rsShow .25s ease-out .3s both; }
  body:not(.no-anim) .rs-play :is(.rs-you, .rs-ymk) { animation: rsDrop .35s cubic-bezier(.3, .9, .4, 1.3) .4s both; }
}
@keyframes rsGrow { from { transform: scaleX(0); } }
@keyframes rsShow { from { opacity: 0; } }
@keyframes rsDrop { from { opacity: 0; transform: translateY(-.6rem); } }
@media print { .dp-wait :is(.dp-dot, .dp-yc), .rs-wait :is(.rs-mid, .rs-typ, .rs-you, .rs-ymk) { opacity: 1 !important; } .rs-wait :is(.rs-b80, .rs-b50) { transform: none !important; } }
