/* ============================================================================
   U27 · 黑洞坍缩层（仅首页；由 build.mjs 只给 index.html 注入）

   这里只负责「触发命中区 + overlay 画布外观」，动效本体在 assets/js/warp.js。
   overlay 必须是 fixed（既躲开 harness-overflow 的越界断言，也不参与舞台布局）；
   颜色一律引用 theme.css 的 --hole-* 令牌，本文件不定义任何颜色值。
   ========================================================================= */

/* ------------------------------------------------------------ 核心触发区 */
.hole-trigger {
  position: absolute;
  z-index: 6;                    /* 与 .stage-hud 同层：在画布/网格/节点之上，在 .stage-in 之下 */
  display: block;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
  transition: box-shadow var(--dur-2) var(--ease-out);
}

/* 悬停/聚焦时才出现的虚线提示环：平时不干扰画面 */
.hole-trigger::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--hole-ring-a) 46%, transparent);
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease-out);
}
.stage.hero:hover .hole-trigger::after,
.hole-trigger:focus-visible::after { opacity: .7; }

.hole-trigger:hover {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--hole-ring-a) 38%, transparent),
    0 0 46px -8px color-mix(in srgb, var(--hole-ring-a) 70%, transparent);
}
.hole-trigger:focus-visible { outline: 2px solid var(--hole-ring-a); outline-offset: 6px; }

/* 按钮文字只在窄屏档显示（宽屏下按钮是覆盖在核心上的隐形命中区）。
   注意顺序：这条 base 规则必须排在下面的 @media 之前，否则会盖掉 .hole-label{display:inline}。 */
.hole-label { display: none; }

/* 触摸屏（含 iPad 这类 ≥980px 的宽屏触摸）：没有 hover，核心上的虚线环改成常显呼吸环 */
@media (hover: none) {
  .hole-trigger::after {
    opacity: .45;
    animation: hole-breathe 2.6s var(--ease-soft) infinite;
  }
}
@keyframes hole-breathe {
  0%, 100% { transform: scale(.78); opacity: .16; }
  50%      { transform: scale(1);   opacity: .52; }
}

/* 窄屏：hero.js 把核心画在画布正中 (0.5, 0.5)，而那里正好压着正文 —— ≤979px 的
   .stage-in::before 白色径向遮罩会把画布盖掉，核心基本看不见。所以手机上不再让按钮
   隐身在核心上，而是变成文字流末尾的显式胶囊按钮（warp.js 在 <980px 不再写 inline 定位）。 */
@media (max-width: 979px) {
  .hole-trigger {
    position: relative;
    order: 5;                     /* 排在 HUD / 正文 / 节点胶囊之后 */
    display: inline-flex;
    align-items: center;
    gap: 9px;
    justify-self: start;
    margin: 20px var(--gutter) 0;
    padding: 9px 15px;
    border: 1px solid color-mix(in srgb, var(--hole-ring-a) 42%, transparent);
    border-radius: 999px;
    background-color: color-mix(in srgb, var(--hole-ring-a) 10%, var(--bg));
    color: var(--tech-deep);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    line-height: 1;
  }
  .hole-trigger::before {
    content: '';
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--hole-ring-a);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--hole-ring-a) 18%, transparent);
  }
  .hole-trigger::after { display: none; }   /* 虚线环只在「核心命中区」上才有意义 */
  .hole-label { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .hole-trigger::after { animation: none; opacity: .5; }
}
/* U32：同一条呼吸环也要认 html.no-motion（命令面板「动效 = 关」）——
   只挂媒体查询的话，手选关掉动效后触摸屏上这条环还会一直呼吸。 */
html.no-motion .hole-trigger::after { animation: none; opacity: .3; }

/* 视觉隐藏的状态播报（role="status"，文案由 i18n 走 data-zh / data-en） */
.hole-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- overlay */
.hole-canvas {
  position: fixed;
  inset: 0;
  z-index: 87;                   /* #art-cut(80) 之上、光标层(88+)与快捷键浮层(96) 之下 */
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--hole-fade, .45s) var(--ease-out);
}
html.warp-on .hole-canvas { opacity: 1; }
html.no-motion .hole-canvas { transition: none; }

@media print {
  .hole-canvas, .hole-trigger, .hole-sr { display: none; }
}
