/* ============ 文章置顶按钮样式 ============ */

.zpc-pin-card {
    position: relative;
}

/* ====== 按钮容器定位 ====== */

.zpc-pin-wrapper,
.zpc-unpin-wrapper {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
}

/* ====== 按钮基础样式 ====== */

.zpc-pin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.7);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* ====== 核心：卡片悬浮 0.5s 后按钮才出现 ====== */

/* 未置顶卡片：hover 卡片 0.5s 后显示置顶按钮 */
.zpc-pin-card:not(.is-pinned-card):hover .zpc-pin-wrapper .zpc-pin-btn {
    opacity: 0.6;
    visibility: visible;
    transform: scale(1);
    transition-delay: 0.5s;
}

/* 已置顶卡片：hover 卡片 0.5s 后显示取消置顶按钮 */
.zpc-pin-card.is-pinned-card:hover .zpc-unpin-wrapper .zpc-pin-btn {
    opacity: 0.85;
    visibility: visible;
    transform: scale(1);
    transition-delay: 0.5s;
}

/* 按钮消失延迟 0.3s（松开鼠标后等一会再消失） */
.zpc-pin-card:not(.is-pinned-card) .zpc-pin-wrapper .zpc-pin-btn,
.zpc-pin-card.is-pinned-card .zpc-unpin-wrapper .zpc-pin-btn {
    transition-delay: 0.3s;
}

/* ====== 取消按钮红色调 ====== */

.zpc-unpin-wrapper .zpc-pin-btn svg {
    filter: drop-shadow(0 0 2px rgba(255, 107, 107, 0.4));
}

/* ====== 按钮 hover 放大 ====== */

.zpc-pin-btn:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    transform: scale(1.15) !important;
}

.zpc-pin-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.zpc-pin-btn:hover svg {
    transform: scale(1.15);
}

/* ====== tooltip ====== */

.zpc-pin-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 120%;
    right: 0;
    white-space: nowrap;
    font-size: 12px;
    color: #fff;
    background: rgba(0, 0, 0, 0.8);
    padding: 4px 10px;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 20;
}

.zpc-pin-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ====== 已置顶 badge：左上角，纯展示 ====== */

.zpc-pin-badge {
    position: absolute;
    top: 0;
    left: 0;
    background: #ff6b6b;
    color: #fff;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 0 0 8px 0;
    font-weight: 500;
    letter-spacing: 0.5px;
    z-index: 5;
    display: none;
    line-height: 1.6;
    pointer-events: none;
}

.zpc-pin-card.is-pinned-card > .zpc-pin-badge {
    display: block;
}

/* ====== 置顶动效关键帧 ====== */

/* 置顶卡片弹入动效 */
@keyframes zpcPinBounceIn {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4);
    }
    30% {
        transform: scale(1.03);
        box-shadow: 0 0 20px 4px rgba(255, 107, 107, 0.25);
    }
    60% {
        transform: scale(0.99);
        box-shadow: 0 0 12px 2px rgba(255, 107, 107, 0.15);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
    }
}

/* 取消置顶卡片淡出动效 */
@keyframes zpcPinFadeOut {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 12px 2px rgba(107, 107, 107, 0.15);
    }
    100% {
        transform: scale(0.96);
        opacity: 0.85;
        box-shadow: 0 0 0 0 rgba(107, 107, 107, 0);
    }
}

/* ====== 卡片移动平滑过渡 ====== */

.zpc-pin-card {
    transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
                box-shadow 0.5s ease,
                opacity 0.4s ease;
}

/* ====== 响应式 ====== */

@media (max-width: 768px) {
    .zpc-pin-btn {
        width: 28px;
        height: 28px;
    }

    .zpc-pin-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* ====== 深色模式 ====== */

@media (prefers-color-scheme: dark) {
    .zpc-pin-btn {
        background: rgba(255, 255, 255, 0.85);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .zpc-pin-btn:hover {
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    }
}
