#trip-itineraries-button {
  display: flex;
  align-items: center;
  gap: 6px;
}
.trip-card {
  max-height: min(660px, calc(100dvh - var(--site-header-height) - 152px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.card-itinerary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: calc(100% - 28px);
  min-height: 40px;
  margin: 12px 14px -4px;
  padding: 9px 0 2px;
  border: 0;
  border-top: 1px solid #dcd7cb;
  background: transparent;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
}
.card-itinerary span:last-child {
  color: #a34f3a;
  font-size: 10px;
}
.card-itinerary:hover span:first-child {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* A non-modal side panel inside the map area: the map stays usable beside it. */
.trip-itinerary {
  position: absolute;
  z-index: 900;
  inset: 70px 20px 20px auto;
  margin: 0;
  width: min(400px, calc(100% - 32px));
  height: auto;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid #dcd7cb;
  border-radius: 5px;
  background: #faf8f3;
  color: #272724;
  box-shadow: 0 12px 44px #23323d30;
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  transition:
    transform 0.34s cubic-bezier(0.33, 1, 0.68, 1),
    opacity 0.2s ease-out;
}
.trip-itinerary[open] {
  display: flex;
  flex-direction: column;
}
.trip-itinerary.is-visible {
  transform: none;
  opacity: 1;
}
.trip-itinerary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
  min-height: 48px;
  padding: 6px 8px 6px 12px;
  background: #272724;
  color: #faf8f3;
  border-radius: 4px 4px 0 0;
}
.trip-itinerary-back {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #faf8f3;
  font-size: 11px;
  font-weight: 600;
}
.trip-itinerary-back[hidden] {
  display: none;
}
.trip-itinerary-back svg {
  width: 14px;
  height: 14px;
}
.trip-itinerary-back svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.trip-itinerary-close {
  width: 36px;
  height: 36px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #faf8f3;
  font-size: 24px;
  line-height: 1;
}
.trip-itinerary-back:hover,
.trip-itinerary-close:hover {
  background: #ffffff1a;
}
#trip-itinerary-title {
  flex-shrink: 0;
  margin: 0;
  padding: 17px 22px 0;
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.trip-itinerary-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 0 14px 18px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.itinerary-subtitle {
  margin: 7px 8px 0;
  color: #77756f;
  font-size: 11px;
}
.itinerary-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin: 14px 8px 4px;
}
.itinerary-mode {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: #77756f;
  white-space: nowrap;
}
.itinerary-mode svg {
  width: 13px;
  height: 13px;
  color: var(--mode);
  flex-shrink: 0;
}

/* Itinerary hovers lift their routes on the map and fade the rest. */
.itinerary-hovering .leaflet-routes-pane path:not(.itinerary-hot):not(.route-hit) {
  opacity: 0.22;
}
.leaflet-routes-pane path.itinerary-hot.activity-route,
.leaflet-routes-pane path.itinerary-hot.transport-route {
  stroke-width: 6px;
}
.itinerary-hovering .route-badge:not(.itinerary-hot) span {
  opacity: 0.35;
}
.route-badge.itinerary-hot span {
  transform: scale(1.2);
}
.leaflet-flights-pane path.itinerary-hot {
  stroke-width: 3px;
  stroke-opacity: 0.95;
}

/* Trip list */
.itinerary-trips {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}
.itinerary-trip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 10px 8px;
  border: 0;
  border-top: 1px solid #e7e3d9;
  background: transparent;
  text-align: left;
}
.itinerary-trips li:last-child .itinerary-trip {
  border-bottom: 1px solid #e7e3d9;
}
.itinerary-trip:hover {
  background: #f1eee5;
}
.itinerary-trip img,
.itinerary-trip-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 4px;
  object-fit: cover;
  background: #e9e6dc;
}
.itinerary-trip-icon {
  display: grid;
  place-items: center;
  color: var(--mode);
}
.itinerary-trip-icon svg {
  width: 22px;
  height: 22px;
}
.itinerary-trip-text {
  flex: 1;
  min-width: 0;
}
.itinerary-trip b {
  display: block;
  font-size: 13px;
  font-weight: 600;
}
.itinerary-trip-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 10px;
  color: #63743d;
}
.itinerary-trip-meta svg {
  width: 12px;
  height: 12px;
  color: var(--mode);
}
.itinerary-trip-arrow {
  color: #a34f3a;
  font-size: 13px;
}

/* Days */
.itinerary-days {
  margin: 12px 0 0;
  list-style: none;
  padding: 0;
  border-top: 1px solid #dcd7cb;
}
.itinerary-day {
  position: relative;
  padding: 0 0 12px 34px;
  border-radius: 4px;
}
.itinerary-day::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 34px;
  bottom: -14px;
  width: 2px;
  background: #dcddd3;
}
.itinerary-day:last-child::before {
  display: none;
}
.itinerary-dot {
  display: grid;
  place-items: center;
  position: absolute;
  z-index: 1;
  left: 6px;
  top: 16px;
  width: 18px;
  height: 18px;
  border: 2px solid #c9ccbd;
  border-radius: 50%;
  background: #faf8f3;
  color: #777d69;
  font-size: 9px;
  font-weight: 600;
}
.current > .itinerary-dot {
  border-color: #859650;
  color: #566631;
  box-shadow:
    0 0 0 3px #faf8f3,
    0 0 0 4px #b5bfa0;
}
.itinerary-day.is-highlighted > .itinerary-dot {
  border-color: #859650;
  background: #859650;
  color: #fff;
}
.itinerary-day-head {
  display: block;
  width: 100%;
  padding: 13px 9px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
}
.itinerary-day-head:hover,
.itinerary-day.is-highlighted > .itinerary-day-head {
  background: #f1eee5;
}
.itinerary-day-head small {
  display: block;
  font-size: 10px;
  color: #77756f;
}
.itinerary-day-head b {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.current > .itinerary-day-head b {
  color: #566631;
}
.itinerary-day-head .itinerary-day-total {
  margin-top: 4px;
  color: #63743d;
}
.itinerary-legs {
  list-style: none;
  margin: 2px 0 0;
  padding: 0 0 0 9px;
}
.itinerary-leg {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 5px 6px;
  border-radius: 4px;
  outline-offset: -2px;
}
.itinerary-leg.is-highlighted {
  background: #eef0e5;
}
.itinerary-leg-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  color: #fff;
  background: var(--mode);
}
.itinerary-leg-icon svg {
  width: 13px;
  height: 13px;
}
.itinerary-leg-text {
  flex: 1;
  min-width: 0;
}
.itinerary-leg b {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #3d4530;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.itinerary-leg small {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 2px;
  font-size: 10px;
  color: #747b65;
}
.itinerary-leg small:empty {
  display: none;
}
.itinerary-photos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0 15px;
}
.itinerary-photos button {
  width: 52px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  overflow: hidden;
  background: #e9e6dc;
}
.itinerary-photos img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.itinerary-photos button:hover img {
  filter: brightness(1.08);
}
.itinerary-photos span {
  font-size: 10px;
  color: #77756f;
}
.itinerary-note,
.itinerary-help {
  margin: 17px 8px 0;
  font-size: 10px;
  line-height: 1.6;
  color: #77756f;
}
.itinerary-help {
  border-top: 1px solid #dcd7cb;
  padding-top: 12px;
}
@media (max-width: 600px) {
  .trip-itinerary {
    inset: auto 0 0;
    width: 100%;
    height: min(55%, 520px);
    max-height: none;
    border-width: 1px 0 0;
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
  }
  .trip-itinerary-header {
    border-radius: 11px 11px 0 0;
  }
  #trip-itinerary-title {
    padding: 12px 18px 0;
    font-size: 21px;
  }
  .trip-itinerary-content {
    padding-left: 10px;
    padding-right: 10px;
  }
}
