* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: #111827;
  background: #f9fafb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.page {
  min-height: 100vh;
  padding: 3rem 1rem;
}

.container {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
}

.logo {
  display: block;
  width: fit-content;
  margin: 0 auto 2rem;
}

.logo img {
  display: block;
  width: auto;
  height: 4rem;
}

.card {
  overflow: hidden;
  background: #fff;
  border-radius: .5rem;
  box-shadow: 0 1px 3px rgb(0 0 0 / .1), 0 1px 2px rgb(0 0 0 / .06);
}

.search {
  display: flex;
  gap: .75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.search input {
  min-width: 0;
  flex: 1;
  padding: .75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: .5rem;
}

.search input:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
}

.search button {
  padding: .75rem 1.5rem;
  color: #fff;
  font-weight: 600;
  background: #2563eb;
  border: 0;
  border-radius: .5rem;
  cursor: pointer;
}

.search button:hover {
  background: #1d4ed8;
}

.search button:disabled {
  background: #60a5fa;
  cursor: wait;
}

.alert {
  padding: .75rem 1rem;
  margin-bottom: 1.5rem;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: .5rem;
}

.results > header,
.shipments {
  padding: 1.5rem;
}

.results > header {
  border-bottom: 1px solid #e5e7eb;
}

.results > header p,
.shipment-heading p,
.muted,
time {
  color: #6b7280;
}

.results > header p,
.shipment-heading p,
.event p {
  margin: 0;
}

.results > header p,
.shipment-heading p,
time,
summary {
  font-size: .875rem;
}

.results h1 {
  margin: .2rem 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.125rem;
  font-weight: 600;
}

.shipment + .shipment {
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.shipment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.shipment-heading h2 {
  margin: 0 0 .2rem;
  font-size: 1rem;
}

.status {
  padding: .25rem .75rem;
  font-size: .875rem;
  font-weight: 600;
  text-transform: capitalize;
  border-radius: 9999px;
}

.status--delivered { color: #166534; background: #dcfce7; }
.status--in_transit { color: #1e40af; background: #dbeafe; }
.status--out_for_delivery { color: #854d0e; background: #fef9c3; }
.status--issue { color: #991b1b; background: #fee2e2; }
.status--default { color: #1f2937; background: #f3f4f6; }

.event {
  display: grid;
  grid-template-columns: .75rem 1fr;
  gap: 1rem;
  padding-bottom: 1rem;
}

.event p {
  font-weight: 600;
}

.event-dot {
  width: .75rem;
  height: .75rem;
  margin-top: .3rem;
  background: #d1d5db;
  border-radius: 50%;
}

.event--latest .event-dot {
  background: #2563eb;
}

time {
  display: block;
  margin-top: .2rem;
}

details {
  margin-top: -.25rem;
}

details[open] {
  display: flex;
  flex-direction: column;
}

details[open] summary {
  order: 1;
}

summary {
  width: fit-content;
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
}

summary::marker {
  content: '▸  ';
}

details[open] summary::marker {
  content: '▴  ';
}

summary:hover {
  color: #1e40af;
}

.previous-events {
  padding-bottom: 1rem;
}

.when-open,
details[open] .when-closed {
  display: none;
}

details[open] .when-open {
  display: inline;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 32rem) {
  .page {
    padding-top: 2rem;
  }

  .search {
    flex-direction: column;
  }
}
