/**
 * Custom Post Grid Styles
 * Modern, financial, trustworthy design matching screenshot specifications
 */

/* Grid Container */
.cpg-grid-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Grid Layout */
.cpg-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Card Styles */
.cpg-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.cpg-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

/* Card Hover Effects */
.cpg-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Image Wrapper */
.cpg-card-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #f5f5f5;
    border-radius: 12px 12px 0 0;
}

.cpg-card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cpg-card:hover .cpg-card-image {
    transform: scale(1.05);
}

/* Category Badge */
.cpg-category-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #2563eb;
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-transform: none;
    z-index: 2;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Card Content */
.cpg-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Card Title */
.cpg-card-title {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 12px 0;
    color: #1a1a1a;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cpg-card-link:hover .cpg-card-title {
    color: #2563eb;
}

/* Card Excerpt */
.cpg-card-excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: #666666;
    margin: 0 0 16px 0;
    flex: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Meta */
.cpg-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #999999;
    margin-top: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.cpg-meta-date {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cpg-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.cpg-meta-separator {
    color: #cccccc;
    font-weight: 300;
}

.cpg-meta-author {
    color: #999999;
}

/* Card Arrow */
.cpg-card-arrow {
    position: absolute;
    bottom: 20px;
    right: 20px;
    color: #666666;
    transition: transform 0.3s ease, color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpg-card:hover .cpg-card-arrow {
    transform: translateX(4px);
    color: #2563eb;
}

.cpg-card-arrow svg {
    width: 16px;
    height: 16px;
}

/* Responsive Design */

/* Tablet: 2 columns */
@media screen and (max-width: 1024px) {
    .cpg-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    
    .cpg-grid-container {
        padding: 0 16px;
    }
}

/* Mobile: 1 column */
@media screen and (max-width: 768px) {
    .cpg-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .cpg-grid-container {
        padding: 0 12px;
    }
    
    .cpg-card-title {
        font-size: 18px;
    }
    
    .cpg-card-excerpt {
        font-size: 14px;
    }
    
    .cpg-card-content {
        padding: 16px;
    }
    
    .cpg-category-badge {
        font-size: 12px;
        padding: 5px 12px;
        top: 10px;
        left: 10px;
    }
}

/* Small Mobile */
@media screen and (max-width: 480px) {
    .cpg-grid-container {
        padding: 0 10px;
    }
    
    .cpg-card-title {
        font-size: 17px;
    }
    
    .cpg-card-meta {
        font-size: 12px;
    }
}

/* Accessibility */
.cpg-card-link:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.cpg-card-link:focus:not(:focus-visible) {
    outline: none;
}

/* Print Styles */
@media print {
    .cpg-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .cpg-card:hover {
        transform: none;
        box-shadow: none;
    }
}
