/* Cryptidex — documentation multi-pages. Palette « guide de terrain ». */
:root {
  --ink: #211f18;
  --muted: #514c3d;
  --faint: #8a8368;
  --line: #d8d1bd;
  --line-soft: #e7e0cd;
  --bg-side: #f3efe4;
  --accent: #2f5d3d;
  --accent-ink: #234a30;
  --accent-soft: #e7eddf;
  --code-bg: #efe9db;
  --paper: #fbf9f3;
  --water: #3f78b0;
  --fire: #c2622f;
  --flora: #4e8a3e;
  --urban: #7d7f88;
  --ghost: #6b4e86;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased;
  font-size: 15px; line-height: 1.65;
}
.serif { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 56px;
  display: flex; align-items: center; gap: 20px; padding: 0 22px;
  background: rgba(251,249,243,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15.5px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { width: 24px; height: 24px; image-rendering: pixelated; }
.brand .tag { color: var(--faint); font-weight: 500; }
.topbar .spacer { flex: 1; }
.topbar a.tlink { color: var(--muted); font-size: 14px; font-weight: 500; }
.topbar a.tlink:hover { color: var(--ink); text-decoration: none; }
.lang-switch { background: none; border: 1px solid var(--line); color: var(--muted); padding: 5px 11px; border-radius: 7px; cursor: pointer; font: 500 12.5px inherit; }
.lang-switch:hover { border-color: var(--faint); color: var(--ink); }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 7px; padding: 5px 10px; cursor: pointer; font-size: 15px; }

/* layout */
.shell { display: flex; max-width: 1320px; margin: 0 auto; }
aside {
  width: 264px; flex: none; border-right: 1px solid var(--line);
  background: var(--bg-side); padding: 26px 16px 60px;
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
}
.navgroup { margin-bottom: 22px; }
.navgroup .glabel { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 0 10px; margin-bottom: 6px; }
aside a.item {
  display: block; color: var(--muted); font-size: 13.5px; font-weight: 500;
  padding: 7px 10px; border-radius: 7px; line-height: 1.4;
}
aside a.item:hover { background: #ebe5d5; color: var(--ink); text-decoration: none; }
aside a.item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

main { flex: 1; min-width: 0; }
.doc { max-width: 780px; margin: 0 auto; padding: 46px 44px 120px; }

/* right toc */
.toc { width: 210px; flex: none; padding: 46px 22px; position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; }
.toc .tlabel { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.toc a { display: block; color: var(--muted); font-size: 12.5px; padding: 4px 0 4px 12px; border-left: 2px solid var(--line-soft); line-height: 1.5; }
.toc a:hover { color: var(--ink); text-decoration: none; border-left-color: var(--faint); }

/* content typography */
.doc .eyebrow { color: var(--accent); font-size: 13px; font-weight: 600; margin-bottom: 8px; letter-spacing: .02em; }
.doc h1 { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; font-weight: 600; font-size: 40px; letter-spacing: -.5px; line-height: 1.12; margin-bottom: 14px; }
.doc .lede { font-size: 18px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.doc h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 26px; letter-spacing: -.2px; font-weight: 600; margin: 54px 0 4px;
  padding-top: 28px; border-top: 1px solid var(--line); scroll-margin-top: 72px;
}
.doc h2:first-of-type { border-top: none; padding-top: 8px; }
.doc h3 { font-size: 16.5px; font-weight: 700; margin: 28px 0 6px; }
.doc p { margin: 12px 0; color: #3c3a2e; }
.doc ul { margin: 12px 0 12px 4px; list-style: none; }
.doc ul li { position: relative; padding-left: 20px; margin: 8px 0; color: #3c3a2e; }
.doc ul li::before { content: ""; position: absolute; left: 4px; top: 10px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.doc b, .doc strong { color: var(--ink); font-weight: 650; }
.doc code { background: var(--code-bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font: 500 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent-ink); }
.doc .foot-note { color: var(--faint); font-size: 13px; margin-top: 6px; }

.callout { display: flex; gap: 12px; background: var(--accent-soft); border: 1px solid #cdd9c6; border-radius: 10px; padding: 14px 16px; margin: 18px 0; font-size: 14px; color: #3c3a2e; }
.callout.warn { background: #fbecdd; border-color: #e6c9a8; }
.callout .ci { flex: none; font-size: 16px; line-height: 1.5; }
.callout b { color: var(--accent-ink); }

table { border-collapse: collapse; width: 100%; margin: 18px 0; font-size: 13.5px; }
thead th { background: var(--bg-side); color: var(--ink); font-weight: 650; text-align: left; }
th, td { border: 1px solid var(--line); padding: 9px 13px; }
tbody tr:nth-child(even) { background: #f6f2e8; }
td.na { color: var(--faint); }

.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); vertical-align: middle; }

/* pager between pages */
.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 56px; flex-wrap: wrap; }
.pager a { flex: 1; min-width: 200px; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; color: var(--ink); }
.pager a:hover { border-color: var(--faint); text-decoration: none; background: var(--bg-side); }
.pager .dir { font-size: 12px; color: var(--faint); }
.pager .ttl { font-weight: 650; margin-top: 3px; }
.pager a.next { text-align: right; }

/* hub cards (index) */
.hub { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 30px; }
a.hubcard { display: flex; gap: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; color: var(--ink); background: #fff; align-items: flex-start; }
a.hubcard:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 8px 26px -14px rgba(35,74,48,.4); }
.hubcard .hi { font-size: 24px; line-height: 1; flex: none; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); border-radius: 10px; }
.hubcard h3 { font-size: 17px; font-weight: 700; margin-bottom: 3px; }
.hubcard p { font-size: 13.5px; color: var(--muted); line-height: 1.5; }
@media (max-width: 720px) { .hub { grid-template-columns: 1fr; } }

/* ---------- diagrams ---------- */
.fig-cap { font-size: 12.5px; color: var(--faint); font-style: italic; text-align: center; margin-top: 8px; }

/* element cycle */
.cyclewrap { display: flex; justify-content: center; margin: 26px 0 6px; }

/* type chart */
.chart { border-collapse: collapse; margin: 20px auto; font-size: 12.5px; }
.chart th, .chart td { border: 1px solid var(--line); width: 62px; height: 38px; text-align: center; padding: 0; }
.chart th { background: var(--bg-side); font-weight: 650; }
.chart td.win { background: #dcecd6; color: #2c5a2f; font-weight: 700; }
.chart td.lose { background: #f0dcd0; color: #9a4e2a; }
.chart td.neu { color: var(--faint); }
.chart td.self { background: #efe9db; }

/* element chips */
.elrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.elchip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 99px; color: #fff; }
.el-eau { background: var(--water); } .el-feu { background: var(--fire); }
.el-flore { background: var(--flora); } .el-urbain { background: var(--urban); }
.el-spectre { background: var(--ghost); }

/* gene grades */
.grades { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.grade { flex: 1; min-width: 120px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; text-align: center; }
.grade .g { font-family: "Iowan Old Style", Georgia, serif; font-size: 26px; font-weight: 700; }
.grade small { color: var(--muted); font-size: 12px; }
.g-c { color: #9a8f6a; } .g-b { color: #6f8f5a; } .g-a { color: #3f7d4a; } .g-s { color: #b8862c; }

/* difficulty gradient */
.gradient { display: flex; margin: 20px 0 6px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.gradient div { flex: 1; padding: 12px 10px; text-align: center; color: #fff; font-size: 12.5px; }
.gradient .z0 { background: #4e8a3e; } .gradient .z3 { background: #6f8a3a; }
.gradient .z6 { background: #9a7d33; } .gradient .z10 { background: #8a5a2c; }
.gradient div b { display: block; font-size: 13.5px; }
.gradient div span { opacity: .85; }

/* langue : on masque juste la langue inactive, l'élément visible garde son
   display naturel (table-cell, flex, block…) — robuste pour tous les cas. */
html.lang-fr [data-l="en"] { display: none !important; }
html.lang-en [data-l="fr"] { display: none !important; }

@media (max-width: 1080px) { .toc { display: none; } }
@media (max-width: 820px) {
  aside { position: fixed; left: 0; top: 56px; z-index: 25; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 10px 40px rgba(0,0,0,.12); }
  body.nav-open aside { transform: translateX(0); }
  .menu-btn { display: block; }
  .doc { padding: 32px 22px 90px; }
}
