/* Escape Velocity — styles for soc-place.js. Colours come from the theme variables, never fixed values. The exceptions are the six
 * level hues of the badges (slate, green and blue, then bronze, silver and gold for the podium) and the gold used for "you". Text is
 * always in the theme's own ink and muted colours, so it reads on every theme; the hues are only on shapes and bars, and they are
 * mixed toward the theme's ink colour (--tmix, --tmixc) so a bar stands out on a light card and on a dark one.
 * The card lays itself out by its own width (a container query), so it changes shape at the same point on a phone, in a narrow
 * column and at the biggest text size. Every size is in rem or em. */

.lg-card { margin-bottom: 1.2rem; }
.lg-wrap { container: lg / inline-size; }

/* ---------- the level hues ---------- */
.lg-t0 { --lg-f: #a8b6ca; --lg-r: #475569; --lg-n: #0f172a; }      /* slate: the pad */
.lg-t1 { --lg-f: #62e29d; --lg-r: #15803d; --lg-n: #052e16; }      /* green: go */
.lg-t2 { --lg-f: #74b4fd; --lg-r: #1d4ed8; --lg-n: #0b1a40; }      /* blue: the sky */
.lg-t3 { --lg-f: #e3a574; --lg-r: #8a4b1c; --lg-n: #2a1405; }      /* bronze */
.lg-t4 { --lg-f: #e4eaf2; --lg-r: #64748b; --lg-n: #1e293b; }      /* silver */
.lg-t5 { --lg-f: #fcd34d; --lg-r: #a16207; --lg-n: #3a2600; }      /* gold */
/* --lg-c is the hue for bars and edges: deep on a light theme, bright on a dark one (a mix toward the theme's ink where light-dark() is missing) */
.lg-t0, .lg-t1, .lg-t2, .lg-t3, .lg-t4, .lg-t5 { --lg-c: color-mix(in srgb, var(--lg-f) var(--tmix), var(--tmixc)); }
.lg-card { --lg-gold: color-mix(in srgb, #fbbf24 var(--tmix), var(--tmixc)); }
@supports (color: light-dark(red, blue)) {
  .lg-t0, .lg-t1, .lg-t2, .lg-t3, .lg-t4, .lg-t5 { --lg-c: light-dark(color-mix(in srgb, var(--lg-f) 30%, var(--lg-r)), var(--lg-f)); }
  .lg-card { --lg-gold: light-dark(#b7791f, #fbbf24); }
}

/* ---------- badges (inline SVG, decoration only) ---------- */
.lg-svg { display: block; width: 100%; height: auto; overflow: visible; }
.lg-svg .lg-s { fill: var(--lg-f); stroke: var(--lg-r); stroke-width: 3; stroke-linejoin: round; }
.lg-svg .lg-sh { fill: #fff; opacity: .32; }
.lg-svg .lg-ring { fill: none; stroke: var(--lg-r); stroke-width: 1.6; opacity: .5; }
.lg-svg .lg-d { fill: var(--lg-r); }
.lg-svg .lg-v { fill: none; stroke: var(--lg-n); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.lg-svg .lg-orb { fill: none; stroke: var(--lg-r); stroke-width: 3; }
.lg-svg .lg-front { stroke-dasharray: 50 50; stroke-linecap: round; }        /* the half of the ring in front of the hexagon */
.lg-svg .lg-leaf { fill: var(--lg-f); stroke: var(--lg-r); stroke-width: 1.2; }
.lg-svg .lg-wing { fill: var(--lg-f); stroke: var(--lg-r); stroke-width: 2; stroke-linejoin: round; }
.lg-svg .lg-star { fill: var(--lg-f); stroke: var(--lg-r); stroke-width: 1.6; stroke-linejoin: round; }
.lg-svg .lg-num { fill: var(--lg-n); font-family: inherit; font-size: 22px; font-weight: 800; text-anchor: middle; }
.lg-none .lg-s { fill: none; stroke: var(--muted); stroke-dasharray: 5 4; }
.lg-none .lg-plus { fill: none; stroke: var(--muted); stroke-width: 3.5; stroke-linecap: round; }

/* ---------- the viewer's profile, like a player card ---------- */
.lg-pro { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "id" "xp" "st"; gap: 1.1rem 1.8rem; margin: .4rem 0 1.4rem; padding: 1.1rem 1.2rem;
  border-radius: calc(var(--r) - 2px); border: 1px solid color-mix(in srgb, var(--lg-c, var(--brand)) 40%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--lg-c, var(--brand)) 15%, transparent), color-mix(in srgb, var(--lg-c, var(--brand)) 3%, transparent) 70%); }
.lg-id { grid-area: id; display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.lg-big { position: relative; flex: none; width: 5.4rem; filter: drop-shadow(0 .35rem .9rem color-mix(in srgb, var(--lg-c, var(--brand)) 45%, transparent)); }
.lg-who { min-width: 0; }
.lg-who p { margin: 0; }
.lg-over { display: block; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lg-name { font-family: var(--font-head, inherit); font-size: 1.65rem; line-height: 1.2; overflow-wrap: anywhere; }
.lg-name b { font-weight: 800; }
.lg-pro-none .lg-name { font-size: 1.3rem; font-weight: 800; }
.lg-chip { display: inline-block; vertical-align: .25em; padding: .12rem .6rem; border-radius: 999px; background: var(--chip); color: var(--ink); font-family: var(--font, inherit); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.lg-who .lg-range { margin-top: .1rem; color: var(--muted); font-weight: 650; }
.lg-who .lg-say { margin-top: .4rem; }
.lg-go { display: inline-block; margin-top: .7rem; text-decoration: none; }

/* the bar to the next level */
.lg-xp { grid-area: xp; min-width: 0; align-self: end; }
.lg-xp p { margin: 0; }
.lg-xp-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .15rem 1rem; margin-bottom: .5rem !important; }
.lg-xp-head b { font-size: 1.12rem; }
.lg-xp-head span { color: var(--muted); font-size: .92rem; }
.lg-bar { position: relative; height: 1.05rem; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--ink) 13%, transparent); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .28); }
.lg-bar > span { position: absolute; inset: 0 auto 0 0; width: var(--f); border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--lg-c, var(--brand)) 62%, transparent), var(--lg-c, var(--brand)));
  box-shadow: 0 0 .8rem color-mix(in srgb, var(--lg-c, var(--brand)) 60%, transparent); }
.lg-bar > span::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255, 255, 255, .4), transparent 60%); }
.lg-bar > i { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--card-solid); opacity: .75; }
.lg-ends { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 1rem; margin-top: .35rem !important; color: var(--muted); font-size: .88rem; }
.lg-ends > :last-child { margin-left: auto; text-align: right; }
.lg-won .lg-bar > span { background: linear-gradient(90deg, color-mix(in srgb, var(--lg-gold) 70%, transparent), var(--lg-gold)); }

/* three readouts: where you place, your places, who you are ahead of */
.lg-stats { grid-area: st; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto auto; gap: .7rem; min-width: 0; }
.lg-stat { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: .2rem; align-content: start; min-width: 0; padding: .8rem .9rem; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.lg-stat small { color: var(--muted); font-size: .9rem; line-height: 1.3; }
.lg-stat b { font-family: var(--font-head, inherit); font-size: clamp(1.3rem, 5.2cqi, 1.95rem); font-weight: 800; line-height: 1.12; }
.lg-stat span { color: var(--muted); font-size: .9rem; line-height: 1.4; }
.lg-wait { grid-area: st; margin: 0; align-self: center; padding: .85rem 1rem; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--ink) 30%, transparent); font-weight: 650; }

/* ---------- the board ---------- */
.lg-h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .7rem; margin: 1.3rem 0 .6rem; font-size: 1.05rem; }
.lg-h3 small { color: var(--muted); font-size: .9rem; font-weight: 500; }
.lg-board { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.lg-hdr { display: none; }
.lg-row { position: relative; display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); grid-template-areas: "b n" "f f"; gap: .35rem .75rem; align-items: center;
  padding: .6rem .8rem; border-radius: 12px; border: 1px solid var(--line); background: color-mix(in srgb, var(--card-solid) 55%, transparent); }
.lg-b { grid-area: b; width: 2.4rem; }
.lg-tn { grid-area: n; min-width: 0; line-height: 1.35; }
.lg-tn b { font-size: 1.05rem; }
.lg-rng { color: var(--muted); font-size: .92rem; white-space: nowrap; }
.lg-figs { grid-area: f; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .95rem; min-width: 0; font-size: .95rem; }
.lg-pl:empty { display: none; }
.lg-k { color: var(--muted); }
.lg-sh { display: flex; align-items: center; gap: .6rem; flex: 1 1 8rem; min-width: 0; }
.lg-sh b { min-width: 2.6em; }
.lg-pips { position: relative; flex: 1 1 auto; min-width: 3.5rem; height: .7rem; border-radius: 2px; background: color-mix(in srgb, var(--ink) 13%, transparent);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(5% - 2px), transparent calc(5% - 2px) 5%); mask: repeating-linear-gradient(90deg, #000 0 calc(5% - 2px), transparent calc(5% - 2px) 5%); }
.lg-pips > i { position: absolute; inset: 0 auto 0 0; background: var(--lg-c); }

/* the viewer's row is lit; the others step back (their text keeps full contrast: only the badge and bar dim) */
.lg-row.lg-me { border: 2px solid var(--lg-gold); padding: calc(.6rem - 1px) calc(.8rem - 1px);
  background: linear-gradient(90deg, color-mix(in srgb, #fbbf24 17%, var(--card-solid)), color-mix(in srgb, #fbbf24 5%, var(--card-solid)));
  box-shadow: 0 0 0 3px color-mix(in srgb, #fbbf24 20%, transparent), 0 .4rem 1.4rem color-mix(in srgb, #fbbf24 24%, transparent); }
.lg-row.lg-me .lg-b { filter: drop-shadow(0 0 .45rem color-mix(in srgb, #fbbf24 70%, transparent)); }
.you-tag.lg-here { display: inline-block; margin-left: .35rem; vertical-align: .1em; padding: .12rem .55rem; border-radius: 999px; background: #fbbf24; color: #2a1d00;
  font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; box-shadow: 0 0 .6rem rgba(251, 191, 36, .55); }
.lg-row.lg-dim .lg-b { opacity: .72; filter: saturate(.7); }
.lg-row.lg-dim .lg-pips > i { opacity: .6; }
.lg-row.lg-dim { background: transparent; }
.lg-row.lg-pod:not(.lg-me) { box-shadow: inset 4px 0 0 color-mix(in srgb, var(--lg-c) 75%, transparent); }

/* ---------- the milestone ladder ---------- */
.lg-ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: .7rem .5rem; }
.lg-rung { display: flex; flex-direction: column; align-items: center; gap: .35rem; min-width: 0; text-align: center; }
.lg-rb { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; max-width: 3.5rem; aspect-ratio: 1 / 1.12;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--ink); font-size: .85rem; font-weight: 650; line-height: 1.1; }
.lg-rb > i { font-style: normal; font-size: .8rem; line-height: 1; }
.lg-got .lg-rb { background: var(--lg-f); color: var(--lg-n); font-weight: 800; }
.lg-rp { color: var(--muted); font-size: .82rem; line-height: 1.25; }
.lg-rp b { display: block; color: var(--ink); font-size: .95rem; }

.lg-note { margin: .75rem 0 0; font-size: .95rem; }
.lg-foot { margin: 1.15rem 0 0; font-size: .92rem; }

/* ---------- wider: the profile side by side, the board in columns ---------- */
@container lg (min-width: 40em) {
  .lg-board { grid-template-columns: 3rem minmax(11em, 1.7fr) minmax(5.5em, auto) minmax(5.5em, auto) minmax(9em, 1.3fr); column-gap: 1.1rem; }
  .lg-hdr, .lg-row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; grid-template-areas: none; align-items: center; }
  .lg-hdr { padding: 0 .8rem; border: 1px solid transparent; color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
  .lg-hdr > :nth-child(3), .lg-hdr > :nth-child(4) { text-align: right; }
  .lg-row > *, .lg-figs > * { grid-area: auto; }
  .lg-b { width: 3rem; }
  .lg-figs { display: contents; }
  .lg-pl:empty { display: block; }
  .lg-pl, .lg-mn { text-align: right; white-space: nowrap; }
  .lg-pl b, .lg-mn b, .lg-sh b { font-size: 1.05rem; }
  .lg-k { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@container lg (min-width: 54em) {
  .lg-pro { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); grid-template-areas: "id st" "xp st"; align-items: center; padding: 1.3rem 1.5rem; }
  .lg-pro-none { grid-template-columns: minmax(0, 1fr); grid-template-areas: "id"; }
}

/* ---------- narrow: readouts as sentences, the ladder in two rows ---------- */
@container lg (max-width: 36em) {
  .lg-stats { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; gap: .5rem; }
  .lg-stat { grid-row: auto; grid-template-rows: none; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .45rem; padding: .65rem .8rem; }
  .lg-ladder { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@container lg (max-width: 24em) {
  .lg-pro { padding: .9rem .85rem; }
  .lg-id { gap: .8rem; }
  .lg-big { width: 4rem; }
  .lg-name { font-size: 1.35rem; }
  .lg-row { grid-template-columns: 2.1rem minmax(0, 1fr); column-gap: .6rem; padding: .55rem .65rem; }
  .lg-row.lg-me { padding: calc(.55rem - 1px) calc(.65rem - 1px); }
  .lg-b { width: 2.1rem; }
  .lg-ladder { gap: .6rem .35rem; }
}
@container lg (max-width: 16em) { .lg-pw { display: none; } }          /* (the heading above says it: "the share of members who passed") */
/* the smallest phone at the biggest text size: the badge goes above the name, labels may wrap, the ladder takes three columns */
@container lg (max-width: 13em) {
  .lg-pro { padding: .75rem .7rem; }
  .lg-id { flex-direction: column; align-items: flex-start; gap: .55rem; }
  .lg-big { width: 3.6rem; }
  .lg-chip, .lg-rng, .you-tag.lg-here, .lg-pl b.num, .lg-stat b.num { white-space: normal; }    /* (a figure like "1,861 to 2,700" may wrap at "to"; a number never splits) */
  .you-tag.lg-here { margin-left: 0; border-radius: .5rem; text-transform: none; letter-spacing: 0; }      /* (in capitals it would not fit one line) */
  .lg-row { grid-template-columns: 1.9rem minmax(0, 1fr); column-gap: .5rem; padding: .5rem .55rem; }
  .lg-row.lg-me { padding: calc(.5rem - 1px) calc(.55rem - 1px); }
  .lg-b { width: 1.9rem; }
  .lg-ladder { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- a short entrance, once a visit; none with less motion or with animations off ---------- */
.lg-sparks { position: absolute; inset: 0; pointer-events: none; }
.lg-sparks i { position: absolute; left: 50%; top: 50%; width: .5rem; height: .5rem; margin: -.25rem; border-radius: 50%; background: #fbbf24; box-shadow: 0 0 .5rem #fbbf24; opacity: 0; }
.lg-sparks i:nth-child(even) { background: #fff; box-shadow: 0 0 .5rem #fde68a; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.no-anim) .lg-play .lg-big { animation: lgPop .5s cubic-bezier(.2, .9, .3, 1.35) both; }
  body:not(.no-anim) .lg-play .lg-bar > span { animation: lgFill .6s cubic-bezier(.2, .8, .2, 1) .1s both; }
  body:not(.no-anim) .lg-play .lg-row { animation: lgRise .36s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 40ms + 50ms); }
  body:not(.no-anim) .lg-play .lg-sparks i { animation: lgSpark 1.1s cubic-bezier(.15, .7, .3, 1) both; animation-delay: calc(.25s + var(--d, 0ms)); }
}
@keyframes lgPop { from { transform: scale(.55) rotate(-10deg); opacity: 0; } }
@keyframes lgFill { from { width: 0; } }
@keyframes lgRise { from { transform: translateY(.5rem); opacity: 0; } }
@keyframes lgSpark { 0% { opacity: 0; transform: rotate(var(--a)) translateY(0) scale(.4); } 25% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-3.6rem) scale(1); } }

/* Your place is half the page, with "how members are progressing" beside it (the two are about the same thing, and about as tall) */
.g-place { align-items: start; }

/* the first row: the activity strip and the map side by side when there is room for two cards of at least 26rem, one over the other when not.
   The strip's tiles are four in a row in a wide card and two by two in a half one. */
.g-top { grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); align-items: stretch; }
.act-card { margin-bottom: 1.2rem; container: act / inline-size; }
.g-top > .act-card { margin-bottom: 0; }
@container act (max-width: 40rem) { .act-card .g-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* the groups below the first screen: a row for each, with a line about what is in it, that opens and closes (soc-groups in social.js) */
.soc-grps-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-start; gap: .3rem 1.2rem; margin: 1.6rem 0 .7rem; }          /* the button first, on the left, then the line about it */
.soc-grps-head p { margin: 0; font-size: .95rem; }
.soc-grp { margin: 0 0 .8rem; }
.soc-grp-h { margin: 0; }
.soc-grp-btn { display: flex; flex-wrap: wrap; align-items: center; column-gap: 1rem; row-gap: .1rem; width: 100%; padding: .85rem 3.2rem .85rem 1.2rem; position: relative; border: 1px solid var(--line); border-radius: 16px; background: var(--card-solid); color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.soc-grp-btn:hover { border-color: color-mix(in srgb, var(--brand) 60%, var(--line)); }
.soc-grp-t { font-size: 1.1rem; font-weight: 700; line-height: 1.3; }
.soc-grp-about { flex: 1 1 18rem; min-width: 0; color: var(--muted); font-size: .95rem; line-height: 1.4; }
.soc-grp-ic { position: absolute; right: 1.1rem; top: 50%; width: 1.4rem; height: 1.4rem; margin-top: -.7rem; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.soc-grp.open .soc-grp-ic { transform: rotate(180deg); }
.soc-grp.open > .soc-grp-h .soc-grp-btn { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); }
.soc-grp-body { padding-top: 1.1rem; }
body.no-anim .soc-grp-ic { transition: none; }
/* the map card: the picture and the list of countries side by side when the card is wide, one over the other when it is not */
.map-box { display: flex; flex-direction: column; }
.map-body { container: mapb / inline-size; flex: 1; display: flex; flex-direction: column; justify-content: center; }       /* (in a card stretched to the height of the activity strip, the map and its list sit in the middle) */
.g-start { align-items: start; }                                                                     /* two cards side by side that keep their own heights */
.map-list { margin-top: .6rem; }
@container mapb (min-width: 46rem) {
  .map-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); column-gap: 2rem; align-items: start; }
  .map-list { margin-top: 0; }
}

/* the live feed is half a row, beside the ideas: its updates are one column, a few at a time. The ideas list is the taller of the two, so on a wide
   screen the feed stays in view beside it as the page scrolls past (it only has its own row to move in, so it never overlaps anything) */
@media (min-width: 1101px) { .g-start > .feed { position: sticky; top: 1rem; } }
