@import url("https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Montserrat:wght@700&display=swap");

:root {
    /* Colors */
    --brand-color: #ff5757;
    --black: hsl(0, 0%, 0%);
    --white: hsl(0, 0%, 100%);
    /* Fonts */
    --font-title: "Montserrat", sans-serif;
    --font-text: "Lato", sans-serif;
}

/* RESET */

/* Box sizing rules */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Remove default margin */
body,
h2,
p {
    margin: 0;
}

/* GLOBAL STYLES */
/* body {
    display: grid;
    place-items: center;
    height: 100vh;
} */

h2 {
    font-size: 1.6rem;
    font-family: var(--font-title);
    color: var(--white);
    line-height: 1.1;
}

p {
    font-family: var(--font-text);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--white);
}

.flow>*+* {
    margin-top: var(--flow-space, 1em);
}

/* CARD COMPONENT */

.cardZoom {
    display: grid;
    place-items: center;
    width: 80vw;
    max-width: 21.875rem;
    max-height: 21.875rem;
    height: 21.875rem;
    overflow: hidden;
    border-radius: 0.625rem;
    box-shadow: 0.25rem 0.25rem 0.5rem rgba(0, 0, 0, 0.25);
}

.cardZoom>* {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.card__background {
    object-fit: cover;
    max-width: 100%;
    height: 100%;
}

.card__content {
    --flow-space: 0.9375rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-self: flex-end;
    height: 55%;
    padding: 12% 1.25rem 1.875rem;
    background: linear-gradient(180deg,
            hsla(0, 0%, 0%, 0) 0%,
            hsla(0, 0%, 0%, 0.3) 10%,
            hsl(0, 0%, 0%) 100%);
}

.card__content--container {
    --flow-space: 1.25rem;
}

.card__title {
    position: relative;
    width: fit-content;
    color: #fff;
    font-weight: bold;
    width: -moz-fit-content;
    /* Prefijo necesario para Firefox  */
}

.card__title::after {
    content: "";
    position: absolute;
    height: 0.3125rem;
    width: calc(100% + 1.25rem);
    bottom: calc((1.25rem - 0.5rem) * -1);
    left: -1.25rem;
    background-color: var(--brand-color);
}

.card__button {
    padding: 0.75em 1.6em;
    width: fit-content;
    width: -moz-fit-content;
    /* Prefijo necesario para Firefox  */
    font-variant: small-caps;
    font-weight: bold;
    border-radius: 0.45em;
    border: none;
    background-color: var(--brand-color);
    font-family: var(--font-title);
    font-size: 1.125rem;
    color: var(--black);
}

.card__button:focus {
    outline: 2px solid black;
    outline-offset: -5px;
}

@media (any-hover: hover) and (any-pointer: fine) {
    .card__content {
        transform: translateY(62%);
        transition: transform 500ms ease-out;
        transition-delay: 500ms;
    }

    .card__title::after {
        opacity: 0;
        transform: scaleX(0);
        transition: opacity 1000ms ease-in, transform 500ms ease-out;
        transition-delay: 500ms;
        transform-origin: right;
    }

    .card__background {
        transition: transform 500ms ease-in;
    }

    .card__content--container> :not(.card__title),
    .card__button {
        opacity: 0;
        transition: transform 500ms ease-out, opacity 500ms ease-out;
    }

    .cardZoom:hover,
    .cardZoom:focus-within {
        transform: scale(1.05);
        transition: transform 500ms ease-in;
    }

    .cardZoom:hover .card__content,
    .cardZoom:focus-within .card__content {
        transform: translateY(0);
        transition: transform 500ms ease-in;
    }

    .cardZoom:focus-within .card__content {
        transition-duration: 0ms;
    }

    .cardZoom:hover .card__background,
    .cardZoom:focus-within .card__background {
        transform: scale(1.3);
    }

    .cardZoom:hover .card__content--container> :not(.card__title),
    .cardZoom:hover .card__button,
    .cardZoom:focus-within .card__content--container> :not(.card__title),
    .cardZoom:focus-within .card__button {
        opacity: 1;
        transition: opacity 500ms ease-in;
        transition-delay: 1000ms;
    }

    .cardZoom:hover .card__title::after,
    .cardZoom:focus-within .card__title::after {
        opacity: 1;
        transform: scaleX(1);
        transform-origin: left;
        transition: opacity 500ms ease-in, transform 500ms ease-in;
        transition-delay: 500ms;
    }
}

.card-container {
    display: flex;
    /* Utiliser flexbox pour aligner horizontalement les cartes */
    flex-wrap: wrap;
    /* Permettre aux cartes de passer à la ligne lorsque l'espace est insuffisant */
    justify-content: space-around;
    /* Espacement égal entre les cartes avec de l'espace autour */
}

.cardZoom {
    flex: 0 0 calc(33.33% - 20px);
    /* Définir la largeur de chaque carte avec un espacement entre elles */
    margin-bottom: 20px;
    /* Espacement entre les cartes */
    border: 1px solid #ccc;
    /* Bordure autour de chaque carte */
    box-sizing: border-box;
    /* Inclure la bordure dans la largeur de la carte */
}

/* Styles pour le contenu de la carte */
.card__content {
    padding: 20px;
    /* Espacement intérieur du contenu de la carte */
}

/* Styles pour le bouton de la carte */
.card__button {
    display: block;
    /* Faire en sorte que le bouton prenne toute la largeur disponible */
    margin-top: 10px;
    /* Espacement entre le contenu de la carte et le bouton */
}

@media screen and (max-width: 768px) {
    .cardZoom {
        flex: 0 0 calc(50% - 20px);
        /* Pour deux cartes par ligne sur les écrans de taille moyenne */
    }
}

@media screen and (max-width: 576px) {
    .cardZoom {
        flex: 0 0 calc(100% - 20px);
        /* Pour une carte par ligne sur les petits écrans */
    }
}