/* /map/ 互動地圖（原型，2026-11-25；docs/互動地圖-原型-2026-11-25.md）。只有這一頁載入，不動 site.css。 */

/* 地圖滿版：跳出 main 的 .wrap 寬度 */
.mapx { width: 100vw; margin-left: calc(50% - 50vw); margin-top: -8px; }
.mapx-head { max-width: 1120px; margin: 0 auto; padding: 0 16px 10px; }
.mapx-head h1 { margin: 0 0 4px; font-size: clamp(1.35rem, 2.6vw, 1.9rem); }
.mapx-lede { margin: 0; color: var(--muted); max-width: 62ch; }

.mapx-stage { position: relative; height: calc(100svh - 150px); min-height: 420px; max-height: 900px; border-block: 1px solid var(--border); background: var(--background); }
.mapx-canvas { position: absolute; inset: 0; }
.mapx-canvas .maplibregl-canvas:focus-visible { outline: 3px solid var(--link); outline-offset: -3px; }
/* 鍵盤操作時正中間的十字：Enter 打開這一格 */
.mapx-cross { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; pointer-events: none; display: none; }
.mapx-cross::before, .mapx-cross::after { content: ''; position: absolute; background: var(--text); }
.mapx-cross::before { left: 10px; top: 0; width: 2px; height: 22px; }
.mapx-cross::after { top: 10px; left: 0; height: 2px; width: 22px; }
.mapx-stage:has(.maplibregl-canvas:focus-visible) .mapx-cross { display: block; }

.mapx-panel { position: absolute; left: 12px; top: 12px; width: 220px; max-height: calc(100% - 60px); overflow: auto; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; box-shadow: 0 2px 10px rgb(0 0 0 / 0.08); font-size: 0.85rem; }
.mapx-layers { border: 0; margin: 0 0 6px; padding: 0; display: grid; gap: 3px; }
.mapx-layers legend { font-weight: 600; margin-bottom: 2px; padding: 0; }
.mapx-layers label { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.mapx-off { color: var(--muted); }
.mapx-soon { font-size: 0.75rem; color: var(--muted); margin: 2px 0 0; }
.mapx-key summary { font-weight: 600; cursor: pointer; margin: 4px 0; }
.mapx-legend, .mapx-legend-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mapx-legend-notes { margin-top: 6px; color: var(--muted); }
.mapx-legend-ends { display: none; }
.mapx-legend li, .mapx-legend-notes li { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.mapx-swatch { flex: none; width: 18px; height: 14px; border-radius: 3px; background: var(--sw); border: 1px solid var(--scale-line, #6F879B); }
.mapx-swatch-thin { opacity: 0.7; background: repeating-linear-gradient(135deg, var(--sw) 0 3px, transparent 3px 6px); border-style: dashed; }
.mapx-swatch-none { background: transparent; border-style: dashed; }

.mapx-status:empty { display: none; }
.mapx-status { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); margin: 0; max-width: calc(100% - 32px); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 0.85rem; box-shadow: 0 2px 8px rgb(0 0 0 / 0.08); }
.mapx-attrib { position: absolute; right: 0; bottom: 0; margin: 0; padding: 2px 8px; font-size: 0.72rem; background: color-mix(in srgb, var(--surface) 85%, transparent); border-top-left-radius: 8px; }
.mapx-attrib a { color: var(--text); }
.mapx-noscript { position: absolute; inset: 40% 16px auto; text-align: center; }

.mapx-card { position: absolute; z-index: 3; right: 12px; top: 12px; width: min(300px, calc(100% - 24px)); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; box-shadow: 0 4px 16px rgb(0 0 0 / 0.12); }
.mapx-card p { margin: 0 0 6px; }
.mapx-card-value { font-size: 1.05rem; }
.mapx-card-value strong { font-size: 1.5rem; font-family: var(--serif, inherit); }
.mapx-card-line { font-size: 0.88rem; color: var(--muted); }
.mapx-card-links { display: grid; gap: 4px; margin-top: 8px !important; }
.mapx-close { position: absolute; right: 6px; top: 4px; border: 0; background: none; color: var(--muted); font-size: 1.4rem; line-height: 1; padding: 4px 8px; cursor: pointer; }

.mapx-below { max-width: 1120px; margin: 0 auto; padding: 12px 16px 0; }
.mapx-jump { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mapx-jump span { color: var(--muted); }

.maplibregl-ctrl-group { background: var(--surface); }
.maplibregl-ctrl-top-right { top: 8px; right: 8px; }
.maplibregl-cooperative-gesture-screen { font-family: inherit; font-size: 1rem; }

/* 暗色：MapLibre 的按鈕圖示是深色的 SVG，反白 */
@media (prefers-color-scheme: dark) {
  .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
  .maplibregl-ctrl-group button + button { border-top-color: var(--border); }
}

/* 手機：標題縮小、圖例收成一條七格的色帶（頭尾寫數字），小卡貼底 */
@media (max-width: 640px) {
  .mapx-head h1 { font-size: 1.25rem; }
  .mapx-lede { font-size: 0.9rem; line-height: 1.4; }
  .mapx-stage { height: calc(100svh - 170px); min-height: 380px; }
  .mapx-panel { width: auto; right: 56px; padding: 8px 10px; }
  .mapx-layers { display: none; }
  .mapx-key summary { margin: 0 0 4px; }
  .mapx-legend { grid-template-columns: repeat(7, 1fr); gap: 0; }
  .mapx-legend li { display: block; font-size: 0; }
  .mapx-legend .mapx-swatch { display: block; width: 100%; border-radius: 0; height: 12px; }
  .mapx-legend-ends { display: flex; justify-content: space-between; font-size: 0.72rem; margin: 2px 0 0; }
  .mapx-legend-notes { font-size: 0.75rem; }
  .mapx-card { left: 12px; right: 12px; top: auto; bottom: 30px; width: auto; }
}
