/* common-recipe-cards.css */

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.recipe-card {
    background-color: var(--clr-highlight-background);
    border-radius: 0.8rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.recipe-thumbnail {
    width: 100%;       /* Make the image take 100% width of its parent card/container */
    height: 200px;     /* Keep the fixed height for uniform card layout */
    object-fit: contain; /* Scales the entire image to fit within the container. May leave empty space (letterboxing) */
    border-bottom: 1px solid var(--clr-border);
    display: block;
}

.recipe-card .recipe-title {
    font-size: 1.4rem;
    margin: 1rem 1rem 0.5rem 1rem;
    color: var(--clr-main-text);
    line-height: 1.3;

    /* --- Added for text truncation --- */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines, adjust as needed */
    -webkit-box-orient: vertical;
    /* --- End of added properties --- */
}

.recipe-card .recipe-title a {
    color: var(--clr-main-text);
    text-decoration: none;
}

.recipe-card .recipe-title a:hover {
    color: var(--clr-primary-accent);
    text-decoration: underline;
}

.recipe-description {
    font-size: 0.95rem;
    color: var(--clr-muted-greys);
    padding: 0 1rem;
    margin-bottom: 1rem;
    flex-grow: 1;
    /* Added from your profile.css for consistency if description is often clamped */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Default to 3 lines */
    -webkit-box-orient: vertical;
}

.recipe-meta,
.recipe-rating {
    font-size: 0.85rem;
    color: var(--clr-muted-greys);
    padding: 0 1rem 1rem 1rem;
    display: flex;
    align-items: baseline;
    gap: 0.1rem; /* Make gap smaller, maybe? Or even 0 for direct control */
}

/* Target all direct spans within recipe-rating */
.recipe-rating span {
    line-height: 1;
    white-space: nowrap;
}

/* Target the specific rating value span */
.recipe-rating span:nth-child(2) {
    font-weight: 600;
    color: var(--clr-primary-accent);
}

/* --- Media Queries for common recipe cards --- */

@media (max-width: 992px) {
    .recipe-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    /* Specific adjustments for cards on smaller screens that apply generally */
    .recipe-thumbnail {
        height: 140px; /* Adjusted height for common cards on medium screens */
    }
    .recipe-card .recipe-title {
        font-size: 1rem;
    }
    .recipe-description {
        font-size: 0.8rem;
    }
    .recipe-meta,
    .recipe-rating {
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    .recipe-grid {
        grid-template-columns: 1fr; /* On very small screens, stack cards */
    }
    .recipe-card {
        max-width: 350px; /* Constrain single cards on mobile */
        margin: 0 auto;
    }
    .recipe-thumbnail {
        height: 180px; /* Slightly larger image for single column */
    }
    .recipe-card .recipe-title {
        font-size: 1.2rem;
    }
    .recipe-description {
        font-size: 0.9rem;
        -webkit-line-clamp: 3; /* Keep 3 lines on small single column */
    }
    .recipe-meta,
    .recipe-rating {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .recipe-card .recipe-title {
        font-size: 1.05rem;
    }
    .recipe-description {
        font-size: 0.85rem;
        -webkit-line-clamp: 2; /* Limit to 2 lines on very small screens */
    }
    .recipe-meta,
    .recipe-rating {
        font-size: 0.75rem;
    }
}