:root {
  --light: #eaefef;
  --muted: #bfc9d1;
  --dark: #25343f;
  --accent: #ff9b51;
  --transition: 4s;
  --pin-counted: #d62828;
  --pin-joined: #6c757d;
  --pin-unknown: #f69730;
}

body {
  font-family: system-ui, sans-serif;
  line-height: 1.5;
  color: var(--dark);
  background: var(--light);
  margin: 0;
}

main {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  max-width: 44rem;
  margin: 0 auto;
  padding: 3rem 1rem 4rem;
}

.hero {
  text-align: center;
}

h1 {
  font-size: clamp(1.75rem, 6vw, 2.75rem);
  line-height: 1.15;
  margin: 0 0 1rem;
}

.hero p {
  max-width: 34rem;
  margin: 0 auto;
  font-size: 1.125rem;
}

h2 {
  font-size: 1.125rem;
  margin: 0 0 1rem;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  padding: 1rem;
  background: white;
  border-radius: 0.5rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: flex;
  justify-content: center;
  align-items: center;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  background: var(--accent);
  border-radius: 50%;
}

.steps strong {
  display: block;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pin {
  flex: none;
  box-sizing: border-box;
  width: 1.125rem;
  height: 1.125rem;
  background: white;
  border: 3px solid;
  border-radius: 50%;
}

.pin-counted {
  border-color: var(--pin-counted);
}

.pin-triangle {
  flex: none;
  width: 1.25rem;
  height: 1.125rem;
  fill: white;
  stroke-width: 4;
  stroke-linejoin: round;
}

.pin-joined {
  stroke: var(--pin-joined);
  stroke-dasharray: 1.5 1;
  stroke-dashoffset: 0.75;
}

.pin-unknown {
  stroke: var(--pin-unknown);
}

.map-legend {
  display: none;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  background: white;
}

.map-legend .legend {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dropzone {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 14rem;
  padding: 1rem;
  text-align: center;
  background: var(--muted);
  border: 2px dashed var(--dark);
  border-radius: 0.5rem;
}

.dropzone.dragging {
  border-color: var(--accent);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.loader {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.loader-text {
  position: relative;
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  white-space: pre;
}

.cursor {
  background: var(--dark);
}

#loader-dots {
  position: absolute;
  left: 100%;
}

.dropzone.loading {
  border-style: solid;
}

.dropzone.loading .loader {
  display: flex;
}

.dropzone.loading #dropzone-text,
.dropzone.loading input {
  display: none;
}

.loader {
  --pulse: 1.6s;
  --pulses-per-lap: 4;
}

.scene {
  display: block;
  width: 15rem;
}

.world,
.rider {
  animation: calc(var(--pulse) * var(--pulses-per-lap)) linear infinite;
}

.world {
  animation-name: world-turns-left;
}

.rider {
  animation-name: rider-goes-right;
}

.road {
  fill: none;
  stroke: #5d6a75;
  stroke-width: 22;
}

.road-line {
  fill: none;
  stroke: var(--light);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
}

.pole {
  stroke: #333;
  stroke-width: 2.5;
}

.sign {
  transform-box: fill-box;
  transform-origin: center;
  animation: sign-pulse var(--pulse) ease-in-out infinite;
}

.sign circle {
  fill: white;
  stroke: var(--pin-counted);
  stroke-width: 3.5;
}

.sign text {
  font: 700 8px system-ui, sans-serif;
  fill: #111;
  text-anchor: middle;
  dominant-baseline: central;
}

.rider text {
  font-size: 26px;
  text-anchor: middle;
}

@keyframes world-turns-left {
  from {
    transform: rotate(90deg);
  }
  to {
    transform: rotate(-90deg);
  }
}

@keyframes rider-goes-right {
  0%,
  17% {
    transform: rotate(-62deg);
  }
  83%,
  100% {
    transform: rotate(62deg);
  }
}

@keyframes sign-pulse {
  0%,
  100% {
    transform: scale(1.15);
  }
  50% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .world,
  .sign {
    animation-name: none;
  }

  .rider {
    transform: rotate(-20deg);
    animation-name: none;
  }
}

button {
  font: inherit;
  padding: 0.75rem 1rem;
  color: var(--light);
  background: var(--dark);
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.actions button {
  flex: 1 1 12rem;
}

.privacy-note {
  margin: 0;
  font-size: 0.875rem;
  text-align: center;
  opacity: 0.75;
}

button.secondary {
  color: var(--dark);
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--dark);
}

button:hover:not(:disabled) {
  color: var(--dark);
  background: var(--accent);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.map {
  display: none;
  border: none;
  background: var(--muted);
}

.map-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.map-page main {
  display: none;
}

.map-page .map-legend {
  display: block;
}

.map-page .map {
  display: block;
  flex: 1;
}

.navbar {
  display: flex;
  justify-content: center;
  padding: 0.75rem 1rem;
  color: var(--dark);
  background: var(--accent);
  position: relative;
  overflow: hidden;
  view-transition-name: navbar;
}

.navbar-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: calc(50% - 4rem);
  overflow: hidden;
  pointer-events: none;
}

.navbar-rider {
  position: absolute;
  left: -3rem;
  top: 50%;
  translate: -50% -50%;
  font-size: 1.5rem;
  line-height: 1;
}

.map-page .navbar {
  justify-content: flex-start;
}

.brand {
  display: inline-block;
  font-size: 1.25rem;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
}

.dropzone,
.map {
  view-transition-name: stage;
}

::view-transition-old(navbar) {
  display: none;
}

::view-transition-new(navbar) {
  animation: none;
}

::view-transition-group(*) {
  animation-duration: var(--transition);
  animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1);
}

::view-transition-group(stage) {
  overflow: clip;
}

::view-transition-new(stage) {
  height: 100%;
  object-fit: cover;
  animation: none;
}

::view-transition-old(stage) {
  height: 100%;
  object-fit: none;
  z-index: 1;
  animation: stage-fade-out 0.3s both;
}

.going-back::view-transition-new(stage) {
  object-fit: none;
}

.going-back::view-transition-old(stage) {
  object-fit: cover;
  animation: stage-fade-out-at-the-end var(--transition) both;
}

@keyframes stage-fade-out-at-the-end {
  0%,
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes stage-fade-out {
  to {
    opacity: 0;
  }
}
