
/* Lazy Load Posts Styles */

.lazy-load-posts-container {
    width: 100%;
    margin: 0 auto;
}

.lazy-load-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Responsive grid adjustments - Using theme breakpoints */
@media only screen and (max-width: 767px) { /* @mobile */
    .lazy-load-posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media only screen and (min-width: 768px) and (max-width: 979px) { /* @tablet to @notDesktop */
    .lazy-load-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media only screen and (min-width: 980px) { /* @desktop */
    .lazy-load-posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Load More Button Styles - Using theme colors */
.lazy-load-more-container {
    text-align: center;
    margin: 2rem 0;
}

.lazy-load-more-btn {
    background-color: #158dc0; /* @colorBlue */
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-family: proxima-nova, sans-serif;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 140px;
    min-height: 48px;
}

.lazy-load-more-btn:hover {
    background-color: #102b54; /* @colorNavy */
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.lazy-load-more-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lazy-load-more-btn:disabled {
    background-color: #e6ebef; /* @colorGrey */
    color: #102b54; /* @colorNavy */
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.lazy-load-more-btn:disabled:hover {
    background-color: #e6ebef; /* @colorGrey */
    transform: none;
}

/* Loading Spinner */
.load-more-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Status Messages */
.lazy-load-status {
    text-align: center;
    margin: 2rem 0;
    padding: 1rem;
}

.lazy-load-end-message {
    color: #102b54; /* @colorNavy */
    font-style: italic;
    margin: 0;
    padding: 1rem;
    background-color: #f1f1f1; /* @colorGreyLight */
    border-radius: 4px;
    border-left: 4px solid #158dc0; /* @colorBlue */
    font-family: proxima-nova, sans-serif;
}

.lazy-load-error-message {
    color: #d63638;
    margin: 0;
    padding: 1rem;
    background-color: #fef7f7;
    border-radius: 4px;
    border-left: 4px solid #d63638;
    font-family: proxima-nova, sans-serif;
}

/* Post Grid Item Animations */
.lazy-load-posts-grid .post {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

/* Stagger animation in groups of 6 so each load cascades */
.lazy-load-posts-grid .post:nth-child(6n+1) { animation-delay: 0.1s; }
.lazy-load-posts-grid .post:nth-child(6n+2) { animation-delay: 0.2s; }
.lazy-load-posts-grid .post:nth-child(6n+3) { animation-delay: 0.3s; }
.lazy-load-posts-grid .post:nth-child(6n+4) { animation-delay: 0.4s; }
.lazy-load-posts-grid .post:nth-child(6n+5) { animation-delay: 0.5s; }
.lazy-load-posts-grid .post:nth-child(6n+6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure posts display properly */
.lazy-load-posts-grid .post {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lazy-load-posts-grid .post:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Post content styling */
.lazy-load-posts-grid .post .post-content {
    padding: 1.5rem;
}

.lazy-load-posts-grid .post .post-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    line-height: 1.4;
}

.lazy-load-posts-grid .post .post-excerpt {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

.lazy-load-posts-grid .post .post-meta {
    color: #999;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

/* Featured image styling */
.lazy-load-posts-grid .post .post-featured-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: #f5f5f5;
}

.lazy-load-posts-grid .post .post-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.lazy-load-posts-grid .post:hover .post-featured-image img {
    transform: scale(1.05);
}

/* Loading state for individual posts */
.lazy-load-posts-grid .post.loading {
    opacity: 0.6;
    pointer-events: none;
}

.lazy-load-posts-grid .post.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #0073aa;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

/* Accessibility improvements */
.lazy-load-more-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .lazy-load-more-btn {
        border: 2px solid currentColor;
    }
    
    .lazy-load-posts-grid .post {
        border: 1px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .lazy-load-posts-grid .post,
    .lazy-load-more-btn,
    .load-more-spinner {
        animation: none;
        transition: none;
    }
    
    .lazy-load-posts-grid .post:hover,
    .lazy-load-more-btn:hover {
        transform: none;
    }
}
