/* ============================================================
   智道AI 首页 · 作品星球
   只作用于 #home-gal / #home-planet，不覆盖站内其他组件。
   ============================================================ */

.hp-section {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 4px 0 0;
  isolation: isolate;
}

/* 移动端：星球在前，文字在后 */
.hp-stage {
  order: -1;
}
.hp-copy {
  order: 1;
}

.hp-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 18px auto 2px;
  font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.38em;
  color: rgba(242, 193, 78, 0.78);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}
.hp-kicker::before,
.hp-kicker::after {
  content: "";
  width: clamp(28px, 7vw, 90px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(242, 193, 78, 0.55));
}
.hp-kicker::after {
  transform: scaleX(-1);
}

.hp-stage {
  position: relative;
  height: clamp(400px, 58vh, 680px);
  margin: 0 auto;
  isolation: isolate;
  touch-action: pan-y;
  cursor: grab;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.hp-stage::before {
  content: "";
  position: absolute;
  inset: 12% 8% 8%;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(4, 7, 14, 0.9), rgba(4, 7, 14, 0.6) 46%, transparent 72%),
    radial-gradient(circle at 50% 46%, rgba(109, 141, 255, 0.16), transparent 58%),
    radial-gradient(circle at 62% 60%, rgba(70, 214, 200, 0.1), transparent 62%),
    radial-gradient(circle at 38% 38%, rgba(242, 193, 78, 0.08), transparent 60%);
  filter: blur(26px);
  pointer-events: none;
}
.hp-stage.hp-hovering {
  cursor: pointer;
}
.hp-stage.hp-dragging {
  cursor: grabbing;
}

.hp-stage canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}
.hp-stage canvas:focus-visible {
  outline: 1px solid rgba(242, 193, 78, 0.55);
  outline-offset: 2px;
  border-radius: 28px;
}

/* 底部浮出的当前作品名玻璃标签 */
.hp-hud {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(90%, 560px);
  padding: 9px 18px;
  transform: translate(-50%, 6px);
  border: 1px solid rgba(242, 193, 78, 0.26);
  border-radius: 999px;
  background: rgba(6, 10, 20, 0.66);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  white-space: nowrap;
}
.hp-hud.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.hp-hud .hp-dot {
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold, #f2c14e);
  box-shadow: 0 0 10px rgba(242, 193, 78, 0.9);
}
.hp-hud .hp-name {
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--serif, "Noto Serif SC", serif);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
}
.hp-hud .hp-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11.5px;
  color: var(--dim, #8b93a9);
}
.hp-hud .hp-meta b {
  color: var(--gold2, #ffd98a);
  font-weight: 700;
}

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

.hp-loading {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  color: var(--dim, #8b93a9);
  font-size: 12.5px;
  letter-spacing: 0.16em;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.hp-loading i {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(242, 193, 78, 0.22);
  border-top-color: var(--gold, #f2c14e);
  border-radius: 50%;
  animation: hpSpin 0.9s linear infinite;
}
@keyframes hpSpin {
  to {
    transform: rotate(360deg);
  }
}
.hp-ready .hp-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hp-loading {
  opacity: 0;
}

.hp-fallback {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  padding: 8px;
  overflow: auto;
}
.hp-fallback[hidden] {
  display: none;
}
.hp-fb-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink, #e9edf6);
  text-align: left;
  cursor: zoom-in;
}
.hp-fb-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line2, rgba(255, 255, 255, 0.16));
  border-radius: 12px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.hp-fb-item:hover img {
  transform: translateY(-3px);
  border-color: rgba(242, 193, 78, 0.7);
}
.hp-fb-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--dim, #8b93a9);
}
.hp-is-fallback canvas,
.hp-is-fallback .hp-hud,
.hp-is-empty canvas,
.hp-is-empty .hp-hud {
  display: none;
}
.hp-is-empty .hp-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.hp-empty {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  color: var(--dim, #8b93a9);
}
.hp-empty b {
  font-family: var(--serif, "Noto Serif SC", serif);
  font-size: 20px;
  color: var(--gold2, #ffd98a);
  letter-spacing: 0.04em;
}
.hp-empty span {
  font-size: 13px;
  line-height: 1.8;
}
.hp-is-fallback .hp-stage {
  height: auto;
  min-height: 320px;
}
.hp-is-fallback .hp-fallback {
  position: relative;
  inset: auto;
}

/* 标题区 */
#home-gal .hp-caption {
  text-align: center;
  padding: 10px 16px 0;
}
#home-gal .hp-caption .gal-title {
  font-size: clamp(18px, 2.6vw, 24px);
}
#home-gal .hp-caption .gal-sub {
  white-space: normal;
  line-height: 1.8;
}
#home-gal .hp-caption .hp-hint {
  opacity: 0.72;
  transition: opacity 0.2s ease;
}
#home-gal .hp-hint .hp-key {
  color: rgba(242, 193, 78, 0.9);
}

.hp-count-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin: 14px 0 2px;
}
.hp-count-row b {
  font-family: var(--serif, "Noto Serif SC", serif);
  font-size: clamp(30px, 3.6vw, 42px);
  font-weight: 800;
  line-height: 1;
  color: var(--gold, #f2c14e);
  font-variant-numeric: tabular-nums;
}
.hp-count-row span {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--faint, #5b6378);
}

/* 移动端：矮一点，标签缩小 */
@media (max-width: 720px) {
  .hp-section {
    width: 100%;
  }
  .hp-stage {
    height: clamp(330px, 46vh, 430px);
  }
  .hp-kicker {
    margin-top: 10px;
    letter-spacing: 0.24em;
    font-size: 9px;
  }
  .hp-hud {
    bottom: 2px;
    max-width: 94%;
    padding: 7px 13px;
    gap: 7px;
  }
  .hp-hud .hp-name {
    font-size: 13px;
  }
  .hp-hud .hp-meta {
    font-size: 10.5px;
  }
  .hp-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hp-loading {
    font-size: 11.5px;
  }
  .hp-count-row {
    margin-top: 12px;
  }
}

/* 宽屏：左侧档案说明 + 右侧星球，像一块展览说明牌 */
@media (min-width: 900px) {
  .hp-section {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    grid-template-areas: "copy stage";
    justify-content: center;
    align-items: center;
    column-gap: clamp(20px, 3vw, 52px);
    width: min(1400px, 94vw);
  }
  .hp-copy {
    position: relative;
    grid-area: copy;
    align-self: center;
  }
  .hp-copy::before {
    content: "";
    position: absolute;
    inset: -24% -22% -24% -14%;
    z-index: -1;
    background: radial-gradient(ellipse at 36% 50%, rgba(4, 7, 14, 0.9), rgba(4, 7, 14, 0.62) 55%, transparent 78%);
    filter: blur(12px);
    pointer-events: none;
  }
  .hp-kicker {
    justify-content: flex-start;
    margin: 0 0 12px;
  }
  .hp-kicker::before {
    display: none;
  }
  .hp-stage {
    grid-area: stage;
    order: 0;
    width: 100%;
    max-width: 820px;
    justify-self: center;
    height: clamp(540px, 72vh, 760px);
  }
  #home-gal .hp-caption {
    text-align: left;
    padding: 0;
  }
  #home-gal .hp-caption .gal-title {
    font-size: clamp(24px, 2.8vw, 40px);
    letter-spacing: 0.03em;
  }
  #home-gal .hp-caption .gal-sub {
    line-height: 1.95;
    text-align: left;
  }
  .hp-count-row {
    justify-content: flex-start;
  }
  .hp-hud {
    bottom: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hp-hud,
  .hp-fb-item img {
    transition: none;
  }
  .hp-loading i {
    animation: none;
    border-top-color: rgba(242, 193, 78, 0.22);
  }
}
