/* The relief map card: the card of a mountain loop on a white page. Its map is a stack of paper sheets in the
   colours of a contour map, from the green of the valley to the white of the summit, with the trail in red. */
:root {
  --page: #ffffff;          /* the page */
  --card: #ffffff;          /* the card */
  --ink: #15302a;           /* the words */
  --muted: #687a73;
  --button: #1d4639;        /* the button */
  --button-lit: #2e6652;    /* the button filling up during the flight */
  --water: #a3d2e2;         /* the lake */
  --low: #a9d49d;           /* the lowest sheet */
  --mid: #eee6b6;           /* the sheets half way up */
  --high: #dcc2a8;          /* the high sheets */
  --peak: #fbfaf6;          /* the top sheet */
  --trail: #e2372d;         /* the trail */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Geologica Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

/* ---------------------------------------------------------------- the card */
.trail {
  width: min(340px, 100%);
  padding: 8px;
  border-radius: 26px;
  background: var(--card);
  box-shadow:
    0 0 0 1px rgba(21, 48, 42, 0.07),
    0 2px 6px -2px rgba(21, 48, 42, 0.08),
    0 30px 50px -26px rgba(21, 48, 42, 0.34);
}

/* the map: a canvas the script draws, clipped to the rounded window */
.trail__map {
  position: relative;
  aspect-ratio: 324 / 228;
  overflow: hidden;
  border-radius: 18px;
  background: var(--water);
  isolation: isolate;
}

.trail__map::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(21, 48, 42, 0.1);
  pointer-events: none;
}

/* a finger held on the map raises it and looks round it: the page does not scroll under it */
.trail__canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.trail__body {
  padding: 18px 14px 14px;
}

/* the title sharpens its corners (the SHRP axis of Geologica) as the relief rises: the script writes --sharp */
.trail__title {
  margin: 0;
  font-size: 26px;
  font-weight: 640;
  line-height: 1.08;
  letter-spacing: -0.022em;
  font-variation-settings: 'SHRP' var(--sharp, 0);
}

.trail__where {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.trail__facts {
  display: flex;
  gap: 40px;
  margin: 18px 0 0;
}

.trail__facts div {
  display: grid;
  gap: 2px;
}

.trail__facts dt {
  color: var(--muted);
  font-size: 12.5px;
}

.trail__facts dd {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

.trail__unit {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}

/* ---------------------------------------------------------------- the button */
.go {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  margin-top: 20px;
  padding: 0 20px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: #ffffff;
  font: 600 16px/1 'Geologica Variable', system-ui, sans-serif;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1), background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

/* the progress of the flight, filled by the script */
.go__fill {
  position: absolute;
  inset: 0;
  background: var(--button-lit);
  transform: scaleX(0);
  transform-origin: left center;
}

.go__icon {
  position: relative;
  width: 18px;
  height: 18px;
  transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.go__glyph {
  position: absolute;
  inset: 0;
  display: block;
}

.go__glyph:not(.go__glyph--play) {
  opacity: 0;
}

.go__glyph svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.go__glyph--play svg {
  fill: currentColor;
  stroke: none;
}

.go__label {
  position: relative;
}

/* pointed at, the button swells a little and its arrow takes a step; on the map the trail's dashes start to walk */
@media (hover: hover) {
  .go:hover {
    transform: scale(1.025);
    background-color: color-mix(in srgb, var(--button) 88%, #ffffff);
  }

  .go:hover .go__icon {
    transform: translateX(2px);
  }
}

.go:active {
  transform: scale(0.97);
  transition-duration: 0.12s;
}

.go:focus-visible {
  outline: 2.5px solid var(--button);
  outline-offset: 3px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
