/* =========================================================
   Contact Map Module — 静态地址展示（无后端、无第三方地图脚本）
   ========================================================= */
#contactMap {
  height: auto;
  border-radius: var(--radius, 10px);
  overflow: hidden;
  border: 1px solid var(--c-border, #e5e7eb);
  background: #eef2f7;
  position: relative;
}
/* 纯 CSS 兜底地图需要固定高度（由 contact-map.js 注入时加 .contact-map--fallback） */
#contactMap.contact-map--fallback {
  min-height: 360px;
  height: 360px;
}

/* 真实地图图片（本地静态图，前端仅引用图片，不含任何地图 Key） */
.map-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 14px;
}
.map-shot {
  margin: 0;
  background: #fff;
  border: 1px solid var(--c-border, #e5e7eb);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15,31,61,.08);
}
/* 主图占满整行 */
.map-shot--hero {
  grid-column: 1 / -1;
}
.map-shot img {
  display: block;
  width: 100%;
  height: auto;
}

/* 单图模式：图片满铺卡片，与左侧信息卡保持同一圆角/描边语言 */
.map-gallery--single {
  display: block;
  padding: 0;
  gap: 0;
}
.map-gallery--single .map-shot {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.map-gallery--single .map-shot--hero img {
  max-height: none;
  object-fit: contain;
}
.map-gallery--single picture { display: block; }

.map-shot figcaption {
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-text-soft, #4b5563);
  text-align: center;
  border-top: 1px solid var(--c-border, #e5e7eb);
}

/* =========================================================
   兜底：纯 CSS 静态地图 + 地址卡片（无任何网络请求）
   仅在页面没有地图图片时由 contact-map.js 注入
   ========================================================= */
.map-static {
  position: absolute;
  inset: 0;
  background-color: #eaf0f6;
  background-image:
    linear-gradient(rgba(255,255,255,.95) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255,255,255,.95) 2px, transparent 2px),
    linear-gradient(120deg, transparent 46%, rgba(255,255,255,.8) 46%, rgba(255,255,255,.8) 54%, transparent 54%);
  background-size: 44px 44px, 44px 44px, 100% 100%;
  overflow: hidden;
}

/* 定位标记（水滴形） */
.ms-pin {
  position: absolute;
  top: 44%;
  left: 50%;
  width: 54px;
  height: 54px;
  background: var(--c-blue, #2563eb);
  border-radius: 50% 50% 50% 0;
  transform: translate(-50%, -100%) rotate(-45deg);
  box-shadow: 0 10px 20px rgba(37,99,235,.35);
  display: grid;
  place-items: center;
}
.ms-pin i {
  transform: rotate(45deg);
  color: #fff;
  font-size: 22px;
}

/* 地址卡片 */
.ms-card {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(86%, 360px);
  background: #fff;
  border: 1px solid var(--c-border, #e5e7eb);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 12px 30px rgba(15,31,61,.16);
  text-align: center;
}
.ms-company {
  font-weight: 700;
  font-size: 15px;
  color: var(--c-navy, #1a2a4a);
  margin-bottom: 8px;
}
.ms-addr {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--c-text-soft, #4b5563);
}
.ms-addr i {
  color: var(--c-blue, #2563eb);
  margin-top: 3px;
  flex: 0 0 auto;
}

/* ---------- 点击放大：可点区域与提示 ---------- */
.map-zoom {
  position: relative;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.map-zoom img {
  transition: transform .5s cubic-bezier(.2,.7,.3,1);
  will-change: transform;
}
.map-zoom__hint {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: rgba(15,31,61,.52);
  border: 1px solid rgba(255,255,255,.28);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  backdrop-filter: blur(10px) saturate(160%);
  box-shadow: 0 4px 14px rgba(10,20,40,.22);
  pointer-events: none;
  transition: background-color .25s ease, transform .25s ease;
}
.map-zoom__hint i { font-size: 12px; }

@media (hover: hover) and (pointer: fine) {
  .map-zoom:hover img,
  .map-zoom:focus-visible img { transform: scale(1.02); }
  .map-zoom:hover .map-zoom__hint { background: rgba(37,99,235,.86); }
  .map-zoom:focus-visible { outline: none; }
  .map-zoom:focus-visible .map-zoom__hint {
    outline: 2px solid var(--c-blue, #2563eb);
    outline-offset: 2px;
  }
}
.map-zoom:focus { outline: none; }

/* =========================================================
   地图大图灯箱（复用 style.css 的 .lightbox 基础样式）
   ========================================================= */
.lightbox--map {
  flex-direction: column;
  gap: 14px;
  padding: 22px 16px 18px;
}

/* 关闭按钮：实底白色圆形，保证在深色页头与地图上同样清晰 */
.lightbox--map .lightbox__close {
  top: 14px;
  right: 16px;
  width: 42px;
  height: 42px;
  font-size: 24px;
  color: var(--c-navy, #1a2a4a);
  background: rgba(255,255,255,.94);
  box-shadow: 0 8px 22px rgba(0,0,0,.34);
}
.lightbox--map .lightbox__close:hover { background: #fff; color: var(--c-blue, #2563eb); }

/* 舞台：正常态随图片撑开；放大态变为可滚动视口 */
.lightbox--map .lightbox__stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 96vw;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.lightbox--map .lightbox__img {
  max-width: min(96vw, 1440px);
  max-height: calc(100vh - 150px);
  max-height: calc(100dvh - 150px);
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
  cursor: zoom-in;
  -webkit-user-select: none;
  user-select: none;
}
.lightbox--map .lightbox__stage.is-zoom {
  display: block;
  width: min(96vw, 1440px);
  height: calc(100vh - 150px);
  height: calc(100dvh - 150px);
  overflow: auto;
  cursor: grab;
  background: #fff;
  border-radius: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(15,31,61,.34) transparent;
}
.lightbox--map .lightbox__stage.is-zoom::-webkit-scrollbar { width: 10px; height: 10px; }
.lightbox--map .lightbox__stage.is-zoom::-webkit-scrollbar-thumb {
  background: rgba(15,31,61,.32);
  border: 2px solid #fff;
  border-radius: 999px;
}
.lightbox--map .lightbox__stage.is-zoom::-webkit-scrollbar-thumb:hover { background: rgba(15,31,61,.5); }
.lightbox--map .lightbox__stage.is-zoom::-webkit-scrollbar-track { background: #fff; }
.lightbox--map .lightbox__stage.is-zoom .lightbox__img {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  border-radius: 0;
  box-shadow: none;
  cursor: grab;
}
.lightbox--map .lightbox__stage.is-grabbing,
.lightbox--map .lightbox__stage.is-grabbing .lightbox__img { cursor: grabbing; }

/* 底部操作条 */
.lightbox__bar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 7px 7px 16px;
  border-radius: 999px;
  background: rgba(12,22,40,.6);
  border: 1px solid rgba(255,255,255,.16);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
}
.lb-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  background: rgba(255,255,255,.16);
  transition: background-color .2s ease;
}
.lb-btn:hover { background: rgba(255,255,255,.3); }
.lb-btn i { font-size: 12.5px; }
.lb-tip {
  font-size: 12.5px;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
}

/* 打开灯箱时锁定页面滚动，并补偿滚动条宽度，避免页面横向跳动 */
body.lb-open {
  overflow: hidden;
  padding-right: var(--lb-sbw, 0px);
}
body.lb-open .site-header { right: var(--lb-sbw, 0px); }

@media (max-width: 640px) {
  #contactMap.contact-map--fallback { height: 300px; min-height: 300px; }
  .map-gallery:not(.map-gallery--single) { padding: 10px; }
  .map-zoom__hint { top: 10px; right: 10px; padding: 6px 10px; font-size: 11.5px; }
  .lightbox--map { padding: 12px 10px 14px; gap: 10px; }
  .lightbox--map .lightbox__img { max-width: 100%; max-height: calc(100vh - 132px); max-height: calc(100dvh - 132px); }
  .lightbox--map .lightbox__stage { max-width: 100%; }
  .lightbox--map .lightbox__stage.is-zoom { width: 100%; height: calc(100vh - 132px); height: calc(100dvh - 132px); }
  .lightbox__bar { padding: 6px 6px 6px 14px; gap: 10px; }
  .lb-btn { padding: 8px 14px; font-size: 13px; }
  .lb-tip { display: none; }
  .lightbox--map .lightbox__close { top: 10px; right: 12px; }
}

/* 尊重用户「减少动效」偏好 */
@media (prefers-reduced-motion: reduce) {
  .map-zoom img { transition: none; }
  .map-zoom:hover img,
  .map-zoom:focus-visible img { transform: none; }
}
