/* Scoped travel layout; the shared stylesheet owns the site shell. */
.trip-page, .trip-lightbox {
  --surface: var(--card); --muted: var(--ink-2); --accent: var(--clay);
  --accent-soft: var(--clay-tint); --border: var(--line);
  --group: #6B7F4A; --group-soft: #E7ECD9;
  --serif: var(--font-serif); --sans: var(--font-sans);
  --sheet-ease: .2s ease;
}
.trip-page { max-width: 1280px; margin: 0 auto; padding: 32px 24px 48px; }
.trip-back { display: inline-block; font-size: 13px; color: var(--muted); margin-bottom: 28px; }
.trip-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 24px; padding: 0 8px 32px; }
.trip-header h1 { margin: 0; font-family: var(--serif); font-size: clamp(28px, 2.6vw, 40px); font-weight: 500; line-height: 1.25; letter-spacing: -.6px; }
.trip-header .accent { color: var(--accent); padding: 0 4px; }
.trip-header .range { color: var(--muted); font-size: 13px; margin-top: 12px; }
.trip-page .stats { display: flex; align-items: flex-start; gap: 0; padding-bottom: 2px; }
.trip-page .stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 0 24px; border-left: 1px solid var(--border);
}
.trip-page .stat:first-child { padding-left: 0; border-left: 0; }
.trip-page .stat b {
  display: block; margin: 0; padding: 0;
  font-family: var(--serif); font-size: 32px; font-weight: 400; line-height: 1;
  letter-spacing: -.04em; font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink);
}
.trip-page .stat span {
  font-size: 12px; line-height: 1; color: var(--muted); letter-spacing: .02em;
}

/* Layout is a real split: day rail | photos [| map]. Not viewport drawers. */
.trip-layout { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 16px; align-items: start; }
.trip-page #timeline {
  position: sticky; top: 80px; z-index: 4; align-self: start;
  width: 52px; max-height: calc(100dvh - 96px); overflow-x: hidden; overflow-y: auto;
  padding: 4px 8px 12px; background: transparent; border: 0;
  transition: width var(--sheet-ease);
}
.trip-page #timeline.expanded { width: 260px; padding: 8px 10px 16px; }

.timeline-toggle {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 28px; height: 28px; margin: 0 auto 10px; padding: 0;
  border: 1px solid transparent; border-radius: 50%; background: transparent;
  color: var(--muted); cursor: pointer; transition: background .15s ease, color .15s ease, width var(--sheet-ease), border-radius var(--sheet-ease);
}
.timeline-toggle:hover { background: var(--bg-alt); color: var(--ink); }
.trip-page #timeline.expanded .timeline-toggle {
  width: 100%; height: 36px; justify-content: flex-start; padding: 0 10px; margin: 0 0 10px;
  border-radius: 10px; background: var(--bg-alt); color: var(--ink);
}
.timeline-toggle-label { display: none; font-size: 12px; letter-spacing: .06em; }
.trip-page #timeline.expanded .timeline-toggle-label { display: inline; }

.timeline-body { display: flex; flex-direction: column; gap: 2px; }
.trip-page button, .trip-lightbox button { font: inherit; color: inherit; }
.trip-page :focus-visible, .trip-lightbox :focus-visible { outline: 2px solid var(--clay-dark); outline-offset: 4px; }

.trip-page .day {
  position: relative; display: block; width: 100%; text-align: left;
  padding: 14px 14px 14px 48px; margin: 0; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; transition: background .15s ease;
}
.trip-page .day:hover { background: var(--bg-alt); }
.trip-page .day.active { background: var(--accent-soft); }
.trip-page .day::before { content: ""; position: absolute; width: 1px; left: 24px; background: var(--border); top: 40px; bottom: -8px; }
.trip-page .day:last-child::before { display: none; }
.trip-page .dot {
  position: absolute; left: 13px; top: 16px; width: 22px; height: 22px;
  border: 1px solid var(--accent); border-radius: 50%; background: var(--bg); color: var(--clay-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 11px; font-weight: 500; line-height: 1;
  transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.trip-page .day:hover .dot { background: var(--accent-soft); }
.trip-page .day.active .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.trip-page .d-date { color: var(--muted); letter-spacing: .6px; font-size: 11px; }
.trip-page .d-title { font-family: var(--serif); font-size: 18px; font-weight: 400; margin: 6px 0 4px; line-height: 1.35; }
.trip-page .d-desc { font-size: 12px; line-height: 1.65; color: var(--muted); }
.trip-page .d-count { display: inline-block; margin-top: 8px; color: var(--clay-dark); font-size: 11px; }
.trip-page .d-copy { display: block; }
.trip-page .d-date, .trip-page .d-title, .trip-page .d-desc { display: block; }

/* Collapsed rail: a spine of serif numerals. Hover/active live on the circle, not a square chip. */
.trip-page #timeline:not(.expanded) .timeline-body { position: relative; gap: 6px; padding: 2px 0; }
.trip-page #timeline:not(.expanded) .timeline-body::before {
  content: ""; position: absolute; left: 50%; top: 14px; bottom: 14px; width: 1px;
  background: var(--border); transform: translateX(-50%); pointer-events: none;
}
.trip-page #timeline:not(.expanded) .day {
  width: 28px; height: 28px; margin: 0 auto; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent;
}
.trip-page #timeline:not(.expanded) .day:hover,
.trip-page #timeline:not(.expanded) .day.active { background: transparent; }
.trip-page #timeline:not(.expanded) .dot {
  position: relative; z-index: 1; left: auto; top: auto;
  width: 28px; height: 28px; font-size: 12px;
  background: var(--bg);
}
.trip-page #timeline:not(.expanded) .day:hover .dot { background: var(--accent-soft); }
.trip-page #timeline:not(.expanded) .day.active .dot {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.trip-page #timeline:not(.expanded) .day::before,
.trip-page #timeline:not(.expanded) .d-copy { display: none; }

.trip-page #right {
  display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: minmax(0,auto);
  gap: 0; min-width: 0; position: relative; align-items: start;
}

.trip-page #panel {
  grid-column: 1; grid-row: 1; min-width: 0; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
}

.map-toggle-slot {
  grid-column: 1; grid-row: 1; z-index: 6;
  justify-self: end; align-self: start;
  position: sticky; top: calc(100dvh - 72px);
  width: max-content; height: max-content;
  margin: 0 16px 0 0; pointer-events: none;
}
.trip-page #right.map-open .map-toggle-slot {
  grid-column: 2; justify-self: start; margin: 0 0 18px 40px;
}
.map-toggle {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border: 0; border-radius: 999px;
  background: var(--clay); color: #fff; font-size: 14px; cursor: pointer;
  box-shadow: var(--shadow); transition: background .15s ease;
}
.trip-page .map-toggle,
.trip-page .map-toggle:hover { color: #fff; }
.map-toggle:hover { background: var(--clay-dark); }

.map-sheet {
  grid-column: 2; grid-row: 1;
  position: sticky; top: 80px; height: calc(100dvh - 96px);
  width: 0; min-width: 0; overflow: hidden; margin-left: 0;
  border-radius: var(--radius-lg); background: var(--bg-alt); border: 0;
  visibility: hidden; opacity: 0; pointer-events: none;
  transition: width var(--sheet-ease), margin-left var(--sheet-ease), visibility var(--sheet-ease), opacity var(--sheet-ease);
}
.trip-page #right.map-open .map-sheet {
  width: min(400px, 36vw); margin-left: 18px;
  visibility: visible; opacity: 1; pointer-events: auto; border: 1px solid var(--border);
}
.trip-page #map {
  position: relative; width: 100%; height: 100%;
  background: var(--bg-alt); isolation: isolate;
}
.trip-page .map-close {
  position: absolute; top: 10px; right: 10px; z-index: 1100;
  width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: var(--surface); color: var(--ink); font-size: 18px; line-height: 1;
  cursor: pointer; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}

/* 地图降级提示：Leaflet 未加载、初始化失败或底图不可用时只影响地图本身 */
.trip-page .map-notice {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 1200;
  margin: 0; padding: 10px 14px; border-radius: 10px;
  background: var(--surface); color: var(--muted);
  font-size: 12px; line-height: 1.5; text-align: center;
  box-shadow: var(--shadow);
}
.trip-page .map-toggle:disabled { opacity: .45; cursor: not-allowed; }
.trip-page .map-toggle:disabled:hover { background: var(--clay); }

.trip-page #panel-head { padding: 17px 22px; display: flex; gap: 16px; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.trip-page #panel-title { font-family: var(--serif); font-size: 19px; line-height: 1.4; }
.trip-page #panel-count { white-space: nowrap; font-size: 11px; color: var(--muted); }
.trip-page #grid { display: grid; padding: 16px 20px 22px; grid-template-columns: repeat(auto-fill,minmax(132px,1fr)); gap: 12px; align-content: start; }
.trip-page .photo { border: 0; padding: 0; background: var(--bg); border-radius: 10px; cursor: zoom-in; aspect-ratio: 1; min-width: 0; }
.trip-page #grid img { display: block; width: 100%; height: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; transition: filter .18s; }
.trip-page #grid img:hover { filter: brightness(1.07); }
.trip-page .g-head { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 14px 0 8px; border-bottom: 1px solid var(--border); font-family: var(--serif); font-size: 16px; line-height: 1.5; scroll-margin-top: 88px; }
.trip-page .g-head:first-child { padding-top: 0; }
.trip-page .g-head b { font-weight: 500; }
.trip-page .g-head span { font-family: var(--sans); font-size: 11px; color: var(--muted); white-space: nowrap; }
.trip-page .stop-marker { width: 34px; height: 34px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); color: var(--accent); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 700; font-size: 14px; box-shadow: 0 2px 6px #302e2a20; cursor: pointer; }
.trip-page .stop-marker.active { background: var(--accent); color: white; }
.trip-page .grp-marker {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--group); color: #fff; border: 2px solid var(--group);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 11px; font-weight: 600; line-height: 1;
  box-shadow: 0 0 0 3px #6b7f4a33; cursor: pointer;
}
.trip-page .grp-marker.active {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--group);
}
.trip-page .route-chevron-wrap { background: none; border: none; pointer-events: none; }
.trip-page .route-chevron {
  width: 18px; height: 18px; transform-origin: 50% 50%;
}
.trip-page .route-chevron svg { display: block; overflow: visible; }
.trip-page #map.route-dim .route-chevron-wrap.is-national .route-chevron { opacity: .55; }
.trip-page .day-track.is-on {
  filter: drop-shadow(0 0 1.6px #faf9f5) drop-shadow(0 0 1.6px #faf9f5);
}
.trip-page .trip-route {
  filter: drop-shadow(0 0 1px #faf9f5);
}
.trip-page .leaflet-control-zoom { border: 1px solid var(--border) !important; border-radius: 12px !important; overflow: hidden; box-shadow: 0 2px 8px #302e2a0d !important; }
.trip-page .leaflet-control-zoom a { width: 44px !important; height: 44px !important; line-height: 44px !important; background: var(--surface) !important; color: var(--ink) !important; border-color: var(--border) !important; font-weight: 400 !important; }
.trip-page .leaflet-tooltip { font-family: var(--sans); background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 9px; padding: 8px 12px; box-shadow: 0 2px 8px #302e2a12; }
.trip-page .leaflet-control-attribution { font-size: 9px !important; background: #ffffffe0 !important; }
.trip-lightbox { display: none; position: fixed; inset: 0; z-index: 2000; background: rgba(27,26,24,.94); padding: 24px; align-items: center; justify-content: center; flex-direction: column; }
.trip-lightbox.open { display: flex; }
.trip-lightbox img { max-width: 84vw; max-height: 78dvh; border-radius: 8px; box-shadow: 0 12px 48px #0004; object-fit: contain; }
.trip-lightbox #lb-cap { color: #d8d5cc; text-align: center; font-size: 12px; line-height: 1.6; margin-top: 20px; }
.trip-lightbox .lb-btn { position: absolute; top: 50%; transform: translateY(-50%); border: 0; color: white; width: 44px; height: 44px; border-radius: 50%; font-size: 20px; background: #ffffff16; cursor: pointer; }
.trip-lightbox .lb-btn:hover { background: #ffffff30; }
.trip-lightbox #lb-prev { left: 24px; }
.trip-lightbox #lb-next { right: 24px; }
.trip-lightbox #lb-close { position: absolute; width: 44px; height: 44px; right: 18px; top: 16px; font-size: 26px; border: 0; border-radius: 50%; background: #ffffff12; color: white; cursor: pointer; }
@media (max-width: 900px) {
  .trip-layout { display: flex; flex-direction: column; gap: 18px; }
  .trip-page #timeline, .trip-page #timeline.expanded {
    position: static; width: 100%; max-height: none; transform: none;
    display: flex; gap: 10px; padding: 4px 4px 12px;
    overflow-x: auto; overflow-y: visible; scroll-snap-type: x proximity;
    background: transparent; border: 0;
  }
  .timeline-toggle { display: none; }
  .timeline-body { display: flex; flex-direction: row; gap: 10px; }
  .trip-page #timeline:not(.expanded) .day,
  .trip-page .day {
    flex: 0 0 240px; width: 240px; height: auto; margin: 0; padding: 14px 14px 14px 48px;
    display: block; scroll-snap-align: start; border: 1px solid var(--border);
  }
  .trip-page #timeline:not(.expanded) .day:hover,
  .trip-page .day:hover { background: var(--bg-alt); }
  .trip-page #timeline:not(.expanded) .day.active,
  .trip-page .day.active { background: var(--accent-soft); border-color: #ddc3b5; }
  .trip-page #timeline:not(.expanded) .timeline-body::before { display: none; }
  .trip-page #timeline:not(.expanded) .dot,
  .trip-page .dot { position: absolute; left: 14px; top: 17px; }
  .trip-page #timeline:not(.expanded) .d-copy,
  .trip-page .d-copy { display: block; }
  .trip-page #timeline:not(.expanded) .day::before,
  .trip-page .day::before { display: none; }
  .trip-page #right, .trip-page #right.map-open {
    display: block; width: 100%; grid-template-columns: none; gap: 0;
  }
  .trip-page #panel { grid-column: auto; grid-row: auto; }
  .map-toggle-slot, .trip-page #right.map-open .map-toggle-slot {
    position: static; height: auto; display: contents; padding: 0;
    grid-column: auto; justify-content: unset;
  }
  .map-toggle {
    position: fixed; right: 16px; bottom: 16px; z-index: 45;
    padding: 10px 16px; font-size: 13px;
  }
  .map-sheet {
    position: fixed; top: 72px; right: 12px; left: 12px; z-index: 40;
    width: auto; height: 46dvh; margin: 0; grid-column: auto; grid-row: auto;
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    visibility: hidden; pointer-events: none; opacity: 0;
    transform: translateY(-6px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
  }
  .trip-page #right.map-open .map-sheet {
    visibility: visible; pointer-events: auto; opacity: 1; transform: none;
    width: auto; margin-left: 0;
  }
}
@media (max-width: 540px) {
  .trip-page { padding: 24px 12px 32px; }
  .trip-back { margin-left: 8px; margin-bottom: 24px; }
  .trip-header { padding: 0 8px 24px; gap: 22px; }
  .trip-header h1 { font-size: 28px; line-height: 1.35; }
  .trip-page .stats { width: 100%; }
  .trip-page .stat { padding: 0 18px; }
  .trip-page .stat:first-child { padding-left: 0; border: 0; }
  .trip-page .stat b { font-size: 28px; }
  .trip-layout { gap: 10px; }
  .trip-page #right { gap: 14px; }
  .trip-page #map, .trip-page #panel, .map-sheet { border-radius: 14px; }
  .trip-page #panel-head { padding: 16px 14px; gap: 8px; }
  .trip-page #panel-title { font-size: 17px; }
  .trip-page #grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 12px; }
  .trip-page .g-head { flex-wrap: wrap; gap: 2px 10px; font-size: 15px; }
  .trip-lightbox { padding: 12px; }
  .trip-lightbox img { max-width: 94vw; max-height: 72dvh; }
  .trip-lightbox .lb-btn { top: auto; bottom: 26px; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .trip-page *, .trip-page *::before, .trip-page *::after, .trip-lightbox * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
