/* finesse · register=brand · A=photo-led dark + periwinkle city mark · B=serif display / grotesk labels
 * C=radial label arc + right text column · D=GSAP state tweens · E=dial · SOUL=7 SPECTACLE=4 DENSITY=3 */

:root {
  --ink: #100c0a;
  --light: #f3eee8;
  --light-dim: rgba(243, 238, 232, .72);
  --light-mute: rgba(243, 238, 232, .5);
  --hairline: rgba(243, 238, 232, .2);
  --blue: #88a3d8;
  --button-ink: #17120f;

  --serif: "Newsreader", "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: "Geist", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  /* 层级：背景 < 遮罩 < 颗粒 < 转盘 < 文案 < 顶部控件 */
  --z-backdrop: 0;
  --z-scrim: 1;
  --z-grain: 2;
  --z-wheel: 3;
  --z-intro: 4;
  --z-chrome: 5;
}

*, *::before, *::after { box-sizing: border-box; }

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

.stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: clip;
  font-family: var(--sans);
  touch-action: pinch-zoom; /* 触屏左右滑交给翻图，不让浏览器接管 */
}

/* 背景图：未加载或加载失败时露出参考页的暖棕底色 */
.backdrop {
  position: absolute;
  inset: 0;
  z-index: var(--z-backdrop);
  background:
    radial-gradient(ellipse 70% 60% at 62% 108%, #74391f 0%, transparent 70%),
    radial-gradient(ellipse 90% 80% at 40% 20%, #3b1c11 0%, transparent 75%),
    #1b0e09;
}

.backdrop-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.scrim {
  position: absolute;
  inset: 0;
  z-index: var(--z-scrim);
  pointer-events: none;
  background:
    radial-gradient(ellipse 50% 80% at 8% 50%, rgba(14, 10, 8, .55) 0%, transparent 75%),
    linear-gradient(90deg, rgba(14, 10, 8, .6) 0%, rgba(14, 10, 8, .5) 28%, rgba(14, 10, 8, .22) 47%, rgba(14, 10, 8, .36) 62%, rgba(14, 10, 8, .5) 100%),
    radial-gradient(ellipse 110% 95% at 55% 50%, transparent 48%, rgba(10, 7, 6, .6) 100%),
    rgba(14, 10, 8, .12);
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: .08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 转盘 ---------- */

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

.ring {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pinch-zoom;
  -webkit-mask-image: var(--band-mask, none);
          mask-image: var(--band-mask, none);
}

.ring:focus { outline: none; }

.spot {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  display: flex;
  align-items: center;
  padding: var(--hit, .3em) .7em var(--hit, .3em) 0;
  font-size: var(--label);
  line-height: 1.2;
  letter-spacing: .005em;
  white-space: nowrap;
  transform-origin: 0 0;
  cursor: pointer;
}

.spot-label {
  display: block;
  color: var(--light);
  opacity: .66;
  text-shadow: 0 0 14px rgba(10, 7, 6, .55);
  transform-origin: 0 50%;
  transition: opacity .35s var(--ease-out), transform .45s var(--ease-out);
}

.spot.in-city .spot-label { opacity: .86; }

.spot.is-city {
  font-size: var(--city);
  letter-spacing: 0;
}

.spot.is-city .spot-label {
  color: var(--blue);
  opacity: .9;
}

.spot-mark {
  position: relative;
  flex: none;
  width: .86em;
  height: .86em;
  margin-right: .42em;
  border-radius: .12em;
  background: var(--blue);
}

.spot-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: .24em;
  height: .24em;
  border-radius: 50%;
  background: rgba(16, 12, 10, .85);
  transform: translate(-50%, -50%);
}

.spot.is-current .spot-label {
  opacity: 1;
  transform: scale(1.1);
}

.spot.is-city.is-current .spot-label { transform: none; }

.ring:focus-visible .spot.is-current .spot-label {
  outline: 1px solid var(--light-mute);
  outline-offset: .3em;
  border-radius: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .spot:hover .spot-label { opacity: 1; }
}

/* 焦点位的指针：转盘把选中项转到这里 */
.needle {
  position: absolute;
  left: calc(var(--cx) + var(--r) - 1.9 * var(--label));
  top: var(--cy);
  width: calc(.95 * var(--label));
  height: 1px;
  background: var(--light-mute);
  pointer-events: none;
}

/* ---------- 右侧文案 ---------- */

.intro {
  position: absolute;
  z-index: var(--z-intro);
  left: 54.3%;
  top: 50%;
  width: min(27rem, 40vw);
  transform: translateY(-50%);
  text-shadow: 0 1px 24px rgba(10, 7, 6, .35);
}

.intro-title {
  margin: 0 0 .56em;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.9rem, 5.3vh, 3.5rem);
  line-height: 1.03;
  letter-spacing: -.012em;
  overflow-wrap: anywhere;
  min-width: 0;
}

.intro-title span { display: block; }

html[lang="zh-CN"] .intro-title {
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: .02em;
}

.intro-desc {
  margin: 0 0 1.7em;
  max-width: 27em;
  font-size: clamp(.84rem, 2.05vh, 1.05rem);
  line-height: 1.55;
  min-height: 4.65em; /* 固定三行高度，切换地点时按钮不跳动 */
}

.intro-place {
  margin-right: .35em;
  font-weight: 500;
}

.intro-cta {
  display: inline-flex;
  align-items: center;
  min-height: 2.5em;
  padding: 0 1.35em;
  border: 0;
  border-radius: 999px;
  background: var(--light);
  color: var(--button-ink);
  font: 500 clamp(.78rem, 1.9vh, .95rem)/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: transform .2s var(--ease-out), background-color .2s;
}

.intro-cta:hover { background: #fffaf4; }
.intro-cta:active { transform: scale(.97); }

/* ---------- 顶部控件与署名 ---------- */

.lang {
  position: absolute;
  z-index: var(--z-chrome);
  top: calc(18px + env(safe-area-inset-top));
  right: calc(20px + env(safe-area-inset-right));
  display: flex;
  padding: 3px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(16, 12, 10, .3);
}

.lang button {
  min-width: 2.6em;
  padding: 7px 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--light-dim);
  font: 500 12px/1 var(--sans);
  letter-spacing: .03em;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}

.lang button:hover { color: var(--light); }

.lang button[aria-pressed="true"] {
  background: var(--light);
  color: var(--button-ink);
}

.flip {
  position: absolute;
  z-index: var(--z-chrome);
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(44px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
}

.flip button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: rgba(16, 12, 10, .3);
  color: var(--light-dim);
  cursor: pointer;
  transition: background-color .2s, color .2s;
}

.flip button:hover {
  background: rgba(16, 12, 10, .5);
  color: var(--light);
}

.flip svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.credit {
  position: absolute;
  z-index: var(--z-chrome);
  right: calc(24px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  margin: 0;
  font-size: 11px;
  line-height: 1.3;
  color: var(--light-mute);
}

.credit a {
  color: inherit;
  text-decoration: none;
}

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

.intro-cta:focus-visible,
.lang button:focus-visible,
.flip button:focus-visible,
.credit a:focus-visible {
  outline: 2px solid var(--light);
  outline-offset: 3px;
}

/* ---------- 竖屏 / 手机：转盘在上，文案在下 ---------- */

@media (max-width: 859px), (max-aspect-ratio: 11/10) {
  .scrim {
    background:
      linear-gradient(0deg, rgba(14, 10, 8, .9) 0%, rgba(14, 10, 8, .62) 30%, transparent 58%),
      linear-gradient(180deg, rgba(14, 10, 8, .55) 0%, transparent 22%),
      radial-gradient(ellipse 95% 50% at 0% 34%, rgba(14, 10, 8, .72) 0%, transparent 85%),
      rgba(14, 10, 8, .24);
  }

  .intro {
    left: calc(20px + env(safe-area-inset-left));
    right: calc(20px + env(safe-area-inset-right));
    top: auto;
    bottom: calc(26px + env(safe-area-inset-bottom));
    width: auto;
    transform: none;
  }

  .intro-title { font-size: clamp(1.7rem, 7.4vw, 2.6rem); }
  .intro-desc { font-size: .9rem; margin-bottom: 1.4em; }

  /* 与“下一站”按钮同一行，靠右 */
  .flip { bottom: calc(26px + env(safe-area-inset-bottom)); }

  .credit {
    right: auto;
    bottom: auto;
    left: calc(20px + env(safe-area-inset-left));
    top: calc(26px + env(safe-area-inset-top));
    max-width: calc(100% - 150px);
  }
}

@media (pointer: coarse) {
  .intro-cta { min-height: 44px; font-size: .9rem; }
  .lang button { padding: 12px 14px; }
  .flip button { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
