/* Foredoom delivery scenario: booked window, departure, assumed transit and calculated arrival,
   with the dispatcher's decision kept as a separate record. Static values are server-rendered;
   js/arrival-scenario.js only updates them. Time axes stay left to right in every language. */
.fd-arrival {
  --fd-depart: 33.333%;
  --fd-arrive: 83.333%;
  --fd-close: 83.333%;
  --fd-accent: var(--ref-text, #f7f7f5);
  --fd-late: #ff8f7a;
  --fd-surface: color-mix(in srgb, var(--brand-ink) 4%, transparent);
  margin-block-start: clamp(3rem, 7vw, 6rem);
  color: var(--brand-ink);
  scroll-margin-top: 6rem;
}
:root[data-theme="light"] .fd-arrival {--fd-accent: #1e2124; --fd-late: #b3361f}

.fd-page .product-feature .fd-arrival-jump {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  min-height: 44px;
  border-bottom: 1px solid currentColor;
  color: var(--brand-ink);
  font-size: .95rem;
  text-decoration: none;
}
.fd-page .product-feature .fd-arrival-jump:hover {color: var(--brand-secondary)}
.fd-page .product-feature .fd-arrival-jump:focus-visible {outline: 2px solid currentColor; outline-offset: 3px}

.fd-kicker,
.fd-panel-label {
  margin: 0 0 .7rem;
  font-size: .82rem;
  letter-spacing: .02em;
  color: var(--brand-muted);
}
.fd-arrival-title {
  margin: 0 0 clamp(1.6rem, 3vw, 2.6rem);
  max-width: 24ch;
  font-size: clamp(1.6rem, 3.2vw, 2.75rem);
  line-height: 1.12;
  font-weight: 500;
  letter-spacing: -.03em;
  text-wrap: balance;
}
html[dir="rtl"] .fd-arrival-title {letter-spacing: normal}

.fd-arrival-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: stretch;
  border-block-start: 1px solid var(--brand-line);
  padding-block-start: 1.4rem;
}

/* Four facts read as one row: window, departure, transit, arrival. */
.fd-facts {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) repeat(3, minmax(0, 1fr));
  gap: 0 clamp(1rem, 2.2vw, 2rem);
  margin: 0;
}
.fd-facts > div {
  border-block-start: 2px solid var(--brand-line);
  padding-block: .8rem 1.1rem;
  min-width: 0;
}
.fd-facts dt {font-size: .88rem; color: var(--brand-secondary)}
.fd-facts dd {margin: 0}
.fd-value {
  margin-block: .35rem .3rem !important;
  font-size: clamp(1.45rem, 2.4vw, 2.25rem);
  line-height: 1.1;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.fd-value small {font-size: .42em; font-weight: 400; letter-spacing: 0; color: var(--brand-muted)}
.fd-source {font-size: .8rem; line-height: 1.45; color: var(--brand-muted)}
.fd-assumed {border-block-start-style: dashed !important}
.fd-tag {
  display: inline-block;
  margin-inline-end: .35rem;
  padding: .05rem .45rem;
  border: 1px dashed currentColor;
  border-radius: 999px;
  color: var(--brand-ink);
}
.fd-result {border-block-start-color: var(--brand-ink) !important}
.fd-arrival.is-late .fd-result {border-block-start-color: var(--fd-late) !important}
.fd-arrival.is-late .fd-result .fd-value,
.fd-arrival.is-late .fd-verdict {color: var(--fd-late)}

/* Native range input: mouse, touch, arrow keys and Home/End without extra code. */
.fd-control {margin-block-start: 1.2rem}
.fd-control label {display: block; font-size: .88rem; color: var(--brand-secondary)}
.fd-control input {
  display: block;
  width: 50%;
  height: 44px;
  /* Physical left so the thumb sits over the same times on the axis in RTL pages too. */
  margin: .2rem auto 0 0;
  direction: ltr;
  accent-color: var(--fd-accent);
  cursor: pointer;
}
.fd-control input:disabled {cursor: default; opacity: .7}
.fd-control input:focus-visible {outline: 2px solid currentColor; outline-offset: 2px}

/* Axis 09:45 to 11:15. The slider covers 09:45 to 10:30, the first half of the same axis. */
.fd-timeline {direction: ltr; margin-block-start: .4rem}
.fd-track {
  position: relative;
  height: 4.2rem;
  border-block-end: 1px solid var(--brand-line);
}
.fd-window {
  position: absolute;
  inset-block: 0;
  left: 50%;
  width: 33.333%;
  background: var(--fd-surface);
  border-inline: 1px solid var(--brand-line);
}
.fd-window > span {
  position: absolute;
  top: .3rem;
  left: .45rem;
  font-size: .72rem;
  color: var(--brand-muted);
}
.fd-trip,
.fd-over {
  position: absolute;
  bottom: .9rem;
  height: 6px;
  border-radius: 3px;
}
.fd-trip {
  left: var(--fd-depart);
  width: calc(var(--fd-arrive) - var(--fd-depart));
  background: repeating-linear-gradient(90deg, var(--fd-accent) 0 8px, transparent 8px 12px);
}
.fd-trip > span {
  position: absolute;
  bottom: .55rem;
  left: 0;
  white-space: nowrap;
  font-size: .72rem;
  color: var(--brand-secondary);
}
.fd-over {
  left: var(--fd-close);
  width: calc(var(--fd-arrive) - var(--fd-close));
  background: var(--fd-late);
}
.fd-dot {
  position: absolute;
  bottom: calc(.9rem + 3px);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translate(-50%, 50%);
  border: 2px solid var(--brand-page);
}
.fd-dot-depart {left: var(--fd-depart); background: var(--brand-ink)}
.fd-dot-arrive {left: var(--fd-arrive); background: var(--fd-accent)}
.fd-arrival.is-late .fd-dot-arrive {background: var(--fd-late)}
.fd-ticks {
  position: relative;
  height: 1.5rem;
  font-size: .74rem;
  color: var(--brand-muted);
  font-variant-numeric: tabular-nums;
}
.fd-ticks span {position: absolute; top: .3rem; transform: translateX(-50%)}
.fd-ticks span:nth-child(1) {left: 0; transform: none}
.fd-ticks span:nth-child(2) {left: 16.667%}
.fd-ticks span:nth-child(3) {left: 50%}
.fd-ticks span:nth-child(4) {left: 83.333%}
.fd-ticks span:nth-child(5) {right: 0; left: auto; transform: none}

.fd-sum {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .3rem 1.1rem;
  margin: 1.4rem 0 0;
  padding-block-start: 1.1rem;
  border-block-start: 1px solid var(--brand-line);
  font-size: clamp(1.15rem, 1.9vw, 1.5rem);
  font-variant-numeric: tabular-nums;
}
.fd-sum > bdi {font-weight: 500}
.fd-sum-verdict {font-size: .92rem; color: var(--brand-secondary)}
.fd-static {margin: .8rem 0 0; color: var(--brand-secondary); max-width: 62ch}

/* The decision is a different record from the calculation. */
.fd-decision {
  padding: 1.1rem clamp(1rem, 2vw, 1.6rem) 1.3rem;
  border: 1px solid var(--brand-line);
  border-radius: 4px;
  background: var(--fd-surface);
  align-self: start;
}
.fd-decision-title {margin: 0; font-size: 1.15rem; font-weight: 500; line-height: 1.3}
.fd-decision-state {
  display: inline-block;
  margin: .7rem 0 .35rem;
  padding: .1rem .6rem;
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  font-size: .85rem;
}
.fd-decision > p:not([class]) {margin: .8rem 0 0; font-size: .93rem; line-height: 1.55; color: var(--brand-secondary)}

.fd-arrival-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.fd-arrival-sources {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: clamp(1.5rem, 6vw, 6rem);
  align-items: start;
  margin-block-start: clamp(2.5rem, 5vw, 4rem);
}
.fd-arrival-sources > .record-reader {margin: 0}

@media (prefers-reduced-motion: no-preference) {
  .fd-arrival.is-live :is(.fd-trip, .fd-over, .fd-dot) {transition: left .18s ease-out, width .18s ease-out}
}

@media (max-width: 880px) {
  .fd-arrival-grid,
  .fd-arrival-sources {grid-template-columns: 1fr}
  .fd-facts {grid-template-columns: repeat(2, minmax(0, 1fr))}
  .fd-facts > div:is(:first-child, :last-child) {grid-column: 1 / -1}
  .fd-control input {width: 100%}
  .fd-decision {border-style: dashed}
  .fd-ticks span:nth-child(2) {display: none}
}
