/* ============================================================
   Wiki "Le dossier" : themes Casier (defaut) et Nuit, comme les pages du jeu.
   Polices : /wiki/static/fonts.css (celles de ui, servies par le wiki).
   ============================================================ */

html[data-theme="casier"] {
    --bg: #1b1813;
    --sheet-bg: #ebe4d2;
    --sheet-dark: #d9d0b8;
    --ink: #17140f;
    --muted: #4d463b;
    --faded: #7d7566;
    --line: rgba(23, 20, 15, .18);
    --accent: #f2a324;
    --green: #2e6e3a;
    --red: #b3271d;
    --world: #f6f1e3;
    --world-dim: rgba(246, 241, 227, .62);
    --font: "Barlow", "Segoe UI", Arial, sans-serif;
    --mono: "IBM Plex Mono", "Courier New", monospace;
    --cond: "Saira Condensed", "Arial Narrow", sans-serif;
    --heavy: "Saira Extra Condensed", "Arial Narrow", sans-serif;
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .16 0 0 0 0 .1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
    --sheet: var(--grain), radial-gradient(ellipse at 18% 8%, #f6f1e3, var(--sheet-bg) 55%, var(--sheet-dark));
    --tape: linear-gradient(90deg, rgba(235,222,184,.86), rgba(242,232,200,.94), rgba(235,222,184,.86));
    --shadow: 0 12px 28px rgba(0, 0, 0, .5);
    --radius: 0px;
    --hl: linear-gradient(transparent 12%, rgba(242,163,36,.85) 12% 88%, transparent 88%);
    --code-bg: rgba(23, 20, 15, .08);
}
html[data-theme="nuit"] {
    --bg: #07080b;
    --sheet-bg: #11131a;
    --sheet-dark: #191c25;
    --ink: #f4f1ea;
    --muted: #c9ccd3;
    --faded: #8b919c;
    --line: rgba(255, 255, 255, .10);
    --accent: #ffa04a;
    --green: #3ddc97;
    --red: #ff4d5e;
    --world: #f4f1ea;
    --world-dim: #9aa0ab;
    --font: "Archivo", "Segoe UI", Arial, sans-serif;
    --mono: "JetBrains Mono", Consolas, monospace;
    --cond: "Archivo", "Arial Narrow", sans-serif;
    --heavy: "Archivo", "Arial Narrow", sans-serif;
    --sheet: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015)), #11131a;
    --shadow: 0 12px 30px rgba(0, 0, 0, .55);
    --radius: 8px;
    --grad: linear-gradient(90deg, #ffa04a, #ff3d7f);
    --code-bg: rgba(255, 255, 255, .07);
}

/* Transition douce d'une page a l'autre (navigateurs qui la gerent ; les autres changent net) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--bg);
    color: var(--world);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main { flex: 1; }
html[data-theme="casier"] body {
    background: radial-gradient(ellipse at 50% -10%, rgba(242,163,36,.10), transparent 55%), var(--grain), var(--bg);
}
html[data-theme="nuit"] body {
    background:
        radial-gradient(ellipse at 85% -10%, rgba(255,61,127,.14), transparent 50%),
        radial-gradient(ellipse at 10% -10%, rgba(255,160,74,.12), transparent 45%),
        var(--bg);
}
a { color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

/* ================= En-tete ================= */
.top { padding: 22px 0 0; }
.top .wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.logo { text-decoration: none; display: flex; align-items: baseline; gap: 10px; }
.logo b {
    font-family: var(--heavy); font-weight: 900; font-size: 42px; line-height: .9;
    letter-spacing: .01em; text-transform: uppercase; color: var(--world);
}
.logo small {
    font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .2em;
    text-transform: uppercase; color: var(--accent);
}
html[data-theme="nuit"] .logo b { font-stretch: 70%; letter-spacing: -.01em; }

.search {
    position: relative;
    flex: 1; min-width: 220px; max-width: 420px; margin-left: auto;
    display: flex; align-items: center; gap: 10px;
    padding: 0 14px;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
    border-radius: var(--radius);
    color: var(--world-dim);
}
.search:focus-within { border-color: var(--accent); }
.search input {
    flex: 1; min-width: 0; padding: 10px 0; border: 0; outline: 0; background: none;
    color: var(--world); font: 500 15px var(--font);
}
.search input::placeholder { color: var(--world-dim); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
    font-family: var(--mono); font-size: 11px;
    padding: 2px 6px; border: 1px solid rgba(255,255,255,.3); border-radius: 3px;
}
.results {
    position: absolute; left: -1px; right: -1px; top: calc(100% + 6px); z-index: 30;
    max-height: 70vh; overflow-y: auto;
    background: var(--sheet); color: var(--ink);
    box-shadow: var(--shadow); border-radius: var(--radius);
}
html[data-theme="nuit"] .results { border: 1px solid var(--line); }
.results a { display: block; padding: 10px 14px; text-decoration: none; border-top: 1px solid var(--line); }
.results a:first-child { border-top: 0; }
.results a:hover, .results a.on { background: rgba(242,163,36,.25); }
html[data-theme="nuit"] .results a:hover, html[data-theme="nuit"] .results a.on { background: rgba(255,255,255,.07); }
.results b { display: block; font-weight: 700; }
.results small { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.35; }
.results .eyebrow { margin-bottom: 2px; }
.results .none { padding: 12px 14px; color: var(--muted); }
.results mark { background: var(--accent); color: #17140f; padding: 0 2px; }

.top-tools { display: flex; gap: 6px; }
.chip {
    font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-decoration: none;
    padding: 7px 10px; border: 1px solid rgba(255,255,255,.2); color: var(--world);
    border-radius: var(--radius); background: none; cursor: pointer; line-height: 1.2;
}
.chip.on { background: var(--world); color: #17140f; }
.chip:hover:not(.on) { border-color: var(--accent); }

.tabs { margin-top: 22px; display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
/* Grand ecran : tous les onglets visibles, sur deux rangees s'il le faut (intercalaires) */
@media (min-width: 900px) {
    .tabs { flex-wrap: wrap; overflow: visible; row-gap: 4px; }
}
/* Petit ecran : bande qui defile, avec un fondu a droite pour le signaler */
@media (max-width: 899px) {
    .tabs { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
.tab {
    flex: none; padding: 10px 12px 9px; text-decoration: none;
    font-family: var(--cond); font-weight: 800; font-size: 15px; letter-spacing: .05em; text-transform: uppercase;
    color: var(--world-dim);
}
.tab:hover { color: var(--world); }
html[data-theme="casier"] .tab { background: rgba(235,228,210,.08); clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 100%, 0 100%); }
html[data-theme="casier"] .tab.on { background: var(--sheet); color: var(--ink); }
html[data-theme="nuit"] .tab { font-weight: 700; font-stretch: 85%; border-bottom: 2px solid transparent; }
html[data-theme="nuit"] .tab.on { color: var(--world); border-image: var(--grad) 1; }
.tabs-line { height: 3px; }
html[data-theme="casier"] .tabs-line { background: var(--sheet); }
html[data-theme="nuit"] .tabs-line { height: 1px; background: rgba(255,255,255,.1); }

/* ================= Feuilles ================= */
.sheet {
    background: var(--sheet); color: var(--ink);
    box-shadow: var(--shadow); border-radius: var(--radius);
    position: relative;
}
html[data-theme="nuit"] .sheet { border: 1px solid var(--line); }
.tape {
    position: absolute; top: -12px; left: 50%; width: 120px; height: 26px;
    transform: translateX(-50%) rotate(-2deg);
    background: var(--tape); box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
html[data-theme="nuit"] .tape { display: none; }
html[data-theme="nuit"] .sheet.hot::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
    background: var(--grad); border-radius: var(--radius) var(--radius) 0 0;
}

.eyebrow {
    font-family: var(--mono); font-weight: 600; font-size: 11.5px;
    letter-spacing: .18em; text-transform: uppercase; color: var(--faded);
}
h1, h2, h3 { margin: 0; text-transform: uppercase; }
h1 { font-family: var(--heavy); font-weight: 900; line-height: .88; }
h2 { font-family: var(--cond); font-weight: 800; font-size: 26px; line-height: 1.05; letter-spacing: .02em; }
h3 { font-family: var(--cond); font-weight: 800; font-size: 19px; line-height: 1.1; letter-spacing: .02em; }
html[data-theme="nuit"] h1 { font-stretch: 68%; letter-spacing: -.01em; }
html[data-theme="nuit"] h2, html[data-theme="nuit"] h3 { font-weight: 700; font-stretch: 80%; }
.hl { background: var(--hl); padding: 0 .12em; }
html[data-theme="nuit"] .hl { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding: 0; }
.money { font-family: var(--mono); font-weight: 700; color: var(--green); white-space: nowrap; }

/* Texte classe : seule la barre arrive au navigateur */
.redact {
    display: inline-block; vertical-align: -2px; max-width: 100%;
    height: 1em; background: var(--ink); cursor: help; position: relative;
}
html[data-theme="nuit"] .redact { background: repeating-linear-gradient(135deg, #2b2f3a 0 6px, #232731 6px 12px); border-radius: 3px; }
.redact:hover::after, .redact:focus::after {
    content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 5;
    white-space: nowrap; padding: 4px 8px;
    background: var(--accent); color: #17140f;
    font: 700 11px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase;
}

.stamp {
    display: inline-block; padding: 4px 12px 3px;
    border: 3px solid currentColor; color: var(--red);
    font-family: var(--cond); font-weight: 800; font-size: 15px; letter-spacing: .12em; text-transform: uppercase;
    transform: rotate(-4deg); opacity: .9; white-space: nowrap;
}
html[data-theme="nuit"] .stamp { transform: none; border-width: 1px; border-radius: 99px; font-weight: 700; font-size: 12px; padding: 4px 10px; }
.stamp.green { color: var(--green); }
.stamp.ink { color: var(--ink); }

.live {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    color: var(--faded);
}
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(46,110,58,.2); }
.live.dim { color: var(--world-dim); }

.btn {
    display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
    padding: 12px 18px; font-family: var(--cond); font-weight: 800; font-size: 17px; letter-spacing: .06em; text-transform: uppercase;
    border-radius: var(--radius);
}
.btn.main { background: var(--accent); color: #17140f; }
html[data-theme="nuit"] .btn.main { background: var(--grad); color: #fff; font-weight: 700; }
.btn.ghost { border: 2px solid rgba(246,241,227,.4); color: var(--world); }
.btn:hover { filter: brightness(1.08); }

/* ================= Accueil ================= */
.hero { margin: 40px 0 34px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 34px; align-items: center; }
.hero h1 { font-size: clamp(54px, 9vw, 104px); color: var(--world); }
.hero p { font-size: 19px; color: var(--world-dim); max-width: 34em; margin: 18px 0 0; }
html[data-theme="casier"] .hero p { color: rgba(246,241,227,.8); }
.hero-cta { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }
.server { padding: 22px 22px 18px; transform: rotate(1.2deg); }
html[data-theme="nuit"] .server { transform: none; }
.server-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-weight: 600; }
.server-row b { font-family: var(--mono); font-weight: 700; text-align: right; }
.server .connect {
    margin-top: 12px; padding: 10px 12px; background: var(--ink); color: var(--accent); text-decoration: none;
    font-family: var(--mono); font-size: 13.5px; font-weight: 700; border-radius: var(--radius);
    display: flex; justify-content: space-between; gap: 10px; text-transform: uppercase; letter-spacing: .06em;
}
html[data-theme="nuit"] .server .connect { background: rgba(255,255,255,.06); }
.live-note { margin-top: 10px; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 22px; }
.section-head h2 { color: var(--world); font-size: 30px; }

.folders { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px 18px; margin-bottom: 46px; }
.folder { padding: 30px 18px 18px; text-decoration: none; transition: transform .15s; }
.folder:hover { transform: translateY(-3px) rotate(-.6deg); }
html[data-theme="casier"] .folder::before {
    content: ""; position: absolute; left: 14px; top: -11px; width: 74px; height: 14px;
    background: var(--sheet-dark); clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 100%, 0 100%);
}
html[data-theme="nuit"] .folder:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.25); }
.folder .num { position: absolute; top: 12px; right: 14px; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--faded); }
.folder h3 { font-size: 22px; margin: 0 0 6px; }
.folder p { margin: 0; font-size: 14.5px; color: var(--muted); line-height: 1.4; }
.folder .count { margin-top: 12px; font-family: var(--mono); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faded); }
.folder.big { grid-column: span 2; }
.folder.big h3 { font-size: 30px; }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 60px; }
.panel { padding: 24px; }
.panel h2 { margin-bottom: 14px; }
.list-row { display: flex; gap: 14px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); text-decoration: none; }
.list-row:hover .t { text-decoration: underline; text-decoration-thickness: 2px; }
.list-row .t { flex: 1; font-weight: 700; }
.list-row .t small { display: block; font-weight: 500; color: var(--muted); font-size: 14px; }
.tag { flex: none; font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border: 1.5px solid currentColor; color: var(--muted); border-radius: var(--radius); }
.tag.new { color: var(--red); }

/* ================= Dossier ================= */
.crumbs { margin: 28px 0 18px; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--world-dim); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.dossier-head { margin: 10px 0 30px; }
.dossier-head h1 { font-size: clamp(48px, 8vw, 88px); color: var(--world); margin-top: 6px; }
.dossier-head p { font-size: 19px; color: var(--world-dim); margin: 12px 0 0; max-width: 40em; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 60px; }
.card { padding: 22px 20px 18px; text-decoration: none; transition: transform .15s; }
.card:hover { transform: translateY(-3px); }
.card h3 { font-size: 24px; margin: 6px 0 8px; }
.card p { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.45; }
.card.empty { grid-column: 1 / -1; }

/* ================= Fiche ================= */
.case { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 26px; align-items: start; margin-bottom: 60px; }
.case.solo { grid-template-columns: minmax(0, 1fr); max-width: 860px; }
.case.wide { max-width: none; }
.see.inline { margin: 26px 0 0; padding: 0; box-shadow: none; background: none; }
.case-main { padding: 34px 36px 30px; min-width: 0; }
.case-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.case-title h1 { font-size: clamp(48px, 8vw, 88px); overflow-wrap: anywhere; }
.lede { font-size: 19px; font-weight: 600; margin: 16px 0 6px; max-width: 36em; }
html[data-theme="nuit"] .lede { color: var(--muted); font-weight: 500; }

.body h2 { margin: 30px 0 14px; padding-top: 18px; border-top: 2px solid var(--ink); }
html[data-theme="nuit"] .body h2 { border-top: 1px solid var(--line); }
.body h3 { margin: 22px 0 8px; }
.body p { margin: 0 0 12px; }
.body ul, .body ol { margin: 0 0 14px; padding-left: 22px; }
.body li { margin: 3px 0; }
.body a { text-decoration-thickness: 2px; text-underline-offset: 2px; text-decoration-color: var(--accent); font-weight: 600; }
.body code { font-family: var(--mono); font-size: .88em; padding: 1px 5px; background: var(--code-bg); border-radius: 3px; }
.body strong { font-weight: 700; }

.steps { list-style: none; margin: 0; padding: 0 !important; counter-reset: s; }
.steps li { position: relative; padding: 0 0 16px 50px; counter-increment: s; margin: 0; }
.steps li::before {
    content: counter(s); position: absolute; left: 0; top: -2px;
    width: 34px; height: 34px; display: grid; place-items: center;
    background: var(--ink); color: var(--sheet-bg);
    font-family: var(--mono); font-weight: 700; font-size: 16px; border-radius: var(--radius);
}
html[data-theme="nuit"] .steps li::before { background: rgba(255,255,255,.08); color: var(--accent); border: 1px solid var(--line); }
.steps b { display: block; font-family: var(--cond); font-weight: 800; font-size: 19px; text-transform: uppercase; letter-spacing: .02em; }
html[data-theme="nuit"] .steps b { font-weight: 700; font-stretch: 85%; }
.steps span { color: var(--muted); }

.ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 14px; }
.way { padding: 16px 16px 6px; border: 2px solid var(--ink); border-radius: var(--radius); }
html[data-theme="nuit"] .way { border: 1px solid var(--line); background: rgba(255,255,255,.03); }
.way.loud { border-color: var(--red); }
.way h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 8px !important; }
.way h3 em { font-style: normal; font-family: var(--mono); font-size: 13px; font-weight: 700; text-transform: none; white-space: nowrap; }
.way ul { color: var(--muted); font-size: 15.5px; }
.way.loud h3 em { color: var(--red); }
.way.calm h3 em { color: var(--green); }

.classified {
    margin: 22px 0 14px; padding: 20px 20px 10px; position: relative;
    border: 2px dashed var(--ink); border-radius: var(--radius);
}
html[data-theme="nuit"] .classified { border: 1px dashed rgba(255,255,255,.22); }
.classified > .stamp { position: absolute; right: 16px; top: -14px; background: var(--sheet-bg); }

.tip {
    margin: 18px 0; padding: 14px 16px 2px 18px; border-left: 6px solid var(--accent);
    background: rgba(242,163,36,.12); font-weight: 600; border-radius: var(--radius);
}
.tip.warn { border-left-color: var(--red); background: rgba(179,39,29,.08); padding-bottom: 14px; }
.tip p { margin: 0 0 12px; }

.table { overflow-x: auto; margin: 0 0 16px; }
.table table { border-collapse: collapse; width: 100%; font-size: 15.5px; }
.table th, .table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-family: var(--mono); font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faded); border-bottom: 2px solid var(--ink); }
html[data-theme="nuit"] .table th { border-bottom-color: var(--line); }
.table tr:hover td { background: rgba(242,163,36,.08); }

.facts { padding: 26px 22px 18px; }
/* La colonne entiere suit le defilement (fiche technique + voir aussi), sauf si elle depasse l'ecran (app.js : .tall) */
.case > aside { position: sticky; top: 16px; }
.case > aside.tall { position: static; }
.facts .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.fact { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: baseline; }
.fact:last-of-type { border-bottom: 0; }
.fact span { font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--faded); }
.fact b { font-weight: 700; text-align: right; }
.fact b.big { font-family: var(--mono); font-size: 21px; color: var(--green); }
.facts .foot { margin-top: 10px; padding-top: 12px; border-top: 2px solid var(--ink); letter-spacing: .1em; }
html[data-theme="nuit"] .facts .foot { border-top: 1px solid var(--line); }
.see { margin-top: 18px; padding: 18px 20px; }
.see a { display: flex; justify-content: space-between; padding: 8px 0; text-decoration: none; font-weight: 700; border-top: 1px solid var(--line); }
.see .eyebrow { margin-bottom: 6px; }
.see a:hover { color: var(--red); }
html[data-theme="nuit"] .see a:hover { color: var(--accent); }

.notfound { max-width: 620px; margin: 60px auto; padding: 40px 36px 36px; text-align: center; }
.notfound h1 { font-size: 120px; margin: 16px 0 8px; }
.notfound p { color: var(--muted); margin: 0 0 22px; }

footer { padding: 26px 0 40px; color: var(--world-dim); font-family: var(--mono); font-size: 12px; letter-spacing: .06em; }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ================= Lecture d'une fiche ================= */
/* Barre de lecture en haut de l'ecran */
.progress { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 50; pointer-events: none; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); }
html[data-theme="nuit"] .progress i { background: var(--grad); }

/* Ancre de section, visible au survol du titre */
.body h2, .body h3 { position: relative; scroll-margin-top: 16px; }
.anchor {
    margin-left: .35em; text-decoration: none !important; color: var(--faded) !important;
    opacity: 0; transition: opacity .12s; font-weight: 700 !important;
}
.body h2:hover .anchor, .body h3:hover .anchor, .anchor:focus { opacity: 1; }
.body h2:target, .body h3:target { color: var(--red); }
html[data-theme="nuit"] .body h2:target, html[data-theme="nuit"] .body h3:target { color: var(--accent); }

/* Sommaire en tete de fiche */
.toc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 18px 0 4px; padding: 12px 0 0; border-top: 1px dashed var(--line); }
.toc .eyebrow { margin-right: 4px; }
.toc a {
    text-decoration: none; font-family: var(--cond); font-weight: 800; font-size: 14.5px; letter-spacing: .04em; text-transform: uppercase;
    padding: 4px 9px 3px; border: 1.5px solid var(--line); border-radius: var(--radius); color: var(--muted);
}
.toc a:hover { border-color: var(--ink); color: var(--ink); }
html[data-theme="nuit"] .toc a { font-weight: 700; font-stretch: 85%; }
html[data-theme="nuit"] .toc a:hover { border-color: var(--accent); color: var(--accent); }
.toc .redact { height: .8em; }

/* Precedente / suivante */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 30px; padding-top: 18px; border-top: 2px solid var(--ink); }
html[data-theme="nuit"] .pager { border-top: 1px solid var(--line); }
.pager a { text-decoration: none; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius); }
.pager a:hover { border-color: var(--ink); }
html[data-theme="nuit"] .pager a:hover { border-color: var(--accent); }
.pager .next { text-align: right; grid-column: 2; }
.pager small { display: block; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faded); }
.pager b { font-family: var(--cond); font-weight: 800; font-size: 19px; text-transform: uppercase; letter-spacing: .02em; }

/* ================= Cartes des dossiers ================= */
.card { display: flex; flex-direction: column; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 18px; }
.card-top .tag { font-size: 9.5px; padding: 2px 6px; }
.card-foot {
    margin-top: auto; padding-top: 12px; display: flex; justify-content: space-between; align-items: end; gap: 10px;
}
.card p + .card-foot { margin-top: 14px; border-top: 1px dashed var(--line); }
.card-foot .k small { display: block; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--faded); }
.card-foot .k b { font-family: var(--mono); font-size: 15px; color: var(--green); }
.mini-stamp {
    flex: none; padding: 2px 7px 1px; border: 2px solid currentColor; color: var(--red);
    font-family: var(--cond); font-weight: 800; font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
    transform: rotate(-3deg); white-space: nowrap;
}
.mini-stamp.green { color: var(--green); }
.mini-stamp.ink { color: var(--ink); }
html[data-theme="nuit"] .mini-stamp { transform: none; border-width: 1px; border-radius: 99px; font-weight: 700; font-size: 10.5px; }

/* ================= Tableau comparatif ================= */
.board-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.board-filter button {
    font-family: var(--mono); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    padding: 6px 10px; background: none; color: var(--ink); border: 1.5px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.board-filter button.on { background: var(--ink); color: var(--sheet-bg); border-color: var(--ink); }
html[data-theme="nuit"] .board-filter button.on { background: var(--accent); color: #111; border-color: var(--accent); }
.board td small { display: block; color: var(--faded); font-size: 12.5px; line-height: 1.3; }
.board td a { font-weight: 700; }
.board td.dim { color: var(--faded); }
.board th[data-sortable] { cursor: pointer; user-select: none; white-space: nowrap; }
.board th[data-sortable]::after { content: " ↕"; opacity: .4; }
.board th[data-dir="asc"]::after { content: " ↑"; opacity: 1; }
.board th[data-dir="desc"]::after { content: " ↓"; opacity: 1; }
.board tr[hidden] { display: none; }
.board-note { font-size: 13.5px; color: var(--faded); }

/* ================= Index A-Z ================= */
.az-letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 26px; }
.az-letters a {
    width: 34px; height: 34px; display: grid; place-items: center; text-decoration: none;
    font-family: var(--cond); font-weight: 800; font-size: 18px; color: var(--world);
    border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius);
}
.az-letters a:hover { background: var(--accent); color: #17140f; border-color: var(--accent); }
.az { padding: 18px 30px 26px; margin-bottom: 60px; }
.az h2 { margin: 18px 0 6px; font-size: 34px; color: var(--accent); scroll-margin-top: 16px; }
html[data-theme="casier"] .az h2 { color: var(--red); }
.az-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
.az-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 0; border-top: 1px solid var(--line); text-decoration: none; align-items: baseline; }
.az-row:hover b { text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: var(--accent); }
.az-row small { grid-column: 1 / -1; color: var(--muted); font-size: 14px; line-height: 1.35; }
.az-row .tag { font-size: 9.5px; }

/* ================= Accueil (outils) ================= */
.section-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ================= Petits ecrans ================= */
@media (max-width: 900px) {
    .hero, .case, .duo { grid-template-columns: minmax(0, 1fr); }
    .folders, .cards { grid-template-columns: 1fr 1fr; }
    .case > aside { position: static; }
    .server { transform: none; }
}
@media (max-width: 560px) {
    body { font-size: 16px; }
    .top { padding-top: 16px; }
    .logo b { font-size: 36px; }
    .folders, .cards { grid-template-columns: minmax(0, 1fr); }
    .folder.big { grid-column: auto; }
    .case-main { padding: 26px 18px 22px; }
    .search { order: 3; max-width: none; flex-basis: 100%; }
    .top-tools { margin-left: auto; }
    .steps li { padding-left: 44px; }
    .az { padding: 14px 16px 20px; }
    .az-list { grid-template-columns: minmax(0, 1fr); }
    .pager { grid-template-columns: minmax(0, 1fr); }
    .pager .next { grid-column: auto; }
}
/* ================= Mode appli (telephone du jeu) =================
   Le telephone choisit langue et theme, et a son propre bouton de fermeture : en-tete reduit. */
html.in-app .top-tools, html.in-app footer { display: none; }
html.in-app main { padding-bottom: 24px; }
/* Dans l'ecran du telephone (etroit) ; la grande fenetre garde la mise en page ordinateur */
@media (max-width: 700px) {
    html.in-app body { font-size: 15px; }
    html.in-app .top { padding-top: 10px; }
    html.in-app .top .wrap { gap: 10px; }
    html.in-app .logo b { font-size: 28px; }
    html.in-app .search kbd { display: none; }
    html.in-app .search { order: 3; max-width: none; flex-basis: 100%; margin-left: 0; }
    html.in-app .tabs { margin-top: 12px; }
    html.in-app .tab { font-size: 14px; padding: 8px 10px 7px; }
    html.in-app .crumbs { margin: 16px 0 12px; }
    html.in-app .hero { margin: 22px 0 26px; }
    html.in-app .case-main { padding: 24px 16px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .folder, .card { transition: none; }
}
