/* ═══════════════════════════════════════════
   DragonsMag — encyclopedie.css
   Dépend de base.css
   Couvre : accueil wiki + listes produits
═══════════════════════════════════════════ */

/* Conteneur des pages de liste (index alphabétique) — même largeur/marges que .page-serie
   (wiki_serie.css), pour éviter le rendu bord à bord. **correctif** : cette règle n'existait pas
   du tout, .page-encyclopedie n'ayant aucune contrainte de largeur dans aucun fichier CSS v3 —
   affecte toutes les pages qui utilisent cette classe (bdtv/index, profils/index, produits/index,
   card/decks), pas seulement decks.tpl. */
.page-encyclopedie {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

/* ════════════════════════════════════════════
   BANNIÈRE D'INTRODUCTION (accueil wiki)
════════════════════════════════════════════ */
.wiki-banner {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--r);
    padding: 20px;
    margin-bottom: 16px;
}

.wiki-banner-logo {
    width: 100px;
    height: 100px;
    border-radius: var(--r);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg3);
    border: 1px solid var(--border2);
}
.wiki-banner-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wiki-banner-content { flex: 1; min-width: 0; }

.wiki-banner-title {
    font-family: var(--fh);
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: .3px;
}
.wiki-banner-title span { color: var(--accent3); }

.wiki-banner-desc {
    font-family: var(--fb);
    font-size: 13px;
    color: var(--text2);
    line-height: 1.7;
}

.wiki-banner-desc a {
    color: var(--accent3);
    text-decoration: none;
    border-bottom: 1px solid rgba(188,61,122,.3);
    transition: border-color .15s;
}
.wiki-banner-desc a:hover { border-color: var(--accent3); }

/* ════════════════════════════════════════════
   BLOCS DE CATÉGORIE (accueil wiki)
════════════════════════════════════════════ */
.wiki-category-bloc {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    margin-bottom: 14px;
}

.wiki-category-head {
    background: var(--accent);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wiki-category-head-title {
    font-family: var(--fh);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .3px;
}

/* Message d'information dans une catégorie */
.wiki-category-notice {
    padding: 12px 16px;
    font-family: var(--fb);
    font-size: 13px;
    color: var(--text2);
    line-height: 1.6;
}
.wiki-category-notice a {
    color: var(--accent3);
    text-decoration: none;
}
.wiki-category-notice a:hover { text-decoration: underline; }

/* Grille de sous-catégories */
.wiki-subcats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 2px;
    padding: 2px;
}

.wiki-subcat-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    background: var(--bg3);
    aspect-ratio: 16/9;
    display: block;
}

.wiki-subcat-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
    filter: brightness(.75) saturate(.9);
}
.wiki-subcat-card:hover img {
    transform: scale(1.06);
    filter: brightness(.85) saturate(1);
}

.wiki-subcat-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(26,7,15,.85) 0%,
        rgba(26,7,15,.3) 60%,
        transparent 100%
    );
    transition: opacity .2s;
}

.wiki-subcat-label {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 14px 14px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wiki-subcat-icon {
    font-size: 14px;
    opacity: .8;
    flex-shrink: 0;
}

.wiki-subcat-name {
    font-family: var(--fh);
    font-size: 15px;
    font-weight: 700;
    color: var(--accent3);
    text-shadow: 0 1px 6px rgba(0,0,0,.6);
    transition: color .2s;
}
.wiki-subcat-card:hover .wiki-subcat-name { color: #fff; }

/* Variante "badge" de .wiki-subcat-name : petit encadré bordeaux semi-transparent derrière le
   nom (au lieu du texte bordeaux seul, peu lisible sur certaines images) + police réduite, pour
   les grilles à noms potentiellement longs (decks, DLC, autres versions sur produits/view.tpl).
   Cumulée à .wiki-subcat-name (garde font-family/weight), pas un remplacement global : les autres
   usages de .wiki-subcat-name (ex: catégories sur l'accueil) restent inchangés. */
.wiki-subcat-name-badge {
    display: inline-block;
    font-size: 12px;
    color: #fff;
    text-shadow: none;
    background: rgba(116,27,71,.55);
    border: 1px solid rgba(188,61,122,.5);
    padding: 3px 9px;
    border-radius: 5px;
}

/* Variante "légende sous la vignette" de .wiki-subcat-card : le nom n'est plus en surimpression
   sur l'image (moins lisible selon l'image) mais dans une bande sous la vignette. Scopée à une
   classe séparée pour ne pas modifier .wiki-subcat-card de base (utilisé tel quel ailleurs, ex.
   catégories de l'accueil). Utilisée sur produits/view.tpl : decks, DLC, autres versions. */
.wiki-subcat-card-stack {
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}
.wiki-subcat-card-stack .wiki-subcat-thumb {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--bg4);
}
.wiki-subcat-card-stack .wiki-subcat-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
    filter: brightness(.9) saturate(.95);
}
.wiki-subcat-card-stack:hover .wiki-subcat-thumb img {
    transform: scale(1.06);
    filter: brightness(1) saturate(1);
}
.wiki-subcat-card-stack .wiki-subcat-caption {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-align: center;
}
.wiki-subcat-card-stack .wiki-subcat-name-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Liens outils */
.wiki-tool-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wiki-tool-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text2);
    font-family: var(--fb);
    font-size: 12px;
    transition: background .12s, color .12s;
}
.wiki-tool-item a:hover {
    background: var(--accent-bg);
    color: var(--accent3);
}

.wiki-tool-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}
.wiki-tool-icon img { width: 100%; height: 100%; object-fit: cover; }

/* Derniers ajouts */
.wiki-recent-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.wiki-recent-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
}
.wiki-recent-item:last-child { border-bottom: none; }

.wiki-recent-item a {
    font-family: var(--fb);
    font-size: 12px;
    color: var(--text2);
    text-decoration: none;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .12s;
}
.wiki-recent-item a:hover { color: var(--accent3); }

.wiki-recent-icon {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}
.wiki-recent-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ════════════════════════════════════════════
   NAVIGATION ALPHABÉTIQUE (liste produits)
════════════════════════════════════════════ */
.alpha-nav {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 10px 14px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
}

.alpha-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 28px;
    padding: 0 6px;
    border-radius: 5px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text3);
    font-family: var(--fm);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all .12s;
    cursor: pointer;
}
.alpha-btn:hover {
    background: var(--bg3);
    color: var(--text);
    border-color: var(--border2);
}
.alpha-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.alpha-btn.all {
    background: var(--bg3);
    color: var(--text2);
    border-color: var(--border2);
    margin-left: 4px;
    padding: 0 10px;
}
.alpha-btn.all:hover,
.alpha-btn.all.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Barre de recherche */
.alpha-search {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: var(--r);
    padding: 4px 10px;
    transition: border-color .15s;
}
.alpha-search:focus-within { border-color: var(--accent2); }

.alpha-search input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--fb);
    font-size: 13px;
    padding: 0;
    width: 160px;
}
.alpha-search input::placeholder { color: var(--text3); }

.alpha-search svg {
    width: 14px;
    height: 14px;
    color: var(--text3);
    flex-shrink: 0;
}

/* Filtre secondaire par liste déroulante (ex: série/couleur pour les decks de cartes) */
.wiki-filter-select {
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: var(--r);
    padding: 5px 8px;
    color: var(--text2);
    font-family: var(--fb);
    font-size: 12px;
    cursor: pointer;
    transition: border-color .15s;
}
.wiki-filter-select:focus { outline: none; border-color: var(--accent2); }

/* ════════════════════════════════════════════
   GRILLE DE PRODUITS (liste alphabétique)
════════════════════════════════════════════ */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 3px;
    margin-bottom: 16px;
}

.product-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 10px 10px;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    position: relative;
    overflow: hidden;
}
.product-card:hover {
    background: var(--bg3);
    border-color: var(--accent2);
}

/* Trait coloré en haut */
.product-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .25s ease;
}
.product-card:hover::before { transform: scaleX(1); }

.product-card-titles {
    text-align: center;
    margin-bottom: 10px;
    min-height: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    width: 100%;
}

.product-card-name {
    font-family: var(--fb);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent3);
    line-height: 1.3;
    transition: color .15s;
}
.product-card:hover .product-card-name { color: var(--text); }

.product-card-original {
    font-family: var(--fb);
    font-size: 11px;
    color: var(--text3);
    line-height: 1.3;
}

/* Mosaïque d'images */
.product-card-mosaic {
    width: 100%;
    display: grid;
    gap: 2px;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    background: var(--bg4);
}

/* 1 image */
.product-card-mosaic.imgs-1 { grid-template-columns: 1fr; }

/* 2 images */
.product-card-mosaic.imgs-2 { grid-template-columns: 1fr 1fr; }

/* 3 images */
.product-card-mosaic.imgs-3 { grid-template-columns: 1fr 1fr; }
.product-card-mosaic.imgs-3 .mosaic-img:first-child { grid-row: 1 / 3; }

/* 4 images */
.product-card-mosaic.imgs-4 { grid-template-columns: 1fr 1fr; }

.mosaic-img {
    overflow: hidden;
    background: var(--bg4);
}
.mosaic-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease, filter .35s;
    filter: brightness(.85);
}
.product-card:hover .mosaic-img img {
    transform: scale(1.04);
    filter: brightness(1);
}

/* ════════════════════════════════════════════
   PAGINATION (partagée)
════════════════════════════════════════════ */
.wiki-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-top: 4px;
}

.wiki-pagination-info {
    font-family: var(--fb);
    font-size: 13px;
    font-weight: 600;
    color: var(--text2);
    text-align: center;
    flex: 1;
}

.wiki-pagination-btns {
    display: flex;
    gap: 6px;
}

/* ════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════ */
@media (max-width: 1100px) {
    .wiki-subcats-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 900px) {
    .wiki-banner { flex-direction: column; text-align: center; }
    .wiki-banner-logo { width: 80px; height: 80px; }
}

@media (max-width: 640px) {
    .products-grid { grid-template-columns: repeat(2, 1fr); }
    .alpha-nav { gap: 1px; padding: 8px 10px; }
    .alpha-btn { min-width: 24px; height: 24px; font-size: 11px; }
    .alpha-search { display: none; }
    .wiki-subcats-grid { grid-template-columns: repeat(2, 1fr); }
}
