/* Track order page */
.track-muted { color: var(--ink-soft); }
.track-grid { display: grid; gap: 20px; }
.track-form-card { padding: 24px 18px; }
.track-form-card h2 { margin-bottom: 6px; }
.track-form-card .track-muted { margin-bottom: 20px; }
.track-help { padding: 24px 18px; background: var(--primary-tint); }
.track-help h3 { display: flex; align-items: center; gap: 10px; color: var(--brand-navy); }
.track-help h3 .icon { color: var(--primary); }
.track-help-list { display: grid; gap: 12px; margin: 16px 0 20px; }
.track-help-list li { display: flex; gap: 10px; align-items: center; min-height: 28px; overflow-wrap: anywhere; }
.track-help-list .icon { color: var(--primary); }
.track-help-list a:hover { color: var(--primary-dark); text-decoration: underline; }
.track-help-actions { display: grid; gap: 10px; }
@media (min-width: 640px) { .track-form-card, .track-help { padding: 32px; } }
@media (min-width: 960px) { .track-grid { grid-template-columns: 1.3fr 1fr; align-items: stretch; } }

/* result */
.track-result { margin-top: 28px; padding: 24px 18px; box-shadow: var(--shadow-md); border-top: 4px solid var(--primary); }
.track-result:not([hidden]) { animation: rise .5s var(--ease) both; }
@media (min-width: 640px) { .track-result { padding: 36px; } }
.track-result-head { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }
.track-result-head h2 { margin: 8px 0 4px; font-size: clamp(1.3rem, 4vw, 1.8rem); overflow-wrap: anywhere; }
.track-result-head .track-muted { margin: 0; }
.track-status {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; font-size: .78rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--primary-deep); background: var(--primary-light);
  border-radius: 999px;
}
.track-status.is-cancelled { color: var(--accent-strong); background: var(--accent-tint); }
.track-facts { margin: 0; display: grid; gap: 6px; min-width: 220px; padding: 12px 16px; border-radius: var(--radius-m); background: var(--primary-light); align-self: flex-start; }
.track-facts div { display: flex; justify-content: space-between; gap: 18px; }
.track-facts dt { color: var(--primary-deep); font-weight: 600; font-size: .88rem; }
.track-facts dd { margin: 0; font-weight: 700; color: var(--brand-navy); text-align: right; }
.track-cancelled { margin-bottom: 8px; }
.track-cancelled a { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 640px) { .track-result-head { flex-direction: row; justify-content: space-between; align-items: flex-start; } }

/* timeline: vertical on mobile */
.timeline { position: relative; margin: 0; padding: 0; list-style: none; display: grid; gap: 0; }
.tl-step { position: relative; display: flex; gap: 16px; padding-bottom: 28px; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step::before { /* connector to the next step */
  content: ''; position: absolute; left: 21px; top: 44px; bottom: 0; width: 3px; border-radius: 3px;
  background: var(--line);
}
.tl-step::after { /* animated fill of the connector */
  content: ''; position: absolute; left: 21px; top: 44px; bottom: 0; width: 3px; border-radius: 3px;
  background: var(--primary); transform: scaleY(0); transform-origin: top;
  transition: transform .45s var(--ease); transition-delay: calc(var(--i) * 600ms + 300ms);
}
.tl-step:last-child::before, .tl-step:last-child::after { display: none; }
.timeline.is-run .tl-step.is-done::after { transform: scaleY(1); }
.timeline.is-run .tl-step.is-active::after { transform: scaleY(.4); background: var(--primary); }

.tl-dot {
  position: relative; z-index: 1; flex: none; display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 50%; background: #fff; border: 3px solid var(--line); color: var(--ink-faint);
  transition: background .4s, border-color .4s, color .4s, transform .5s var(--ease); transition-delay: calc(var(--i) * 600ms);
}
.timeline.is-run .tl-step.is-done .tl-dot { background: var(--primary-btn); border-color: var(--primary-btn); color: #fff; transform: scale(1); animation: pop .5s var(--ease) both; animation-delay: calc(var(--i) * 600ms); }
.timeline.is-run .tl-step.is-active .tl-dot { background: #fff; border-color: var(--primary); color: var(--primary-dark); animation: pop .5s var(--ease) both, tlPulse 1.8s ease-out infinite; animation-delay: calc(var(--i) * 600ms), calc(var(--i) * 600ms + 500ms); }
@keyframes tlPulse { 0% { box-shadow: 0 0 0 0 rgba(8,152,204,.5); } 100% { box-shadow: 0 0 0 16px rgba(8,152,204,0); } }

.tl-text { padding-top: 2px; opacity: .45; transition: opacity .5s; transition-delay: calc(var(--i) * 600ms); }
.timeline.is-run .tl-step.is-done .tl-text, .timeline.is-run .tl-step.is-active .tl-text { opacity: 1; }
.tl-text h3 { margin: 0 0 2px; font-size: 1.05rem; }
.tl-text p { margin: 0 0 4px; color: var(--ink-soft); font-size: .92rem; }
.tl-when { font-size: .8rem; font-weight: 600; color: var(--primary-dark); }
.tl-step.is-active .tl-when { color: var(--accent-strong); }
.tl-step.is-pending .tl-when { color: var(--ink-faint); }
/* before the animation runs (or if JS never starts it) pending steps stay dim */
.timeline:not(.is-run) .tl-step.is-done .tl-dot { background: #fff; }

/* horizontal from 860px */
@media (min-width: 860px) {
  .timeline { grid-template-columns: repeat(5, 1fr); }
  .tl-step { flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 0 8px; }
  .tl-step::before, .tl-step::after { left: calc(50% + 28px); right: calc(-50% + 28px); top: 21px; bottom: auto; width: auto; height: 3px; }
  .tl-step::after { transform: scaleX(0); transform-origin: left; }
  .timeline.is-run .tl-step.is-done::after { transform: scaleX(1); }
  .timeline.is-run .tl-step.is-active::after { transform: scaleX(.4); background: var(--primary); }
}

@media (prefers-reduced-motion: reduce) {
  .tl-dot, .tl-step::after, .tl-text { animation-delay: 0ms !important; transition-delay: 0ms !important; }
}
