/* ============================================================
   Smart Post Showcase v2.0 — style.css
   Matches the blog card design from the reference screenshots
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Root Variables ── */
:root {
    --sps-bg:          #eef2f7;
    --sps-white:       #ffffff;
    --sps-accent:      #2563eb;        /* blue links / category color */
    --sps-title:       #111827;
    --sps-text:        #4b5563;
    --sps-meta:        #6b7280;
    --sps-border:      #e5e7eb;
    --sps-radius:      10px;
    --sps-shadow:      0 2px 12px rgba(0,0,0,.07);
    --sps-shadow-h:    0 8px 32px rgba(0,0,0,.13);
    --sps-font:        'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --sps-transition:  0.25s ease;
    --sps-btn-bg:      #2563eb;
    --sps-btn-hover:   #1d4ed8;
}

/* ── Section Wrapper ── */
.sps-section {
    font-family: var(--sps-font);
    width: 100%;
    box-sizing: border-box;
}

/* ── Grid: 3 columns desktop ── */
.sps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    width: 100%;
    box-sizing: border-box;
}

/* ── No-posts ── */
.sps-no-posts {
    font-family: var(--sps-font);
    color: var(--sps-meta);
    text-align: center;
    padding: 60px 20px;
    font-size: 1rem;
}

/* ============================================================
   CARD
   ============================================================ */
.sps-card {
    background: var(--sps-white);
    border-radius: var(--sps-radius);
    box-shadow: var(--sps-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--sps-transition), transform var(--sps-transition);
    cursor: pointer;
}

.sps-card:hover {
    box-shadow: var(--sps-shadow-h);
    transform: translateY(-3px);
}

/* ── Thumbnail ── */
.sps-thumb-link {
    display: block;
    overflow: hidden;
    text-decoration: none;
    flex-shrink: 0;
}

.sps-thumb {
    width: 100%;
    padding-top: 60%;     /* ~5:3 ratio — matches screenshots */
    position: relative;
    overflow: hidden;
    background: #f3f4f6;
}

.sps-img {
    position: absolute !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.sps-card:hover .sps-img {
    transform: scale(1.04);
}

/* ── Card Body ── */
.sps-body {
    padding: 20px 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

/* ── Category Links ── */
.sps-cats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 2px;
}

.sps-cat {
    font-size: 13px;
    font-weight: 600;
    color: var(--sps-accent);
    text-decoration: none;
    letter-spacing: .01em;
    transition: opacity var(--sps-transition);
}

.sps-cat:hover {
    opacity: .75;
    text-decoration: underline;
}

.sps-cat-sep {
    font-size: 13px;
    font-weight: 600;
    color: var(--sps-accent);
}

/* ── Title ── */
.sps-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--sps-title);
    margin: 0;
}

.sps-title a {
    text-decoration: none;
    color: inherit;
    transition: color var(--sps-transition);
}

.sps-title a:hover {
    color: var(--sps-accent);
}

/* ── Meta: author / date ── */
.sps-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.sps-author {
    font-size: 13px;
    color: var(--sps-accent);
    font-weight: 500;
    text-decoration: none;
}

.sps-meta-sep {
    font-size: 13px;
    color: var(--sps-meta);
}

.sps-date {
    font-size: 13px;
    color: var(--sps-meta);
}

/* ── Excerpt ── */
.sps-excerpt {
    font-size: 14px;
    color: var(--sps-text);
    line-height: 1.65;
    margin: 4px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   LOAD MORE BUTTON
   ============================================================ */
.sps-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 44px;
}

.sps-load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--sps-btn-bg);
    color: #fff;
    font-family: var(--sps-font);
    font-size: 15px;
    font-weight: 600;
    padding: 13px 36px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background var(--sps-transition), transform var(--sps-transition), box-shadow var(--sps-transition);
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
    letter-spacing: .02em;
}

.sps-load-more-btn:hover {
    background: var(--sps-btn-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37,99,235,.45);
}

.sps-load-more-btn:active {
    transform: translateY(0);
}

.sps-load-more-btn svg {
    transition: transform 0.3s ease;
}

.sps-load-more-btn.sps-loading svg {
    animation: sps-spin 0.8s linear infinite;
}

.sps-load-more-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

@keyframes sps-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============================================================
   ENTRANCE ANIMATION
   ============================================================ */
@keyframes sps-fade-up {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sps-card {
    animation: sps-fade-up 0.45s ease both;
}

/* Staggered delay for initial load */
.sps-grid .sps-card:nth-child(1)  { animation-delay: .03s; }
.sps-grid .sps-card:nth-child(2)  { animation-delay: .07s; }
.sps-grid .sps-card:nth-child(3)  { animation-delay: .11s; }
.sps-grid .sps-card:nth-child(4)  { animation-delay: .15s; }
.sps-grid .sps-card:nth-child(5)  { animation-delay: .19s; }
.sps-grid .sps-card:nth-child(6)  { animation-delay: .23s; }
.sps-grid .sps-card:nth-child(7)  { animation-delay: .27s; }
.sps-grid .sps-card:nth-child(8)  { animation-delay: .31s; }
.sps-grid .sps-card:nth-child(9)  { animation-delay: .35s; }
.sps-grid .sps-card:nth-child(10) { animation-delay: .39s; }
.sps-grid .sps-card:nth-child(11) { animation-delay: .43s; }
.sps-grid .sps-card:nth-child(12) { animation-delay: .47s; }
.sps-grid .sps-card:nth-child(13) { animation-delay: .51s; }
.sps-grid .sps-card:nth-child(14) { animation-delay: .55s; }
.sps-grid .sps-card:nth-child(15) { animation-delay: .59s; }

/* Newly loaded cards get a fresh animation */
.sps-card.sps-new {
    animation: sps-fade-up 0.4s ease both;
    animation-delay: 0s !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet: 2 columns */
@media (max-width: 900px) {
    .sps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Mobile: 1 column */
@media (max-width: 540px) {
    .sps-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .sps-body {
        padding: 16px 18px 20px;
    }

    .sps-title {
        font-size: 1rem;
    }

    .sps-load-more-btn {
        padding: 12px 28px;
        font-size: 14px;
    }
}
