/* Trip day header — crisp modern ticket. Usage:
   <div class="tdh" data-day="20"></div>  +  <script src="trip-header.js"></script> */

.tdh {
  opacity: 0;
  transform: translateY(10px);
  font-family: "Nunito", sans-serif;
  background: #f5ecd0;
  border: 1px solid #d0c8b5;
  border-radius: 14px;
  padding: 18px 22px 16px;
  margin: 18px 0 26px;
  box-shadow: 0 1px 4px rgba(60, 40, 20, 0.06);
  overflow: hidden;
}

.tdh.in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.tdh-top {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.tdh-top-compact { margin-bottom: 4px; }
.tdh-top-compact .tdh-km { margin-left: auto; }

.tdh-day {
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 2px;
  color: #fffdf8;
  background: #5a8a6a;
  padding: 3px 10px;
  border-radius: 999px;
}

.tdh-date {
  font-size: 0.78rem;
  letter-spacing: 1px;
  color: #7a6a58;
  text-transform: uppercase;
}

.tdh-km {
  margin-left: auto;
  font-family: "Caveat", cursive;
  font-size: 1.7rem;
  font-weight: 700;
  color: #c17f3e;
  line-height: 1;
}

/* route row: from --car--> to */
.tdh-route {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tdh-place {
  font-family: "Lora", serif;
  font-weight: 700;
  font-size: 1.02rem;
  color: #3d2a1e;
  white-space: nowrap;
}

.tdh-track {
  position: relative;
  flex: 1;
  height: 60px;
  min-width: 90px;
}

.tdh-stop-dot {
  position: absolute;
  top: 20px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fffdf8;
  border: 2.5px solid #5a8a6a;
  transform: translateX(-50%);
  opacity: 0;
}

.tdh-fuel {
  position: absolute;
  top: 16px;
  width: 16px;
  height: 16px;
  transform: translateX(-50%);
  opacity: 0;
}

.tdh.go .tdh-fuel {
  opacity: 1;
  transition: opacity 0.55s ease-out;
}

.tdh-stop-label {
  position: absolute;
  top: 31px;
  font-size: 0.62rem;
  line-height: 1.25;
  color: #9a8a74;
  transform: translateX(-50%);
  white-space: nowrap;
  text-align: center;
  opacity: 0;
}

.tdh-stop-label b { color: #7a6a58; font-weight: 700; }

.tdh-stop-label.edge-l { transform: translateX(-10%); }
.tdh-stop-label.edge-r { transform: translateX(-90%); }
.tdh-stop-label.row2 { top: 44px; }

.tdh.go .tdh-stop-dot,
.tdh.go .tdh-stop-label {
  opacity: 1;
  transition: opacity 0.55s ease-out;
}

@media (max-width: 560px) {
  .tdh-stop-label { display: none; }   /* names live in the stopped-at line */
}

.tdh-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 24px;
  border-top: 2px dashed #ddd3bd;
}

.tdh-car {
  position: absolute;
  top: 2px;
  left: 0;
  width: 58px;
  height: 26px;
  transform: translateX(0);
}

.tdh.go .tdh-car {
  transform: translateX(calc(100% * var(--tdh-travel, 4)));
  transition: transform 3s cubic-bezier(0.37, 0, 0.63, 1);
}

/* facts row under the track */
.tdh-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2d7b8;
}

.tdh-fact {
  opacity: 0;
  transform: translateY(3px);
}

.tdh.go .tdh-fact {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.tdh.go .tdh-fact:nth-child(1) { transition-delay: 0.5s; }
.tdh.go .tdh-fact:nth-child(2) { transition-delay: 0.9s; }
.tdh.go .tdh-fact:nth-child(3) { transition-delay: 1.3s; }
.tdh.go .tdh-fact:nth-child(4) { transition-delay: 1.7s; }

.tdh-fact b {
  display: block;
  font-size: 0.98rem;
  font-weight: 800;
  color: #3d2a1e;
  font-variant-numeric: tabular-nums;
}

.tdh-fact span {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #9a8a74;
  margin-top: 1px;
}

.tdh-stops {
  margin-top: 10px;
  font-size: 0.78rem;
  color: #9a8a74;
}

.tdh-stops b { color: #7a6a58; font-weight: 700; }

@media (max-width: 560px) {
  .tdh-route { flex-wrap: wrap; }
  .tdh-track { order: 3; flex-basis: 100%; }
  .tdh-facts { gap: 8px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .tdh { opacity: 1; transform: none; }
  .tdh.go .tdh-car, .tdh.go .tdh-fact { transition: none; }
}
