/* 
 * WP Category Posts Cards Styles
 * Mobile-First, Performance & SEO Optimized Layout.
 */

/* Container and Grid Layout (Mobile First) */
.wp-cpc-container {
    width: 100%;
    max-width: 1200px;
    /* Constrain max width for ultra-wide screens */
    margin: 2rem auto;
    box-sizing: border-box;
}

.wp-cpc-container * {
    box-sizing: border-box;
}

.wp-cpc-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Single column on mobile */
    gap: 1.5rem;
}

/* Base Card Style */
.wp-cpc-card {
    background-color: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.05);
    /* Soft, elegant shadow */
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    height: 100%;
    /* Ensure equal heights in grid */
    text-align: left;
    /* reset text alignment */
}

/* Hover Micro-Animation for the entire card */
.wp-cpc-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
}

/* Image/Thumbnail Area */
.wp-cpc-thumbnail {
    margin: 0;
    padding: 0;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    /* Modern, cinematic aspect ratio */
    overflow: hidden;
    background-color: #f8f9fa;
    /* Placeholder color before image loads */
}

.wp-cpc-thumbnail a {
    display: block;
    width: 100%;
    height: 100%;
}

.wp-cpc-thumbnail .wp-cpc-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Ensures image covers area without distortion */
    display: block;
    transition: transform 0.5s ease;
    /* Smooth image scale on hover */
}

.wp-cpc-card:hover .wp-cpc-img {
    transform: scale(1.05);
}

/* Card Content Area */
.wp-cpc-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* Pushes footer to bottom */
}

.wp-cpc-header {
    margin-bottom: 0.75rem;
}

/* Metadata (Date) */
.wp-cpc-meta {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Title */
.wp-cpc-title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.4;
    font-weight: 700;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.wp-cpc-title a {
    color: #111827;
    text-decoration: none;
    transition: color 0.2s ease;
    /* Multi-line truncation fallback (max 2 lines) */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wp-cpc-title a:hover {
    color: #2563eb;
    /* Primary brand color on hover */
}

/* Excerpt */
.wp-cpc-excerpt {
    color: #4b5563;
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    flex-grow: 1;
    /* Pushes footer to the bottom if excerpts vary in length */
}

.wp-cpc-excerpt p:last-child {
    margin-bottom: 0;
}

/* Footer / Read More Button */
.wp-cpc-footer {
    margin-top: auto;
}

.wp-cpc-read-more {
    display: inline-flex;
    align-items: center;
    color: #2563eb;
    /* Primary brand color */
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.wp-cpc-icon {
    width: 1.1em;
    height: 1.1em;
    margin-left: 0.35rem;
    transition: transform 0.2s ease;
}

/* Animate arrow on hover */
.wp-cpc-read-more:hover {
    color: #1d4ed8;
}

.wp-cpc-read-more:hover .wp-cpc-icon {
    transform: translateX(4px);
}

/* Responsive Breakpoints (Tablet and Desktop) */
@media (min-width: 640px) {
    .wp-cpc-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on tablet */
    }
}

@media (min-width: 1024px) {
    .wp-cpc-grid {
        grid-template-columns: repeat(3, 1fr);
        /* 3 columns on desktop for the 3 posts */
        gap: 2rem;
    }

    .wp-cpc-content {
        padding: 1.75rem;
    }

    .wp-cpc-title {
        font-size: 1.375rem;
    }
}

/* Dark Mode Support Strategy (Optional auto-adaptation if theme supports it, else purely structural)
   Currently using clean light aesthetics. For a true forced dark mode, 
   we'd detect prefers-color-scheme. Assuming standard WP theme integration here. */
@media (prefers-color-scheme: dark) {

    /* Basic dark mode overrides for environments with generic dark themes */
    body.is-dark-theme .wp-cpc-card,
    .dark-mode .wp-cpc-card {
        background-color: #1f2937;
        border-color: #374151;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    body.is-dark-theme .wp-cpc-title a,
    .dark-mode .wp-cpc-title a {
        color: #f9fafb;
    }

    body.is-dark-theme .wp-cpc-meta,
    .dark-mode .wp-cpc-meta,
    body.is-dark-theme .wp-cpc-excerpt,
    .dark-mode .wp-cpc-excerpt {
        color: #9ca3af;
    }

    body.is-dark-theme .wp-cpc-thumbnail,
    .dark-mode .wp-cpc-thumbnail {
        background-color: #374151;
    }

    body.is-dark-theme .wp-cpc-read-more,
    .dark-mode .wp-cpc-read-more {
        color: #60a5fa;
    }
}