/**
 * Core Blocks Fade-in Animation - CSS Styles
 * Fade-in animations for WordPress core heading and paragraph blocks
 */

/* Base fade-in animation styles */
.has-fade-in-animation.fade-in-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.has-fade-in-animation.fade-in-visible {
    opacity: 1;
    transform: none;
}

/* Editor preview styles */
.wp-block-editor .has-fade-in-animation.editor-fade-in-preview {
    position: relative;
}

.wp-block-editor .has-fade-in-animation.editor-fade-in-preview::before {
    content: '✨ Fade-in enabled';
    position: absolute;
    top: -20px;
    left: 0;
    font-size: 10px;
    color: #666;
    background: rgba(0, 115, 170, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    pointer-events: none;
    z-index: 1;
}

/* Different timing for headings vs paragraphs */
h1.has-fade-in-animation.fade-in-item,
h2.has-fade-in-animation.fade-in-item,
h3.has-fade-in-animation.fade-in-item,
h4.has-fade-in-animation.fade-in-item,
h5.has-fade-in-animation.fade-in-item,
h6.has-fade-in-animation.fade-in-item {
    transform: translateY(40px);
    transition-duration: 1s;
}

h1.has-fade-in-animation.fade-in-visible,
h2.has-fade-in-animation.fade-in-visible,
h3.has-fade-in-animation.fade-in-visible,
h4.has-fade-in-animation.fade-in-visible,
h5.has-fade-in-animation.fade-in-visible,
h6.has-fade-in-animation.fade-in-visible {
    transform: none;
}

/* Specific styles for image blocks */
figure.has-fade-in-animation.fade-in-item {
    transform: translateY(40px);
    transition-duration: 1s;
}

figure.has-fade-in-animation.fade-in-visible {
    transform: none;
}

/* Specific styles for button blocks */
.wp-block-button.has-fade-in-animation.fade-in-item,
.wp-block-buttons.has-fade-in-animation.fade-in-item {
    transform: translateY(25px);
    transition-duration: 0.9s;
}

.wp-block-button.has-fade-in-animation.fade-in-visible,
.wp-block-buttons.has-fade-in-animation.fade-in-visible {
    transform: none;
}

/* Accessibility: Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .has-fade-in-animation.fade-in-item {
        opacity: 0;
        transform: none;
        transition: opacity 0.4s ease-out;
    }
    
    .has-fade-in-animation.fade-in-visible {
        opacity: 1;
        transform: none;
    }
    
    h1.has-fade-in-animation.fade-in-item,
    h2.has-fade-in-animation.fade-in-item,
    h3.has-fade-in-animation.fade-in-item,
    h4.has-fade-in-animation.fade-in-item,
    h5.has-fade-in-animation.fade-in-item,
    h6.has-fade-in-animation.fade-in-item,
    figure.has-fade-in-animation.fade-in-item,
    .wp-block-button.has-fade-in-animation.fade-in-item,
    .wp-block-buttons.has-fade-in-animation.fade-in-item {
        transform: none;
        transition-duration: 0.4s;
    }
}

/* Hide editor preview indicator on frontend */
body:not(.wp-admin) .has-fade-in-animation::before {
    display: none !important;
}
