/* 照片定位页（参考 archive/locate-reference.webp）：右边大半个地球压在右下角，左边窄栏是上传框和说明，
 * 最左边一行竖排标题，底部居中是进度轴。颜色、字体、缓动、层级用 site.css 的变量 */

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--light);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.locate {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: clip;
  font-family: var(--sans);
  /* 地球没画出来（three.js 加载失败）时，右下角留一团淡淡的蓝光，构图不至于空掉 */
  background:
    radial-gradient(circle at 78% 92%, color-mix(in srgb, var(--blue) 22%, transparent) 0, transparent 62%),
    radial-gradient(ellipse at 20% 30%, color-mix(in srgb, var(--blue) 7%, transparent) 0, transparent 70%),
    var(--ink);
}

/* ---------- 地球：canvas 铺满，标签叠在上面 ---------- */

.globe {
  position: absolute;
  inset: 0;
  z-index: var(--z-backdrop);
}

.globe canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s var(--ease-out);
}

.globe.is-ready canvas { opacity: 1; }

.globe-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* 每个标签的位置由 locate.js 每帧写 transform，原点在地面上那一点 */
.glabel {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  will-change: transform;
  transition: opacity .5s var(--ease-out);
}

.glabel[data-off] { opacity: 0 !important; }

/* 城市：白点加半透明光圈（参考页地球上的点） */
.glabel-city { width: 0; height: 0; }

.glabel-city::before {
  content: "";
  position: absolute;
  left: -18px;
  top: -18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--light) 0 5px, rgba(243, 238, 232, .24) 5.5px 100%);
}

/* 景点：✕ 加名字 */
.glabel-spot {
  width: 0;
  height: 0;
  font: 600 12px/1.2 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(16, 12, 10, .85);
}

.glabel-spot svg {
  position: absolute;
  left: -9px;
  top: -9px;
  width: 18px;
  height: 18px;
  stroke: var(--light);
  stroke-width: 2.4;
  stroke-linecap: round;
  filter: drop-shadow(0 1px 3px rgba(16, 12, 10, .8));
}

.glabel-spot span {
  position: absolute;
  left: 50%;
  bottom: 14px;
  translate: -50% 0;
}

/* 左边栏底下压暗一点：地球转过来、云层飘过时说明文字也看得清 */
.locate::before {
  content: "";
  position: absolute;
  z-index: var(--z-scrim);
  inset: 0 auto 0 0;
  width: 46%;
  background: linear-gradient(90deg, rgba(16, 12, 10, .72) 0%, rgba(16, 12, 10, .45) 55%, transparent 100%);
  pointer-events: none;
}

/* ---------- 定位结果：景点照片铺满，左边压暗让说明栏看得清 ---------- */

.result {
  position: absolute;
  inset: 0;
  z-index: var(--z-scrim);
  margin: 0;
}

.result-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 压暗层盖在照片上（照片缩放时自成一层，压暗层要显式压在它上面）；顶上也压一点，导航栏在亮天空上看得清 */
.result::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(16, 12, 10, .55) 0%, transparent 18%),
    linear-gradient(90deg, rgba(16, 12, 10, .82) 0%, rgba(16, 12, 10, .5) 34%, transparent 62%),
    linear-gradient(0deg, rgba(16, 12, 10, .65) 0%, transparent 32%);
}

.result-caption {
  position: absolute;
  right: clamp(16px, 4vw, 48px);
  bottom: clamp(56px, 11vh, 96px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  z-index: 2;
  max-width: min(46vw, 640px);
  text-align: right;
}

.result-city {
  font: 600 12px/1.2 var(--sans);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--light-dim);
}

.result-name {
  font: 400 clamp(2rem, 5.2vw, 4.25rem)/1.02 var(--serif);
  text-wrap: balance;
}

.result-credit {
  margin-top: 6px;
  color: var(--light-mute);
  font: 400 11px/1.3 var(--sans);
  text-decoration: none;
}

.result-credit:hover { color: var(--light); }

/* ---------- 最左边的竖排标题（参考页的 PROJECTS WE SUPPORT） ---------- */

.side-title {
  position: absolute;
  z-index: var(--z-intro);
  left: clamp(28px, 4.6vw, 64px);
  top: 50%;
  margin: 0;
  font: 400 12px/1 var(--serif);
  letter-spacing: .24em;
  text-transform: uppercase;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: translateY(-50%) rotate(180deg);
}

.side-title:lang(zh) { transform: translateY(-50%); letter-spacing: .5em; } /* 中文竖排从上往下读，不转 */

.side-title span:last-child { color: var(--light-dim); }

/* ---------- 左边栏：细线、上传框、说明、操作 ---------- */

.panel {
  position: absolute;
  z-index: var(--z-intro);
  text-shadow: 0 1px 8px rgba(16, 12, 10, .9); /* 文字压在地球边缘上时也看得清 */
  left: 13.6vw;
  top: 32vh;
  width: clamp(260px, 27vw, 380px);
}

.panel-rule {
  display: block;
  width: 52px;
  height: 1px;
  margin-bottom: 8vh;
  background: var(--hairline);
}

/* 上传框：5:2 横幅；空的时候是细框加图标，拖进来时边框变亮 */
.drop {
  position: relative;
  display: block;
  aspect-ratio: 5 / 2;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: rgba(243, 238, 232, .04);
  cursor: pointer;
  transition: border-color .25s, background-color .25s;
}

.drop:hover,
.drop.is-over {
  border-color: var(--glass-edge);
  background: rgba(243, 238, 232, .08);
}

.drop:has(.drop-input:focus-visible) {
  outline: 2px solid var(--light);
  outline-offset: 3px;
}

.drop.is-gone { display: none; }
.drop.is-gone + .panel-label { margin-top: 0; }

.drop-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--light-mute);
  font: 400 12px/1.3 var(--sans);
}

.drop-empty svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel-label {
  margin: 28px 0 6px;
  font: 600 11px/1.2 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.panel-text {
  margin: 0;
  max-width: 34ch;
  color: var(--light-dim);
  font: 400 13px/1.5 var(--sans);
  text-wrap: pretty;
}

.panel-coords {
  margin: 4px 0 0;
  color: var(--light-mute);
  font: 400 12px/1.4 var(--sans);
  font-variant-numeric: tabular-nums;
}

/* 操作：圆圈图标加大写字（参考页的 WATCH VIDEO） */
.panel-action {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 0 -2px;
  padding: 4px 4px 4px 0;
  border: 0;
  background: none;
  color: var(--light);
  font: 600 11px/1 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
}

.panel-action:disabled { opacity: .45; cursor: default; }

.panel-action-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--glass-edge);
  border-radius: 50%;
  transition: background-color .2s, border-color .2s;
}

.panel-action:not(:disabled):hover .panel-action-icon {
  border-color: var(--light);
  background: var(--glass);
}

.panel-action-icon svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.panel-action:focus-visible {
  outline: 2px solid var(--light);
  outline-offset: 4px;
  border-radius: 999px;
}

.panel-note {
  margin: 22px 0 0;
  max-width: 36ch;
  color: var(--light-mute);
  font: 400 11px/1.5 var(--sans);
}

/* ---------- 底部进度轴：三个点之间是虚线，走到的一步变亮，下面一个小圆点 ---------- */

.steps {
  position: absolute;
  z-index: var(--z-intro);
  left: 50%;
  bottom: clamp(28px, 6vh, 56px);
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  translate: -50% 0;
}

.steps li {
  position: relative;
  color: var(--light-mute);
  text-shadow: 0 1px 6px rgba(16, 12, 10, .8); /* 压在白云上也看得清 */
  font: 500 11px/1 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  transition: color .4s;
}

.steps li + li::before {
  content: "";
  display: inline-block;
  width: clamp(48px, 13vw, 200px);
  margin: 0 18px;
  vertical-align: middle;
  border-top: 1px dotted var(--hairline);
}

.steps span { position: relative; }

.steps span::after {
  content: "";
  position: absolute;
  left: calc(50% - 2.5px);
  bottom: -12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
  opacity: 0;
  transition: opacity .4s;
}

.steps li.is-done { color: var(--light-dim); }
.steps li.is-current { color: var(--light); }
.steps li.is-current span::after { opacity: 1; }

.earth-credit {
  position: absolute;
  z-index: var(--z-intro);
  right: clamp(16px, 4vw, 48px);
  bottom: clamp(28px, 6vh, 56px);
  margin: 0;
  color: var(--light-mute);
  font: 400 11px/1 var(--sans);
  text-shadow: 0 1px 6px rgba(16, 12, 10, .8);
}

.result:not([hidden]) ~ .earth-credit,
.globe:not(.is-ready) ~ .earth-credit { display: none; }

/* ---------- 竖屏 / 手机（断点和 site.css、home.css、site.js 里的一致）：地球在上，说明栏在下 ---------- */

@media (max-width: 859px), (max-aspect-ratio: 11/10) {
  /* 竖屏没地方放竖排标题：只留给读屏和搜索引擎 */
  .side-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .panel {
    left: 16px;
    right: 16px;
    top: auto;
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: auto;
    max-width: 480px;
  }

  .panel-rule { display: none; }

  /* 说明栏压在地球下半部，底下压暗，上传框用实一点的底 */
  .locate::after {
    content: "";
    position: absolute;
    z-index: var(--z-scrim);
    inset: auto 0 0;
    height: 58%;
    background: linear-gradient(0deg, var(--ink) 0%, rgba(16, 12, 10, .85) 55%, transparent 100%);
    pointer-events: none;
  }

  .locate:has(.result:not([hidden]))::after { display: none; } /* 结果照片有自己的压暗 */
  .locate::before { display: none; }

  .drop { background: rgba(16, 12, 10, .6); }
  .panel-label { margin-top: 16px; }
  .panel-action { margin-top: 10px; min-height: 44px; }
  .panel-note { margin-top: 6px; }

  .steps {
    left: 16px;
    right: 16px;
    bottom: auto;
    top: calc(var(--bar-bottom, 60px) + 16px);
    justify-content: center;
    translate: none;
  }

  .steps li + li::before { width: clamp(28px, 10vw, 80px); margin: 0 12px; }

  .earth-credit {
    top: calc(var(--bar-bottom, 60px) + 44px);
    bottom: auto;
    right: 16px;
  }

  .result::before {
    background:
      linear-gradient(180deg, rgba(16, 12, 10, .75) 0%, transparent 40%),
      linear-gradient(0deg, rgba(16, 12, 10, .9) 0%, rgba(16, 12, 10, .7) 42%, transparent 68%);
  }

  .result-caption {
    left: 16px;
    right: 16px;
    top: calc(var(--bar-bottom, 60px) + 52px);
    bottom: auto;
    align-items: flex-start;
    max-width: none;
    text-align: left;
  }

}

/* 横屏但不高（手机横放、常见笔记本）：上传框压扁，腾出地方给"照片会发给谁"的说明，这段说明不能藏 */
@media (max-height: 700px) and (min-aspect-ratio: 11/10) {
  .drop { aspect-ratio: auto; height: 56px; }
}

/* 其中够宽、用横屏布局的（如大屏手机横放）再收紧左边栏；min-width 和竖屏断点错开，免得叠到竖屏布局上 */
@media (min-width: 860px) and (max-height: 560px) and (min-aspect-ratio: 11/10) {
  .panel { top: 18vh; }
  .panel-rule { margin-bottom: 4vh; }
  .panel-label { margin-top: 12px; }
}

@media (pointer: coarse) {
  .panel-action { min-height: 44px; }
}
