/* 阴阳边框流光（对标 PixelBorderBeam 手法）
 * 用法：宿主加 class="bb-yin"；需 position:relative（本文件会补）
 * hover 显现；黑/白对位；渐隐→硬边；顺时针 4s
 */
@property --bb-yin-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.bb-yin {
  --bb-yin-line: 2px;
  --bb-yin-duration: 4s;
  --bb-yin-angle: 0deg;
  position: relative;
  isolation: isolate;
}

.bb-yin::before,
.bb-yin::after {
  content: '';
  position: absolute;
  inset: calc(-1 * var(--bb-yin-line));
  z-index: 2;
  box-sizing: border-box;
  border-radius: inherit;
  padding: var(--bb-yin-line);
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-clip: content-box, border-box;
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-clip: content-box, border-box;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.15s linear;
  animation: bb-yin-angle var(--bb-yin-duration) linear infinite;
  animation-play-state: paused;
}

/* 黑：渐隐起笔 → 硬边实色 */
.bb-yin::before {
  background: conic-gradient(
    from var(--bb-yin-angle),
    transparent 0%,
    rgba(0, 0, 0, 0.55) 14%,
    #000 20.5%,
    #000 22%,
    transparent 22.01%,
    transparent 100%
  );
}

/* 白：与黑相对 +180° */
.bb-yin::after {
  background: conic-gradient(
    from calc(var(--bb-yin-angle) + 180deg),
    transparent 0%,
    rgba(255, 255, 255, 0.55) 14%,
    #fff 20.5%,
    #fff 22%,
    transparent 22.01%,
    transparent 100%
  );
}

.bb-yin:hover::before,
.bb-yin:hover::after {
  opacity: 1;
  animation-play-state: running;
}

@keyframes bb-yin-angle {
  to {
    --bb-yin-angle: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bb-yin::before,
  .bb-yin::after {
    animation: none !important;
    opacity: 0 !important;
  }
}
