/* The marathon course that draws itself on scroll. Colours in :root (the Playground palette): the course orange is
   the only accent; the river and the park are two muted tints of the map, everything else is a deep blue-black with
   hairlines. GSAP moves .frame, .cam and the tags in .labels; the CSS styles .panel, the map and the tag faces. */
:root {
  --page: #090c11;          /* the page */
  --page-lift: #121823;     /* the soft lift of the page behind the panel */
  --panel: #10151d;         /* the panel */
  --ground: #0d1219;        /* the ground of the map */
  --block: #151c26;         /* the city blocks */
  --block-line: rgba(214, 226, 245, 0.11); /* the edges of the blocks */
  --water: #0f2234;         /* the river and the harbour */
  --water-line: rgba(122, 176, 230, 0.34); /* the banks and the coast */
  --park: #102019;          /* the park */
  --park-line: rgba(132, 206, 160, 0.3); /* the edge of the park */
  --ink: #eef1f5;           /* the words */
  --muted: #7d8796;         /* the small words */
  --course: #ff6a3d;        /* the accent: the course, its head, the marks */
  --course-hot: #ffb08f;    /* the hot core of the head and the trail */
  --cool: #3f7bd6;          /* the second light behind the panel */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--page); }
html, body { overflow-x: clip; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.race { position: relative; height: 480vh; }
.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2.4vh, 36px) 12px;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(120% 90% at 50% 40%, var(--page-lift), var(--page) 70%);
}
@supports (height: 100lvh) {
  .stage { height: 100lvh; }
}

.light {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: min(70vw, 70vh, 600px);
  height: min(70vw, 70vh, 600px);
  margin: calc(min(70vw, 70vh, 600px) / -2) 0 0 calc(min(70vw, 70vh, 600px) / -2);
  border-radius: 50%;
  pointer-events: none;
  filter: blur(56px);
}
.light--a { background: radial-gradient(closest-side, color-mix(in srgb, var(--course) 26%, transparent), color-mix(in srgb, var(--course) 6%, transparent) 60%, transparent); }
.light--b { background: radial-gradient(closest-side, color-mix(in srgb, var(--cool) 30%, transparent), color-mix(in srgb, var(--cool) 7%, transparent) 60%, transparent); }
.grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- the panel */
.frame { width: min(100%, 1060px); }
.panel {
  position: relative;
  border-radius: clamp(16px, 3.6vh, 26px);
  padding: clamp(10px, 2.6vh, 20px);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 88%, white 4%), color-mix(in srgb, var(--panel) 96%, transparent));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 10px 24px -10px rgba(0, 0, 0, 0.6),
    0 44px 90px -30px rgba(0, 0, 0, 0.8);
}
.panel__edge {
  position: absolute;
  left: 14%;
  right: 14%;
  top: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 214, 196, 0.45), transparent);
}

.head { display: flex; align-items: center; gap: 10px; margin-bottom: clamp(8px, 2vh, 16px); }
.mark {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(24px, 6vh, 30px);
  height: clamp(24px, 6vh, 30px);
  border-radius: 9px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--course) 70%, white), var(--course) 55%, color-mix(in srgb, var(--course) 70%, #5a1404));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 6px 14px -6px color-mix(in srgb, var(--course) 80%, transparent);
}
.mark svg { width: 15px; height: 15px; fill: none; stroke: #2a0b02; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.head__words { flex: 1; min-width: 0; }
.brand { font-size: clamp(13px, 1.5vw, 15px); font-weight: 640; font-stretch: 112%; letter-spacing: -0.01em; white-space: nowrap; }
.when { margin-top: 1px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sep { display: inline-block; width: 1px; height: 9px; margin: 0 6px; vertical-align: -1px; background: rgba(255, 255, 255, 0.16); }
.tag-course {
  flex: none;
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 560;
  font-stretch: 108%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 27vw, 270px);
  gap: clamp(10px, 1.6vw, 18px);
  align-items: center;
}

/* ---------------------------------------------------------------- the map */
.map {
  position: relative;
  width: min(100%, calc(66vh * 1.5));
  aspect-ratio: 3 / 2;
  justify-self: center;
  overflow: hidden;
  border-radius: clamp(10px, 2.4vh, 16px);
  background: var(--ground);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 1px 0 rgba(255, 255, 255, 0.04);
}
.cam { position: absolute; inset: 0; transform-origin: 50% 50%; }
.city { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map__vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  background: radial-gradient(130% 120% at 50% 45%, transparent 55%, rgba(5, 7, 11, 0.55));
}

.ground { fill: var(--ground); }
.blocks rect { fill: var(--block); stroke: var(--block-line); stroke-width: 0.6; }
.sea__body { fill: var(--water); }
.sea__hatch { stroke: rgba(122, 176, 230, 0.12); stroke-width: 0.8; fill: none; }
.sea__coast { fill: none; stroke: var(--water-line); stroke-width: 0.8; }
.pier { fill: var(--block); stroke: var(--water-line); stroke-width: 0.6; }
.river__body { fill: none; stroke: var(--water); stroke-linecap: round; }
.river__bank { fill: none; stroke: var(--water-line); stroke-width: 0.7; }
.river__flow { fill: none; stroke: rgba(122, 176, 230, 0.16); stroke-width: 0.6; stroke-dasharray: 2 9; }
.park__body { fill: var(--park); stroke: var(--park-line); stroke-width: 0.8; }
.park__trees { fill: url(#trees); }
.park__hatch { stroke: rgba(132, 206, 160, 0.16); stroke-width: 0.8; stroke-linecap: round; fill: none; }
.park__walk { fill: none; stroke: rgba(132, 206, 160, 0.26); stroke-width: 0.7; stroke-dasharray: 1.6 2.4; }
.park__pond { fill: var(--water); stroke: var(--water-line); stroke-width: 0.6; }
.bridge { fill: var(--block); stroke: rgba(214, 226, 245, 0.28); stroke-width: 0.7; }
.names text {
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  font-size: 6.4px;
  font-weight: 560;
  font-stretch: 125%;
  letter-spacing: 0.22em;
  fill: rgba(205, 216, 232, 0.3);
}
.names .names--water { fill: rgba(122, 176, 230, 0.45); }
.names .names--park { fill: rgba(132, 206, 160, 0.48); }

.route { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.route--ghost { stroke: rgba(255, 190, 160, 0.2); stroke-width: 1; stroke-dasharray: 1.2 4.2; }
.route--aura { stroke: var(--course); stroke-width: 12; opacity: 0; }
.route--glow { stroke: var(--course); stroke-width: 5; opacity: 0.45; }
.route--line { stroke: var(--course); stroke-width: 2.4; }
.route--trail { stroke: var(--course-hot); stroke-width: 2.4; }
.route--sweep { stroke: #fff1e8; stroke-width: 3.2; opacity: 0; }

.mk__ring { fill: var(--ground); stroke: rgba(255, 210, 190, 0.38); stroke-width: 1; }
.mk__core { fill: var(--course); }
.mk__flare { fill: url(#halo); }
.mk--finish .mk__ring { stroke-width: 1.2; }

.head-dot { pointer-events: none; }
.head-dot__ring { fill: rgba(255, 106, 61, 0.18); stroke: var(--course); stroke-width: 1; }
.head-dot__core { fill: #fff6f1; }

/* the tags beside the marks: positioned in percent of the map, opened by GSAP from the mark */
.labels { position: absolute; inset: 0; pointer-events: none; }
.lab { position: absolute; width: 0; height: 0; }
.lab__box {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 8px 5px;
  border-radius: 8px;
  white-space: nowrap;
  background: linear-gradient(180deg, rgba(34, 40, 52, 0.86), rgba(20, 25, 34, 0.86));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 6px 16px -6px rgba(0, 0, 0, 0.7);
}
.lab__k { font-family: 'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif; font-size: 11px; font-weight: 640; letter-spacing: -0.01em; color: var(--ink); }
.lab__k em { font-style: normal; color: var(--course); }
.lab__what { font-size: 9.5px; color: var(--muted); font-stretch: 106%; }
.lab--l .lab__box { right: 9px; top: 0; transform: translateY(-50%); }
.lab--r .lab__box { left: 9px; top: 0; transform: translateY(-50%); }
.lab--t .lab__box { left: 0; bottom: 9px; transform: translateX(-50%); }
.lab--b .lab__box { left: 0; top: 9px; transform: translateX(-50%); }
.lab--br .lab__box { left: -8px; top: 9px; }
.lab__what { display: block; max-height: 14px; max-width: 140px; overflow: hidden; transition: max-height 0.45s cubic-bezier(0.3, 1.4, 0.5, 1), max-width 0.45s cubic-bezier(0.3, 1.2, 0.5, 1), opacity 0.3s ease; }
.lab--passed .lab__what { max-height: 0; max-width: 0; opacity: 0; }
.lab--passed .lab__box { gap: 0; }
.lab--passed .lab__k { opacity: 0.78; transition: opacity 0.3s ease; }
.lab--finish .lab__box { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--course) 55%, transparent), 0 0 22px -4px color-mix(in srgb, var(--course) 60%, transparent), 0 6px 16px -6px rgba(0, 0, 0, 0.7); }

/* ---------------------------------------------------------------- the glass card */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 2vh, 16px);
  padding: clamp(12px, 2.4vh, 18px);
  border-radius: clamp(14px, 3vh, 20px);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025) 60%, rgba(255, 106, 61, 0.04));
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 18px 40px -20px rgba(0, 0, 0, 0.8);
  transition: box-shadow 0.4s ease;
}
.card__edge {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 220, 205, 0.55), transparent);
}
.card__glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  background: radial-gradient(240px circle at 70% 0%, color-mix(in srgb, var(--course) 16%, transparent), transparent 70%);
}
@media (hover: hover) {
  .card:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 22px 48px -20px rgba(0, 0, 0, 0.85); }
}
.card__top { display: flex; align-items: center; justify-content: space-between; }
.eyebrow, .label { font-size: 10.5px; font-weight: 560; font-stretch: 112%; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.chip {
  display: inline-block;
  overflow: hidden;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--course-hot);
  background: color-mix(in srgb, var(--course) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--course) 30%, transparent);
}
.chip__words { display: inline-block; }

.km { display: flex; align-items: baseline; gap: 5px; }
.km__num, .time__num, .val, .lab__k {
  font-family: 'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.km__num { font-size: clamp(30px, 7.4vh, 50px); font-weight: 600; letter-spacing: -0.035em; line-height: 0.95; }
.km__unit { font-size: clamp(13px, 2.4vh, 16px); font-weight: 560; color: var(--ink); opacity: 0.8; }
.km__of { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }

.row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.val { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.val--muted { font-weight: 450; color: var(--muted); font-family: inherit; }

.profile { display: block; width: 100%; height: clamp(26px, 6vh, 42px); margin-top: 6px; overflow: visible; }
.profile__base { fill: rgba(255, 255, 255, 0.035); }
.profile__line { fill: none; stroke: rgba(255, 255, 255, 0.2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.profile__fill { fill: url(#fillUp); }
.profile__lit { fill: none; stroke: var(--course); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.profile__cursor { stroke: rgba(255, 220, 205, 0.7); stroke-width: 1; vector-effect: non-scaling-stroke; }

.seg {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 6px;
  padding: 3px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 2px rgba(0, 0, 0, 0.4);
}
.seg__thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 3);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 10px -4px rgba(0, 0, 0, 0.7);
}
.seg__opt {
  position: relative;
  padding: clamp(4px, 1.1vh, 7px) 0;
  font-family: 'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--muted);
  border-radius: 8px;
  transition: color 0.3s ease;
}
.seg__opt[aria-checked="true"] { color: var(--ink); }
.seg__opt:focus-visible { outline: 1px solid var(--course); outline-offset: 1px; }
@media (hover: hover) {
  .seg__opt:hover { color: var(--ink); }
}

.time { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-top: clamp(6px, 1.6vh, 12px); border-top: 1px solid rgba(255, 255, 255, 0.07); }
.time__num { font-size: clamp(18px, 4vh, 26px); font-weight: 600; letter-spacing: -0.02em; }
.next { font-size: 11.5px; color: var(--ink); text-align: right; white-space: nowrap; }
.next .label { margin-right: 3px; }
.next__words { display: inline-block; }

/* ---------------------------------------------------------------- narrow: the map on top, the card under it */
@media (max-width: 760px) {
  .wide, .sep--wide { display: none; }
  .body { grid-template-columns: minmax(0, 1fr) clamp(190px, 34vw, 230px); }
  .card { gap: 8px; }
  .next .label { display: none; }
}
@media (max-width: 600px) {
  .tag-course { display: none; }
  .head { margin-bottom: 8px; }
  .body { grid-template-columns: 1fr; gap: 8px; }
  .map { width: min(100%, calc(46vh * 1.5)); }
  .card {
    display: grid;
    grid-template-columns: 104px 1fr;
    grid-template-areas: "km elev" "time pace";
    column-gap: 14px;
    row-gap: 8px;
    padding: 10px 12px;
  }
  .card__top { display: none; }
  .km { grid-area: km; flex-direction: column; align-items: flex-start; gap: 0; }
  .km__num { font-size: 28px; }
  .km__unit { display: none; }
  .km__of { margin: 2px 0 0; font-size: 10px; }
  .elev { grid-area: elev; }
  .profile { height: 26px; margin-top: 4px; }
  .time { grid-area: time; flex-direction: column; align-items: flex-start; gap: 0; padding-top: 0; border-top: 0; }
  .time__num { font-size: 18px; }
  .next { font-size: 10px; text-align: left; }
  .next .label { display: none; }
  .pace { grid-area: pace; }
  .pace .val { display: none; }
  .seg { margin-top: 4px; }
  .seg__opt { font-size: 11.5px; padding: 4px 0; }
  .lab__box { padding: 3px 6px 4px; border-radius: 6px; }
  .lab__k { font-size: 9.5px; }
  .lab__what { font-size: 8px; }
  .lab--br .lab__what { display: none; }
  .km__num { white-space: nowrap; }
}
@media (max-width: 600px) and (max-height: 520px) {
  .when { display: none; }
  .mark { width: 22px; height: 22px; border-radius: 7px; }
}
