/* Overpass is derived from Highway Gothic, the lettering of road signs. */
@font-face {
  font-family: 'Overpass';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/overpass-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Overpass';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/overpass-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Overpass';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/overpass-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #e6e8e4;
  --surface: #f4f5f2;
  --ink: #15191b;
  --muted: #586167;
  --line: #b9bfb8;
  --sign: #0a6847;
  --sign-ink: #ffffff;
  --sign-dim: #cde5d8;
  --logo: #0a6847;
  --marking: #f2c014;
  --marking-ink: #2a2200;
  --organic: #4f9b45;
  --google: #1a73e8;
  --waze: #33ccff;
  --waze-ink: #062a38;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #141719;
    --surface: #1d2124;
    --ink: #e8ebe7;
    --muted: #9aa3a8;
    --line: #3a4145;
    --sign: #0b5c40;
    --sign-dim: #b7d5c6;
    --logo: #46b483;
    --organic: #4a9141;
    --google: #3b82e6;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #141719;
  --surface: #1d2124;
  --ink: #e8ebe7;
  --muted: #9aa3a8;
  --line: #3a4145;
  --sign: #0b5c40;
  --sign-dim: #b7d5c6;
  --logo: #46b483;
  --organic: #4a9141;
  --google: #3b82e6;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Overpass', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--marking);
  outline-offset: 2px;
}

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

/* --- Header ------------------------------------------------------------------------------ */

.bar {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
}

.bar__home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.05rem;
  text-decoration: none;
}

.bar__logo {
  width: 22px;
  height: 22px;
  color: var(--logo);
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 4px 16px calc(40px + env(safe-area-inset-bottom));
}

/* --- The sign: the one loud element ------------------------------------------------------- */

.sign {
  background: var(--sign);
  color: var(--sign-ink);
  border-radius: 14px;
  padding: 5px;
}

.sign__frame {
  border: 3px solid var(--sign-ink);
  border-radius: 10px;
  padding: 18px 18px 16px;
}

.sign__title {
  margin: 0;
  font-size: clamp(1.9rem, 8vw, 2.6rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.sign__sub {
  margin: 8px 0 0;
  color: var(--sign-dim);
  font-size: 1.05rem;
  line-height: 1.35;
  text-wrap: pretty;
}

.sign__coords {
  margin: 14px 0 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  color: var(--sign-dim);
}

.flag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px 0;
  border-radius: 4px;
  background: var(--marking);
  color: var(--marking-ink);
  font-size: 0.8rem;
  font-weight: 700;
  vertical-align: 1px;
}

.sign--enter {
  animation: sign-in 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes sign-in {
  from {
    transform: translateY(-12px);
    opacity: 0;
  }
}

.sign--problem {
  background: var(--ink);
  color: var(--bg);
}
.sign--problem .sign__frame {
  border-color: var(--bg);
}
.sign--problem .sign__sub {
  color: var(--bg);
  opacity: 0.8;
}

/* Loading: lane markings rolling under the title. */
.sign--loading .sign__title {
  font-size: clamp(1.4rem, 6vw, 1.9rem);
}

.road {
  height: 4px;
  margin-top: 18px;
  background: repeating-linear-gradient(90deg, var(--sign-ink) 0 22px, transparent 22px 40px);
  animation: road 600ms linear infinite;
}

@keyframes road {
  to {
    background-position: -40px 0;
  }
}

/* Route: stops stacked like a direction sign. */
.stops {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.stop {
  position: relative;
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 12px;
  align-items: start;
}

.stop:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 22px;
  bottom: -14px;
  width: 2px;
  background: var(--sign-ink);
  opacity: 0.55;
}

.stop__dot {
  width: 20px;
  height: 20px;
  margin-top: 3px;
  border-radius: 50%;
  border: 3px solid var(--sign-ink);
}

.stop--via .stop__dot {
  width: 12px;
  height: 12px;
  margin: 7px 4px 0;
  border: 0;
  background: var(--sign-ink);
}

.stop--to .stop__dot {
  background: var(--sign-ink);
}

.stop__body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.stop__name {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.stop--to .stop__name {
  font-size: clamp(1.6rem, 7vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.stop__meta {
  color: var(--sign-dim);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.from {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* --- Choices ------------------------------------------------------------------------------ */

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  margin-top: 18px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
}

.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 11px 6px 9px;
  min-height: 46px;
  cursor: pointer;
}

.seg button + button {
  border-left: 2px solid var(--ink);
}

.seg button[aria-checked='true'] {
  background: var(--ink);
  color: var(--bg);
}

.seg--modes {
  margin-top: 10px;
  border-width: 1.5px;
}
.seg--modes button {
  padding-inline: 2px;
  font-size: clamp(0.78rem, 3.7vw, 0.9rem);
  font-weight: 600;
  min-height: 40px;
}
.seg--modes button + button {
  border-left-width: 1.5px;
}

/* Exits: one lane per app, separated by dashed lane markings. */
.lanes {
  margin-top: 26px;
  border-bottom: 2px dashed var(--line);
}

.lanes__title {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.lane {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border-top: 2px dashed var(--line);
}

.lane__go {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 16px;
  align-items: center;
  min-height: 82px;
  padding: 14px 0;
  text-decoration: none;
  color: var(--ink);
}

.lane__go[aria-disabled='true'] {
  opacity: 0.45;
}

.lane__mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 9px;
  background: var(--app);
  color: #fff;
  transition: transform 120ms ease-out;
}

.lane__mark svg {
  width: 28px;
  height: 28px;
}

a.lane__go:active .lane__mark {
  transform: translate(2px, -2px);
}

.lane[data-app='organic'] {
  --app: var(--organic);
}
.lane[data-app='google'] {
  --app: var(--google);
}
.lane[data-app='waze'] {
  --app: var(--waze);
}
.lane[data-app='waze'] .lane__mark {
  color: var(--waze-ink);
}

.lane__text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.lane__name {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.lane__note {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.3;
}

.lane__copy {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-left: 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.lane__copy svg {
  width: 22px;
  height: 22px;
}

.lane__copy:hover {
  color: var(--ink);
  background: var(--surface);
}

/* --- Secondary blocks --------------------------------------------------------------------- */

.facts {
  margin-top: 22px;
}

.facts__note {
  margin: 0 0 14px;
  padding-left: 12px;
  border-left: 4px solid var(--marking);
  color: var(--muted);
  font-size: 0.95rem;
  text-wrap: pretty;
}

.facts__actions,
.paste__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 16px 8px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn--primary {
  background: var(--sign);
  border-color: var(--sign);
  color: var(--sign-ink);
}

.raw {
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.raw summary,
.guide summary {
  cursor: pointer;
  font-weight: 700;
}

.raw pre {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 0.9rem;
}

.paste {
  margin-top: 24px;
}

.paste__label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.paste textarea {
  display: block;
  width: 100%;
  min-height: 92px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  resize: vertical;
}

.paste textarea:focus {
  border-color: var(--ink);
  outline: none;
}

.paste .btn--primary {
  flex: 1;
}

.block {
  margin-top: 32px;
}

.block__title {
  margin: 0 0 4px;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.recent {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent__item {
  display: grid;
  gap: 1px;
  padding: 12px 0;
  border-bottom: 2px dashed var(--line);
  text-decoration: none;
}

.recent__label {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.recent__meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.guide {
  padding: 14px 0;
  border-bottom: 2px dashed var(--line);
}

.guide p {
  margin: 10px 0 0;
  text-wrap: pretty;
}

.steps {
  margin: 10px 0 0;
  padding-left: 1.4em;
}

.steps li + li {
  margin-top: 6px;
}

.guide .btn {
  margin-top: 12px;
}

.copyable {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface);
  font-family: inherit;
  font-weight: 700;
  overflow-wrap: anywhere;
  cursor: copy;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  padding: 10px 18px 8px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms,
    transform 160ms;
}

.toast--show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .sign--enter,
  .road {
    animation: none;
  }
  .toast,
  .lane__mark {
    transition: none;
  }
}
