:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #8a94a6;
  --paper: #f4f6f8;
  --surface: #ffffff;
  --line: #dce2ea;
  --line-strong: #c9d2df;
  --orange: #f06423;
  --orange-dark: #d84d12;
  --forest: #1f5b3b;
  --rose: #bd4f63;
  --rose-soft: #fff0f3;
  --shadow: 0 18px 45px rgba(21, 31, 48, 0.12);
  --hero-gutter: max(28px, calc((100vw - 1180px) / 2));
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  background: #eef2f5;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

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

.page-shell {
  width: 100%;
  margin: 0 0 48px;
}

.tracking-console {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 390px);
  align-items: center;
  gap: 32px;
  padding: clamp(44px, 8vh, 86px) var(--hero-gutter);
  background: #eef2f5;
}

.tracking-console::before,
.tracking-console::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.tracking-console::before {
  inset: -34px;
  z-index: 0;
  background: url("assets/hero-logistics.png") center / cover no-repeat;
  filter: blur(2px);
}

.tracking-console::after {
  inset: 0;
  z-index: 1;
  background-image: url("assets/courier-foreground.png");
  background-position: 32% bottom;
  background-repeat: no-repeat;
  background-size: auto clamp(620px, 88vh, 900px);
}

.tracking-console > * {
  position: relative;
  z-index: 2;
}

.lookup-panel,
.status-panel,
.route-card,
.shipment-card,
.timeline-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lookup-panel {
  position: relative;
  z-index: 2;
  grid-column: 2;
  width: min(100%, 390px);
  justify-self: end;
  transform: none;
  border-color: rgba(211, 218, 227, 0.92);
  background: #ffffff;
  padding: 30px;
}

body.has-result .lookup-panel {
  display: none;
}

.lookup-logo {
  width: 148px;
  height: 74px;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto 12px;
}

.lookup-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.lookup-error {
  display: none;
  margin: -4px 0 14px;
  border: 1px solid rgba(189, 79, 99, 0.24);
  border-radius: 6px;
  background: #fff3f5;
  color: var(--rose);
  padding: 10px 12px;
  font-size: 0.92rem;
  font-weight: 850;
  line-height: 1.35;
}

body.has-lookup-error .lookup-error {
  display: block;
}

.eyebrow {
  margin: 0;
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.parcel-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  fill: none;
  stroke: #111827;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 760;
  line-height: 1.45;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: clamp(1.18rem, 2vw, 1.55rem);
  line-height: 1.18;
  letter-spacing: 0;
}

.tracking-form {
  display: grid;
  gap: 14px;
}

.tracking-input {
  display: grid;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 760;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fbfcfd;
  color: var(--ink);
  outline: none;
  padding: 0 14px;
  font-weight: 760;
}

input::placeholder {
  color: #9aa4b3;
}

input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(240, 100, 35, 0.14);
}

button {
  min-height: 50px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 850;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-action {
  background: var(--orange);
  color: #fff;
  padding: 0 18px;
  font-size: 0.98rem;
  box-shadow: 0 12px 22px rgba(240, 100, 35, 0.2);
}

.primary-action:hover {
  background: var(--orange-dark);
}

.result-panel {
  display: none;
  grid-column: 2;
}

body.has-result .result-panel {
  display: grid;
}

.tracking-result-card {
  width: min(100%, 254px);
  justify-self: end;
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.gauge-status {
  display: grid;
  justify-items: center;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.gauge-meter {
  position: relative;
  width: min(100%, 254px);
  aspect-ratio: 1732 / 908;
  height: auto;
  margin: 0 auto;
}

.gauge-reference {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gauge-state {
  justify-self: stretch;
  margin: 0;
  color: #59bd4d;
  padding: 8px 18px 9px;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.gauge-state.is-warning {
  color: var(--rose);
}

.tracking-readout {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 12px 18px 14px;
  background: #ffffff;
}

.tracking-readout div {
  min-height: 22px;
  display: grid;
  grid-template-columns: minmax(74px, 0.58fr) minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
}

.tracking-readout dt {
  margin: 0;
  color: #8d96a5;
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}

.tracking-readout dd {
  overflow-wrap: anywhere;
  color: #6a7280;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.22;
  text-align: right;
}

body:not(.has-result) .day-badge,
body:not(.has-result) .progress-wrap {
  display: none;
}

.status-panel {
  align-content: space-between;
  gap: 20px;
  padding: clamp(20px, 3vw, 30px);
}

.tracking-result-card.status-panel {
  padding: 0;
}

.status-topline,
.status-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.status-head {
  flex-wrap: wrap;
}

.state-pill,
.scan-id {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 0.74rem;
  font-weight: 900;
}

.state-pill {
  border: 1px solid rgba(31, 91, 59, 0.22);
  background: #eaf5ed;
  color: var(--forest);
}

.state-pill.is-warning {
  border-color: rgba(189, 79, 99, 0.24);
  background: var(--rose-soft);
  color: var(--rose);
}

.scan-id {
  max-width: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f7f9fb;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-code {
  margin-bottom: 8px;
  color: var(--orange);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.day-badge {
  min-width: 92px;
  min-height: 92px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 1px solid rgba(240, 100, 35, 0.18);
  border-radius: 8px;
  background: #fff3ec;
  color: var(--orange);
  text-align: center;
}

.day-badge span {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.day-badge strong {
  font-size: 1.48rem;
  line-height: 1;
}

.status-copy {
  min-height: 44px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.58;
}

.progress-wrap {
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: center;
  gap: 12px;
  color: var(--orange-dark);
  font-weight: 950;
}

.progress-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), #f0ad35, var(--forest));
  transition: width 0.35s ease;
}

.status-meta,
.shipment-details {
  display: grid;
  gap: 10px;
  margin: 0;
}

.status-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.status-meta div,
.shipment-details div {
  min-height: 78px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
}

dt {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

dd {
  margin: 0;
  color: var(--ink);
  font-weight: 900;
  line-height: 1.28;
}

.route-grid,
.history-section {
  display: none;
  width: min(1180px, calc(100% - 32px));
  margin-right: auto;
  margin-left: auto;
}

body.has-result .history-section {
  display: none;
}

.route-grid {
  grid-template-columns: minmax(0, 1.02fr) minmax(340px, 0.98fr);
  gap: 18px;
  margin-top: 18px;
}

.history-section {
  margin-top: 18px;
}

.route-card,
.shipment-card,
.timeline-card {
  padding: clamp(18px, 3vw, 28px);
}

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-title .eyebrow {
  margin-bottom: 6px;
  color: var(--orange);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.route-visual {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbff;
}

.route-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.route-progress {
  position: absolute;
  left: 18%;
  top: 50%;
  width: min(62%, 410px);
  height: 5px;
  transform: translateY(-50%);
  transform-origin: left center;
  border-radius: 999px;
  background: var(--orange);
  box-shadow: 0 0 0 6px rgba(240, 100, 35, 0.12);
}

.route-point {
  position: absolute;
  width: min(34vw, 156px);
  min-height: 76px;
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(21, 31, 48, 0.08);
}

.route-point::before {
  content: "";
  width: 14px;
  height: 14px;
  position: absolute;
  top: -8px;
  left: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 1px var(--line);
}

.route-point.is-active {
  border-color: rgba(240, 100, 35, 0.45);
}

.route-point.is-active::before,
.route-point.is-complete::before {
  background: var(--orange);
}

.route-point strong {
  color: var(--ink);
  font-size: 0.96rem;
}

.route-point small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.route-point-china {
  left: 6%;
  top: 54%;
}

.route-point-dubai {
  left: 40%;
  top: 29%;
}

.route-point-turkey {
  right: 6%;
  top: 54%;
}

.shipment-details {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stage-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.stage-list span {
  min-height: 96px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
  color: var(--muted);
  padding: 12px;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.3;
}

.stage-list strong {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e8edf3;
  color: var(--muted);
  font-size: 0.72rem;
}

.stage-list span.is-complete {
  border-color: rgba(31, 91, 59, 0.24);
  background: #eef7f0;
  color: var(--forest);
}

.stage-list span.is-active {
  border-color: rgba(240, 100, 35, 0.36);
  background: #fff3ec;
  color: var(--orange-dark);
}

.stage-list span.is-complete strong,
.stage-list span.is-active strong {
  background: var(--orange);
  color: #fff;
}

.timeline-card {
  box-shadow: 0 10px 24px rgba(21, 31, 48, 0.08);
}

.timeline {
  display: block;
  position: relative;
  margin: 0;
  padding: 4px 2px 2px;
  list-style: none;
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  padding: 0 0 16px;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 42px;
  bottom: 0;
  left: 20px;
  width: 2px;
  border-radius: 999px;
  background: #dce3ec;
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li:last-child::before {
  display: none;
}

.timeline-marker {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8e0ea;
  border-radius: 999px;
  background: #f2f5f8;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 950;
  line-height: 1;
}

.timeline-body {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
  padding: 12px 13px;
}

.timeline-day {
  display: block;
  width: auto;
  min-height: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.timeline-title {
  color: var(--ink);
  font-weight: 950;
  line-height: 1.25;
}

.timeline-location {
  color: var(--orange-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.timeline-copy {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.timeline li.is-complete::before {
  background: rgba(77, 168, 89, 0.38);
}

.timeline li.is-complete .timeline-marker {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
}

.timeline li.is-current .timeline-body {
  border-color: rgba(240, 100, 35, 0.42);
  background: #fff3ec;
  box-shadow: 0 10px 24px rgba(240, 100, 35, 0.12);
}

.timeline li.is-current .timeline-marker {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

.timeline li.is-current .timeline-title {
  color: var(--orange-dark);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 920px) {
  .tracking-console {
    min-height: 100svh;
    grid-template-columns: 1fr;
    align-items: end;
    gap: 0;
    padding: 28px var(--hero-gutter) clamp(112px, 16svh, 156px);
    background-position: 38% center;
  }

  .tracking-console::after {
    background-position: 42% calc(100% - clamp(72px, 11svh, 120px));
    background-size: auto 72vh;
  }

  .lookup-panel {
    grid-column: 1;
    width: min(100%, 380px);
    justify-self: end;
    margin-top: 0;
  }

  .result-panel {
    order: 3;
    grid-column: 1;
    justify-self: center;
  }

  body.has-result .route-grid {
    grid-template-columns: 1fr;
  }

  .status-meta,
  .shipment-details,
  .stage-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: 100%;
  }

  .tracking-console {
    padding: 16px 12px clamp(130px, 20svh, 178px);
    background-position: 36% center;
  }

  .tracking-console::after {
    background-position: center calc(100% - clamp(94px, 15svh, 142px));
    background-size: auto 68vh;
    clip-path: inset(0 0 clamp(286px, 44svh, 360px) 0);
  }

  body:has(#orderInput:focus) .tracking-console {
    padding-bottom: clamp(210px, 34svh, 292px);
  }

  body:has(#orderInput:focus) .tracking-console::after {
    background-position: center calc(100% - clamp(170px, 28svh, 242px));
    background-size: auto 62vh;
    clip-path: inset(0 0 clamp(330px, 50svh, 410px) 0);
  }

  body.has-result .tracking-console {
    padding: 16px 12px clamp(66px, 10svh, 92px);
  }

  body.has-result .tracking-console::after {
    background-position: center calc(100% - clamp(162px, 26svh, 218px));
    background-size: auto 64vh;
    clip-path: inset(0 0 clamp(430px, 62svh, 520px) 0);
  }

  body.has-result .result-panel {
    align-self: end;
    transform: translateY(clamp(-34px, -5svh, -18px));
  }

  .lookup-panel,
  .status-panel,
  .route-card,
  .shipment-card,
  .timeline-card {
    padding: 18px;
  }

  .lookup-panel {
    justify-self: stretch;
  }

  .tracking-result-card {
    padding: 0;
  }

  .lookup-logo {
    width: 128px;
    height: 64px;
  }

  .eyebrow {
    font-size: 1.28rem;
  }

  .status-topline {
    display: grid;
  }

  .scan-id {
    max-width: 100%;
  }

  .route-visual {
    min-height: 320px;
  }

  .route-point {
    width: 110px;
    min-height: 62px;
    padding: 9px;
  }

  .route-point strong {
    font-size: 0.86rem;
  }

  .route-point small {
    display: none;
  }

  .timeline {
    padding-bottom: 0;
  }

  .timeline li {
    min-height: auto;
  }
}
