/*
 * Styles for Advanced Related Posts Display - v2.0.0
 * Supports: Grid layout, List layout, hover effects, responsive design.
 */

/* =============================================
   CONTAINER
   ============================================= */
.rpbc-related-posts {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 2px solid #f0f0f0;
    clear: both;
    font-family: inherit;
}

.rpp-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 24px;
    color: #1a1a1a;
    letter-spacing: -0.02em;
}

/* =============================================
   GRID LAYOUT (default)
   ============================================= */
.rpp-layout-grid .rpp-posts-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 24px;
}

.rpp-layout-grid .rpp-post-item {
    margin: 0;
    padding: 0;
    text-align: center;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.22s ease, transform 0.22s ease;
}

.rpp-layout-grid .rpp-post-item:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.rpp-layout-grid .rpp-thumbnail-link {
    display: block;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #f5f5f5;
}

.rpp-layout-grid .rpp-thumbnail-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.rpp-layout-grid .rpp-post-item:hover .rpp-thumbnail-link img {
    transform: scale(1.06);
}

.rpp-layout-grid .rpp-post-info {
    padding: 12px 14px 16px;
    text-align: left;
}

/* =============================================
   LIST LAYOUT
   ============================================= */
.rpp-layout-list .rpp-posts-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rpp-layout-list .rpp-post-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    transition: box-shadow 0.22s ease;
}

.rpp-layout-list .rpp-post-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.rpp-layout-list .rpp-thumbnail-link {
    display: block;
    flex: 0 0 80px;
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: 8px;
    background: #f5f5f5;
}

.rpp-layout-list .rpp-thumbnail-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.rpp-layout-list .rpp-post-item:hover .rpp-thumbnail-link img {
    transform: scale(1.08);
}

.rpp-layout-list .rpp-post-info {
    flex: 1;
    min-width: 0;
}

/* =============================================
   META (date + read time)
   ============================================= */
.rpp-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

.rpp-meta span {
    font-size: 0.72rem;
    color: #888;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rpp-meta .rpp-read-time::before {
    content: '·';
    margin-right: 8px;
    color: #ccc;
}

.rpp-meta .rpp-date:only-child + .rpp-read-time::before,
.rpp-meta span:first-child.rpp-read-time::before {
    display: none;
}

/* =============================================
   TITLE LINK
   ============================================= */
a.rpbc-title {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
    line-height: 1.4;
    margin-top: 2px;
    transition: color 0.18s ease;

    /* Clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

a.rpbc-title:hover {
    color: #0073aa;
    text-decoration: underline;
}

/* =============================================
   EXCERPT
   ============================================= */
.rpp-excerpt {
    font-size: 0.78rem;
    color: #666;
    margin: 6px 0 0;
    line-height: 1.5;

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =============================================
   LOAD MORE BUTTON
   ============================================= */
.rpp-load-more-wrap {
    margin-top: 28px;
    text-align: center;
}

.rpp-load-more-btn {
    display: inline-block;
    padding: 10px 28px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0073aa;
    background: transparent;
    border: 2px solid #0073aa;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    letter-spacing: 0.02em;
}

.rpp-load-more-btn:hover {
    background: #0073aa;
    color: #fff;
    transform: scale(1.03);
}

.rpp-load-more-btn:disabled,
.rpp-load-more-btn.rpp-loading {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.rpp-load-more-btn.rpp-loading::after {
    content: ' …';
}

/* =============================================
   NEWLY LOADED ITEMS ANIMATION
   ============================================= */
@keyframes rppFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rpp-new-item {
    animation: rppFadeIn 0.35s ease both;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 600px) {
    .rpp-layout-grid .rpp-posts-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .rpp-layout-list .rpp-thumbnail-link {
        flex: 0 0 64px;
        width: 64px;
        height: 64px;
    }

    .rpp-section-title {
        font-size: 1.1rem;
    }
}
