
/* Mobile-only historical card enhancement. Map, route and timeline styles are untouched. */
.history-image-preview[hidden] { display: none !important; }
.history-image-preview {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(0, 7, 10, .82);
  -webkit-backdrop-filter: blur(12px) saturate(.78);
  backdrop-filter: blur(12px) saturate(.78);
  opacity: 0;
  visibility: hidden;
  cursor: zoom-out;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .24s ease-out, visibility .24s ease-out, backdrop-filter .24s ease-out;
  overscroll-behavior: contain;
}
.history-image-preview.is-open { opacity: 1; visibility: visible; }
.history-image-preview__figure {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 9px;
  pointer-events: none;
  transform: scale(.95);
  opacity: .5;
  transition: transform .28s cubic-bezier(.16, 1, .3, 1), opacity .22s ease-out;
}
.history-image-preview.is-open .history-image-preview__figure { transform: scale(1); opacity: 1; }
.history-image-preview__image {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  display: block;
  object-fit: contain;
  cursor: zoom-out;
  filter: none;
  user-select: none;
  -webkit-user-drag: none;
}
.history-image-preview__caption {
  max-width: min(72ch, calc(100% - 116px));
  margin: 0 auto;
  color: #d6e0dc;
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
  overflow-wrap: anywhere;
}
.history-image-preview__close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 2;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(173, 218, 217, .34);
  border-radius: 50%;
  background: rgba(5, 18, 23, .88);
  color: #eff7f4;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .34);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .16s ease-out, background .16s ease-out, border-color .16s ease-out;
}
.history-image-preview__close:active { transform: scale(.94); background: rgba(12, 34, 41, .96); }
.history-image-preview__close:focus-visible { outline: 2px solid #74dadd; outline-offset: 3px; }
html.history-preview-open,
html.history-preview-open body { overflow: hidden !important; }

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .history-image-preview { background: rgba(0, 7, 10, .94); }
}
@media (prefers-reduced-transparency: reduce) {
  .history-image-preview { background: rgba(0, 7, 10, .96); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

.node-detail.mobile-history-card { overflow: hidden !important; }
.node-detail.mobile-history-card .node-detail__scroll {
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(85,177,180,.35) transparent;
}
.node-detail.mobile-history-card .node-detail__media-image { overflow: hidden; }
.node-detail.mobile-history-card .history-media-gallery {
  width: 100%;
  height: 100%;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  touch-action: pan-x;
}
.node-detail.mobile-history-card .history-media-gallery::-webkit-scrollbar { display: none; }
.node-detail.mobile-history-card .history-media-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
.node-detail.mobile-history-card .history-media-zoom {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  display: block;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}
.node-detail.mobile-history-card .history-media-zoom:focus-visible { outline: 2px solid var(--active-color); outline-offset: -3px; }
.node-detail.mobile-history-card .history-media-slide img,
.node-detail.mobile-history-card .history-media-zoom img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  filter: saturate(.72) sepia(.1) contrast(1.04) brightness(.9);
}
.node-detail.mobile-history-card .node-detail__media figcaption span { overflow-wrap: anywhere; }
.node-detail.mobile-history-card .node-detail__media figcaption a { display: none !important; }
.node-detail.mobile-history-card .node-detail__copy-wrap {
  max-height: 88px;
  overflow: hidden;
}
.node-detail.mobile-history-card.is-copy-expanded .node-detail__copy-wrap {
  max-height: none !important;
  overflow: visible !important;
}
.node-detail.mobile-history-card .node-detail__copy-wrap p {
  min-height: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.node-detail.mobile-history-card .detail-copy-toggle.is-visible { display: block !important; }

@media (orientation: landscape) and (max-height: 560px), (orientation: portrait) and (max-width: 760px) {
  .node-detail.mobile-history-card .node-detail__copy-wrap { max-height: 66px; }
  .node-detail.mobile-history-card .node-detail__media figcaption { min-height: 18px; font-size: 6.5px; line-height: 1.35; }
  .node-detail.mobile-history-card .detail-copy-toggle { min-height: 25px; height: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  .history-image-preview,
  .history-image-preview__figure,
  .node-detail.mobile-history-card .history-media-gallery { transition: none !important; scroll-behavior: auto; }
}
