/* ==== CSS variables to tweak layout ==== */
:root {
    --card-min-width: 220px;     /* min width of each card */
    --card-gap: 24px;            /* space between cards */
    --card-padding: 16px;        /* inner padding of cards */
    --card-icon-size: 10vmin;      /* image size */
}

/* ==== Grid container ==== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--card-min-width, 220px), 1fr));
    gap: var(--card-gap, 24px);
    justify-items: center; /* centers cards in leftover space if fewer per row */
    margin-left: 10%;
    width: 80%;
}

/* ==== Card link wrapper ==== */
.card-link {
    display: block;
    width: 100%;  /* important: fills the grid cell */
    text-decoration: none;
    color: inherit;
}

/* ==== Card ==== */
.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    background-color: color-mix(
            in srgb,
            var(--bs-body-bg) 85%,
            black 15%
    );
    border-color: var(--bs-border-color);
    transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    cursor: pointer;

    width: 100%; /* now card fills its slot completely */
    padding: var(--card-padding, 16px);
    box-sizing: border-box;
}

/* ==== Hover / Active ==== */
.card-link:hover .card {
    background-color: color-mix(
            in srgb,
            var(--bs-body-bg) 75%,
            black 25%
    );
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

.card-link:active .card {
    background-color: color-mix(
            in srgb,
            var(--bs-body-bg) 65%,
            black 35%
    );
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
}

/* ==== Card content ==== */
.card-icon {
    width: var(--card-icon-size, 64px);
    height: var(--card-icon-size, 64px);
    object-fit: contain;
}

.card-title {
    color: var(--bs-body-color);
    text-align: center;
    margin-top: 12px;
}

/* ==== Optional responsive tweaks ==== */
@media (max-width: 992px) {
    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 576px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}
