/* ───── ui.css — 全站轻交互 UI:回到顶部按钮 ─────
   .to-top 固定右下角圆形按钮;默认不可见/不可点,滚动一屏后 .to-top.show 淡入(由 ui.js 切换)。 */

.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  overflow: hidden;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--glass-edge);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  color: var(--text-2);
  box-shadow: inset 0 1px 0 var(--glass-sheen), var(--glass-shadow);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  /* 默认隐藏:淡出 + 下移 + 不可点 */
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease),
    visibility .3s var(--ease), border-color .25s var(--ease),
    color .25s var(--ease), box-shadow .25s var(--ease);
}

.to-top.show {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

/* 跟随指针的镜面高光 */
.to-top::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(44px circle at var(--gx, 50%) var(--gy, 50%), var(--glass-sheen), transparent 60%);
  opacity: 0; transition: opacity .35s var(--ease); pointer-events: none;
}
.to-top:hover::before { opacity: 1; }

.to-top:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--card-shadow-hover);
}

.to-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 600px) {
  .to-top {
    right: 16px;
    bottom: 16px;
    width: 42px;
    height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .to-top { transform: none; }
  .to-top:hover { transform: none; }
}
