:root {
  --yellow: #ffcc00;
  --yellow-light: #fff0b2;
  --red: #d40511;
  --red-dark: #a8040d;
  --text: #323232;
  --muted: #666;
  --line: #e6e6e6;
  --bg: #f2f2f2;
  --ok: #2b8a3e;
  --warn: #e07b00;
  --bad: var(--red);
  font-family: "Frutiger", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--red);
}

code {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 0.9em;
  background: #f4f4f4;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 0.25em;
}

.wrap {
  width: min(1100px, 100% - 2rem);
  margin-inline: auto;
}

.muted {
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Header */

.topbar {
  background: linear-gradient(
    90deg,
    var(--yellow) 0%,
    var(--yellow) 30%,
    #ffe57f 79%,
    var(--yellow-light) 100%
  );
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
}

.logo {
  height: 40px;
  width: auto;
  display: block;
}

.tagline {
  color: var(--red);
  font-weight: 700;
  font-style: italic;
  font-size: 0.85rem;
  line-height: 1.1;
  max-width: 9rem;
}

nav {
  display: flex;
  gap: 1.5rem;
}

nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
}

nav a:hover {
  color: var(--red);
}

/* Hero with tracking form */

.hero {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 2rem 0 1.5rem;
}

h1 {
  margin: 0 0 1rem;
  font-size: 2rem;
  font-weight: 800;
}

.track-form {
  display: flex;
  max-width: 640px;
}

.track-form input {
  flex: 1;
  font: inherit;
  font-size: 1.05rem;
  padding: 0.8rem 1rem;
  border: 1px solid #8c8c8c;
  border-right: 0;
  border-radius: 4px 0 0 4px;
  min-width: 0;
}

.track-form input:focus {
  outline: 2px solid var(--yellow);
  outline-offset: -2px;
}

.track-form button {
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: var(--red);
  border: 0;
  border-radius: 0 4px 4px 0;
  padding: 0 2rem;
  cursor: pointer;
}

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

.quota {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Cards */

main {
  flex: 1;
  padding: 1.5rem 0;
}

.card {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card h3 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.grid .card {
  margin-bottom: 0;
}

@media (max-width: 800px) {
  .grid {
    grid-template-columns: 1fr;
  }
  nav {
    display: none;
  }
}

/* Status card */

.status {
  border-top: 6px solid var(--yellow);
}

.status.tone-ok h2 {
  color: var(--text);
}
.status.tone-warn {
  border-top-color: var(--warn);
}
.status.tone-warn h2 {
  color: var(--warn);
}
.status.tone-bad {
  border-top-color: var(--bad);
}
.status.tone-bad h2 {
  color: var(--bad);
}

.status-head {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.status h2 {
  margin: 0.25rem 0 0.5rem;
  font-size: 2.1rem;
  font-weight: 800;
}

.message {
  margin: 0;
  max-width: 60ch;
  line-height: 1.5;
}

.eta {
  background: var(--yellow-light);
  border-left: 4px solid var(--yellow);
  padding: 0.75rem 1rem;
  min-width: 14rem;
  max-width: 20rem;
  align-self: flex-start;
}

.eta span {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.eta strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.05rem;
}

/* Progress bar */

.progress {
  list-style: none;
  padding: 0;
  margin: 1.75rem 0 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.progress .bar {
  display: block;
  height: 10px;
  background: #ddd;
}

.progress li:first-child .bar {
  border-radius: 5px 0 0 5px;
}

.progress li:last-child .bar {
  border-radius: 0 5px 5px 0;
}

.progress .done .bar,
.progress .current .bar {
  background: var(--yellow);
}

.progress.tone-warn .current .bar {
  background: repeating-linear-gradient(
    -45deg,
    var(--yellow) 0 8px,
    var(--warn) 8px 16px
  );
}

.progress.tone-bad .current .bar {
  background: var(--bad);
}

.progress .label {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.progress .current .label {
  color: var(--text);
  font-weight: 700;
}

.progress.tone-bad .current .label {
  color: var(--bad);
}

/* Route */

.stops {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0;
}

.stop {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.5rem;
  align-items: center;
  padding-right: 2.5rem;
  position: relative;
}

.stop:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0.6rem;
  top: 0.55rem;
  width: 1.3rem;
  border-top: 2px dashed #bbb;
}

.stop .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #bbb;
  background: #fff;
}

.stop.true .dot {
  background: var(--yellow);
  border-color: #e0b400;
}

.stop.false .dot {
  border-color: var(--warn);
}

.stop small {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.75rem;
}

/* History */

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

.event {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1rem;
  padding: 0.9rem 0 0.9rem 1rem;
  border-left: 3px solid var(--line);
  position: relative;
}

.event + .event {
  border-top: 1px solid var(--line);
}

.event::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 1.1rem;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #ccc;
}

.event.latest::before {
  background: var(--yellow);
  border-color: var(--red);
}

.event.tone-ok::before {
  border-color: var(--ok);
}
.event.tone-warn::before {
  border-color: var(--warn);
}
.event.tone-bad::before {
  border-color: var(--bad);
}
.event.tone-bad strong {
  color: var(--bad);
}

.event time {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.event time.unknown {
  font-style: italic;
}

.event p {
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.event .location {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

@media (max-width: 560px) {
  .event {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

.more summary {
  cursor: pointer;
  color: var(--red);
  font-weight: 700;
  margin-top: 1rem;
}

.more[open] summary {
  margin-bottom: 0.5rem;
}

.more .events .event:first-child {
  border-top: 1px solid var(--line);
}

/* Details sidebar */

.details dl {
  margin: 0 0 1.5rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.92rem;
}

.details dt {
  color: var(--muted);
}

.details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.sender {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sender img {
  border-radius: 50%;
}

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

.options li + li {
  border-top: 1px solid var(--line);
}

.options a {
  display: block;
  padding: 0.6rem 0;
  font-weight: 700;
  text-decoration: none;
}

.options a::after {
  content: " ›";
}

/* Parcel lists on the start page */

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

.parcels li + li {
  border-top: 1px solid var(--line);
}

.parcels a {
  display: grid;
  grid-template-columns: 9.5rem 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.7rem 0;
  color: inherit;
  text-decoration: none;
}

.parcels a:hover .title {
  color: var(--red);
}

.parcels .num {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85rem;
  color: var(--muted);
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  white-space: nowrap;
}

.badge.open {
  background: var(--yellow-light);
}
.badge.draft {
  background: #eee;
}
.badge.merged {
  background: #e3f4e6;
  color: var(--ok);
}
.badge.closed {
  background: #fde8e9;
  color: var(--red);
}

/* Loading */

.loading {
  text-align: center;
  overflow: hidden;
}

.truck {
  font-size: 2.5rem;
  display: inline-block;
  transform: scaleX(-1);
  animation: drive 1.6s linear infinite;
}

@keyframes drive {
  from {
    translate: -260px 0;
  }
  to {
    translate: 260px 0;
  }
}

/* Business login, footer */

.business summary {
  cursor: pointer;
  font-weight: 700;
}

.business p {
  max-width: 70ch;
  line-height: 1.5;
}

footer {
  background: #fff;
  border-top: 4px solid var(--yellow);
  padding: 1.25rem 0;
  font-size: 0.85rem;
  margin-top: 1rem;
}

footer p {
  margin: 0.25rem 0;
}
