/* ----------------- Card Container ----------------- */
.card-container {
    display: flex;
    gap: 16px;
    flex-wrap: wrap; /* Allow cards to wrap on smaller screens */
    justify-content: left;
    padding: 3rem 5rem;
}

/* ----------------- Cards Components ----------------- */

.card {
    width: 100%;
    min-width: 300px; 
    max-width: 500px;
    min-height: 350px;
    display: flex;
    flex: 1 1 calc(33.333% - 16px);
    flex-direction: column;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
    color: white;
}

.imageCard {
    width: 100%;          /* Ensures image takes up full width of card */
    height: 100%;          /* Keep image height consistent at 60% of card height */
    object-fit: cover ;     /* Ensures image covers the space without stretching */
    border-radius: 15px;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    border-radius: 20px;
    transition: all 0.3s ease-in-out;
}

.card:hover::before {
    background: rgba(0, 0, 0, 0.6);
}

/* ----------------- Text and Buttons ----------------- */
.buttons-container,
.text-container {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    position: absolute;
    z-index: 1;
}

.text-container {
    line-height: 20px; /* adjust text line height */
    bottom: 2.5rem;
    padding: 0.5rem 1.2rem;
    transform: translateY(100%); /* Initially position the text offscreen */
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    flex-grow: 1; /* Allow the text container to grow */
}

.buttons-container {
    cursor: pointer;
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    transform: translateX(100%);
    display: flex;
    flex-direction: row;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.card:hover .text-container,
.card:hover .buttons-container {
    opacity: 1;
    visibility: visible;
    transform: translateY(0); /* Move the text into place */
}

/* ----------------- Tag Labels ----------------- */
.card-tags {
    display: flex;
    flex-wrap: wrap; /* Allow tags to wrap onto the next line */
    gap: 0.25rem; /* Adds spacing between tags */
    width: 100%; /* Ensures that it doesn't overflow the card */
    box-sizing: border-box; /* Ensures padding doesn't affect width */
    margin-bottom: 1rem;
}

.tag-label {
    background-color: coral;
    border-radius: 5px;
    padding: 0px 5px;
    line-height: 1.2rem;
    font-size: 0.8em;
    white-space: nowrap; /* Prevents text from breaking inside the tag */
    max-width: 100%; /* Ensures the label doesn't exceed card width */
    overflow: hidden; /* Hides any overflow */
    text-overflow: ellipsis; /* Optionally adds ellipsis for long tags */
}

/* ----------------- Buttons ----------------- */
a:link {text-decoration:none;}

.buttons-container>a {
    font-size: small;
    border-radius: 6px;
    padding: 1em 1em;
    width: auto;
    height: 0px;
    border: none;
    margin-right: 5px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease-in-out;
    background-color: white;
    color: #333;
}

.buttons-container>a:hover {
    background-color: orangered;
    color: white;
}

/* ----------------- Media Queries ----------------- */

@media (max-width: 764px) {
    .card-container {
        padding: 20vh 1rem;
    }

    .card {
        height: 350px; /* Set height to a smaller value on smaller screens */
        /* min-width: unset; */
        min-width: 260px;
    }

    .imageCard {
        height:100%; /* Keep image at 60% of card height */
    }

    .buttons-container {
        bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .card-container {
        padding: 20vh 0.5rem;
    }

    .card {
        height: 300px; /* Adjust for very small screens */
        width: 100%; /* Ensure cards stack in smaller screens */
    }

    .imageCard {
        height: 100%; /* Adjust image height */
        width: 100%; /* Ensure image covers the full width */
    }

    .text-container {
        bottom: 3rem;
        line-height: 1.3em;
        transform: translateY(100%);
        transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    }

    .buttons-container {
        bottom: 1rem;
    }

    .buttons-container>a {
        padding: 0.8em;
        margin-right: 5px;
    }
}