/**
 * Standardized Card Grid Styles
 * Used across all public pages for consistent card layouts
 */

/* Grid Container */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 0 auto;
}

/* Card Base */
.grid-card {
    background: white;
    border-radius: var(--radius-lg, 20px);
    overflow: hidden;
    box-shadow: 0 5px 15px 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;
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 0;
    /* Important for flex child */
}

.grid-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Card Image Container - Standardized to 16:9 aspect ratio */
.grid-card-image {
    width: 100%;
    /* height: 200px; Removed fixed height to allow aspect ratio to control consistency */
    aspect-ratio: 4 / 3;
    background: var(--light-gray, #f8f9fa);
    position: relative;
    overflow: hidden;
    /* rounded top corners for image */
}

.grid-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.grid-card:hover .grid-card-image img {
    transform: scale(1.1);
}

/* Card Image Placeholder */
.grid-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--light-gray, #f8f9fa) 0%, #e0e0e0 100%);
    color: var(--gray, #888);
    font-size: 3rem;
}

/* Card Body */
.grid-card-body {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.grid-card-title {
    color: var(--primary-dark, #1A5028);
    margin-bottom: 10px;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.grid-card-text {
    color: var(--text-light, #666);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    /* Pushes meta/link to bottom */
    overflow-wrap: anywhere;
    word-break: break-word;
}

.grid-card-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--text-light, #666);
    flex-shrink: 0;
}

.grid-card-link {
    color: var(--primary, #2D7A3E);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: auto;
    transition: transform 0.2s;
    text-decoration: none;
}

.grid-card:hover .grid-card-link {
    transform: translateX(5px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .grid-cards {
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
        gap: 15px;
    }

    .grid-card-body {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .grid-cards {
        /* Premium 2-column mobile layout */
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .grid-card-body {
        padding: 12px;
    }

    .grid-card-title {
        font-size: 1rem;
        margin-bottom: 5px;
        line-height: 1.25;
    }

    .grid-card-text {
        font-size: 0.85rem;
        margin-bottom: 10px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .grid-card-meta {
        gap: 8px;
        font-size: 0.8rem;
        margin-bottom: 10px;
    }

    .grid-card-link {
        font-size: 0.8rem;
    }
}

/* Fallback for extremely small screens */
@media (max-width: 340px) {
    .grid-cards {
        grid-template-columns: 1fr;
    }
}