/* ===========================================
   动画样式库 - Notion 极简风格
   轻柔、直接、不喧宾夺主的动效设计
   =========================================== */

/* ===========================================
   基础设置
   =========================================== */

/* 为支持动画的元素添加初始状态 */
[data-animate] {
    opacity: 0;
    transition: all 0.3s ease-out;
}

[data-animate].animated {
    opacity: 1;
}

/* 支持用户偏好：减少动画 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    [data-animate] {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ===========================================
   淡入动画 (Fade In) - Notion 风格
   =========================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

[data-animate="fade-in"] {
    animation: fadeIn 0.3s ease-out forwards;
}

[data-animate="fade-in"].animated {
    opacity: 1;
}

/* ===========================================
   滑入动画 (Slide) - Notion 风格（更轻柔）
   =========================================== */

/* 从下方滑入 */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

[data-animate="slide-up"] {
    transform: translateY(20px);
}

[data-animate="slide-up"].animated {
    animation: slideUp 0.3s ease-out forwards;
}

/* 从上方滑入 */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

[data-animate="slide-down"] {
    transform: translateY(-20px);
}

[data-animate="slide-down"].animated {
    animation: slideDown 0.3s ease-out forwards;
}

/* 从左侧滑入 */
@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[data-animate="slide-right"] {
    transform: translateX(-20px);
}

[data-animate="slide-right"].animated {
    animation: slideRight 0.3s ease-out forwards;
}

/* 从右侧滑入 */
@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[data-animate="slide-left"] {
    transform: translateX(20px);
}

[data-animate="slide-left"].animated {
    animation: slideLeft 0.3s ease-out forwards;
}

/* ===========================================
   轻微缩放动画 - Notion 风格
   =========================================== */

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

[data-animate="scale-in"] {
    transform: scale(0.96);
}

[data-animate="scale-in"].animated {
    animation: scaleIn 0.25s ease-out forwards;
}

/* ===========================================
   卡片悬停效果 - Notion 风格
   =========================================== */

.card-hover-effect {
    transition: transform 0.2s ease-out, border-color 0.2s ease-out;
}

.card-hover-effect:hover {
    transform: translateY(-2px);
}

/* ===========================================
   按钮悬停效果 - Notion 风格
   =========================================== */

.button-hover-effect {
    transition: background 0.2s ease-out, color 0.2s ease-out;
}

/* ===========================================
   下划线展开动画 - Notion 风格
   =========================================== */

.underline-expand {
    position: relative;
    display: inline-block;
}

.underline-expand::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: #2383E2;
    transition: width 0.2s ease-out;
}

.underline-expand.animated::after {
    width: 100%;
}

/* ===========================================
   输入框聚焦效果 - Notion 风格
   =========================================== */

.input-focus-effect {
    transition: border-color 0.15s ease-out, background 0.15s ease-out;
}

.input-focus-effect:focus {
    border-color: #2383E2;
    outline: none;
}

/* ===========================================
   延迟效果 - 用于逐个显示元素
   =========================================== */

[data-delay="100"] {
    animation-delay: 0.05s;
}
[data-delay="200"] {
    animation-delay: 0.1s;
}
[data-delay="300"] {
    animation-delay: 0.15s;
}
[data-delay="400"] {
    animation-delay: 0.2s;
}
[data-delay="500"] {
    animation-delay: 0.25s;
}
[data-delay="600"] {
    animation-delay: 0.3s;
}
[data-delay="700"] {
    animation-delay: 0.35s;
}
[data-delay="800"] {
    animation-delay: 0.4s;
}

/* ===========================================
   波浪式显示效果 - 用于列表项
   =========================================== */

.stagger-animation:nth-child(1) {
    animation-delay: 0s;
}
.stagger-animation:nth-child(2) {
    animation-delay: 0.05s;
}
.stagger-animation:nth-child(3) {
    animation-delay: 0.1s;
}
.stagger-animation:nth-child(4) {
    animation-delay: 0.15s;
}
.stagger-animation:nth-child(5) {
    animation-delay: 0.2s;
}
.stagger-animation:nth-child(6) {
    animation-delay: 0.25s;
}
.stagger-animation:nth-child(7) {
    animation-delay: 0.3s;
}
.stagger-animation:nth-child(8) {
    animation-delay: 0.35s;
}
.stagger-animation:nth-child(9) {
    animation-delay: 0.4s;
}
.stagger-animation:nth-child(10) {
    animation-delay: 0.45s;
}
.stagger-animation:nth-child(11) {
    animation-delay: 0.5s;
}
.stagger-animation:nth-child(12) {
    animation-delay: 0.55s;
}

/* ===========================================
   数字递增动画
   =========================================== */

.counter-animation {
    transition: all 0.3s ease-out;
}

/* ===========================================
   性能优化
   =========================================== */

.will-animate {
    will-change: transform, opacity;
}

/* 动画完成后移除will-change */
.animation-complete {
    will-change: auto;
}
