

.cards-container {
    margin: 0 auto;
    padding: 0 20px;
}

/* Section Header */
.cards-section-header {
    text-align: center;
    margin: 0 auto 60px auto;
}

.cards-section-header h2 {
    color: #000000;
    margin-bottom: 10px;
}
.cards-section-header p {
    font-size: 18px;
    color: #000000;
    line-height: 1.5;
}

/* Grid Layout */
.cards-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
}

/* Individual Card Styling */
.card-item {
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0px 0px 10px 0px #DEDEF9CC;
    overflow: hidden;
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}


/* --- Conditional Layout Logic --- */
/* Default style for 1-3 items */
.card-item {
    flex: 1 1 340px; /* Grow, shrink, with a base size */
    max-width: 380px; /* Max size for 3 items */
}

/* Style for 4+ items */
.cards-grid.has-more-than-three .card-item {
    flex: 1 1 260px; /* Smaller base size for 4 columns */
    max-width: 280px; /* Max size for 4 items */
}

/* Image Wrapper and the White Fade */
.card-image-wrapper {
    position: relative;
    height: 240px;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* The white fade effect */
.card-image-wrapper::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 80%;
    background: linear-gradient(to top, rgba(255, 255, 255, 1) 25%, rgba(255, 255, 255, 0));
}

/* Card Content */
.card-content {
    padding: 20px 30px 30px;
    margin-top: -60px; /* Pulls the text up over the faded area */
    position: relative; /* Ensures it sits on top of the ::after element */
    z-index: 2;
}

.card-content h3 {
    font-size: 23px;
    color: #000000;
    margin-bottom: 10px;
    font-family: 'FAIRE Sprig Sans';
}

.card-content p {
    font-size: 18px;
    color: #000000;
    line-height: 1.5;
}

.home .card-content h3,
.home .card-content p {
    text-align: center;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .cards-grid {
        flex-direction: column;
        align-items: center;
    }

.card-item, .cards-grid.has-more-than-three .card-item {
    width: 100%;
    max-width: 450px;
    min-height: 350px;
}

.card-content {
    padding: 20px;
}

    .cards-section-header h2 {
    font-size: 28px;
}

.cards-section-header p {
    font-size: 16px;
}

.cards-section-header {
    margin-bottom: 40px;
}
.cards-section-header p br {
    display: none;
}

.card-content h3 {
    font-size: 20px;
}
}