/* ============================================================
 * WaterDrop Pro Theme — 可旋转的 3D 球形标签云
 * 彩色渐变文字 + 球面倾斜排布；支持自动旋转、拖拽/触屏旋转、鼠标视差。
 * 颜色用 CSS 变量表达，暗色模式自动适配，无需 JS 重建。
 * ============================================================ */

.yz-tagcloud-card .yz-tag-sphere {
    position: relative;
    width: 100%;
    height: 252px;
    margin-top: 2px;
    overflow: hidden;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    isolation: isolate;
}

.yz-tagcloud-card .yz-tag-sphere:active {
    cursor: grabbing;
}

/* 旧版连线画布保留结构兼容，但不再绘制 */
.yz-tagcloud-card .yz-tag-lines {
    display: none;
}

.yz-tagcloud-card .yz-sphere-stage {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.yz-tagcloud-card .yz-sphere-tag {
    position: absolute;
    left: 50%;
    top: 50%;
    display: block;
    white-space: nowrap;
    font-family: inherit;
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: .2px;
    text-decoration: none;
    transform: translate(-50%, -50%);
    transform-origin: 50% 50%;
    will-change: transform, opacity;
    opacity: 0;                 /* 尺寸就绪、JS 首次投影前不显示，避免堆在中心 */
    -webkit-tap-highlight-color: transparent;
}

.yz-tagcloud-card .yz-sphere-tag__name {
    color: var(--tag-color, #4f6ef7);
}

/* 12 组糖果色渐变，按标签顺序循环 */
.yz-tagcloud-card .yz-sphere-tag:nth-child(12n + 1)  { --g1: #4f6ef7; --g2: #22d3ee; --g3: #8b5cf6; --tag-color: #4f6ef7; --gd: 5.0s; --gdel: -0.4s; }
.yz-tagcloud-card .yz-sphere-tag:nth-child(12n + 2)  { --g1: #e0529c; --g2: #f97316; --g3: #facc15; --tag-color: #e0529c; --gd: 6.5s; --gdel: -1.1s; }
.yz-tagcloud-card .yz-sphere-tag:nth-child(12n + 3)  { --g1: #12b886; --g2: #38bdf8; --g3: #a3e635; --tag-color: #12b886; --gd: 4.5s; --gdel: -2.3s; }
.yz-tagcloud-card .yz-sphere-tag:nth-child(12n + 4)  { --g1: #f59f00; --g2: #ef4444; --g3: #ec4899; --tag-color: #f59f00; --gd: 7.0s; --gdel: -3.2s; }
.yz-tagcloud-card .yz-sphere-tag:nth-child(12n + 5)  { --g1: #8b5cf6; --g2: #ec4899; --g3: #6366f1; --tag-color: #8b5cf6; --gd: 5.5s; --gdel: -0.8s; }
.yz-tagcloud-card .yz-sphere-tag:nth-child(12n + 6)  { --g1: #0ea5b7; --g2: #22c55e; --g3: #14b8a6; --tag-color: #0ea5b7; --gd: 6.0s; --gdel: -1.7s; }
.yz-tagcloud-card .yz-sphere-tag:nth-child(12n + 7)  { --g1: #ef4444; --g2: #f97316; --g3: #f59f00; --tag-color: #ef4444; --gd: 4.0s; --gdel: -2.9s; }
.yz-tagcloud-card .yz-sphere-tag:nth-child(12n + 8)  { --g1: #20c997; --g2: #0ea5e9; --g3: #818cf8; --tag-color: #20c997; --gd: 7.5s; --gdel: -0.2s; }
.yz-tagcloud-card .yz-sphere-tag:nth-child(12n + 9)  { --g1: #5c7cfa; --g2: #22d3ee; --g3: #34d399; --tag-color: #5c7cfa; --gd: 5.2s; --gdel: -3.6s; }
.yz-tagcloud-card .yz-sphere-tag:nth-child(12n + 10) { --g1: #f06595; --g2: #a78bfa; --g3: #f472b6; --tag-color: #f06595; --gd: 6.8s; --gdel: -1.4s; }
.yz-tagcloud-card .yz-sphere-tag:nth-child(12n + 11) { --g1: #f97316; --g2: #facc15; --g3: #fb7185; --tag-color: #f97316; --gd: 4.8s; --gdel: -2.1s; }
.yz-tagcloud-card .yz-sphere-tag:nth-child(12n + 12) { --g1: #22b8cf; --g2: #818cf8; --g3: #2dd4bf; --tag-color: #22b8cf; --gd: 5.8s; --gdel: -3.9s; }

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .yz-tagcloud-card .yz-sphere-tag__name {
        background-image: linear-gradient(100deg,
            var(--g1, #4f6ef7), var(--g2, #22d3ee), var(--g3, #8b5cf6), var(--g1, #4f6ef7));
        background-size: 300% 100%;
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        animation: yz-tag-flow var(--gd, 6s) var(--gdel, 0s) ease-in-out infinite;
    }
}

@keyframes yz-tag-flow {
    0%   { background-position:   0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position:   0% 50%; }
}

/* 悬停：强制最前景、放大由 JS 处理 */
.yz-tagcloud-card .yz-sphere-tag:hover {
    opacity: 1 !important;
    text-decoration: none;
}

.yz-tagcloud-card .yz-sphere-tag:hover .yz-sphere-tag__name {
    filter: brightness(1.12) drop-shadow(0 2px 5px rgba(80, 100, 160, .28));
}

.yz-tagcloud-card .yz-sphere-tag:focus-visible {
    opacity: 1 !important;
    outline: 2px solid rgba(79, 110, 247, .6);
    outline-offset: 3px;
    border-radius: 4px;
}

.yz-tagcloud-card .yz-tag-hint {
    position: absolute;
    right: 8px;
    bottom: 6px;
    z-index: 2;
    padding: 3px 7px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .82);
    font-size: 10px;
    line-height: 1;
    color: #9aa4b2;
    letter-spacing: .3px;
    pointer-events: none;
    transition: opacity .25s ease;
}

.yz-tagcloud-card .yz-tag-sphere:hover .yz-tag-hint {
    opacity: 0;
}

.yz-tagcloud-card .yz-tag-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa4b2;
    font-size: .875rem;
}

/* 深色模式：整体提亮，避免彩色文字在深底上发灰 */
html.dark .yz-tagcloud-card .yz-sphere-tag__name {
    filter: brightness(1.18) saturate(1.12);
}

html.dark .yz-tagcloud-card .yz-sphere-tag:hover .yz-sphere-tag__name {
    filter: brightness(1.3) saturate(1.15) drop-shadow(0 2px 6px rgba(0, 0, 0, .5));
}

html.dark .yz-tagcloud-card .yz-tag-hint {
    color: #8b95a7;
    background: rgba(28, 32, 45, .82);
}

@media (max-width: 768px) {
    .yz-tagcloud-card .yz-tag-sphere {
        height: 210px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .yz-tagcloud-card .yz-sphere-tag__name {
        animation: none;
    }
}
