/**
 * Custom Post Grid Stylesheet
 *
 * @package M13Core
 */

.custom-post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin: 40px 0;
}

.custom-post-grid.list {
    grid-template-columns: 1fr;
}

.grid-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.grid-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.image-link {
    display: block;
    overflow: hidden;
}

.grid-thumbnail {
    width: 100%;
    min-height: 250px;
    max-height: 250px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.image-link:hover .grid-thumbnail {
    transform: scale(1.05);
}

.grid-content {
    padding: 22px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.meta {
    font-size: 13px;
    color: #999;
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.meta i {
    margin-right: 4px;
    color: #333;
}

.meta .category,
.meta .tags {
    margin-right: 6px;
}

.title-link,
.excerpt-link {
    text-decoration: none;
    color: inherit;
}

.title {
    font-size: 20px;
    font-weight: 700;
    color: #222;
    margin: 8px 0;
    line-height: 1.35;
    transition: color 0.25s ease;
}

.title-link:hover .title {
    color: #000;
}

.excerpt {
    font-size: 15px;
    color: #666;
    margin-bottom: 16px;
    line-height: 1.5;
}

.read-more-link {
    font-size: 14px;
    color: #111;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    transition: transform 0.2s ease, color 0.2s ease;
}

.read-more-link:hover {
    color: #000;
    transform: translateX(4px);
}

#load-more-posts {
    display: block;
    margin: 35px auto;
    padding: 12px 36px;
    background: #000000;
    color: #ffffff;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.3s ease, transform 0.2s ease;
}

#load-more-posts:hover {
    background: #333333;
    transform: translateY(-2px);
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #000000;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    animation: m13_spin_loader 0.8s linear infinite;
    margin: 25px auto;
}

@keyframes m13_spin_loader {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 992px) {
    .custom-post-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .custom-post-grid {
        grid-template-columns: 1fr;
    }

    .grid-item {
        flex-direction: row;
    }

    .image-link {
        flex: 0 0 40%;
    }

    .grid-thumbnail {
        height: 100% !important;
        min-height: 100%;
        max-height: unset;
    }

    .grid-content {
        flex: 1;
        padding: 16px;
    }

    .title {
        font-size: 16px;
    }

    .excerpt,
    .meta span,
    .read-more-link {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .grid-item {
        flex-direction: column;
    }

    .image-link {
        flex: none;
    }

    .grid-thumbnail {
        min-height: 200px;
        max-height: 200px;
    }
}
