/* Wiki Cobblemon Trinity — mise en page (s'appuie sur tokens.css + composants.css du site) */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body { margin: 0; font-family: var(--font-sans); font-size: 16px; line-height: 26px; background: var(--surface); color: var(--encre); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: var(--texte-bleu); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
.conteneur { width: min(1160px, 100% - 2 * var(--space-6)); margin-inline: auto; }
.visuellement-cache { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lien-evitement { position: absolute; left: var(--space-4); top: -100px; z-index: 100; }
.lien-evitement:focus { top: var(--space-4); }
code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-creux); border: 1px solid var(--trait); border-radius: 6px; padding: 1px 6px; word-break: break-word; }
kbd { display: inline-block; min-width: 26px; text-align: center; font-family: var(--font-sans); font-weight: 700; font-size: 13px; line-height: 20px; padding: 1px 7px; background: var(--surface-relief); color: var(--encre); border: 2px solid var(--trait); border-bottom-width: 4px; border-radius: 7px; white-space: nowrap; }
h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: .01em; }
h2 { font-size: 30px; line-height: 36px; margin: var(--space-12) 0 var(--space-4); }
h3 { font-size: 21px; line-height: 26px; margin: var(--space-6) 0 var(--space-2); }
.mini-ic { display: inline-block; vertical-align: -4px; image-rendering: pixelated; }

/* ---------- Navigation ---------- */
.ct-nav { position: sticky; top: 0; z-index: 50; }
.ct-nav__marque img { width: 40px; height: 40px; }
.ct-nav__liens { flex-wrap: wrap; }
.nav__droite { display: flex; align-items: center; gap: var(--space-3); }
.nav__theme, .nav__recherche { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; min-width: 40px; border-radius: var(--radius-sm); border: var(--trait-fin) solid var(--trait); background: var(--surface-relief); color: var(--encre); cursor: pointer; font: inherit; font-weight: 500; padding: 0 10px; }
.nav__recherche { padding: 0 8px 0 12px; color: var(--encre-douce); }
.nav__recherche:hover, .nav__theme:hover { background: var(--surface-creux); }
.nav__recherche kbd { font-size: 11px; line-height: 16px; min-width: 20px; padding: 0 5px; border-bottom-width: 2px; }
.nav__theme svg, .nav__recherche svg { width: 20px; height: 20px; flex: none; }
.nav__theme .icone-lune { display: none; }
[data-theme="nuit"] .nav__theme .icone-soleil { display: none; }
[data-theme="nuit"] .nav__theme .icone-lune { display: block; }
@media (max-width: 1100px) { .marque-nom { display: none; } }
@media (max-width: 900px) {
  .ct-nav { flex-wrap: wrap; gap: var(--space-2) var(--space-4); padding: var(--space-2) var(--space-4); }
  .ct-nav__liens { order: 3; width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; }
  .ct-nav__lien { white-space: nowrap; }
  .nav__droite { margin-left: auto; }
  .nav__recherche span, .nav__recherche kbd { display: none; }
}

/* ---------- En-tête de page ---------- */
.page-entete { background: linear-gradient(var(--coupe-angle), var(--rose-pastel) 0 calc(50% - var(--coupe-bande) / 2), var(--halo) calc(50% - var(--coupe-bande) / 2) calc(50% + var(--coupe-bande) / 2), var(--ciel-pastel) calc(50% + var(--coupe-bande) / 2) 100%); border-bottom: var(--trait-sticker) solid var(--contour); padding: var(--space-12) 0 var(--space-8); }
[data-theme="nuit"] .page-entete { background: linear-gradient(var(--coupe-angle), var(--rouge-ombre) 0 calc(50% - var(--coupe-bande) / 2), #3a3242 calc(50% - var(--coupe-bande) / 2) calc(50% + var(--coupe-bande) / 2), var(--bleu-fort) calc(50% + var(--coupe-bande) / 2) 100%); }
.page-titre { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 52px; line-height: 56px; color: var(--contour); text-shadow: 3px 3px 0 var(--halo); }
[data-theme="nuit"] .page-titre { color: var(--halo); text-shadow: 3px 3px 0 var(--contour); }
.page-corps { padding: var(--space-8) 0 var(--space-16); max-width: 1160px; }
.chapo { font-size: 18px; line-height: 29px; color: var(--encre-douce); max-width: 70ch; }
.page-corps > p, .page-corps > ul, .page-corps > ol, .bloc > p, .bloc > ul, .bloc > ol { max-width: 78ch; }
.astuce { background: var(--teinte-or); color: var(--encre); border: var(--trait-fin) solid var(--or); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); max-width: 78ch; }
.astuce::before { content: "★ "; color: var(--texte-or); font-weight: 700; }
.note { color: var(--encre-douce); font-size: 14px; max-width: 78ch; }

/* ---------- Accueil ---------- */
.accueil .page-corps { padding-top: var(--space-12); }
.accueil-heros { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--space-12); align-items: center; margin-bottom: var(--space-12); }
.accueil-titre { margin: var(--space-3) 0 0; font-family: var(--font-display); font-weight: 400; font-size: 68px; line-height: 70px; }
.accueil-heros__visuel { aspect-ratio: 4 / 3; border: var(--trait-sticker) solid var(--contour); border-radius: var(--radius-lg); box-shadow: var(--ombre-sticker-lg); display: grid; place-items: center; }
.accueil-heros__visuel img { width: 45%; height: auto; filter: drop-shadow(0 6px 0 rgba(22, 18, 26, .3)); }
.accueil-recherche { margin-top: var(--space-4); }
.grille-accueil { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.tuile { text-decoration: none; transition: transform .08s ease, box-shadow .08s ease; }
.tuile:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 0 var(--contour); }
.tuile .ct-card__entete { height: 64px; }
@media (max-width: 860px) { .accueil-heros { grid-template-columns: 1fr; } .accueil-heros__visuel { display: none; } .grille-accueil { grid-template-columns: 1fr 1fr; } .accueil-titre { font-size: 48px; line-height: 52px; } }
@media (max-width: 560px) { .grille-accueil { grid-template-columns: 1fr; } .page-titre { font-size: 38px; line-height: 42px; } }

/* ---------- Cartes génériques ---------- */
.cartes-2, .cartes-3 { display: grid; gap: var(--space-4); margin: var(--space-4) 0; }
.cartes-2 { grid-template-columns: repeat(2, 1fr); }
.cartes-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .cartes-2, .cartes-3 { grid-template-columns: 1fr; } }
.carte-lien { text-decoration: none; }
.carte-lien:hover { border-color: var(--contour); background: var(--surface-creux); }
.ct-card__corps .ct-card__titre { font-size: 21px; }
.faction { overflow: hidden; }
.faction__bande { height: 10px; border-bottom: var(--trait-fin) solid var(--trait); }
.etapes { padding-left: 0; list-style: none; counter-reset: e; display: grid; gap: var(--space-3); }
.etapes li { counter-increment: e; position: relative; padding-left: 48px; }
.etapes li::before { content: counter(e); position: absolute; left: 0; top: 0; width: 32px; height: 32px; display: grid; place-items: center; font-family: var(--font-display); font-size: 18px; background: var(--or-clair); color: var(--contour); border: var(--trait-fin) solid var(--contour); border-radius: 50%; }
.liste-serree { padding-left: 20px; margin: 0; display: grid; gap: 6px; color: var(--encre-douce); }
.sommaire { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-6) 0; }
.sommaire a { text-decoration: none; font-weight: 700; color: var(--encre); background: var(--surface-relief); border: var(--trait-fin) solid var(--trait); border-radius: var(--radius-pill); padding: 4px 14px; }
.sommaire a:hover { background: var(--teinte-or); border-color: var(--or); }
.bloc { border-top: var(--trait-fin) dashed var(--trait); margin-top: var(--space-8); }
.bloc:first-of-type { border-top: none; }
.pieces, .fossiles { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-4) 0; }
.piece { display: grid; justify-items: center; gap: 2px; min-width: 130px; padding: var(--space-3) var(--space-4); background: var(--surface-relief); border: var(--trait-sticker) solid var(--trait); border-radius: var(--radius-md); box-shadow: var(--ombre-sticker); }
.piece img { width: 40px; height: 40px; image-rendering: pixelated; }
.piece span { font-size: 13px; color: var(--encre-douce); }
.fossile { display: flex; gap: var(--space-3); align-items: center; flex: 1 1 240px; padding: var(--space-3) var(--space-4); background: var(--surface-relief); border: var(--trait-fin) solid var(--trait); border-radius: var(--radius-md); }
.fossile img { image-rendering: pixelated; flex: none; }
.fossile div { display: grid; }
.fossile span { font-size: 14px; color: var(--encre-douce); line-height: 20px; }
.fossile--jackpot { border-color: var(--or); background: var(--teinte-or); }
.tableau { border-collapse: separate; border-spacing: 0; width: 100%; max-width: 820px; border: var(--trait-fin) solid var(--trait); border-radius: var(--radius-md); overflow: hidden; margin: var(--space-3) 0 var(--space-6); }
.tableau th, .tableau td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--trait); vertical-align: top; }
.tableau th { background: var(--surface-creux); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.tableau tr:last-child td { border-bottom: none; }
.tableau tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-creux) 45%, transparent); }
.tableau-defile { overflow-x: auto; }
.tableau-defile .tableau { max-width: none; }
.faq { background: var(--surface-relief); border: var(--trait-fin) solid var(--trait); border-radius: var(--radius-md); padding: 0 var(--space-4); margin-bottom: var(--space-2); max-width: 820px; }
.faq summary { cursor: pointer; font-weight: 700; padding: var(--space-3) 0; }
.faq p { margin-top: 0; color: var(--encre-douce); }

/* ---------- Règlement ---------- */
.regles { list-style: none; padding: 0; display: grid; gap: var(--space-3); max-width: 860px; }
.regle { display: flex; gap: var(--space-4); align-items: flex-start; background: var(--surface-relief); border: var(--trait-fin) solid var(--trait); border-radius: var(--radius-md); padding: var(--space-4); }
.regle__n { flex: none; width: 40px; height: 40px; display: grid; place-items: center; font-family: var(--font-display); font-size: 20px; background: var(--or-clair); color: var(--contour); border: var(--trait-fin) solid var(--contour); border-radius: var(--radius-sm); }
.regle h3 { margin: 4px 0 4px; }
.regle p { margin: 0 0 6px; color: var(--encre-douce); }
.regle ul { margin: 0; color: var(--encre-douce); }
.sanctions { margin-top: var(--space-8); max-width: 860px; background: var(--teinte-rouge); border: var(--trait-fin) solid var(--rouge); border-radius: var(--radius-md); padding: 0 var(--space-6) var(--space-2); }
.sanctions h2 { margin-top: var(--space-4); font-size: 24px; }

/* ---------- Mods ---------- */
.filtres { display: grid; gap: var(--space-3); margin: var(--space-6) 0; position: sticky; top: 64px; z-index: 5; background: var(--surface); padding: var(--space-3) 0; }
.filtres .ct-input { max-width: 520px; width: 100%; }
.puces { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.puce { font: inherit; font-size: 14px; font-weight: 700; color: var(--encre); background: var(--surface-relief); border: var(--trait-fin) solid var(--trait); border-radius: var(--radius-pill); padding: 3px 12px; cursor: pointer; }
.puce span { color: var(--encre-douce); font-weight: 500; }
.puce[aria-pressed="true"] { background: var(--or-clair); color: var(--contour); border-color: var(--contour); }
.puce[aria-pressed="true"] span { color: var(--contour); }
.cat-titre { display: flex; align-items: baseline; gap: var(--space-3); margin-bottom: 0; }
.cat-titre span { font-family: var(--font-sans); font-size: 15px; color: var(--encre-douce); }
.cat-desc { color: var(--encre-douce); margin-top: 4px; }
.grille-mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-4); margin-top: var(--space-4); }
.mod { background: var(--surface-relief); border: var(--trait-fin) solid var(--trait); border-radius: var(--radius-md); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.mod:target { border-color: var(--or); box-shadow: 0 0 0 3px var(--or-clair); }
.mod__tete { display: flex; gap: var(--space-3); align-items: center; }
.mod__tete img, .mod__lettre { width: 40px; height: 40px; flex: none; border-radius: 8px; image-rendering: auto; }
.mod__lettre { display: grid; place-items: center; font-family: var(--font-display); font-size: 20px; background: var(--surface-creux); border: var(--trait-fin) solid var(--trait); }
.mod__nom { margin: 0; font-size: 18px; line-height: 22px; }
.mod__nom .ct-badge { vertical-align: 2px; margin-left: 4px; }
.mod__auteurs { margin: 0; font-size: 12px; line-height: 16px; color: var(--encre-douce); }
.mod__resume { margin: 0; font-size: 15px; line-height: 22px; }
.mod__touches { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; color: var(--encre-douce); }
.mod__touches kbd { margin-right: 4px; }
.mod__liens { margin: auto 0 0; font-size: 14px; display: flex; gap: var(--space-3); }
.biblios summary { cursor: pointer; list-style: none; }
.biblios summary::-webkit-details-marker { display: none; }
.biblios summary .cat-titre::after { content: "Afficher ▾"; font-family: var(--font-sans); font-size: 14px; color: var(--texte-bleu); margin-left: auto; }
.biblios[open] summary .cat-titre::after { content: "Masquer ▴"; }
.vide { color: var(--encre-douce); font-style: italic; }

/* ---------- Clavier ---------- */
.clavier-zone { display: grid; grid-template-columns: 1fr; gap: var(--space-4); padding: var(--space-4); overflow-x: auto; }
.clavier { display: flex; gap: var(--space-4); align-items: flex-start; --u: 40px; min-width: max-content; }
.clavier__principal, .clavier__droite { display: grid; gap: 5px; }
.clavier__droite .cl-rang:nth-child(3) { height: var(--u); }
.clavier__souris { display: grid; gap: 5px; }
.clavier__souris p { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--encre-douce); }
.cl-rang { display: flex; gap: 5px; }
.cl, .cl-vide { width: calc(var(--u) * var(--l) + 5px * (var(--l) - 1)); height: var(--u); flex: none; }
.cl { position: relative; font: inherit; font-size: 11.5px; font-weight: 700; line-height: 1; color: var(--encre-douce); background: var(--surface-creux); border: 2px solid var(--trait); border-bottom-width: 4px; border-radius: 7px; cursor: default; padding: 0 2px; }
.cl--prise { cursor: pointer; color: var(--contour); background: var(--or-clair); border-color: var(--contour); }
.cl--prise:hover { background: var(--or); }
.cl[aria-pressed="true"] { background: var(--bleu); color: var(--halo); border-color: var(--contour); }
.cl__lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cl__n { position: absolute; top: -7px; right: -6px; min-width: 17px; height: 17px; border-radius: 99px; background: var(--rouge-fort); color: var(--halo); font-size: 10px; line-height: 13px; border: 2px solid var(--contour); }
.clavier__souris .cl { width: 110px; }
.clavier-info { min-height: 110px; background: var(--surface); border: var(--trait-fin) dashed var(--trait); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.clavier-info h3 { margin: 0 0 var(--space-2); }
.clavier-info ul { margin: 0; padding-left: 18px; }
.clavier-info li span { color: var(--encre-douce); font-size: 14px; }
.clavier-info__vide { margin: 0; color: var(--encre-douce); }
#table-touches tr.cache, .mod.cache, .categorie.cache { display: none; }

/* ---------- Recherche ---------- */
.recherche { position: fixed; inset: 0; z-index: 200; background: rgba(10, 7, 12, .55); display: grid; justify-items: center; align-items: start; padding: 10vh var(--space-4) var(--space-4); }
.recherche[hidden] { display: none; }
.recherche__boite { width: min(640px, 100%); padding: var(--space-4); gap: var(--space-2); max-height: 76vh; }
.recherche__champ { width: 100%; font-size: 18px; }
.recherche__resultats { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 2px; }
.recherche__resultats a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--encre); }
.recherche__resultats a small { display: block; color: var(--encre-douce); font-size: 13px; line-height: 18px; }
.recherche__resultats a[aria-selected="true"], .recherche__resultats a:hover { background: var(--teinte-or); }
.recherche__resultats mark { background: none; color: var(--texte-rouge); font-weight: 700; }
.recherche__aide { margin: 0; font-size: 12px; color: var(--encre-douce); }

/* ---------- Pied ---------- */
.pied { border-top: var(--trait-sticker) solid var(--trait); background: var(--surface-relief); padding: var(--space-8) 0; font-size: 14px; }
.pied__grille { display: grid; gap: var(--space-2); }
.pied p { margin: 0; }
.pied__note { color: var(--encre-douce); font-size: 12px; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .tuile { transition: none; } }
@media (max-width: 640px) { .filtres .puces { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; } .puce { white-space: nowrap; } .filtres { top: 100px; } }
