/* =============================================
   Related Posts Starter – Frontend Styles
   Developer: Ican Mori | https://icanmori.com/
   Version: 1.1.0
   ============================================= */

/* --- Container --- */
.rps-related-posts {
    margin: 40px 0 20px;
    padding: 0;
    clear: both;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* --- Heading --- */
.rps-heading {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 24px 0;
    padding: 0 0 12px 0;
    border-bottom: 3px solid #4361ee;
    display: inline-block;
    line-height: 1.3;
}

/* --- Grid --- */
.rps-grid {
    display: grid;
    gap: 24px;
}

.rps-cols-2 { grid-template-columns: repeat(2, 1fr); }
.rps-cols-3 { grid-template-columns: repeat(3, 1fr); }
.rps-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* --- Card Item --- */
.rps-card-item {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

.rps-card-item:hover {
    transform: translateY(-4px);
}

/* --- Card Style Variants --- */
.rps-style-shadow .rps-card-item {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.1);
}
.rps-style-shadow .rps-card-item:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.1);
}

.rps-style-border .rps-card-item {
    border: 1px solid #e2e8f0;
}
.rps-style-border .rps-card-item:hover {
    border-color: #4361ee;
}

.rps-style-minimal .rps-card-item {
    box-shadow: none;
    border-radius: 8px;
}
.rps-style-minimal .rps-card-item:hover {
    background: #f8fafc;
}

.rps-style-flat .rps-card-item {
    background: #f8fafc;
}
.rps-style-flat .rps-card-item:hover {
    background: #eef2ff;
}

/* --- Card Link (entire card clickable) --- */
.rps-card-link {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-decoration: none !important;
    color: inherit !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.rps-card-link:hover,
.rps-card-link:focus,
.rps-card-link:visited {
    text-decoration: none !important;
    color: inherit !important;
}

/* --- Thumbnail --- */
.rps-thumb {
    position: relative;
    overflow: hidden;
    background: #e9ecef;
    width: 100%;
}

.rps-ratio-16-9 { aspect-ratio: 16 / 9; }
.rps-ratio-4-3  { aspect-ratio: 4 / 3; }
.rps-ratio-1-1  { aspect-ratio: 1 / 1; }
.rps-ratio-3-2  { aspect-ratio: 3 / 2; }

.rps-thumb-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.rps-card-item:hover .rps-thumb-img {
    transform: scale(1.06);
}

/* No thumbnail placeholder */
.rps-no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    color: #adb5bd;
}

.rps-no-thumb svg {
    width: 40px;
    height: 40px;
}

/* Category Badge */
.rps-cat-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #4361ee;
    color: #fff !important;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
    z-index: 2;
    transition: background 0.3s ease;
}

.rps-card-item:hover .rps-cat-badge {
    background: #3a56d4;
}

/* --- Card Body --- */
.rps-card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Title */
.rps-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    margin: 0 0 8px 0;
    color: #1a1a2e;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rps-card-item:hover .rps-title {
    color: #4361ee;
}

/* Excerpt */
.rps-excerpt {
    font-size: 13px;
    line-height: 1.55;
    color: #6b7280;
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Meta */
.rps-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #9ca3af;
    flex-wrap: wrap;
}

.rps-meta-author {
    font-weight: 500;
    color: #6b7280;
}

.rps-meta-author::after {
    content: '\00B7';
    margin-left: 12px;
}

.rps-meta-date {
    color: #9ca3af;
}

/* =============================================
   Responsive Breakpoints
   ============================================= */

/* Tablet */
@media (max-width: 900px) {
    .rps-cols-3,
    .rps-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .rps-grid {
        gap: 18px;
    }

    .rps-heading {
        font-size: 20px;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .rps-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .rps-related-posts {
        margin: 28px 0 16px;
    }

    .rps-heading {
        font-size: 18px;
        margin-bottom: 18px;
    }

    .rps-card-item {
        border-radius: 10px;
    }

    .rps-card-body {
        padding: 14px;
    }

    .rps-title {
        font-size: 15px;
    }
}

/* Accessibility: Focus visible */
.rps-card-link:focus-visible {
    outline: 2px solid #4361ee;
    outline-offset: 2px;
    border-radius: 12px;
}

/* Accessibility: Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .rps-card-item,
    .rps-card-item:hover,
    .rps-thumb-img,
    .rps-card-item:hover .rps-thumb-img {
        transition: none;
        transform: none;
    }
}
