/* =========================
   CONTENEUR DES CARTES
   ========================= */

#cartes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}


/* =========================
   CARTE
   ========================= */

.carte {
    /* Dimensions de la carte */
    width: 300px;
    height: 420px;
    box-sizing: border-box;

    /* Apparence générale */
    border-radius: 15px;
    border: 5px solid #333;
    padding: 15px;
    font-family: Arial, sans-serif;

    /* Organisation du contenu */
    display: flex;
    flex-direction: column;
    align-items: center;

    /* Positionnement des éléments animés */
    position: relative;
    isolation: isolate;

    /* On conserve le contenu à l'intérieur de la carte */
    overflow: hidden;

    /* Ombre initiale */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);

    /* Couleur par défaut du glow */
    --glow-color: #d35400;
}


/* =========================
   NOM DE LA CARTE
   ========================= */

.carte h2 {
    width: 100%;
    margin: 5px 0 15px 0;

    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: white;

    text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.7);
}


/* =========================
   IMAGE
   ========================= */

.carte img {
    width: 100%;
    height: 270px;

    object-fit: cover;
    border-radius: 10px;
    border: 3px solid rgba(0, 0, 0, 0.5);

    display: block;
}


/* =========================
   RARETÉ AFFICHÉE
   ========================= */

.carte p {
    margin-top: 15px;

    font-size: 20px;
    font-weight: bold;
    color: white;

    text-transform: uppercase;
    text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.7);
}


/* =========================
   COULEURS DES RARETÉS
   ========================= */

/* C = Commune */
.carte.C {
    background: linear-gradient(135deg, #d0d0d0, #808080);
    border-color: #666;
    --glow-color: #b0b0b0;
}

/* R = Rare */
.carte.R {
    background: linear-gradient(135deg, #74c7ff, #246bce);
    border-color: #18549b;
    --glow-color: #42a5ff;
}

/* SR = Super Rare */
.carte.SR {
    background: linear-gradient(135deg, #d58cff, #6c2ca8);
    border-color: #4d1978;
    --glow-color: #ce70ff;
}

/* UR = Ultra Rare */
.carte.UR {
    background: linear-gradient(135deg, #fff3a3, #e5a900);
    border-color: #b98a00;
    --glow-color: #ffdc42;
}

/* L = Légendaire */
.carte.L {
    background: linear-gradient(135deg, #ffcf70, #d35400);
    border-color: #a33f00;
    --glow-color: #ff9d00;
}


/* =========================
   BORDURE ANIMÉE
   ========================= */

/*
   ::before crée une couche colorée.
   Le dégradé conique fait apparaître
   une portion lumineuse qui tourne.
*/

.carte::before {
    content: "";

    position: absolute;
    inset: 0;

    /* La bordure suit les coins arrondis */
    border-radius: inherit;

    /* Dégradé tournant autour de la carte */
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 280deg,
        var(--glow-color) 320deg,
        transparent 360deg
    );

    /*
       L'effet lumineux reste derrière
       le contenu de la carte.
    */
    z-index: -2;

    /* Halo autour de la bordure */
    box-shadow: 0 0 15px var(--glow-color);

    /* Animation continue */
    animation: rotation-glow 4s linear infinite;
}


/* =========================
   FOND INTÉRIEUR DE LA CARTE
   ========================= */

/*
   ::after recouvre le centre du dégradé.
   Il laisse apparaître uniquement une
   fine bande animée sur les bords.
*/

.carte::after {
    content: "";

    position: absolute;

    /* Épaisseur de la bordure lumineuse */
    inset: 5px;

    border-radius: 10px;

    /*
       On reprend le fond de la rareté.
       Le dégradé animé reste visible
       autour de cette couche.
    */
    background: inherit;

    z-index: -1;
}


/* =========================
   ANIMATION DE ROTATION
   ========================= */

@keyframes rotation-glow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}


/* =========================
   EFFET AU SURVOL
   ========================= */

.carte {
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.carte:hover {
    transform: translateY(-5px);

    /* Ombre plus forte au survol */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}
/* =========================
   GLOW ANIMÉ : LÉGENDAIRE UNIQUEMENT
   ========================= */

/*
   La carte légendaire sert de référence
   pour positionner les couches lumineuses.
*/

.carte.L {
    position: relative;
    isolation: isolate;

    /* Couleur du glow */
    --glow-color: #ff9d00;
}


/* =========================
   BORDURE LUMINEUSE ANIMÉE
   ========================= */

/*
   Le ::before crée un grand dégradé circulaire.
   Sa rotation fait tourner la lumière autour
   de la carte.
*/

.carte.L::before {
    content: "";

    position: absolute;

    /*
       On agrandit le dégradé pour que sa rotation
       soit visible sur tout le contour.
    */
    width: 200%;
    height: 200%;

    top: -50%;
    left: -50%;

    border-radius: inherit;

    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 250deg,
        #ff6a00 285deg,
        #fff3b0 305deg,
        #ff9d00 325deg,
        transparent 350deg,
        transparent 360deg
    );

    /*
       Le pseudo-élément est placé derrière
       le contenu de la carte.
    */
    z-index: -2;

    /* Rotation permanente */
    animation: legendary-rotation 2.5s linear infinite;
}


/* =========================
   FOND INTÉRIEUR
   ========================= */

/*
   Cette couche masque le centre du dégradé.
   Elle laisse seulement apparaître la bordure.
*/

.carte.L::after {
    content: "";

    position: absolute;

    /*
       Épaisseur de la bordure lumineuse.
       Plus cette valeur est élevée,
       plus la bordure est épaisse.
    */
    inset: 4px;

    border-radius: 9px;

    /* Même fond que la carte légendaire */
    background: linear-gradient(
        135deg,
        #ffcf70,
        #d35400
    );

    z-index: -1;

    /*
       Ombre lumineuse interne :
       elle renforce la sensation de lumière.
    */
    box-shadow:
        inset 0 0 8px #ff9d00,
        inset 0 0 16px rgba(255, 157, 0, 0.6);
}


/* =========================
   HALO AUTOUR DE LA CARTE
   ========================= */

/*
   Le halo extérieur est créé par une ombre.
   Il ne s'applique qu'aux cartes légendaires.
*/

.carte.L {
    box-shadow:
        0 0 8px #ff9d00,
        0 0 20px rgba(255, 157, 0, 0.9),
        0 0 40px rgba(255, 106, 0, 0.65),
        0 5px 15px rgba(0, 0, 0, 0.3);
}


/* =========================
   ANIMATION DE ROTATION
   ========================= */

@keyframes legendary-rotation {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}


/* =========================
   SURVOL DES CARTES
   ========================= */

/* Toutes les cartes se soulèvent au survol */
.carte {
    transition: transform 0.2s ease;
}

.carte:hover {
    transform: translateY(-5px);
}

/* Halo renforcé uniquement sur la légendaire */
.carte.L:hover {
    box-shadow:
        0 0 12px #ffb52e,
        0 0 28px #ff9d00,
        0 0 55px rgba(255, 106, 0, 0.85),
        0 10px 25px rgba(0, 0, 0, 0.4);
}

/* =========================
   EFFET SHINE : LÉGENDAIRE
   ========================= */

/*
   Couche lumineuse qui traverse la carte.
   Elle est invisible au départ, puis une
   bande blanche et dorée passe en diagonale.
*/

.carte.L .shine-overlay {
    position: relative;
    inset: 0;

    /* La bande lumineuse en diagonale */
    background: linear-gradient(
        115deg,
        transparent 25%,
        rgba(255, 255, 255, 0.03) 35%,
        rgba(255, 244, 200, 0.75) 48%,
        rgba(255, 255, 255, 0.15) 53%,
        transparent 65%
    );

    /* La bande dépasse la carte pour entrer et sortir */
    background-size: 250% 250%;
    background-position: 200% 200%;

    /* Au-dessus de l'image, sans bloquer les clics */
    z-index: 4;
    pointer-events: none;

    /* Animation continue */
    animation: legendary-shine 9s ease-in-out infinite;
}


/* =========================
   ANIMATION DU REFLET
   ========================= */

@keyframes legendary-shine {
    0%, 15% {
        background-position: 200% 200%;
    }

    65%, 100% {
        background-position: -100% -100%;
    }
}


/* =========================
   CONTENU AU-DESSUS DU SHINE
   ========================= */

/*
   Le titre et la rareté restent lisibles
   lorsque le reflet traverse la carte.
*/

.carte.L h2,
.carte.L p {
    position: relative;
    z-index: 5;
}

/* =========================
   BADGE DE QUANTITÉ (collection)
   ========================= */

.carte-quantite {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    padding: 2px 10px;
    border-radius: 12px;
    background: rgba(17, 24, 39, 0.85);
    color: #fbbf24;
    font-weight: bold;
}
