/* ════════════════════════════════════════════════════════════
   Shipment route map (js/route-map.js) — Swiss: grey world, red trail,
   square numbered markers coloured by what happened at each place.
   ════════════════════════════════════════════════════════════ */

.rm-section { --rm-transit: #1F5FAD; --rm-held: #C27A00; --rm-stopped: #E4002B; --rm-done: #0A7D3E; --rm-origin: #111111; --rm-neutral: #55555C; --rm-planned: #FFFFFF; }
.sw-record .rm-body { grid-column: 4 / -1; min-width: 0; }

.rm-figure { margin: 0; }
.rm-frame { position: relative; aspect-ratio: 16 / 10; background: #F7F7F8; border: 1px solid #D9D9DE; overflow: hidden; }
.rm-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rm-sea { fill: #F7F7F8; }

/* Trail: travelled legs draw in one after another; the remaining leg is dashed */
.rm-leg { fill: none; stroke-linecap: round; }
.rm-leg.is-done { stroke: var(--sw-red, #E4002B); stroke-width: 3px; stroke-dasharray: 100; stroke-dashoffset: 100; animation: rm-draw 700ms cubic-bezier(0.65, 0, 0.35, 1) forwards; animation-delay: calc(250ms + var(--leg, 0) * 520ms); }
.rm-leg.is-planned { stroke: #111111; stroke-width: 2px; stroke-dasharray: 1.4 1.1; opacity: 0.6; }
@keyframes rm-draw { to { stroke-dashoffset: 0; } }

/* Markers and labels (HTML over the map, fixed size at any zoom) */
.rm-pins { position: absolute; inset: 0; pointer-events: none; }
.rm-pin {
  position: absolute; width: 20px; height: 20px; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px)));
  display: flex; align-items: center; justify-content: center;
  font: 800 0.6875rem/1 var(--sw-sans, Arial, sans-serif); color: #FFFFFF; font-feature-settings: "tnum";
  background: var(--rm-neutral); box-shadow: 0 0 0 2px #FFFFFF;
  opacity: 0; animation: rm-pop 380ms cubic-bezier(0.22, 1, 0.36, 1) forwards; animation-delay: calc(150ms + var(--i, 0) * 520ms);
}
@keyframes rm-pop {
  from { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(0.4); }
  to { opacity: 1; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(1); }
}
.rm-pin.tone-origin { background: var(--rm-origin); }
.rm-pin.tone-transit { background: var(--rm-transit); }
.rm-pin.tone-held { background: var(--rm-held); }
.rm-pin.tone-stopped { background: var(--rm-stopped); }
.rm-pin.tone-done { background: var(--rm-done); }
.rm-pin.tone-planned { background: #FFFFFF; color: #111111; box-shadow: inset 0 0 0 2px #111111, 0 0 0 2px #FFFFFF; }
/* Where the shipment is now */
.rm-pin.is-current::after {
  content: ""; position: absolute; inset: -2px; border: 2px solid var(--sw-red, #E4002B);
  animation: rm-pulse 1.8s ease-out infinite; animation-delay: 1.6s; opacity: 0;
}
@keyframes rm-pulse { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(2.4); } }

.rm-tag {
  position: absolute; display: flex; flex-direction: column; gap: 1px; padding: 3px 6px; white-space: nowrap;
  background: rgba(255, 255, 255, 0.92); box-shadow: 0 1px 0 rgba(17, 17, 17, 0.08);
  font: 700 0.75rem/1.2 var(--sw-sans, Arial, sans-serif); color: #111111;
  opacity: 0; animation: rm-fade 300ms ease-out forwards; animation-delay: calc(260ms + var(--i, 0) * 520ms);
}
@keyframes rm-fade { to { opacity: 1; } }
.rm-tag.is-hidden { visibility: hidden; }
.rm-tag-status { font-weight: 600; font-size: 0.6875rem; }
.rm-tag.tone-transit .rm-tag-status { color: var(--rm-transit); }
.rm-tag.tone-held .rm-tag-status { color: #9A6100; }
.rm-tag.tone-stopped .rm-tag-status { color: var(--rm-stopped); }
.rm-tag.tone-done .rm-tag-status { color: var(--rm-done); }
.rm-tag.is-current { box-shadow: inset 2px 0 0 var(--sw-red, #E4002B), 0 1px 0 rgba(17, 17, 17, 0.08); }
/* Legend */
.rm-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 0 0; font-size: 0.8125rem; color: #55555C; }
.rm-key { display: inline-flex; align-items: center; gap: 7px; }
.rm-key i { width: 11px; height: 11px; display: inline-block; }
.rm-key.tone-origin i { background: var(--rm-origin); }
.rm-key.tone-transit i { background: var(--rm-transit); }
.rm-key.tone-held i { background: var(--rm-held); }
.rm-key.tone-stopped i { background: var(--rm-stopped); }
.rm-key.tone-done i { background: var(--rm-done); }
.rm-key.tone-planned i { background: #FFFFFF; box-shadow: inset 0 0 0 1.5px #111111; }
.rm-key-line i { width: 22px; height: 3px; background: var(--sw-red, #E4002B); }
.rm-key-line.is-planned i { background: repeating-linear-gradient(90deg, #111111 0 5px, transparent 5px 9px); opacity: 0.6; }

/* Stop register under the map */
.rm-list { list-style: none; margin-top: 22px; border-top: 1px solid #111111; }
.rm-item { display: grid; grid-template-columns: 56px 1fr; gap: 14px; padding: 16px 0; border-bottom: 1px solid #D9D9DE; }
.rm-item-no {
  font-size: 1.75rem; font-weight: 800; font-stretch: 62%; line-height: 0.9; letter-spacing: -0.02em;
  font-feature-settings: "tnum", "lnum"; color: var(--rm-neutral);
}
.rm-item.tone-transit .rm-item-no { color: var(--rm-transit); }
.rm-item.tone-held .rm-item-no { color: #9A6100; }
.rm-item.tone-stopped .rm-item-no { color: var(--rm-stopped); }
.rm-item.tone-done .rm-item-no { color: var(--rm-done); }
.rm-item.tone-origin .rm-item-no { color: var(--rm-origin); }
.rm-item.is-planned .rm-item-no { color: #A5A5AC; }
.rm-item-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.rm-item-place { font-weight: 700; font-size: 1.0625rem; }
.rm-item-role { font-size: 0.8125rem; color: #55555C; }
.rm-item.is-current .rm-item-role { color: var(--sw-red, #E4002B); font-weight: 700; }
.rm-events { list-style: none; margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.rm-event { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 0.9375rem; }
.rm-event-status { display: inline-flex; align-items: center; gap: 7px; font-weight: 650; }
.rm-event-status::before { content: ""; width: 8px; height: 8px; background: var(--rm-neutral); }
.rm-event.tone-transit .rm-event-status { color: var(--rm-transit); }
.rm-event.tone-transit .rm-event-status::before { background: var(--rm-transit); }
.rm-event.tone-held .rm-event-status { color: #9A6100; }
.rm-event.tone-held .rm-event-status::before { background: var(--rm-held); }
.rm-event.tone-stopped .rm-event-status { color: var(--rm-stopped); }
.rm-event.tone-stopped .rm-event-status::before { background: var(--rm-stopped); }
.rm-event.tone-done .rm-event-status { color: var(--rm-done); }
.rm-event.tone-done .rm-event-status::before { background: var(--rm-done); }
.rm-event time { color: #55555C; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.rm-event-desc { flex-basis: 100%; color: #55555C; font-size: 0.875rem; }
.rm-item-note { margin-top: 4px; font-size: 0.8125rem; color: #8A8A93; }
.rm-empty { color: #55555C; }
.rm-credit { margin-top: 12px; font-size: 0.75rem; color: #8A8A93; }

@media (max-width: 768px) {
  .sw-record .rm-body { grid-column: 1 / -1; }
  .rm-item { grid-template-columns: 44px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .rm-leg.is-done { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
  .rm-pin, .rm-tag { animation: none; opacity: 1; }
  .rm-pin.is-current::after { animation: none; }
}
