@charset "UTF-8";
/* ==========================================================================
   GTAmap — 地图浏览页专用样式 / Map explorer page styles
   依赖 assets/css/style.css 的设计令牌（--bg/--surface/--brand/...），
   本文件只包含 map.html 专用布局，不重复定义变量。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 页头 / Page head
   -------------------------------------------------------------------------- */
.map-page-head {
  padding: 2.4rem 0 1.4rem;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(900px 300px at 8% -40%, var(--brand-soft), transparent 60%),
    var(--bg);
}
.map-page-head h1 { margin-bottom: 0.4rem; }
.map-page-head .lead { max-width: 72ch; margin-bottom: 0; font-size: 1.02rem; }

.map-stage { padding: 1.5rem 0 0.5rem; }

/* --------------------------------------------------------------------------
   2. 工具栏 / Toolbar
   -------------------------------------------------------------------------- */
.map-toolbar { margin-bottom: 1rem; }
.map-toolbar-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.6rem;
  align-items: flex-end;
}

.map-toolbar-toggle { display: none; }

.map-ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  min-width: 0;
}

.map-ctrl-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}

/* 分段按钮 / Segmented control */
.seg {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.seg-btn {
  appearance: none;
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.seg-btn:first-child { border-left: 0; }
.seg-btn:hover { color: var(--brand); background: var(--surface-2); }
.seg-btn[aria-pressed="true"] {
  background: var(--brand);
  color: var(--brand-contrast);
}
.seg-btn .seg-sub {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.72;
  margin-left: 0.3rem;
}
.seg-btn[aria-pressed="true"] .seg-sub { opacity: 0.85; }
.seg-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* 搜索 / Search */
.map-ctrl-search { flex: 1 1 240px; max-width: 360px; }
.map-search-wrap { position: relative; }
.map-search-wrap .input { padding-right: 2rem; }
.map-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.map-search-item {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  line-height: 1.45;
}
.map-search-item:last-child { border-bottom: 0; }
.map-search-item:hover, .map-search-item.is-active { background: var(--brand-soft); }
.map-search-item .s-name { font-weight: 600; }
.map-search-item .s-tags { display: inline-flex; gap: 0.35rem; margin-left: 0.5rem; vertical-align: 1px; }
.map-search-item .s-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 0.3rem;
  background: var(--surface-2);
}
.map-search-empty { padding: 0.6rem 0.75rem; color: var(--text-muted); font-size: 0.85rem; }

/* --------------------------------------------------------------------------
   3. 地图容器 / Map shell
   -------------------------------------------------------------------------- */
.map-shell {
  position: relative;
  height: clamp(460px, calc(100vh - 330px), 780px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
  /* 隔离内部 z-index，避免盖住站点吸顶导航（.site-header z-index:50） */
  isolation: isolate;
}
.map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-canvas .maplibregl-canvas { outline: none; }

/* 底图加载失败时的占位底色 */
.map-shell:not(.has-map) {
  background:
    linear-gradient(var(--bg-alt), var(--bg-alt)) padding-box;
}

/* 显式声明 [hidden]，防止组件自身 display 规则覆盖 UA 默认 */
.map-panel[hidden], .map-legend[hidden],
.map-toast[hidden], .map-search-results[hidden] { display: none; }

/* --------------------------------------------------------------------------
   4. 状态条 / Status chip
   -------------------------------------------------------------------------- */
.map-status {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: min(92%, 520px);
  padding: 0.38rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow-sm);
  font-size: 0.82rem;
  color: var(--text-muted);
  backdrop-filter: blur(6px);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .map-status { background: var(--surface); }
}
.map-status-dot {
  flex: none;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--text-faint);
}
.map-status[data-state="loading"] .map-status-dot {
  background: var(--accent);
  animation: map-pulse 1.2s ease-in-out infinite;
}
.map-status[data-state="ok"] .map-status-dot { background: var(--grade-a); }
.map-status[data-state="error"] .map-status-dot { background: var(--grade-d); }
.map-status[data-state="error"] .map-status-text { color: var(--text); }
.map-status .btn { flex: none; padding: 0.15rem 0.6rem; font-size: 0.76rem; }
/* .btn 的 display:inline-flex 会覆盖 UA 的 [hidden]，需显式还原 */
.map-status .btn[hidden], .map-icon-btn[hidden] { display: none; }
.map-status-text { min-width: 0; overflow-wrap: anywhere; }

@keyframes map-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* --------------------------------------------------------------------------
   5. 图例 / Legend
   -------------------------------------------------------------------------- */
.map-legend {
  position: absolute;
  left: 0.75rem;
  bottom: 2.6rem;
  z-index: 10;
  min-width: 210px;
  max-width: min(86%, 280px);
  padding: 0.6rem 0.8rem 0.7rem;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.82rem;
  backdrop-filter: blur(6px);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .map-legend { background: var(--surface); }
}
.map-legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text);
  margin-bottom: 0.45rem;
}
.map-legend-list { list-style: none; margin: 0; padding: 0; }
.map-legend-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.16rem 0;
  color: var(--text-muted);
}
.map-legend-swatch {
  flex: none;
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.25);
}
.map-legend-label { flex: 1 1 auto; min-width: 0; }
.map-legend-count { font-variant-numeric: tabular-nums; color: var(--text-faint); font-size: 0.76rem; }

/* --------------------------------------------------------------------------
   6. 属性面板 / Info panel
   -------------------------------------------------------------------------- */
.map-panel {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 20;
  width: min(330px, calc(100% - 1.5rem));
  max-height: calc(100% - 1.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.map-panel-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.8rem 0.9rem 0.6rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.map-panel-head strong { font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; }
.map-panel-body { padding: 0.7rem 0.9rem 0.9rem; }

.map-prop { display: flex; gap: 0.6rem; padding: 0.28rem 0; font-size: 0.88rem; }
.map-prop dt {
  flex: 0 0 96px;
  margin: 0;
  color: var(--text-faint);
  font-size: 0.78rem;
  padding-top: 2px;
}
.map-prop dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.map-prop dd.num { font-variant-numeric: tabular-nums; }

.map-icon-btn {
  appearance: none;
  flex: none;
  width: 26px; height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.map-icon-btn:hover { color: var(--brand); border-color: var(--brand); }

/* --------------------------------------------------------------------------
   7. 轻提示 / Toast
   -------------------------------------------------------------------------- */
.map-toast {
  position: absolute;
  left: 50%;
  bottom: 2.8rem;
  transform: translateX(-50%);
  z-index: 30;
  max-width: min(92%, 560px);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  background: #16222e;
  color: #f2f7fb;
  font-size: 0.85rem;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.map-toast.is-static { position: static; margin: 1rem; transform: none; display: block; }

/* --------------------------------------------------------------------------
   8. 地图下方说明 / Data note
   -------------------------------------------------------------------------- */
.map-data-note { margin-top: 0.7rem; }

/* --------------------------------------------------------------------------
   9. MapLibre 控件微调 / MapLibre control tweaks
   -------------------------------------------------------------------------- */
.map-shell .maplibregl-ctrl-group {
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.map-shell .maplibregl-ctrl-attrib {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  font-size: 0.7rem;
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .map-shell .maplibregl-ctrl-attrib { background: var(--surface); }
}
.map-shell .maplibregl-ctrl-attrib a { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   10. 响应式 / Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .map-ctrl-search { max-width: none; flex-basis: 100%; }
}

@media (max-width: 760px) {
  .map-page-head { padding: 1.8rem 0 1.1rem; }
  .map-stage { padding-top: 1.1rem; }
  .map-toolbar { padding: 0.85rem; }
  .map-toolbar-toggle { display: inline-flex; }
  .map-toolbar-body { display: none; }
  .map-toolbar-body.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.9rem;
    margin-top: 0.85rem;
  }
  .map-toolbar-body.is-open .map-ctrl-group { flex-direction: column; }
  .seg { width: 100%; }
  .seg-btn { flex: 1 1 0; justify-content: center; }

  .map-shell { height: clamp(380px, 62vh, 560px); }

  /* 面板改为底部抽屉 / panel becomes a bottom sheet */
  .map-panel {
    top: auto;
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    width: auto;
    max-height: 58%;
  }

  .map-status {
    max-width: calc(100% - 1.5rem);
    font-size: 0.76rem;
  }
  .map-legend { bottom: 2.2rem; max-width: 62%; }
  .map-toast { bottom: 3rem; font-size: 0.8rem; }
}

/* 减少动效 / Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .map-status[data-state="loading"] .map-status-dot { animation: none; }
}
