body {
    display: block;
    padding: 24px;
}

header {
    max-width: 1100px;
    margin: 0 auto 40px;
    text-align: center;
}

header .logo {
    position: static;
    width: 120px;
}

nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
}

nav a, .carte__bouton {
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    background-color: #fff;
    color: #29231c;
    font: inherit;
}

#message {
    text-align: center;
}

.card-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 48px 40px;
    max-width: 1000px;
    margin: 40px auto;
}

.carte {
    width: 300px;
    max-width: 100%;
    perspective: 1000px;
}

.carte__rotation {
    display: grid;
    transform-style: preserve-3d;
    transition: transform 0.6s ease-in-out;
}

.carte--retournee .carte__rotation {
    transform: rotateY(180deg);
}

.carte__recto, .carte__verso {
    grid-area: 1 / 1;
    width: 100%;
    backface-visibility: hidden;
    border-radius: 14px;
}

.carte .toy-card {
    transform: none;
}

/* On réserve la place des statistiques pour ne pas déplacer le plateau au survol. */
.carte__recto {
    position: relative;
    padding-bottom: 86px;
    box-sizing: border-box;
}

.carte .toy-card__unit-stats {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
}

.toy-card__name {
    margin: 0;
}

.image_card {
    max-width: 100%;
    object-fit: contain;
}

.toy-card__description {
    min-height: 60px;
    color: #666;
}

.carte:hover .toy-card, .carte:focus-within .toy-card {
    box-shadow: 12px 12px 2px 1px rgba(26, 26, 35, 0.2);
}

.carte:hover .image_card, .carte:focus-within .image_card {
    transform: translateY(-29px) scale(1.2);
}

.carte:hover .toy-card__unit-stats, .carte:focus-within .toy-card__unit-stats {
    height: 86px;
    opacity: 1;
}

.carte__verso {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #235a94;
    color: #fff;
    transform: rotateY(180deg);
}

.carte__verso img {
    width: 70%;
}

.carte__bouton {
    display: block;
    margin: 16px auto 0;
    cursor: pointer;
}

.carte__bouton:focus-visible, nav a:focus-visible {
    outline: 3px solid #235a94;
    outline-offset: 4px;
}

@media (hover: none) {
    .carte .toy-card__unit-stats {
        height: 86px;
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .carte__rotation, .toy-card, .image_card, .toy-card__unit-stats {
        transition: none;
    }
}
