/* Fiche d'un deck de cartes : visionneuse du haut (partials/deck-visionneuse.php), grille complète
   (partials/deck-contenu.php), carte en grand ; js/modules/deck-contenu.js */

/* Colonne de gauche élargie : le contenu du deck remplace l'image */
.article-hero--deck .article-hero-visuels {
    flex: 0 0 440px;
    max-width: 440px;
}

.deck-visionneuse {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

/* Chiffres */
.deck-chiffres {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.deck-chiffres li {
    padding: 3px 10px;
    border-radius: var(--radius-small);
    background: var(--beige-clair);
    border: 1px solid var(--beige-fonce);
    font-size: 13px;
    color: var(--encre);
}

.deck-chiffres .deck-chiffres-total {
    padding: 2px 12px;
    background: var(--brun-cuir);
    border-color: var(--brun-cuir);
    color: var(--beige-clair);
    font-family: 'Grandstander', cursive;
    font-size: 17px;
}

/* Onglets par groupe (saisons, invocations) */
.deck-onglets {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.deck-onglet {
    flex: 0 0 auto;
    padding: 4px 12px;
    border: 1px solid var(--beige-fonce);
    border-radius: var(--radius-small);
    background: var(--beige-clair);
    color: var(--encre);
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
}

.deck-onglet small {
    opacity: 0.7;
}

.deck-onglet[aria-selected='true'] {
    background: var(--or);
    border-color: var(--or);
    color: #1c110a;
    font-weight: 700;
}

/* Grande carte */
.deck-scene {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 16px 48px;
    background: var(--beige-fonce);
    border: 2px dashed var(--or-terne);
    border-radius: 12px;
}

.deck-scene-carte {
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}

.deck-scene-carte img {
    display: block;
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.deck-scene.is-paysage .deck-scene-carte img {
    max-width: 100%;
}

.deck-scene-nav {
    position: absolute;
    top: 50%;
    width: 36px;
    height: 36px;
    margin-top: -18px;
    border: 0;
    border-radius: 50%;
    background: var(--beige-clair);
    color: var(--brun-nuit);
    font-size: 26px;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.deck-scene-nav:hover,
.deck-scene-nav:focus-visible {
    background: var(--or);
    color: #1c110a;
}

.deck-scene-precedente {
    left: 6px;
}

.deck-scene-suivante {
    right: 6px;
}

/* Langue pas encore réalisée : cartes montrées dans une autre langue, pour illustrer */
.deck-apercu-langue {
    width: 100%;
    margin: 0 0 14px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--rouille);
    color: var(--white);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
}

.deck-apercu-langue[hidden] {
    display: none;
}

.deck-apercu-titre {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 3px;
    font-weight: 800;
    font-size: 15px;
}

.deck-apercu-drapeau {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 8px 1px 4px;
    border-radius: var(--radius-small);
    background: rgba(255, 255, 255, 0.92);
    color: #2a1c12;
}

.deck-apercu-drapeau img {
    border-radius: 50%;
}

.deck-apercu-texte {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
}

.deck-scene-legende {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 28px;
}

.deck-scene-nom {
    font-family: 'Grandstander', cursive;
    font-size: 18px;
    color: var(--brun-nuit);
}

.deck-scene-position {
    margin-left: auto;
    font-size: 13px;
    color: var(--encre);
    opacity: 0.75;
}

.deck-scene-retourner {
    padding: 2px 10px;
    border: 0;
    border-radius: var(--radius-small);
    background: var(--or);
    color: #1c110a;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.deck-scene-quantite,
.deck-carte-quantite,
.deck-carte-verso {
    padding: 1px 7px;
    border-radius: var(--radius-small);
    background: var(--rouille);
    color: var(--white);
    font-weight: 800;
    font-size: 13px;
}

.deck-scene-quantite[hidden],
.deck-scene-retourner[hidden] {
    display: none;
}

/* Bande des miniatures du groupe */
.deck-bande {
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 2px 2px 8px;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x proximity;
}

.deck-bande li {
    flex: 0 0 64px;
    scroll-snap-align: start;
}

.deck-bande.is-paysage li {
    flex-basis: 96px;
}

.deck-bande-carte {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}

.deck-bande-carte img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.deck-bande-carte:hover,
.deck-bande-carte[aria-current] {
    opacity: 1;
}

.deck-bande-carte[aria-current] {
    border-color: var(--or);
}

.deck-bande-carte .deck-carte-quantite {
    position: absolute;
    right: 2px;
    bottom: 2px;
    padding: 0 5px;
    font-size: 11px;
}

.deck-tout-voir {
    align-self: flex-start;
    font-size: 14px;
    font-weight: 700;
    color: var(--rouille);
}

/* Grille complète, sous le haut de la fiche */
.deck-contenu {
    margin: 0 0 32px;
    padding: 18px 24px;
    background: var(--beige-clair);
    border: 1px solid var(--beige-fonce);
    border-radius: var(--radius-card);
}

.deck-details-entete {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}

.deck-details-entete::-webkit-details-marker {
    display: none;
}

.deck-details-entete h2 {
    margin: 0;
    font-family: 'Grandstander', cursive;
    font-size: 20px;
    color: var(--brun-nuit);
}

.deck-details-bouton {
    padding: 6px 16px;
    border-radius: var(--radius-small);
    background: var(--brun-cuir);
    color: var(--beige-clair);
    font-weight: 700;
}

.deck-details-entete:hover .deck-details-bouton {
    background: var(--brun-nuit);
}

.deck-details-fermer,
.deck-details[open] .deck-details-ouvrir {
    display: none;
}

.deck-details[open] .deck-details-fermer {
    display: inline;
}

.deck-contenu .deck-onglets {
    flex-wrap: wrap;
    margin: 16px 0 4px;
}

.deck-groupe-titre {
    margin: 20px 0 10px;
    font-family: 'Grandstander', cursive;
    font-size: 18px;
    color: var(--brun-nuit);
}

.deck-groupe-titre small {
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    opacity: 0.7;
}

.deck-contenu.has-onglets .deck-groupe-titre {
    display: none;
}

.deck-contenu.has-onglets .deck-groupe {
    padding-top: 14px;
}

.deck-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 14px 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.deck-grille-invocation {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.deck-carte-bouton {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--encre);
    text-align: center;
    cursor: zoom-in;
}

.deck-carte-image {
    position: relative;
    display: block;
    aspect-ratio: 220 / 307;
    border-radius: 6px;
    overflow: hidden;
    background: var(--beige-fonce);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.deck-grille-invocation .deck-carte-image {
    aspect-ratio: 220 / 154;
}

.deck-carte-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.deck-carte-bouton:hover .deck-carte-image,
.deck-carte-bouton:focus-visible .deck-carte-image {
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.deck-carte-image .deck-carte-quantite,
.deck-carte-image .deck-carte-verso {
    position: absolute;
    bottom: 5px;
}

.deck-carte-image .deck-carte-quantite {
    right: 5px;
}

.deck-carte-image .deck-carte-verso {
    left: 5px;
    background: var(--brun-cuir);
}

.deck-carte-nom {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Carte en grand */
.deck-loupe {
    max-width: min(92vw, 520px);
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
}

.deck-loupe::backdrop {
    background: rgba(0, 0, 0, 0.78);
}

.deck-loupe img {
    display: block;
    max-width: 100%;
    max-height: 82vh;
    border-radius: 10px;
}

.deck-loupe-fermer {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: var(--beige-clair);
    color: var(--brun-nuit);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.deck-loupe-retourner {
    display: block;
    margin: 12px auto 0;
    padding: 6px 16px;
    border: 0;
    border-radius: var(--radius-small);
    background: var(--or);
    color: #1c110a;
    font-weight: 700;
    cursor: pointer;
}

.deck-loupe-retourner[hidden] {
    display: none;
}

@media (max-width: 991.98px) {
    .article-hero--deck .article-hero-visuels {
        flex: none;
        max-width: none;
    }
}

@media (max-width: 640px) {
    .deck-scene {
        padding: 12px 40px;
    }

    .deck-contenu {
        padding: 14px 16px;
    }

    .deck-grille {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 10px 8px;
    }

    .deck-grille-invocation {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}
