@font-face {
  font-family: "Outfit";
  src: url("/fonts/outfit-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #1b2766;
  --tint: #e8ebf7;
  --paper: #fbfaf7;
  --white: #ffffff;
  --ink: #181b2c;
  --muted: #515670;
  --edge: #6b7090;
  --red: #d01626;
  --red-dark: #a8101d;
  --on-navy-muted: #c9ceee;
  --hairline: rgba(255, 255, 255, 0.28);
  --dash: #8a90b5;

  --radius-field: 10px;
  --radius-card: 16px;
  --radius-button: 8px;

  --field-h: 3.25rem;
  --label-h: 1.5rem;
  --row-gap: 1.25rem;
  --dot: 0.875rem;
  --marker-top: calc(var(--label-h) + var(--field-h) / 2 - var(--dot) / 2);
}

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

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

a {
  color: var(--navy);
  text-underline-offset: 0.18em;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius-button);
}

.skip-link:focus {
  top: 1rem;
}

.shell {
  max-width: 74rem;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2.5rem);
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(1.5rem, 4vw, 3rem);
}

.wordmark {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--navy);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.title {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 4rem);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--navy);
}

.lead {
  margin: 1rem 0 0;
  max-width: 34rem;
  font-size: 1.125rem;
  line-height: 1.55;
}

.rate-text {
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
}

.form {
  margin-top: 2rem;
  max-width: 34rem;
}

.route-card {
  background: var(--white);
  border: 1.5px solid var(--navy);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem 1.5rem;
}

.route-row {
  position: relative;
  padding-left: 2.25rem;
}

.route-row + .route-row {
  margin-top: var(--row-gap);
}

.route-row::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: var(--marker-top);
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  border: 3px solid var(--navy);
}

.route-row--origin::before {
  background: var(--navy);
}

.route-row--dest::before {
  background: var(--white);
}

/* Dashed connector from the origin dot down to the destination dot. */
.route-row--origin::after {
  content: "";
  position: absolute;
  left: calc(0.2rem + var(--dot) / 2 - 1px);
  top: calc(var(--marker-top) + var(--dot) + 4px);
  bottom: calc(-1 * (var(--row-gap) + var(--marker-top) - 4px));
  border-left: 2px dashed var(--dash);
}

.route-label {
  display: block;
  margin: 0;
  height: var(--label-h);
  line-height: var(--label-h);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
}

.origin-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--field-h);
  padding: 0.5rem 0.875rem;
  background: var(--tint);
  border-radius: var(--radius-field);
}

.origin-name {
  font-weight: 600;
  line-height: 1.25;
}

.origin-address {
  font-size: 0.875rem;
  line-height: 1.3;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.combo {
  position: relative;
}

.input {
  display: block;
  width: 100%;
  height: var(--field-h);
  padding: 0 0.875rem;
  background: var(--white);
  color: var(--ink);
  border: 1.5px solid var(--edge);
  border-radius: var(--radius-field);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s;
}

.input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.input:hover {
  border-color: var(--navy);
}

.input:focus-visible {
  border-color: var(--navy);
  outline-offset: 2px;
}

.input[aria-invalid="true"] {
  border-color: var(--red-dark);
}

.field-status {
  margin: 0.5rem 0 0;
  min-height: 1.3rem;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.field-status[data-state="empty"],
.field-status[data-state="error"],
.field-status[data-state="invalid"] {
  color: var(--red-dark);
  font-weight: 500;
}

.field-status[data-state="selected"] {
  color: var(--navy);
  font-weight: 500;
}

/* The popup sits above the result panel, so it is the one element that gets a shadow. */
.suggestions {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 17rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  background: var(--white);
  border: 1.5px solid var(--navy);
  border-radius: var(--radius-field);
  box-shadow: 0 14px 28px -14px rgba(20, 28, 77, 0.5);
}

.suggestions[hidden] {
  display: none;
}

.option {
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

.option:hover {
  background: var(--tint);
}

.option-primary {
  display: block;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.option-secondary {
  display: block;
  font-size: 0.875rem;
  line-height: 1.3;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.option[aria-selected="true"] {
  background: var(--navy);
  color: var(--white);
}

.option[aria-selected="true"] .option-secondary {
  color: var(--on-navy-muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  min-width: 12rem;
  padding: 0 2rem;
  background: var(--red);
  color: var(--white);
  border: 0;
  border-radius: var(--radius-button);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
}

.button:hover {
  background: var(--red-dark);
}

.button:disabled {
  background: var(--tint);
  color: var(--muted);
  cursor: not-allowed;
}

.form .button {
  margin-top: 1.5rem;
}

.button--navy {
  background: var(--navy);
  margin-top: 1rem;
  min-width: 0;
  padding: 0 1.25rem;
}

.button--navy:hover {
  background: var(--ink);
}

.panel {
  position: sticky;
  top: 1.5rem;
  min-height: 24rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius-card);
}

.panel :focus-visible {
  outline-color: var(--white);
}

.panel .error-box :focus-visible {
  outline-color: var(--navy);
}

.state-title {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 600;
}

.state-text {
  margin: 0.75rem 0 0;
  max-width: 34ch;
  color: var(--on-navy-muted);
  line-height: 1.55;
}

.progress {
  margin-top: 1.75rem;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--hairline);
}

/* Shows that a request is in flight. Replaced by a static bar when motion is reduced. */
.progress-bar {
  display: block;
  width: 40%;
  height: 100%;
  background: var(--white);
  animation: travel 1.2s ease-in-out infinite;
}

@keyframes travel {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

.eyebrow {
  margin: 0 0 0.25rem;
  font-weight: 500;
  color: var(--on-navy-muted);
}

.total {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 3.75rem);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.formula {
  margin: 0.75rem 0 0;
  color: var(--on-navy-muted);
  font-variant-numeric: tabular-nums;
}

.facts {
  margin: 1.75rem 0 0;
}

.fact {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--hairline);
}

.fact dt {
  color: var(--on-navy-muted);
}

.fact dd {
  margin: 0;
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.trip {
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.trip-stop {
  position: relative;
  padding: 0 0 1.25rem 2rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.trip-stop:last-child {
  padding-bottom: 0;
}

.trip-stop::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.28rem;
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  border: 3px solid var(--white);
}

.trip-stop--from::before {
  background: var(--white);
}

.trip-stop--from::after {
  content: "";
  position: absolute;
  left: calc(0.2rem + var(--dot) / 2 - 1px);
  top: 1.3rem;
  bottom: 0;
  border-left: 2px dashed var(--on-navy-muted);
}

.warning {
  margin: 1.25rem 0 0;
  padding: 0.75rem 1rem;
  background: var(--tint);
  color: var(--ink);
  border-radius: var(--radius-button);
  font-size: 0.9375rem;
}

.warning[hidden] {
  display: none;
}

.note {
  margin: 1.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--on-navy-muted);
}

.error-box {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--white);
  color: var(--ink);
  border-radius: 12px;
}

.error-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: var(--red-dark);
  color: var(--white);
  border-radius: 6px;
  font-weight: 700;
}

.error-title {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  line-height: 1.25;
  color: var(--red-dark);
}

.error-text {
  margin: 0;
  line-height: 1.5;
}

.state--error .state-text {
  margin-top: 1.25rem;
}

.footer {
  padding-top: 1.5rem;
  border-top: 1px solid var(--edge);
  font-size: 0.875rem;
  color: var(--muted);
}

.footer p {
  margin: 0;
  max-width: 52rem;
}

@media (max-width: 52rem) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel {
    position: static;
    min-height: 0;
  }

  .form .button {
    width: 100%;
  }
}

@media (max-width: 30rem) {
  .route-card {
    padding: 0.875rem 1rem 1.25rem;
  }

  .route-row {
    padding-left: 2rem;
  }

  .lead {
    font-size: 1.0625rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }

  .progress-bar {
    animation: none;
    width: 100%;
    opacity: 0.6;
  }
}
