:root {
  --fg: #111;
  --bg: #fff;
  --f: "Inter", "Noto Sans SC", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--f); color: var(--fg); background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* 语言切换：只显示当前语言 */
html[data-lang="en"] [lang="zh"],
html[data-lang="zh"] [lang="en"] { display: none !important; }

/* ---------- Header ---------- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 20px clamp(16px, 4vw, 40px);
  font-size: 14px;
}
.logo { font-weight: 600; text-decoration: none; margin-right: auto; }
.tabs { display: flex; gap: 20px; }
.tabs a { text-decoration: none; opacity: .55; transition: opacity .2s; }
.tabs a:hover, .tabs a.is-active { opacity: 1; }
.tabs a.is-active { text-decoration: underline; text-underline-offset: 5px; }
.lang-toggle { font-size: 13px; }
.lang-toggle span { opacity: .45; }
html[data-lang="en"] .lang-toggle [data-l="en"],
html[data-lang="zh"] .lang-toggle [data-l="zh"] { opacity: 1; font-weight: 600; }

/* 首页和 Blog：header 叠在深色背景上，文字变白 */
body.on-dark .top { color: #f3f1ea; }
/* 首页是亮的蓝天白云，白字加一层淡阴影，飘过白云时也看得清 */
body.on-dark .top, .home .hint { text-shadow: 0 1px 10px rgba(0, 30, 80, .35); }

/* ---------- Tabs ---------- */
.tab { display: none; }
.tab.is-active { display: block; }

/* ---------- Home ---------- */
.home {
  position: relative;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background: #4a88d0;
  color: #f3f1ea;
}
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#stage.dragging { cursor: grabbing; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hint {
  position: absolute; top: 50%; right: clamp(16px, 4vw, 40px);
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .5;
  writing-mode: vertical-rl;
  transform: translateY(-50%);
  pointer-events: none;
}

/* ---------- Blog：星空 ---------- */
.blog {
  position: relative;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background: #0a0a0a;
  color: #e8e6e1;
}
#constellation { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.blog-labels { position: absolute; inset: 0; pointer-events: none; }
.tag-label {
  position: absolute; top: 0; left: 0;
  pointer-events: auto;
  font-size: clamp(16px, 1.8vw, 24px); font-weight: 600;
  letter-spacing: .08em;
  text-decoration: none;
  color: rgba(255, 255, 255, .72);
  text-shadow: 0 0 3px #0a0a0a, 0 0 8px #0a0a0a, 0 0 14px #0a0a0a; /* 连线穿过时文字仍清楚 */
  white-space: nowrap;
  transition: color .3s, opacity .4s;
}
.tag-label:hover, .tag-label.is-active { color: #fff; }
.tag-label.is-dim { opacity: .3; }
.blog-tip {
  position: absolute; top: 0; left: 0;
  pointer-events: none;
  font-size: 12px; letter-spacing: .04em;
  color: #fff;
  white-space: nowrap;
}
.blog-tip[hidden] { display: none; }

.blog-panel {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 3;
  width: min(380px, 100%);
  padding: 96px 32px 32px;
  overflow-y: auto;
  background: linear-gradient(to left, rgba(10,10,10,.96) 60%, rgba(10,10,10,0));
  transform: translateX(100%); opacity: 0;
  transition: transform .6s cubic-bezier(.2,.8,.2,1), opacity .4s;
  font-size: 14px;
}
.blog-panel.is-open { transform: none; opacity: 1; }
.blog-panel h2 { font-size: 28px; font-weight: 600; letter-spacing: .08em; margin: 16px 0 4px; }
.panel-back { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; opacity: .55; }
.panel-back:hover { opacity: 1; }
.panel-count, .panel-empty { opacity: .5; }
.panel-list { list-style: none; margin-top: 24px; border-top: 1px solid rgba(255,255,255,.12); }
.panel-list a { display: block; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.12); text-decoration: none; }
.panel-list a:hover .pl-title { text-decoration: underline; text-underline-offset: 3px; }
.pl-date { display: block; font-size: 12px; opacity: .5; }
.pl-title { font-size: 16px; }

.blog-post {
  position: absolute; inset: 0; z-index: 5;
  overflow-y: auto;
  background: #0a0a0a;
  padding: 110px 20px 80px;
}
.blog-post[hidden] { display: none; }
.post-inner { max-width: 680px; margin: 0 auto; }
.post-meta { margin: 24px 0 8px; font-size: 13px; opacity: .55; }
.post-meta a { text-decoration: none; }
.post-meta a:hover { text-decoration: underline; }
.blog-post h1 { font-size: 32px; font-weight: 600; line-height: 1.25; margin-bottom: 32px; }
.post-body { font-size: 17px; line-height: 1.8; }
.post-body p + p { margin-top: 1em; }
.post-body img { max-width: 100%; }

/* ---------- 其他页面：纯内容 ---------- */
.page { max-width: 680px; margin: 0 auto; padding: 120px 20px 80px; }
.page h1 { font-size: 32px; font-weight: 600; margin-bottom: 24px; }
.page h2 { font-size: 18px; font-weight: 600; margin: 32px 0 8px; }
.page ul { padding-left: 1.2em; }

/* Climbing 页：全宽，和顶部 Logo 对齐 */
.page-wide { max-width: none; padding-top: 68px; padding-left: clamp(16px, 4vw, 40px); padding-right: clamp(16px, 4vw, 40px); } /* 顶部只留出 header 的高度 */

/* ---------- Projects：卡片 ---------- */
.projects h2 { font-size: 13px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: #888; margin: 32px 0 12px; }
.projects h2:first-child { margin-top: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

/* 项目卡片 */
.project-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  min-height: 120px; padding: 20px;
  border: 1px solid #e5e5e5; border-radius: 12px;
  text-decoration: none;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
a.project-card:hover { border-color: #bbb; box-shadow: 0 6px 24px rgba(0,0,0,.06); transform: translateY(-2px); }
.project-card.is-disabled { color: #999; }
.pc-title { font-size: 14px; font-weight: 600; }
.pc-desc { color: #666; font-size: 13px; }
.pc-arrow { position: absolute; top: 16px; right: 18px; font-size: 15px; transition: transform .2s; }
a.project-card:hover .pc-arrow { transform: translate(2px, -2px); }

/* 带封面的大卡片 */
.project-card.has-cover { grid-column: span 2; padding: 0; gap: 0; overflow: hidden; }
@media (max-width: 560px) { .project-card.has-cover { grid-column: auto; } }
.pc-cover { display: block; aspect-ratio: 630 / 500; overflow: hidden; }
.pc-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s, filter .4s; }
.pc-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 20px 20px; }
.pc-tag { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #999; }
.pc-play { align-self: flex-start; margin-top: 8px; font-size: 13px; font-weight: 600; }

/* Outside The Frame：照游戏的配色——深褐窗框、米色招牌、红按钮、像素字 */
.theme-otf {
  --otf-dark: #100e0b; --otf-frame: #3a352b; --otf-paper: #efe6d2; --otf-line: #d4c4a0; --otf-red: #c8231c;
  background: var(--otf-dark); color: var(--otf-paper);
  border: 6px solid var(--otf-frame); border-radius: 4px;
  box-shadow: inset 0 0 0 1px #5a5243;
}
.theme-otf .pc-cover { border-bottom: 6px solid var(--otf-frame); background: var(--otf-dark); }
.theme-otf .pc-cover img { filter: brightness(.85) sepia(.15); }
.theme-otf .pc-tag { font-family: "Silkscreen", monospace; color: var(--otf-line); opacity: .7; letter-spacing: .04em; text-transform: none; }
.theme-otf .pc-title { font-family: "Silkscreen", monospace; font-weight: 400; font-size: 20px; letter-spacing: .02em; text-transform: uppercase; color: var(--otf-paper); }
.theme-otf .pc-desc { color: #b9ad94; }
.theme-otf .pc-play {
  font-family: "Silkscreen", monospace; font-weight: 400; text-transform: uppercase;
  padding: 6px 12px; background: var(--otf-red); color: #fff; border-radius: 2px;
  box-shadow: 0 2px 0 #7d1611;
}
a.theme-otf:hover { border-color: #4d463a; box-shadow: inset 0 0 0 1px #6b6250, 0 10px 30px rgba(16,14,11,.35); }
a.theme-otf:hover .pc-cover img { filter: brightness(1.05) sepia(0); transform: scale(1.02); }
a.theme-otf:hover .pc-play { background: #e13c35; }


/* ---------- Climbing 地图 ---------- */
/* 钉子：户外 = 暖黄，岩馆 = 钴蓝
   涂色：用同色系的浅色，钉子放上去还看得清；两种都有 = 浅绿（黄 + 蓝） */
:root {
  --outdoor: #f2b134; --gym: #3a63d8; --land: #ececec;
  --fill-outdoor: #f6d58e; --fill-gym: #afc0ec; --fill-both: #b4d6a4;
}
.climb-map {
  position: relative;
  /* 尽量大：宽度占满，高度不超过一屏 */
  height: min(calc((100vw - 80px) / 2), calc(100svh - 130px));
  min-height: 280px;
  background: #fafafa;
  border: 1px solid #eee; border-radius: 8px;
  overflow: hidden;
  touch-action: none;
}
.climb-map svg { display: block; width: 100%; height: 100%; cursor: grab; }
.climb-map svg:active { cursor: grabbing; }
.map-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #999; font-size: 14px; }
.country { fill: var(--land); stroke: #fff; stroke-width: .5; vector-effect: non-scaling-stroke; }
.country.is-outdoor, .region.is-outdoor { fill: var(--fill-outdoor); }
.country.is-gym, .region.is-gym { fill: var(--fill-gym); }
.country.is-both, .region.is-both { fill: var(--fill-both); }
.region { fill: none; stroke: #fff; stroke-width: .35; vector-effect: non-scaling-stroke; }
.pin { cursor: pointer; outline: none; }
.pin path { stroke: rgba(0,0,0,.28); stroke-width: 1; vector-effect: non-scaling-stroke; }
.pin circle { fill: #fff; }
.pin-outdoor path { fill: var(--outdoor); }
.pin-gym path { fill: var(--gym); }
.pin-mixed path { fill: url(#pinMixed); }
.pin-body { transition: transform .2s; }
.pin-multi .pin-body { transform: scale(1.35); }   /* 合并的钉子大一点，头里放数字 */
.pin text { font-size: 7.5px; font-weight: 700; text-anchor: middle; fill: #fff; pointer-events: none; }
.pin-outdoor text { fill: #3d2a00; }                /* 黄底用深色字，看得清 */
.pin:hover .pin-body, .pin:focus-visible .pin-body { transform: scale(1.3); }
.pin-multi:hover .pin-body, .pin-multi:focus-visible .pin-body { transform: scale(1.6); }
.cluster-list { list-style: none; margin-top: 12px; border-top: 1px solid #eee; }
.cluster-list button {
  width: 100%; text-align: left;
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid #eee;
}
.cluster-list button:hover .cl-name { text-decoration: underline; text-underline-offset: 3px; }
.map-ctrl { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.map-ctrl button {
  width: 30px; height: 30px; border-radius: 6px;
  background: #fff; border: 1px solid #ddd;
  font-size: 16px; line-height: 1;
}
.map-ctrl button:hover { border-color: #999; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; color: #555; }
.map-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.map-hint { margin-left: auto; color: #999; }
.cl-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.cl-outdoor { background: var(--outdoor); }
.cl-gym { background: var(--gym); }
.cl-swatch { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.sw-outdoor { background: var(--fill-outdoor); }
.sw-gym { background: var(--fill-gym); }
.sw-both { background: var(--fill-both); }
.legend-sep { width: 1px; height: 12px; background: #ddd; }

.climb-details { margin-top: 24px; }
.climb-details summary { cursor: pointer; font-size: 14px; color: #555; padding: 6px 0; }
.climb-details summary:hover { color: #111; }
.climb-list { list-style: none; padding: 0 !important; margin-top: 8px; border-top: 1px solid #eee; }
.climb-list button {
  width: 100%; text-align: left;
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid #eee;
}
.climb-list button:hover .cl-name { text-decoration: underline; text-underline-offset: 3px; }
.cl-meta { font-size: 13px; color: #888; }

.spot-dialog {
  width: min(720px, calc(100% - 32px)); max-height: calc(100% - 64px);
  margin: auto; padding: 28px;
  border: 0; border-radius: 12px;
  overflow-y: auto;
}
.spot-dialog::backdrop { background: rgba(0,0,0,.55); }
.spot-close { position: sticky; top: 0; float: right; font-size: 18px; opacity: .6; }
.spot-close:hover { opacity: 1; }
.spot-meta { font-size: 13px; color: #888; }
.spot-dialog h3 { font-size: 24px; font-weight: 600; margin: 4px 0 12px; }
.spot-note { margin-bottom: 16px; }
.spot-empty { color: #999; }
.spot-media { display: grid; gap: 16px; }
.spot-media img, .spot-media video { width: 100%; border-radius: 6px; display: block; }
.spot-media .embed iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 6px; }
.spot-media figcaption { font-size: 13px; color: #888; margin-top: 6px; }

@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 8px 16px; }
  .tabs { order: 3; width: 100%; gap: 16px; }
  .hint { display: none; }
  .blog-panel { top: auto; height: 55%; width: 100%; padding: 24px 20px; background: #0a0a0a; border-top: 1px solid rgba(255,255,255,.12); transform: translateY(100%); }
  .blog-panel.is-open { transform: none; }
  .climb-map { height: auto; min-height: 0; aspect-ratio: 2 / 1; }
  .page-wide { padding-top: 100px; } /* 手机上 header 有两行 */
  /* 攀岩列表：地点信息换到名字下面 */
  .climb-list button { grid-template-columns: auto 1fr; row-gap: 2px; }
  .cl-meta { grid-column: 2; }
  .map-hint .desk { display: none; }
}
@media (min-width: 641px) {
  .map-hint .touch { display: none; }
}
