:root {
  --bg: #f6f5f2;
  --text: #1a1a1a;
  --muted: #6e6c68;
  --line: #e2e0db;
  --tile: #e8e6e1;
  --focus: #1a1a1a;
  --pin: #ff6b3d;
  --gap: 8px;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0d;
    --text: #ececec;
    --muted: #9b9994;
    --line: #262625;
    --tile: #1b1b1a;
    --focus: #ececec;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html.lb-open { overflow: hidden; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.wrap { max-width: 1600px; margin: 0 auto; padding-left: 28px; padding-right: 28px; }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 1000;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.logo { font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: .02em; white-space: nowrap; }
.nav-links { display: flex; align-items: center; gap: 24px; font-size: 14px; flex-shrink: 0; }
.nav-links a { color: var(--muted); transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.lang-btn {
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  padding: 3px 10px; border-radius: 6px; cursor: pointer;
  background: transparent; border: 1px solid var(--line);
}
.lang-btn:hover { border-color: var(--muted); }

/* ---------- 开头 ---------- */
.intro { padding-top: 64px; padding-bottom: 40px; }
.intro h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(40px, 7vw, 76px); line-height: 1.1; letter-spacing: .01em;
}
.tagline { margin-top: 14px; font-size: clamp(16px, 2vw, 19px); color: var(--muted); max-width: 36em; }

/* ---------- 工具栏：分类 + 照片/地图切换 ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.filters { display: flex; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; cursor: pointer;
  padding: 5px 14px; border-radius: 999px; font-size: 14px;
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  transition: color .2s, background .2s, border-color .2s;
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { margin-left: 6px; opacity: .55; font-variant-numeric: tabular-nums; }

.toolbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
.view-toggle {
  display: flex; flex-shrink: 0; padding: 2px;
  border: 1px solid var(--line); border-radius: 999px;
}

/* 实况 开/关 */
.live-toggle {
  display: flex; align-items: center; gap: 6px; cursor: pointer; flex-shrink: 0;
  padding: 5px 13px 5px 10px; border-radius: 999px; font-size: 14px;
  background: transparent; color: var(--text); border: 1px solid var(--line);
  transition: color .2s, border-color .2s;
}
.live-toggle:hover { border-color: var(--muted); }
.live-toggle svg { width: 16px; height: 16px; }
.live-toggle .slash { display: none; }
.live-toggle[aria-pressed="false"] { color: var(--muted); }
.live-toggle[aria-pressed="false"] .slash { display: inline; }
html.live-off .tile .live-badge { display: none; }
.view-toggle button {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 3px 12px 3px 10px; border: 0; border-radius: 999px; font-size: 14px;
  background: transparent; color: var(--muted); transition: color .2s, background .2s;
}
.view-toggle button:hover { color: var(--text); }
.view-toggle button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.view-toggle svg { width: 16px; height: 16px; }

/* ---------- 画廊（等高行排版，由 script.js 计算） ---------- */
.gallery { min-height: 40vh; }
.g-row { display: flex; gap: var(--gap); margin-bottom: var(--gap); }
.tile {
  position: relative; display: block; overflow: hidden;
  background: var(--tile); cursor: zoom-in;
}
.tile img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .6s ease, transform .8s cubic-bezier(.2,.7,.2,1);
}
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.025); }

/* 实况照片 */
.tile video, #lb-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .35s ease; pointer-events: none;
}
.tile.playing video, .lb-media.playing #lb-video { opacity: 1; }
.live-badge {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px; border-radius: 999px; border: 0;
  background: rgba(0,0,0,.42); color: #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font: 600 11px/1.4 var(--sans); letter-spacing: .08em;
}
.live-badge svg { width: 16px; height: 16px; stroke-width: 1.6; }
.tile .live-badge { pointer-events: none; }
.tile.playing .live-badge svg, .lb-media.playing .live-badge svg { animation: live-pulse 1s ease-in-out infinite alternate; }
@keyframes live-pulse { to { opacity: .45; } }
.tile:focus-visible { outline-offset: -2px; }
.empty { padding: 48px 0; color: var(--muted); }

/* ---------- 地图 ---------- */
.map-view { height: min(74vh, 800px); min-height: 380px; }
.map-canvas { width: 100%; height: 100%; isolation: isolate; }
.map-canvas.leaflet-container { background: var(--tile); font-family: var(--sans); }
.map-msg { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 14px; padding: 24px; text-align: center; }

/* 底图调成灰调，让照片更突出；深色模式和大图里的地图用反色 */
.map-canvas .leaflet-tile-pane { filter: grayscale(1) brightness(1.03) contrast(.9); }
.lb-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) grayscale(1) brightness(.85) contrast(.9); }
@media (prefers-color-scheme: dark) {
  .map-view .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) grayscale(1) brightness(.85) contrast(.9); }
}

.photo-pin { background: none; border: 0; }
.leaflet-container .leaflet-marker-pane .photo-pin img { width: 100%; height: 100%; }
.photo-pin .pin {
  position: relative; width: 100%; height: 100%; cursor: pointer;
  border: 2px solid #fff; border-radius: 8px; background: #bbb;
  box-shadow: 0 3px 10px rgba(0,0,0,.35);
  transition: transform .2s;
}
.photo-pin .pin:hover { transform: scale(1.12); }
.photo-pin img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.photo-pin .badge {
  position: absolute; top: -9px; right: -9px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; border: 2px solid #fff; background: #1a1a1a; color: #fff;
  font: 600 11px/18px var(--sans); text-align: center;
}
.loc-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--pin); border: 3px solid #fff;
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--pin) 30%, transparent), 0 2px 6px rgba(0,0,0,.4);
}
@media (prefers-color-scheme: dark) {
  .map-view .leaflet-bar a { background: #1e1e1d; color: #ddd; border-color: #333; }
  .map-view .leaflet-control-attribution { background: rgba(13,13,13,.7); color: #888; }
  .map-view .leaflet-control-attribution a { color: #aaa; }
}

/* ---------- 页脚 ---------- */
.footer { padding-top: 48px; padding-bottom: 40px; font-size: 13px; color: var(--muted); }

/* ---------- 大图浏览 ---------- */
.lightbox {
  --panel: 400px;
  position: fixed; inset: 0; z-index: 2000;
  background: #080808; color: #ececec;
  animation: lb-in .2s ease;
}
@keyframes lb-in { from { opacity: 0; } }
.lb-figure { height: 100%; display: flex; flex-direction: column; }
.lb-stage {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 64px 88px 0;
}
.lb-media { position: relative; max-width: 100%; max-height: 100%; -webkit-touch-callout: none; user-select: none; }
#lb-img { display: block; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; }
.lb-media .live-badge { top: 12px; left: 12px; padding: 4px 10px 4px 6px; cursor: pointer; }
.lb-media .live-badge:hover { background: rgba(0,0,0,.6); }
.lb-caption {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 18px;
  padding: 16px 88px calc(20px + env(safe-area-inset-bottom));
  font-size: 12.5px; color: #8a8883;
}
.lb-count { font-variant-numeric: tabular-nums; }
.lb-meta { text-align: center; }
.lb-meta span { display: inline-block; white-space: nowrap; }
.lb-meta span + span::before { content: "·"; margin: 0 8px; opacity: .6; }
.lb-pill {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  padding: 4px 12px 4px 9px; border-radius: 999px; font-size: 12.5px;
  background: transparent; color: #dcdcdc; border: 1px solid #343433;
  transition: background .2s, color .2s, border-color .2s;
}
.lb-pill:hover { background: #1c1c1b; }
.lb-pill[aria-expanded="true"] { background: #ececec; color: #111; border-color: #ececec; }
.lb-pill svg { width: 15px; height: 15px; }

.lb-btn {
  position: absolute; z-index: 2; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.06); border: 0; color: #ececec;
  transition: background .2s, right .25s ease, bottom .25s ease;
}
.lb-btn:hover { background: rgba(255,255,255,.16); }
.lb-btn svg { width: 22px; height: 22px; }
.lb-close { top: 12px; right: 12px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lightbox :focus-visible { outline-color: #ececec; }

/* 位置地图面板：电脑在右侧，手机在底部 */
.lb-map {
  position: absolute; top: 0; right: 0; bottom: 0; width: var(--panel); z-index: 3;
  display: flex; flex-direction: column;
  background: #111110; border-left: 1px solid #222;
  animation: panel-in .25s ease;
}
@keyframes panel-in { from { transform: translateX(24px); opacity: 0; } }
.lb-map-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 18px; }
.lb-map-title { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #9b9994; }
.lb-coords { flex: 1; font-size: 12px; color: #6f6e6a; font-variant-numeric: tabular-nums; }
.lb-map-close {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: #bbb;
}
.lb-map-close:hover { background: #222; }
.lb-map-close svg { width: 18px; height: 18px; }
.lb-map .map-canvas { flex: 1; min-height: 0; }
.lb-map .map-canvas.leaflet-container { background: #1a1a19; }
.lb-map-msg { flex: 1; display: grid; place-items: center; padding: 24px; font-size: 13px; color: #8a8883; text-align: center; }
.lb-map-links { display: flex; gap: 18px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); font-size: 13px; }
.lb-map-links a { color: #bdbcb8; }
.lb-map-links a:hover { color: #fff; }
.lb-map .leaflet-bar a { background: #1e1e1d; color: #ddd; border-color: #333; }
.lb-map .leaflet-control-attribution { background: rgba(17,17,16,.75); color: #777; }
.lb-map .leaflet-control-attribution a { color: #999; }

.lightbox.map-open .lb-figure { margin-right: var(--panel); }
.lightbox.map-open .lb-next { right: calc(var(--panel) + 16px); }
.lightbox.map-open .lb-close { right: calc(var(--panel) + 12px); }

/* ---------- 手机 ---------- */
@media (max-width: 720px) {
  :root { --gap: 4px; }
  .wrap { padding-left: 16px; padding-right: 16px; }
  .nav-links { gap: 14px; }
  .intro { padding-top: 36px; padding-bottom: 24px; }
  .toolbar { margin-bottom: 14px; }
  .filters { margin-left: -16px; padding-left: 16px; }
  .view-toggle button { padding: 4px 9px; }
  .view-toggle span { display: none; }
  .live-toggle { padding: 5px 11px 5px 9px; font-size: 13px; }
  .map-view { height: 70vh; min-height: 320px; margin: 0 -16px; }

  .lightbox { --sheet: 46vh; }
  .lb-stage { padding: 60px 0 0; }
  .lb-caption { padding-left: 56px; padding-right: 56px; }
  .lb-prev, .lb-next { top: auto; bottom: calc(14px + env(safe-area-inset-bottom)); transform: none; width: 40px; height: 40px; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
  .lb-map {
    top: auto; left: 0; width: auto; height: var(--sheet);
    border-left: 0; border-top: 1px solid #222; border-radius: 14px 14px 0 0;
    animation-name: sheet-in;
  }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
  .lightbox.map-open .lb-figure { margin-right: 0; height: calc(100% - var(--sheet)); }
  .lightbox.map-open .lb-next { right: 8px; }
  .lightbox.map-open .lb-close { right: 12px; }
  .lightbox.map-open .lb-caption { padding-bottom: 14px; }
  .lightbox.map-open .lb-prev, .lightbox.map-open .lb-next { bottom: calc(var(--sheet) + 10px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
