:root {
  color-scheme: light;
  --paper: #f3efe6;
  --ink: #1b1813;
  --soft: #6f685d;
  --line: rgba(27, 24, 19, 0.14);
  --pink: #ff3e8a;

  --run: #f4e07d;
  --ride: #cbbcf6;
  --walk: #bfe3b4;
  --swim: #acd9f2;
  --workout: #f6c6ab;
  --any: #f5bfd3;

  --display: "Anybody", "Arial Narrow", sans-serif;
  --text: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --mark: rgba(255, 62, 138, 0.26);  /* highlighter stroke behind the words you can change */
}

* { box-sizing: border-box; }

html { background: var(--paper); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.28;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.4  0 0 0 0 0.32  0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }

/* ---------- top ---------- */

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px var(--gutter) 0;
}

/* the logo is a dark tag with a pink dot, like a race wristband; favicon and social image use the same mark */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.3em 0.75em 0.34em 0.4em;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--display);
  font-weight: 750;
  font-variation-settings: "wdth" 80;
  font-size: 17px;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-decoration: none;
}
.logo i { width: 0.72em; height: 0.72em; border-radius: 50%; background: var(--pink); }
.logo:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; }

.updated { margin: 0; font-size: 14px; color: var(--soft); }

/* ---------- hero ---------- */

.hero { padding: clamp(24px, 4.5vw, 64px) var(--gutter) 28px; }

.hero-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(16px, 3vw, 48px);
}

/* a hand of real badges: Strava users recognise these before they read a word */
.fan {
  position: relative;
  width: clamp(250px, 26vw, 380px);
  aspect-ratio: 2 / 1;   /* badges are 42% wide and drop by at most 15%: always inside */
  max-width: 100%;
}
.fan img {
  position: absolute;
  top: 0;
  width: 42%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(27, 24, 19, 0.25));
  transition: transform 0.35s cubic-bezier(.2, .8, .3, 1.4);
}
.fan img:nth-child(1) { left: 0; transform: rotate(-14deg) translateY(14%); }
.fan img:nth-child(2) { left: 14.5%; transform: rotate(-6deg) translateY(4%); }
.fan img:nth-child(3) { left: 29%; transform: rotate(2deg); z-index: 2; }
.fan img:nth-child(4) { left: 43.5%; transform: rotate(9deg) translateY(5%); }
.fan img:nth-child(5) { left: 58%; transform: rotate(16deg) translateY(15%); }
.fan:hover img:nth-child(odd) { transform: rotate(-4deg) translateY(-4%); }
.fan:hover img:nth-child(even) { transform: rotate(6deg) translateY(-6%); }

@media (max-width: 760px) {
  .hero-head { grid-template-columns: 1fr; }
  .fan { order: -1; width: min(280px, 78vw); }
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 750;
  font-variation-settings: "wdth" 76;
  font-size: clamp(46px, 7.4vw, 128px);
  line-height: 0.92;
  letter-spacing: 0.005em;   /* never negative: at this weight the letters would touch */
}
h1 em {
  font-style: italic;
  font-weight: 700;
  font-variation-settings: "wdth" 124;
  letter-spacing: 0;
  color: var(--pink);
}

.lead {
  max-width: 620px;
  margin: clamp(20px, 3vw, 32px) 0 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--soft);
  text-wrap: pretty;
}

.ask {
  max-width: 1400px;
  margin: clamp(24px, 3.5vw, 44px) 0 0;
  font-family: var(--display);
  font-weight: 400;
  font-variation-settings: "wdth" 88;
  font-size: clamp(24px, 3.2vw, 44px);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.pick { position: relative; display: inline-flex; align-items: center; white-space: nowrap; }

.pick select, .pick input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0 0.9em 0.12em 0.05em;
  border: 0;
  border-radius: 0;
  background: linear-gradient(transparent 58%, var(--mark) 58%, var(--mark) 90%, transparent 90%);
  color: var(--ink);
  font: inherit;
  font-style: italic;
  font-weight: 700;
  font-variation-settings: "wdth" 112;
  letter-spacing: 0;
  cursor: pointer;
  outline: none;
}
.pick select:hover, .pick input:hover { --mark: rgba(255, 62, 138, 0.4); }
.pick select:focus-visible, .pick input:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; border-radius: 4px; }

.pick::after {
  content: "";
  position: absolute;
  right: 0.12em;
  top: 50%;
  width: 0.32em;
  height: 0.32em;
  border-right: 0.08em solid currentColor;
  border-bottom: 0.08em solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.pick-where::after { display: none; }
.pick input { cursor: text; padding-right: 0.15em; width: 7.2ch; text-overflow: clip; }
@supports (field-sizing: content) {
  .pick input { field-sizing: content; width: auto !important; min-width: 3ch; }
}
.pick input::placeholder { color: var(--soft); opacity: 1; }
.pick input.bad { color: var(--soft); }

/* country suggestions: a sticker-like list under the box, in the reading font */
.where-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: max-content;
  min-width: 230px;
  max-width: min(320px, calc(100vw - 32px));
  max-height: 340px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 18px 18px 18px 6px;
  box-shadow: 0 18px 30px -18px rgba(27, 24, 19, 0.6);
  font: 500 16px/1.3 var(--text);
  font-variation-settings: normal;
  letter-spacing: 0;
  white-space: normal;
}
.where-list[hidden] { display: none; }
.where-list li { padding: 9px 12px; border-radius: 11px; color: var(--ink); cursor: pointer; }
.where-list li:hover { background: var(--line); }
.where-list li[aria-selected="true"] { background: var(--ink); color: var(--paper); }
/* after the usual suspects, a hairline before the A to Z */
.where-list li.split { margin-top: 5px; border-top: 1.5px dashed var(--line); border-radius: 0 0 11px 11px; padding-top: 12px; }

.clear {
  margin-left: 0.15em;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  width: 1.1em;
  height: 1.1em;
  border-radius: 50%;
  font: 600 0.55em/1 var(--text);
  cursor: pointer;
}

/* ---------- section counters: what's below, and a way to get there ---------- */

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: clamp(26px, 4vw, 44px);
}
.jump a {
  display: flex;
  flex-direction: column;
  min-width: 150px;
  padding: 12px 18px 14px;
  border: 2px solid var(--ink);
  border-radius: 20px 20px 20px 6px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.2s cubic-bezier(.2, .8, .3, 1.3), box-shadow 0.2s;
}
.jump a[data-k="soon"] { background: var(--ride); }
.jump a[data-k="ending"] { background: var(--any); }
.jump a:hover, .jump a:focus-visible { transform: translateY(-3px) rotate(-1deg); box-shadow: 0 10px 20px -14px rgba(27, 24, 19, 0.7); }
.jump a:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; }
.jump a.empty { opacity: 0.45; pointer-events: none; }
.jump b {
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: "wdth" 70;
  font-size: 44px;
  line-height: 0.95;
  font-feature-settings: "tnum";
}
.jump span { font-size: 15px; font-weight: 600; }
/* All / Added in the last 3 days: a view switch over the whole list, the counters below stay jumps */
.view {
  display: inline-flex;
  gap: 3px;
  margin-top: clamp(26px, 4vw, 44px);
  padding: 4px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
}
.view button {
  padding: 10px 20px 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 600 17px var(--text);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.view button b { margin-left: 5px; font-size: 1.12em; font-family: var(--display); font-weight: 800; font-feature-settings: "tnum"; }
.view button:hover { background: var(--line); }
.view button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.view button[data-new="1"][aria-checked="true"] b { color: var(--pink); }
.view button:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.view button.empty { opacity: 0.45; pointer-events: none; }
.view + .jump { margin-top: 18px; }

.jump-bar .view { flex: none; margin: 0 6px 0 0; padding: 2px; border-width: 1.5px; }
.jump-bar .view button { padding: 5px 11px 6px; font-size: 14px; }

.new-tag {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 7px 3px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  vertical-align: 1px;
}

.jump a { position: relative; }
.jump a::after { content: "↓"; position: absolute; top: 12px; right: 14px; font-size: 17px; }

.jump-bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  display: flex;
  gap: 6px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)) 10px
           max(var(--gutter), env(safe-area-inset-left, 0px));
  background: rgba(243, 239, 230, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1.5px solid var(--ink);
  overflow-x: auto;
  scrollbar-width: none;
  transform: translateY(-110%);
  transition: transform 0.25s ease;
}
.jump-bar::-webkit-scrollbar { display: none; }
.jump-bar.show { transform: none; }
.jump-bar a {
  flex: none;
  padding: 7px 13px 8px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.jump-bar a b { margin-left: 3px; font-family: var(--display); font-weight: 800; }
.jump-bar a:hover { background: var(--line); }
.jump-bar a.current { background: var(--ink); color: var(--paper); }

.band { scroll-margin-top: 64px; }

/* secondary setting at the end of the sentence: same voice, half the size */
.aside {
  font-size: 0.52em;
  color: var(--soft);
  white-space: nowrap;
}
/* normal width and a tighter caret gap so the tail stays on the line whenever it can */
.aside .pick select { color: var(--soft); font-variation-settings: "wdth" 88; letter-spacing: 0; padding-right: 0.75em; }

/* ---------- sections ---------- */

.band { padding: 34px var(--gutter) 30px; }
.band + .band { border-top: 2px solid var(--ink); }

.band-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
  margin-bottom: 8px;
}

.band-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 750;
  font-variation-settings: "wdth" 76;
  font-size: clamp(40px, 6vw, 84px);
  line-height: 0.92;
  letter-spacing: 0.005em;
}
.band-head h2 em {
  font-style: italic;
  font-weight: 700;
  font-variation-settings: "wdth" 124;
  letter-spacing: 0;
}

.band-head .n {
  display: inline-grid;
  place-items: center;
  min-width: 1.9em;
  height: 1.9em;
  padding: 0 0.5em;
  border-radius: 999px;
  border: 2px solid var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  transform: rotate(-6deg) translateY(-0.4em);
}
.band.ending .band-head .n { background: var(--pink); border-color: var(--pink); color: #fff; }

.band-head p { flex-basis: 100%; margin: 4px 0 0; font-size: 17px; color: var(--soft); }

/* ---------- grid of cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 64px 26px;
  padding: 58px 0 10px;
}

.card {
  --tone: var(--any);
  --tilt: -4deg;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 78px 26px 22px;
  border-radius: 30px 30px 30px 8px;
  background: var(--tone);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(.2, .8, .3, 1.2), box-shadow 0.25s;
  outline: none;
}
.card:nth-child(3n + 2) { --tilt: 5deg; border-radius: 30px 8px 30px 30px; }
.card:nth-child(3n) { --tilt: -1.5deg; border-radius: 8px 30px 30px 30px; }

.card.run { --tone: var(--run); }
.card.ride { --tone: var(--ride); }
.card.walk { --tone: var(--walk); }
.card.swim { --tone: var(--swim); }
.card.workout { --tone: var(--workout); }

.card:hover, .card:focus-visible {
  transform: translateY(-6px) rotate(-0.6deg);
  box-shadow: 0 22px 40px -24px rgba(27, 24, 19, 0.55);
}

.badge {
  position: absolute;
  top: -46px;
  left: 18px;
  width: 112px;
  height: 112px;
  object-fit: contain;
  transform: rotate(var(--tilt));
  filter: drop-shadow(0 8px 10px rgba(27, 24, 19, 0.22));
  transition: transform 0.35s cubic-bezier(.2, .8, .3, 1.4);
}
.card:hover .badge { transform: rotate(calc(var(--tilt) * -1.6)) scale(1.06); }

.badge.missing {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  font-family: var(--display);
  font-weight: 800;
  font-size: 34px;
}

.sticker {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 7px 13px 8px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13.5px;
  font-weight: 600;
  transform: rotate(3deg);
}
.sticker.ending { background: var(--pink); color: #fff; transform: rotate(-3deg); }
.sticker.fresh { background: #fff; color: var(--ink); transform: rotate(-2deg); }

.brand {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 750;
  font-variation-settings: "wdth" 76;
  font-size: 30px;
  line-height: 0.98;
  letter-spacing: 0.005em;
  text-wrap: balance;
}

.title a { color: inherit; text-decoration: none; }

.goal {
  margin: 16px 0 22px;
  font-size: 18px;
  line-height: 1.35;
  text-wrap: pretty;
  overflow-wrap: break-word;
}
.goal strong, .sheet-body p strong {
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  font-variation-settings: "wdth" 120;
  font-size: 1.32em;
  letter-spacing: 0;
  /* may wrap: long amounts like "1.5 million kilometres" must stay inside the card.
     The number and the word right after it are glued with a no-break space in taskHTML. */
}

.together {
  display: flex;
  gap: 8px;
  margin: -10px 0 22px;
  font-size: 15px;
  line-height: 1.35;
}
.together::before {
  content: "";
  flex: none;
  width: 22px;
  height: 14px;
  margin-top: 2px;
  background:
    radial-gradient(circle at 7px 7px, var(--ink) 5px, transparent 5.5px),
    radial-gradient(circle at 15px 7px, var(--pink) 5px, transparent 5.5px);
}
.sheet-body .together { margin: 10px 0 0; }

/* with a country chosen: whether the prize is for you (joining is open to everyone either way) */
.prize-note {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: -8px 0 18px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  color: rgba(27, 24, 19, 0.62);
}
.prize-note::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  transform: translateY(-1px);
}
.prize-note.yes { color: var(--ink); }
.prize-note.yes::before { background: var(--pink); border-color: var(--pink); }

.meta {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-top: 14px;
  border-top: 1.5px dashed rgba(27, 24, 19, 0.35);
  font-size: 14.5px;
}
.meta .when { font-weight: 600; }
.meta .sports { color: rgba(27, 24, 19, 0.7); text-align: right; }

.nothing { padding: 20px var(--gutter) 80px; font-size: 20px; color: var(--soft); }

.foot { padding: 40px var(--gutter) 56px; }
.foot p { margin: 0; max-width: 620px; font-size: 14.5px; line-height: 1.55; color: var(--soft); }

/* ---------- detail sheet ---------- */

.sheet {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: 34px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 40px 80px -30px rgba(27, 24, 19, 0.6);
  overflow: visible;
}
.sheet::backdrop { background: rgba(27, 24, 19, 0.42); backdrop-filter: blur(3px); }
.sheet[open] { animation: rise 0.32s cubic-bezier(.2, .8, .3, 1.15); }
@keyframes rise { from { transform: translateY(24px) scale(0.97); opacity: 0; } }

.sheet-inner { max-height: calc(100vh - 48px); overflow-y: auto; border-radius: 34px; }

.sheet-head {
  position: relative;
  padding: 30px 30px 26px;
  background: var(--tone, var(--any));
  border-radius: 34px 34px 0 0;
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 4px 20px;
  align-items: center;
}
.sheet-head .badge {
  position: static;
  width: 132px;
  height: 132px;
  grid-row: span 3;
  transform: rotate(-5deg);
}
.sheet-head .title { font-size: 34px; }
.sheet-head .when { margin: 8px 0 0; font-weight: 600; }

.close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  font: 500 22px/1 var(--text);
  color: var(--ink);
  cursor: pointer;
}
.close:hover { background: #fff; }

.sheet-body { padding: 8px 30px 30px; }
.sheet-body h4 {
  margin: 24px 0 8px;
  font-family: var(--display);
  font-weight: 700;
  font-style: italic;
  font-variation-settings: "wdth" 110;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--pink);
}
.sheet-body p { margin: 0; font-size: 17px; line-height: 1.45; }
.sheet-body .sub { margin-top: 6px; color: var(--soft); font-size: 15.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { padding: 5px 12px 6px; border-radius: 999px; background: rgba(27, 24, 19, 0.07); font-size: 14.5px; }

.go {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
  padding: 17px 22px 18px;
  border-radius: 18px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 600;
  font-size: 17px;
  transition: background 0.2s;
}
.go:hover { background: var(--pink); }
.go span { font-size: 22px; line-height: 1; }

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; gap: 60px; padding-top: 52px; }
  .band { padding-top: 28px; }
  .jump { gap: 8px; flex-wrap: nowrap; }
  .jump a { flex: 1 1 0; min-width: 0; padding: 10px 12px 12px; }
  .jump b { font-size: 32px; }
  .jump span { font-size: 13px; line-height: 1.2; }
  .view button { padding: 7px 13px 8px; font-size: 14px; }
  .jump a::after { top: 8px; right: 10px; font-size: 14px; }
  .card { padding: 72px 22px 20px; }
  .badge { width: 100px; height: 100px; top: -40px; }
  .sheet {
    width: 100vw;
    max-width: 100vw;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: 30px 30px 0 0;
  }
  .sheet-inner { max-height: 92vh; border-radius: 30px 30px 0 0; }
  .sheet-head { grid-template-columns: 96px 1fr; padding: 26px 22px 22px; border-radius: 30px 30px 0 0; }
  .sheet-head .badge { width: 96px; height: 96px; }
  .sheet-head .title { font-size: 28px; }
  .sheet-body { padding: 4px 22px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .badge, .sheet[open] { transition: none; animation: none; }
}
