/* ============================================================
   voice.css —— 开篇天体身份卡 / 尺度标尺 / 语音朗读状态
   ============================================================ */

/* ---------- 语音总控条 ---------- */

.voicebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid hsl(var(--line-strong) / 0.8);
  border-radius: var(--r-pill);
  background: hsl(var(--space-900) / 0.7);
  backdrop-filter: blur(10px);
}

.voicebar__state {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: hsl(var(--ink-low));
  letter-spacing: 0.03em;
  margin-left: auto;
}

.voicebar__rate {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 210px;
}

.voicebar__rate input[type="range"] {
  width: 120px;
}

/* 导航里的朗读开关 */
.nav__voice {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  border: 1px solid hsl(var(--line-strong));
  background: hsl(var(--space-850) / 0.8);
  color: hsl(var(--ink-mid));
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}

.nav__voice:hover {
  color: hsl(var(--ink-hi));
  border-color: hsl(var(--space-500));
}

.nav__voice svg {
  width: 16px;
  height: 16px;
}

.nav__voice .slash {
  opacity: 0;
  transition: opacity var(--t-fast);
}

.nav__voice[aria-pressed="false"] {
  color: hsl(var(--ink-low));
}

.nav__voice[aria-pressed="false"] .slash {
  opacity: 1;
}

/* ---------- 尺度标尺 ---------- */

.ruler__wrap {
  overflow-x: auto;
  padding-bottom: var(--sp-3);
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--space-700)) transparent;
}

.ruler__wrap::-webkit-scrollbar {
  height: 6px;
}

.ruler__wrap::-webkit-scrollbar-thumb {
  background: hsl(var(--space-700));
  border-radius: var(--r-pill);
}

.ruler {
  position: relative;
  min-width: 900px;
  height: 148px;
  margin-inline: 6px;
}

.ruler__axis {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg,
      hsl(var(--violet) / 0.3) 0%,
      hsl(var(--aqua) / 0.75) 40%,
      hsl(var(--sun) / 0.85) 76%,
      hsl(var(--copper) / 0.55) 100%);
}

.ruler__tick {
  position: absolute;
  top: 50%;
  left: var(--pos);
  width: 0;
  height: 0;
}

.ruler__tick::before {
  content: "";
  position: absolute;
  left: -3.5px;
  top: -3.5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(var(--aqua-bright));
  box-shadow: 0 0 10px hsl(var(--aqua-bright) / 0.8);
}

/* 引线：奇数向上，偶数向下 */
.ruler__tick::after {
  content: "";
  position: absolute;
  left: 0;
  width: 1px;
  height: 15px;
  background: hsl(var(--space-600));
}

.ruler__tick:nth-child(odd)::after {
  bottom: 0;
}

.ruler__tick:nth-child(even)::after {
  top: 0;
}

.ruler__label {
  position: absolute;
  left: 0;
  transform: translateX(-50%);
  width: 96px;
  text-align: center;
  font-size: 11px;
  line-height: 1.3;
  color: hsl(var(--ink-mid));
}

.ruler__label b {
  display: block;
  font-weight: 620;
  color: hsl(var(--ink-hi));
}

.ruler__label span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: hsl(var(--ink-low));
}

.ruler__tick:nth-child(odd) .ruler__label {
  bottom: 17px;
}

.ruler__tick:nth-child(even) .ruler__label {
  top: 17px;
}

.ruler__meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: hsl(var(--ink-low));
  margin-top: var(--sp-4);
  padding-top: var(--sp-2);
  border-top: 1px solid hsl(var(--line));
}

/* ---------- 身份卡网格 ---------- */

.vox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
}

.vox-card {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
  padding: var(--sp-5);
  border: 1px solid hsl(var(--line));
  border-radius: var(--r-lg);
  background: linear-gradient(165deg,
      hsl(var(--space-850) / 0.9), hsl(var(--space-950) / 0.92));
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color var(--t-base), transform var(--t-base), box-shadow var(--t-base);
}

.vox-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(220px 120px at 12% -10%,
      hsl(var(--vc, var(--aqua)) / 0.14), transparent 70%);
  opacity: 0;
  transition: opacity var(--t-base);
}

.vox-card:hover {
  transform: translateY(-3px);
  border-color: hsl(var(--line-strong));
  box-shadow: var(--shadow-lift);
}

.vox-card:hover::after {
  opacity: 1;
}

.vox-card.is-voiced {
  border-color: hsl(var(--vc, var(--aqua)));
}

.vox-card.is-voiced::after {
  opacity: 1;
}

/* ---------- 触发图标 ---------- */

.vox {
  position: relative;
  width: 62px;
  height: 62px;
  flex: none;
  border-radius: 50%;
  border: 1px solid hsl(var(--vc, var(--aqua)) / 0.45);
  background:
    radial-gradient(circle at 34% 30%, hsl(var(--vc, var(--aqua)) / 0.22), transparent 62%),
    hsl(var(--space-800) / 0.85);
  color: hsl(var(--vc, var(--aqua-bright)));
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}

.vox svg {
  width: 30px;
  height: 30px;
  position: relative;
  z-index: 2;
  overflow: visible;
}

/* 黑洞图标里的视界圆盘：用页面底色"挖"出一个真正的黑区 */
.vox__hole {
  fill: hsl(var(--space-980));
  stroke: hsl(var(--vc, var(--aqua-bright)));
  stroke-width: 1.1;
}

.vox:hover {
  transform: scale(1.06);
  box-shadow: 0 0 22px -4px hsl(var(--vc, var(--aqua)) / 0.6);
}

.vox::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid hsl(var(--vc, var(--aqua-bright)) / 0.7);
  opacity: 0;
}

.vox::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid hsl(var(--vc, var(--aqua-bright)) / 0.5);
  opacity: 0;
}

.vox.is-voiced {
  box-shadow: 0 0 26px -4px hsl(var(--vc, var(--aqua)) / 0.85);
}

.vox.is-voiced::before {
  animation: voxPulse 1.8s var(--ease-out) infinite;
}

.vox.is-voiced::after {
  animation: voxPulse 1.8s var(--ease-out) 0.6s infinite;
}

@keyframes voxPulse {
  0% {
    opacity: 0.75;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(2.1);
  }
}

.vox__hint {
  position: absolute;
  bottom: -3px;
  right: -6px;
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: hsl(var(--space-980));
  background: hsl(var(--vc, var(--aqua-bright)));
  border-radius: var(--r-pill);
  padding: 1px 6px;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity var(--t-fast), transform var(--t-fast);
}

.vox:hover .vox__hint,
.vox:focus-visible .vox__hint {
  opacity: 1;
  transform: none;
}

.vox.is-voiced .vox__hint {
  opacity: 1;
  transform: none;
}

.vox.is-voiced .vox__hint::after {
  content: " · 停止";
}

/* ---------- 卡片文字 ---------- */

.vox-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: 6px;
}

.vox-card__head h3 {
  font-size: var(--fs-md);
}

.vox-card__en {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: hsl(var(--ink-low));
}

.say {
  font-size: var(--fs-sm);
  color: hsl(var(--ink-mid));
  line-height: 1.72;
  margin: 0;
}

.say-seg {
  border-radius: 3px;
  transition: background var(--t-base), color var(--t-base), box-shadow var(--t-base);
}

.say-seg.is-spoken {
  background: hsl(var(--vc, var(--aqua)) / 0.18);
  color: hsl(var(--ink-hi));
  box-shadow: 0 0 0 5px hsl(var(--vc, var(--aqua)) / 0.18);
}

/* 卡片底部数据 */

.vox-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px dashed hsl(var(--line-strong) / 0.7);
}

.vox-fact {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  color: hsl(var(--ink-mid));
  background: hsl(var(--space-800) / 0.66);
  border: 1px solid hsl(var(--line));
  border-radius: var(--r-xs);
  padding: 2px 7px;
}

.vox-fact b {
  color: hsl(var(--vc, var(--aqua-bright)));
  font-weight: 600;
}

/* 每类天体的主色：写在卡片 style 上的令牌覆盖 */
.vox-card,
.vox {
  --vc: hsl(var(--aqua));
  --vc-bright: hsl(var(--aqua-bright));
}

.vc-sun {
  --vc: hsl(var(--sun));
  --vc-bright: hsl(var(--sun-bright));
}

.vc-aqua {
  --vc: hsl(var(--aqua));
  --vc-bright: hsl(var(--aqua-bright));
}

.vc-violet {
  --vc: hsl(var(--violet));
  --vc-bright: hsl(var(--violet));
}

.vc-copper {
  --vc: hsl(var(--copper));
  --vc-bright: hsl(var(--copper-bright));
}

.vc-ok {
  --vc: hsl(var(--ok));
  --vc-bright: hsl(var(--ok));
}

.vc-mist {
  --vc: hsl(var(--space-400));
  --vc-bright: hsl(var(--space-300));
}

@media (prefers-reduced-motion: reduce) {
  .vox.is-voiced::before,
  .vox.is-voiced::after {
    animation: none;
    opacity: 0.5;
  }
}

@media (max-width: 520px) {
  .vox-card {
    grid-template-columns: minmax(0, 1fr);
  }
}
