/* ============================================================
   Wiki XERB0XI0N — Lexique ionique
   ============================================================

   SKIN : XERB0XI0N (cyberpunk violet/néon, fond sombre, fonts
   Orbitron + Share Tech Mono).

   STRUCTURE : universelle wiki (onglets Lire/Modifier, infobox
   à droite, sommaire/TOC, sections H2 avec lien [modifier],
   footer méta).

   On garde donc tous les sélecteurs du squelette wiki standard
   (.wiki-tabs, .infobox, .wiki-toc, .wiki-h1, …) mais habillés
   en cyberpunk. Le rendu donne : "voilà un wiki, mais c'est
   XERB0XI0N qui le porte".

   @author J0bot
   ============================================================ */

/* ─── Variables ────────────────────────────────────────── */

/* Palette alignée sur xerboxion.css (--xr-bg #050505) mais qui pivote
   l'accent du cyan vers le violet — c'est le brand propre du wiki.
   Le cyan et le pink restent comme accents secondaires pour conserver
   la cohérence visuelle avec le reste du site. */
:root {
    --wk-bg-deep:    #050505;          /* fond le plus sombre — match xerboxion */
    --wk-bg:         #0A0210;          /* corps de page — quasi noir teinté violet */
    --wk-bg-soft:    #160830;          /* infobox / TOC / chip — violet profond */
    --wk-bg-card:    rgba(124, 58, 237, 0.08);
    --wk-ink:        #ECE7FB;          /* texte principal — légèrement plus clair */
    --wk-ink-soft:   #B0A6D9;          /* méta + sous-texte */
    --wk-line:       rgba(124, 58, 237, 0.45);
    --wk-line-soft:  rgba(124, 58, 237, 0.22);

    --wk-violet:     #7C3AED;          /* accent principal */
    --wk-violet-hot: #B47CFF;          /* hover, plus saturé */
    --wk-violet-deep:#4C1D95;          /* nuance profonde pour les fonds */
    --wk-cyan:       #A8B6E4;          /* accent titres/sections — bleu-violet DOUX (calme, lisible, raccord papers) */
    --wk-pink:       #EC4899;          /* highlights */
    --wk-green:      #10F299;          /* statut canon */
    --wk-orange:     #F59E0B;          /* statut fork / warnings */
    --wk-red:        #EF4444;          /* xref manquant (red link) */

    --wk-glow-violet:    0 0 14px rgba(124, 58, 237, 0.7);
    --wk-glow-violet-sm: 0 0 6px  rgba(124, 58, 237, 0.55);
    --wk-glow-cyan:      0 0 6px  rgba(168, 182, 228, 0.22);   /* glow quasi nul : plus de texte qui vibre */
    --wk-glow-pink:      0 0 8px  rgba(236, 72, 153, 0.55);

    --wk-serif: 'Inter', system-ui, 'Segoe UI', sans-serif;
    --wk-disp:  'Orbitron', sans-serif;
    --wk-mono:  'Share Tech Mono', 'Consolas', monospace;
    --wk-px:    'Press Start 2P', monospace;
}

/* ─── Coque ──────────────────────────────────────────── */

.wiki-app {
    background:
        radial-gradient(circle at 15% 0%, rgba(124, 58, 237, 0.18), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(76, 29, 149, 0.12), transparent 50%),
        linear-gradient(180deg, var(--wk-bg) 0%, var(--wk-bg-deep) 100%);
    color: var(--wk-ink);
    font-family: var(--wk-serif);
    font-size: 16px;
    line-height: 1.65;
    max-width: 1280px;
    margin: 1.5rem auto;
    border: 1px solid var(--wk-violet);
    border-radius: 6px;
    box-shadow:
        0 0 32px rgba(124, 58, 237, 0.35),
        0 2px 40px rgba(0, 0, 0, 0.55),
        inset 0 0 80px rgba(76, 29, 149, 0.08);
    overflow: hidden;
}

/* ─── Barre d'onglets ─────────────────────────────────── */

.wiki-tabs {
    display: flex;
    background: var(--wk-bg-deep);
    border-bottom: 1px solid var(--wk-line);
    padding: 0 1.25rem;
    gap: 0;
    font-family: var(--wk-mono);
    font-size: 0.85rem;
    align-items: flex-end;
    letter-spacing: 0.04em;
}

.wiki-tabs__group { display: flex; gap: 0; }
.wiki-tabs__group--right { margin-left: auto; }

.wiki-tab {
    display: inline-block;
    padding: .65rem 1rem;
    color: var(--wk-ink-soft);
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -1px;
    text-transform: lowercase;
}

.wiki-tab:hover {
    color: var(--wk-cyan);
    text-shadow: var(--wk-glow-cyan);
}

.wiki-tab--active {
    background: var(--wk-bg);
    border-color: var(--wk-violet);
    border-top: 3px solid var(--wk-violet-hot);
    color: var(--wk-violet-hot);
    text-shadow: var(--wk-glow-violet);
    font-weight: 600;
    box-shadow: inset 0 -4px 0 0 var(--wk-bg);
}

.wiki-tab--disabled {
    color: rgba(255, 255, 255, 0.25);
    cursor: not-allowed;
}

.wiki-tab--disabled:hover { color: rgba(255, 255, 255, 0.25); text-shadow: none; }

/* ─── Layout deux colonnes (contenu + infobox) ────────── */

.wiki-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 1.5rem 2rem 2.5rem;
}

@media (min-width: 900px) {
    .wiki-body--with-infobox {
        grid-template-columns: 1fr 340px;
        gap: 2rem;
    }
}

.wiki-main { min-width: 0; }
.wiki-aside { min-width: 0; }

/* ─── Titre H1 ────────────────────────────────────────── */

.wiki-h1 {
    font-family: var(--wk-disp);
    font-weight: 600;
    font-size: clamp(1.5rem, 4.5vw, 2.1rem);
    line-height: 1.15;
    margin: 0 0 .15rem;
    color: var(--wk-violet-hot);
    text-shadow: var(--wk-glow-violet);
    border-bottom: 1px solid var(--wk-violet);
    padding-bottom: .55rem;
    letter-spacing: 0.02em;
    word-break: break-word;
}

.wiki-h1__category {
    font-family: var(--wk-mono);
    font-size: 0.75rem;
    color: var(--wk-ink-soft);
    display: block;
    margin-bottom: .3rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.wiki-h1__category a {
    color: var(--wk-cyan);
    text-decoration: none;
}
.wiki-h1__category a:hover { text-shadow: var(--wk-glow-cyan); }

/* ─── TOC ─────────────────────────────────────────────── */

.wiki-toc {
    display: inline-block;
    background: var(--wk-bg-soft);
    border: 1px solid var(--wk-line);
    border-left: 3px solid var(--wk-cyan);
    border-radius: 4px;
    padding: .85rem 1.25rem;
    margin: 1rem 0 1.5rem;
    font-family: var(--wk-mono);
    font-size: 0.85rem;
    min-width: 240px;
}

.wiki-toc__title {
    font-family: var(--wk-disp);
    font-weight: 600;
    margin-bottom: .35rem;
    text-align: center;
    border-bottom: 1px solid var(--wk-line-soft);
    padding-bottom: .25rem;
    color: var(--wk-cyan);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.8rem;
}

.wiki-toc__list {
    list-style: none;
    counter-reset: toc;
    padding: 0;
    margin: 0;
}

.wiki-toc__list li {
    counter-increment: toc;
    padding: .2rem 0;
}

.wiki-toc__list li::before {
    content: counter(toc) ". ";
    color: var(--wk-ink-soft);
    margin-right: .25rem;
}

.wiki-toc a {
    color: var(--wk-cyan);
    text-decoration: none;
}
.wiki-toc a:hover { text-shadow: var(--wk-glow-cyan); }

/* ─── Headings de section ─────────────────────────────── */

.wiki-h2 {
    font-family: var(--wk-disp);
    font-weight: 500;
    font-size: 1.4rem;
    margin: 1.85rem 0 .4rem;
    color: var(--wk-cyan);
    text-shadow: var(--wk-glow-cyan);
    border-bottom: 1px solid var(--wk-line);
    padding-bottom: .25rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    letter-spacing: 0.04em;
    text-transform: lowercase;
}

.wiki-h2__edit {
    font-family: var(--wk-mono);
    font-size: 0.7rem;
    color: var(--wk-pink);
    text-decoration: none;
    font-weight: normal;
    white-space: nowrap;
    text-transform: lowercase;
    letter-spacing: 0.05em;
}

.wiki-h2__edit::before { content: '['; color: var(--wk-ink-soft); }
.wiki-h2__edit::after  { content: ']'; color: var(--wk-ink-soft); }
.wiki-h2__edit:hover   { text-shadow: var(--wk-glow-pink); }

.wiki-h3 {
    font-family: var(--wk-disp);
    font-weight: 600;
    font-size: 1.15rem;
    margin: 1.25rem 0 .35rem;
    color: var(--wk-pink);
    text-transform: lowercase;
    letter-spacing: 0.04em;
}

/* ─── Liens (corps) ───────────────────────────────────── */

.wiki-main a,
.wiki-aside a,
.term-definition a,
.xr-content a {
    color: var(--wk-cyan);
    text-decoration: none;
    border-bottom: 1px dotted rgba(34, 211, 238, 0.4);
    transition: text-shadow 0.15s, border-color 0.15s;
}

.wiki-main a:hover,
.wiki-aside a:hover,
.term-definition a:hover,
.xr-content a:hover {
    text-shadow: var(--wk-glow-cyan);
    border-bottom-color: var(--wk-cyan);
}

/* Red link — xref manquant. Hérite de XrefRenderer. */
.xr-xref--missing {
    color: var(--wk-red) !important;
    border-bottom: 1px dotted rgba(239, 68, 68, 0.4) !important;
    text-decoration: none;
}
.xr-xref--missing:hover {
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.55);
    border-bottom-color: var(--wk-red) !important;
}

/* ─── Décomposition ───────────────────────────────────── */

.term-decomp {
    font-family: var(--wk-mono);
    font-size: 1.3rem;
    margin: .85rem 0 1.25rem;
    color: var(--wk-cyan);
    padding: .65rem 1rem;
    background: var(--wk-bg-soft);
    border-left: 3px solid var(--wk-violet);
    display: inline-block;
    letter-spacing: 0.05em;
    box-shadow: inset 0 0 16px rgba(124, 58, 237, 0.1);
}

.term-decomp::before {
    content: '= ';
    color: var(--wk-pink);
}

.term-decomp__op {
    color: var(--wk-pink);
    padding: 0 .25rem;
    text-shadow: var(--wk-glow-pink);
}

/* Les xref inside .term-decomp héritent du style cyan déjà défini. */

/* ─── Définition (corps) ──────────────────────────────── */

.term-definition,
.xr-content {
    font-family: var(--wk-serif);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--wk-ink);
}

.term-definition p,
.xr-content p { margin: 0 0 .85rem; }

.term-definition strong,
.xr-content strong { color: var(--wk-pink); }

.term-definition em,
.xr-content em { color: var(--wk-cyan); }

.term-definition code,
.xr-content code {
    font-family: var(--wk-mono);
    background: var(--wk-bg-soft);
    padding: 1px 6px;
    border-radius: 2px;
    border: 1px solid var(--wk-line-soft);
    color: var(--wk-pink);
    font-size: 0.92em;
}

.term-letter-meaning {
    font-style: italic;
    color: var(--wk-pink);
    font-size: 1.05rem;
    margin: .5rem 0 1.25rem;
    text-shadow: var(--wk-glow-pink);
}

.term-letter-meaning::before {
    content: '« ';
    font-style: normal;
}
.term-letter-meaning::after { content: ' »'; font-style: normal; }

/* ─── Infobox (sidebar) ───────────────────────────────── */

.infobox {
    background:
        linear-gradient(180deg, rgba(76, 29, 149, 0.15), transparent 40%),
        var(--wk-bg-soft);
    border: 1px solid var(--wk-violet);
    border-top: 4px solid var(--wk-violet-hot);
    border-radius: 4px;
    padding: 1.1rem 1.35rem;
    font-family: var(--wk-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    position: sticky;
    top: 1rem;
    box-shadow:
        0 0 24px rgba(124, 58, 237, 0.25),
        inset 0 0 32px rgba(0, 0, 0, 0.4);
}

.infobox__title {
    font-family: var(--wk-disp);
    font-size: 1.15rem;
    font-weight: 600;
    text-align: center;
    margin: 0 0 .85rem;
    color: var(--wk-violet-hot);
    text-shadow: var(--wk-glow-violet);
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--wk-line);
    text-transform: lowercase;
    letter-spacing: 0.04em;
}

.infobox__glyph {
    display: flex;
    justify-content: center;
    margin-bottom: .85rem;
    color: var(--wk-violet-hot);
    filter: drop-shadow(var(--wk-glow-violet));
}

.infobox__row {
    display: grid;
    grid-template-columns: 90px 1fr;
    padding: .4rem 0;
    border-bottom: 1px solid var(--wk-line-soft);
    align-items: baseline;
    gap: .5rem;
}

.infobox__row:last-child { border-bottom: none; }

.infobox__label {
    font-family: var(--wk-mono);
    font-weight: 600;
    color: var(--wk-cyan);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.infobox__value {
    color: var(--wk-ink);
    font-family: var(--wk-mono);
    font-size: 0.85rem;
}

.infobox__value code {
    font-family: var(--wk-mono);
    background: var(--wk-bg);
    padding: 1px 5px;
    border-radius: 2px;
    border: 1px solid var(--wk-line-soft);
    color: var(--wk-pink);
}

.infobox__value a {
    color: var(--wk-cyan);
    border-bottom: 1px dotted rgba(34, 211, 238, 0.4);
}
.infobox__value a:hover { text-shadow: var(--wk-glow-cyan); }

/* ─── Badges statut ───────────────────────────────────── */

.badge {
    font-family: var(--wk-mono);
    font-size: 0.65rem;
    padding: .1rem .55rem;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    display: inline-block;
    border: 1px solid currentColor;
}

.badge-canon {
    color: var(--wk-green);
    background: rgba(16, 242, 153, 0.08);
    text-shadow: 0 0 4px rgba(16, 242, 153, 0.5);
}

.badge-nouveau {
    color: var(--wk-cyan);
    background: rgba(34, 211, 238, 0.08);
    text-shadow: 0 0 4px rgba(34, 211, 238, 0.5);
}

.badge-fork {
    color: var(--wk-orange);
    background: rgba(245, 158, 11, 0.08);
    text-shadow: 0 0 4px rgba(245, 158, 11, 0.5);
}

/* ─── Encadré ⚠ fork ─────────────────────────────────── */

.term-fork-note {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--wk-orange);
    background: rgba(245, 158, 11, 0.07);
    margin: 1.25rem 0;
    border-radius: 0 4px 4px 0;
    box-shadow: inset 0 0 24px rgba(245, 158, 11, 0.05);
}

.term-fork-note__icon {
    font-size: 1.3rem;
    line-height: 1;
    color: var(--wk-orange);
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.term-fork-note__body { flex: 1; }

/* ─── Hatnote (note de désambiguïsation, façon Wikipédia) ─ */
.term-hatnote {
    margin: 0 0 1rem;
    padding: .35rem 0 .35rem .9rem;
    border-left: 2px solid var(--wk-line);
    font-style: italic;
    font-size: .92rem;
    color: var(--wk-ink-soft);
}
.term-hatnote p { margin: 0; }

/* ─── Citations / blockquotes dans le contenu rendu ─────── */
.xr-content blockquote {
    margin: 1.1rem 0;
    padding: .6rem 1.1rem;
    border-left: 3px solid var(--wk-violet);
    background: rgba(124, 58, 237, 0.06);
    border-radius: 0 4px 4px 0;
    color: var(--wk-ink);
    font-style: italic;
}
.xr-content blockquote p:last-child { margin-bottom: 0; }

/* ─── Navbox « grammaire ionique » (dans l'infobox) ─────── */
.infobox-navbox {
    margin-top: 1rem;
    padding-top: .85rem;
    border-top: 1px solid var(--wk-line);
}
.infobox-navbox__title {
    font-family: var(--wk-mono);
    font-size: .62rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--wk-ink-soft);
    margin-bottom: .55rem;
}
.infobox-navbox__chips {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .3rem;
}
.ion-chip {
    display: flex; align-items: center; justify-content: center;
    aspect-ratio: 1; border-radius: 5px;
    background: rgba(150, 182, 228, .08);
    border: 1px solid var(--wk-line);
    color: var(--wk-ink); text-decoration: none;
    font-family: var(--wk-disp); font-size: .85rem; font-weight: 600;
    transition: background .12s, border-color .12s, transform .1s;
}
.ion-chip:hover { background: rgba(150, 182, 228, .18); border-color: var(--wk-cyan); transform: translateY(-1px); }
.ion-chip--current { background: var(--wk-cyan); color: #0a1428; border-color: var(--wk-cyan); }
.infobox-navbox__formula {
    margin-top: .6rem; text-align: center;
    font-family: var(--wk-mono); font-size: .8rem; letter-spacing: .04em;
    color: var(--wk-ink-soft);
}
.infobox-navbox__formula .ion-ion { color: var(--wk-cyan); }

/* ─── Bandeau d'état d'une section (maintenance, façon Wikipédia) ── */
.section-flag {
    display: inline-block;
    margin: 0 0 .6rem;
    padding: .25rem .7rem;
    border-radius: 999px;
    font-size: .72rem;
    letter-spacing: .03em;
    background: rgba(150, 182, 228, .1);
    border: 1px solid var(--wk-line);
    color: var(--wk-ink-soft);
}
.section-flag--disputed { background: rgba(245, 158, 11, .12); border-color: var(--wk-orange); color: var(--wk-orange); }
.section-flag--sources  { background: rgba(124, 58, 237, .12); border-color: var(--wk-violet); }

/* ─── Bandeau de maintenance de l'ARTICLE (la grosse boîte en tête, façon Wikipédia) ── */
.article-flag {
    display: block;
    margin: 0 0 1.25rem;
    padding: .7rem 1rem;
    border-radius: 6px;
    font-size: .9rem;
    line-height: 1.5;
    background: rgba(150, 182, 228, .08);
    border: 1px solid var(--wk-line);
    border-left: 4px solid var(--wk-cyan);
    color: var(--wk-ink-soft);
}
.article-flag--stub    { background: rgba(120, 200, 140, .08); border-left-color: #78c88c; }
.article-flag--sources { background: rgba(124, 58, 237, .08);  border-left-color: var(--wk-violet); }
.article-flag--verify  { background: rgba(245, 158, 11, .1);   border-left-color: var(--wk-orange); color: var(--wk-orange); }
.article-flag--wip     { background: rgba(150, 182, 228, .08); border-left-color: var(--wk-cyan); }

/* ─── Lien essai long ─────────────────────────────────── */

.term-paper-link {
    display: inline-block;
    margin: 1.25rem 0;
    padding: .65rem 1.1rem;
    background: var(--wk-bg-soft);
    border: 1px solid var(--wk-pink);
    border-radius: 4px;
    color: var(--wk-pink);
    text-decoration: none !important;
    font-family: var(--wk-mono);
    font-size: 0.9rem;
    transition: box-shadow 0.15s, background 0.15s;
    border-bottom: 1px solid var(--wk-pink) !important;
}

.term-paper-link:hover {
    background: rgba(236, 72, 153, 0.12);
    box-shadow: var(--wk-glow-pink);
    text-shadow: var(--wk-glow-pink);
}

.term-paper-link strong { color: var(--wk-pink); }

/* ─── Sections "Voir aussi" / "Référencé par" ─────────── */

.term-section { margin-top: 1.75rem; }

.term-section__list {
    list-style: none;
    padding: 0;
    column-count: 2;
    column-gap: 1.5rem;
    margin: 0;
}

@media (min-width: 700px) {
    .term-section__list { column-count: 3; }
}

.term-section__list li {
    break-inside: avoid;
    padding: .15rem 0;
    font-family: var(--wk-mono);
    font-size: 0.92rem;
}

.term-section__list li::before {
    content: '◇ ';
    color: var(--wk-violet);
    margin-right: .25rem;
}

/* ─── Footer méta ─────────────────────────────────────── */

.term-meta {
    margin-top: 2.25rem;
    padding-top: .85rem;
    border-top: 1px solid var(--wk-line-soft);
    font-family: var(--wk-mono);
    font-size: 0.78rem;
    color: var(--wk-ink-soft);
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.term-meta code {
    background: var(--wk-bg-soft);
    padding: 0 4px;
    border-radius: 2px;
    border: 1px solid var(--wk-line-soft);
    color: var(--wk-pink);
}

.term-meta__edit {
    color: var(--wk-pink);
    text-decoration: none;
    border-bottom: 1px dotted rgba(236, 72, 153, 0.5);
}
.term-meta__edit:hover { text-shadow: var(--wk-glow-pink); }

.term-meta a { color: var(--wk-cyan); border-bottom: 1px dotted rgba(34, 211, 238, 0.4); }

/* ─── Glyphes ─────────────────────────────────────────── */

.xr-glyph {
    display: inline-block;
    color: var(--wk-violet-hot);
    fill: currentColor;
    stroke: currentColor;
    vertical-align: middle;
}

.xr-glyph--sm { width: 22px; height: 22px; }
.xr-glyph--md { width: 40px; height: 40px; }
.xr-glyph--lg { width: 140px; height: 140px; }

.xr-glyph-missing {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(124, 58, 237, 0.18) 5px,
        rgba(124, 58, 237, 0.18) 6px
    );
    border: 1px dashed var(--wk-line);
    border-radius: 4px;
    box-sizing: border-box;
}

/* ─── INDEX / HOMEPAGE ────────────────────────────────── */

.wiki-header {
    padding: 2.25rem 2rem 1.85rem;
    border-bottom: 1px solid var(--wk-violet);
    background:
        radial-gradient(circle at 20% 10%, rgba(124, 58, 237, 0.28), transparent 55%),
        radial-gradient(circle at 85% 75%, rgba(76, 29, 149, 0.22), transparent 50%),
        radial-gradient(circle at 65% 30%, rgba(34, 211, 238, 0.06), transparent 45%),
        linear-gradient(180deg, var(--wk-bg) 0%, var(--wk-bg-deep) 100%);
    box-shadow: inset 0 -1px 24px rgba(124, 58, 237, 0.18);
}

.wiki-title {
    font-family: var(--wk-disp);
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 700;
    margin: 0 0 .5rem;
    color: var(--wk-violet-hot);
    text-shadow:
        0 0 14px rgba(124, 58, 237, 0.7),
        0 0 32px rgba(124, 58, 237, 0.35);
    letter-spacing: 0.05em;
    text-transform: lowercase;
    line-height: 1.1;
}

.wiki-subtitle {
    color: var(--wk-ink-soft);
    max-width: 740px;
    margin: 0 0 1.5rem;
    line-height: 1.6;
}

/* ─── Recherche ───────────────────────────────────────── */

.wiki-search {
    display: flex;
    gap: .45rem;
    max-width: 600px;
    align-items: center;
    flex-wrap: wrap;
    font-family: var(--wk-mono);
}

.wiki-search__input {
    flex: 1 1 260px;
    padding: .55rem .85rem;
    border-radius: 4px;
    border: 1px solid var(--wk-line);
    background: var(--wk-bg-deep);
    color: var(--wk-ink);
    font-family: var(--wk-mono);
    font-size: 0.95rem;
}

.wiki-search__input::placeholder { color: var(--wk-ink-soft); }

.wiki-search__input:focus {
    outline: 2px solid var(--wk-cyan);
    outline-offset: -1px;
    border-color: var(--wk-cyan);
    box-shadow: var(--wk-glow-cyan);
}

.wiki-search__btn,
.wiki-search__random {
    padding: .55rem 1rem;
    border-radius: 4px;
    border: 1px solid var(--wk-violet);
    background: var(--wk-bg-soft);
    color: var(--wk-violet-hot);
    font-family: var(--wk-mono);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 0.05em;
    text-transform: lowercase;
}

.wiki-search__btn:hover,
.wiki-search__random:hover {
    background: var(--wk-violet);
    color: white;
    box-shadow: var(--wk-glow-violet);
}

/* ─── Couches ─────────────────────────────────────────── */

.wiki-layer {
    padding: 1.75rem 2rem;
    border-top: 1px solid var(--wk-line-soft);
}

.wiki-layer:first-of-type { border-top: none; }

.wiki-layer__title {
    font-family: var(--wk-disp);
    font-weight: 500;
    font-size: 1.5rem;
    margin: 0 0 1rem;
    color: var(--wk-cyan);
    text-shadow: var(--wk-glow-cyan);
    border-bottom: 1px solid var(--wk-line);
    padding-bottom: .35rem;
    text-transform: lowercase;
    letter-spacing: 0.04em;
}

.wiki-layer__title small {
    font-family: var(--wk-mono);
    color: var(--wk-ink-soft);
    font-size: 0.8rem;
    margin-left: .5rem;
    text-transform: lowercase;
    letter-spacing: 0.05em;
}

.wiki-layer__intro {
    color: var(--wk-ink-soft);
    margin: 0 0 1rem;
    line-height: 1.6;
}

/* ─── Couche lettres ──────────────────────────────────── */

.wiki-letters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: .6rem;
}

.wiki-letter {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem .5rem;
    border: 1px solid var(--wk-line);
    border-radius: 4px;
    text-decoration: none !important;
    color: var(--wk-ink);
    background: var(--wk-bg-card);
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
    border-bottom: 1px solid var(--wk-line) !important;
}

.wiki-letter:hover {
    border-color: var(--wk-violet);
    background: var(--wk-bg-soft);
    transform: translateY(-2px);
    box-shadow: var(--wk-glow-violet);
}

.wiki-letter__char {
    font-family: var(--wk-px);
    font-size: 1.8rem;
    color: var(--wk-violet-hot);
    text-shadow: var(--wk-glow-violet);
    line-height: 1.2;
}

.wiki-letter__meaning {
    font-family: var(--wk-mono);
    font-size: 0.78rem;
    color: var(--wk-cyan);
    margin-top: .45rem;
    text-align: center;
    text-transform: lowercase;
}

/* ─── Couche mots — grilles ──────────────────────────── */

.wiki-category { margin-bottom: 1.85rem; }

.wiki-category__title {
    font-family: var(--wk-disp);
    font-weight: 500;
    color: var(--wk-pink);
    font-size: 1.05rem;
    margin: 1rem 0 .5rem;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    border-bottom: 1px dotted var(--wk-line-soft);
    padding-bottom: .15rem;
}

.wiki-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .5rem;
}

.wiki-cards-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.term-card {
    display: flex;
    gap: .65rem;
    padding: .6rem .75rem;
    border: 1px solid var(--wk-line-soft);
    border-radius: 4px;
    text-decoration: none !important;
    color: var(--wk-ink);
    background: var(--wk-bg-card);
    transition: background 0.1s, border-color 0.1s, transform 0.1s;
    align-items: flex-start;
    border-bottom: 1px solid var(--wk-line-soft) !important;
}

.term-card:hover {
    background: var(--wk-bg-soft);
    border-color: var(--wk-violet);
    transform: translateY(-1px);
}

.term-card--canon   { border-left: 3px solid var(--wk-green); }
.term-card--nouveau { border-left: 3px solid var(--wk-cyan); }
.term-card--fork    { border-left: 3px solid var(--wk-orange); }

.term-card__glyph {
    flex: 0 0 auto;
    color: var(--wk-violet-hot);
    margin-top: 2px;
}

.term-card__body {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
    flex: 1;
}

.term-card__head {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}

.term-card__name {
    font-family: var(--wk-disp);
    color: var(--wk-violet-hot);
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

.term-card:hover .term-card__name {
    text-shadow: var(--wk-glow-violet);
}

.term-card__teaser {
    font-size: 0.82rem;
    color: var(--wk-ink-soft);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-family: var(--wk-serif);
}

/* ─── Couche lois (axiomes) ───────────────────────────── */

.wiki-axioms {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: .35rem;
}

.wiki-axiom {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    padding: .55rem .85rem;
    border: 1px solid var(--wk-line-soft);
    border-radius: 4px;
    background: var(--wk-bg-card);
}

.wiki-axiom--canon     { border-left: 3px solid var(--wk-green); }
.wiki-axiom--session   { border-left: 3px solid var(--wk-cyan); }
.wiki-axiom--fondement { border-left: 3px solid var(--wk-pink); }

.wiki-axiom__text {
    font-family: var(--wk-mono);
    background: transparent;
    color: var(--wk-ink);
    font-size: 0.92rem;
    flex: 1;
    letter-spacing: 0.03em;
}

.wiki-axiom__source {
    font-family: var(--wk-mono);
    font-size: 0.68rem;
    color: var(--wk-ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.wiki-axiom--canon .wiki-axiom__source     { color: var(--wk-green); }
.wiki-axiom--session .wiki-axiom__source   { color: var(--wk-cyan); }
.wiki-axiom--fondement .wiki-axiom__source { color: var(--wk-pink); }

/* ─── Forks vivants ───────────────────────────────────── */

.wiki-forks {
    list-style: none;
    padding: 0;
    counter-reset: fork;
    margin: 0;
}

.wiki-fork {
    counter-increment: fork;
    padding: .95rem 1.1rem .95rem 3.25rem;
    margin-bottom: .65rem;
    border-left: 4px solid var(--wk-orange);
    background: rgba(245, 158, 11, 0.06);
    border-radius: 0 4px 4px 0;
    position: relative;
    box-shadow: inset 0 0 32px rgba(245, 158, 11, 0.05);
}

.wiki-fork::before {
    content: counter(fork);
    position: absolute;
    top: .95rem;
    left: 1rem;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    background: var(--wk-orange);
    color: var(--wk-bg-deep);
    font-family: var(--wk-disp);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.wiki-fork__title {
    font-family: var(--wk-disp);
    font-size: 1.05rem;
    margin: 0 0 .3rem;
    color: var(--wk-orange);
    text-transform: lowercase;
    letter-spacing: 0.03em;
}

.wiki-fork__detail {
    margin: 0 0 .45rem;
    color: var(--wk-ink-soft);
    font-size: 0.92rem;
    line-height: 1.55;
}

.wiki-fork__termes {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}

.wiki-fork__termes li {
    background: var(--wk-bg-soft);
    border: 1px solid var(--wk-line);
    padding: .1rem .5rem;
    border-radius: 2px;
    font-family: var(--wk-mono);
    font-size: 0.78rem;
}

.wiki-fork__termes a { color: var(--wk-orange); border-bottom: none !important; }

/* ─── Édition ─────────────────────────────────────────── */

.wiki-edit-form {
    display: grid;
    gap: 1rem;
    max-width: 820px;
    font-family: var(--wk-mono);
}

.wiki-edit-field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.wiki-edit-field > span {
    font-family: var(--wk-disp);
    font-weight: 600;
    color: var(--wk-cyan);
    font-size: 0.85rem;
    text-transform: lowercase;
    letter-spacing: 0.04em;
}

.wiki-edit-field small {
    color: var(--wk-ink-soft);
    font-size: 0.78rem;
    font-family: var(--wk-mono);
    font-weight: normal;
    text-transform: none;
    margin-left: .35rem;
}

.wiki-edit-field input,
.wiki-edit-field select,
.wiki-edit-field textarea {
    padding: .55rem .75rem;
    border: 1px solid var(--wk-line);
    border-radius: 4px;
    background: var(--wk-bg-deep);
    color: var(--wk-ink);
    font-family: var(--wk-mono);
    font-size: 0.95rem;
}

.wiki-edit-field textarea {
    resize: vertical;
    min-height: 11rem;
    line-height: 1.55;
}

.wiki-edit-field input:focus,
.wiki-edit-field select:focus,
.wiki-edit-field textarea:focus {
    outline: 2px solid var(--wk-cyan);
    outline-offset: -1px;
    border-color: var(--wk-cyan);
    box-shadow: var(--wk-glow-cyan);
}

.wiki-edit-submit {
    padding: .7rem 1.4rem;
    border: 1px solid var(--wk-violet);
    border-radius: 4px;
    background: var(--wk-violet);
    color: white;
    font-family: var(--wk-disp);
    font-weight: 600;
    cursor: pointer;
    justify-self: start;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: background 0.15s, box-shadow 0.15s;
}

.wiki-edit-submit:hover {
    background: var(--wk-pink);
    border-color: var(--wk-pink);
    box-shadow: var(--wk-glow-pink);
}

.wiki-edit-help {
    background: var(--wk-bg-soft);
    border: 1px solid var(--wk-line-soft);
    border-left: 3px solid var(--wk-cyan);
    border-radius: 4px;
    padding: .75rem .95rem;
    font-size: 0.88rem;
    color: var(--wk-ink-soft);
    font-family: var(--wk-mono);
    line-height: 1.55;
}

.wiki-edit-help code {
    background: var(--wk-bg-deep);
    padding: 1px 5px;
    border-radius: 2px;
    font-family: var(--wk-mono);
    color: var(--wk-pink);
    border: 1px solid var(--wk-line-soft);
}

.wiki-edit-help strong { color: var(--wk-cyan); }

.wiki-errors {
    list-style: square;
    border-left: 4px solid var(--wk-red);
    background: rgba(239, 68, 68, 0.08);
    padding: .65rem 1rem .65rem 2.5rem;
    color: var(--wk-red);
    font-family: var(--wk-mono);
    font-size: 0.9rem;
    border-radius: 0 4px 4px 0;
}

/* ─── États vides / retour ────────────────────────────── */

.wiki-empty {
    color: var(--wk-ink-soft);
    font-style: italic;
    padding: 1rem 0;
    font-family: var(--wk-mono);
}

.wiki-back {
    margin-top: 1.75rem;
    font-family: var(--wk-mono);
    font-size: 0.9rem;
}

.wiki-back a {
    color: var(--wk-cyan);
    border-bottom: 1px dotted rgba(34, 211, 238, 0.4);
}

/* ─── Responsive ──────────────────────────────────────── */

/* Tablette / petits écrans (~768px et moins).
   L'infobox passe sous le contenu, le grid devient 1 colonne. */
@media (max-width: 900px) {
    .wiki-body--with-infobox {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .wiki-aside { order: 2; }
    .infobox {
        position: static;
        margin-top: 1.5rem;
    }
}

@media (max-width: 768px) {
    .wiki-body { padding: 1.25rem 1.25rem 2rem; }
    .wiki-header { padding: 1.5rem 1.25rem; }
    .wiki-layer { padding: 1.25rem; }
    .wiki-app { margin: .5rem; border-radius: 4px; }
    .term-section__list { column-count: 2; }
    .wiki-cards-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .wiki-letters-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }

    /* Onglets scrollables horizontalement plutôt que wrap — préserve
       l'ordre visuel et évite que la barre fasse 3 lignes. */
    .wiki-tabs {
        padding: 0 .5rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .wiki-tabs::-webkit-scrollbar { display: none; }
    .wiki-tabs__group { flex-shrink: 0; }
    .wiki-tab { white-space: nowrap; padding: .55rem .75rem; font-size: 0.8rem; }
}

/* Petit téléphone (~480px et moins). */
@media (max-width: 480px) {
    .wiki-app {
        margin: .35rem;
        border-radius: 4px;
        font-size: 15px;
    }
    .wiki-body { padding: 1rem .85rem 1.5rem; }
    .wiki-header { padding: 1.25rem .85rem 1.1rem; }
    .wiki-layer { padding: 1rem .85rem; }

    /* Cartes en 1 colonne sous 480px : lisibilité prime sur la densité. */
    .wiki-cards-grid,
    .wiki-cards-grid--compact {
        grid-template-columns: 1fr;
    }
    .term-section__list { column-count: 1; }
    .wiki-letters-grid { grid-template-columns: repeat(4, 1fr); gap: .35rem; }
    .wiki-letter { padding: .65rem .25rem; }
    .wiki-letter__char { font-size: 1.5rem; }
    .wiki-letter__meaning { font-size: 0.7rem; }

    /* Le H1 d'article se justifie déjà via clamp(), mais on serre encore
       le padding-bottom pour les écrans étroits. */
    .wiki-h1 { padding-bottom: .35rem; }

    /* Décomposition : adapte la taille et permet le wrap si trop long. */
    .term-decomp {
        font-size: 1.1rem;
        padding: .5rem .75rem;
        display: block;
        text-align: center;
        word-break: break-word;
    }

    /* Forks numérotés : compresser le padding-left et descendre la pastille. */
    .wiki-fork {
        padding: .85rem .85rem .85rem 2.75rem;
    }
    .wiki-fork::before {
        top: .85rem;
        left: .65rem;
        width: 1.4rem;
        height: 1.4rem;
        font-size: 0.75rem;
    }

    /* H2 : on cache discrètement le lien [modifier] sur très petit écran
       (l'admin peut toujours utiliser l'onglet Modifier global). */
    .wiki-h2 {
        font-size: 1.2rem;
        flex-wrap: wrap;
        gap: .35rem;
    }
    .wiki-h2__edit { font-size: 0.65rem; }

    /* Infobox plus compacte : le label colonne descend à 80px. */
    .infobox__row { grid-template-columns: 80px 1fr; }
    .infobox__label { font-size: 0.65rem; }
    .infobox__value { font-size: 0.8rem; }

    /* Recherche en 2 lignes propres (input pleine largeur, boutons en dessous). */
    .wiki-search__input { flex: 1 1 100%; }
    .wiki-search__btn,
    .wiki-search__random { flex: 1; text-align: center; }

    /* Formulaire d'édition : champs et label resserrés pour le mobile. */
    .wiki-edit-field > span { font-size: 0.8rem; }
    .wiki-edit-field input,
    .wiki-edit-field select,
    .wiki-edit-field textarea { padding: .5rem .6rem; font-size: 16px; /* >=16px évite le zoom auto iOS */ }
    .wiki-edit-submit { width: 100%; text-align: center; }
}

/* Très petit (<360px) : on évite l'overflow de l'infobox avec un grid label/value
   à 1 colonne pour les rows. Ça reste lisible. */
@media (max-width: 360px) {
    .infobox__row {
        grid-template-columns: 1fr;
        gap: .15rem;
        padding: .45rem 0;
    }
    .wiki-letters-grid { grid-template-columns: repeat(3, 1fr); }
}
