/* Documentation Modula — même police (Inter, embarquée) et mêmes couleurs que le site.
   Aucune ressource externe. */
:root {
  --bg: #ffffff; --side: #f8fafc; --border: #e2e8f0; --text: #0f172a; --text2: #475569; --muted: #64748b;
  --accent: #0284c7; --accent-bg: #e0f2fe;
  --p: #0d9488; --p-bg: #ccfbf1; --b: #0369a1; --b-bg: #e0f2fe; --a: #7c3aed; --a-bg: #ede9fe; --e: #b45309; --e-bg: #fef3c7;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; color: var(--text); background: var(--bg); font-size: 16px; line-height: 1.6; }
a { color: var(--accent); }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-sub { color: var(--muted); font-size: 14px; }
.menu-btn { display: none; border: 1px solid var(--border); background: #fff; border-radius: 8px; width: 36px; height: 36px; font-size: 18px; cursor: pointer; }

.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.side { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; background: var(--side); border-right: 1px solid var(--border); padding: 16px 12px 40px; }

.search { position: relative; margin-bottom: 14px; }
.search input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 14px; background: #fff; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.results { margin-top: 8px; background: #fff; border: 1px solid var(--border); border-radius: 8px; max-height: 60vh; overflow-y: auto; }
.results a { display: block; padding: 8px 12px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); font-size: 14px; }
.results a:last-child { border-bottom: none; }
.results a:hover, .results a.sel { background: var(--accent-bg); }
.results small { display: block; color: var(--muted); font-size: 12px; }
.results .none { padding: 10px 12px; color: var(--muted); font-size: 14px; }
.results mark { background: #fef08a; color: inherit; }

.tree details { margin-bottom: 2px; }
.tree summary { cursor: pointer; padding: 6px 8px; border-radius: 6px; font-weight: 600; font-size: 14px; list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: '▸'; display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
.tree details[open] > summary::before { transform: rotate(90deg); }
.tree summary:hover { background: #eef2f7; }
.tree ul { list-style: none; margin: 2px 0 8px; padding: 0 0 0 16px; }
.tree a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--text2); text-decoration: none; font-size: 14px; }
.tree a:hover { background: #eef2f7; color: var(--text); }
.tree a.current { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
/* Sujets d'une page : sous son titre, plus petits, reliés par un filet. */
.tree details.page { margin: 0; }
.tree details.page > summary { display: flex; align-items: center; padding: 0; font-weight: inherit; }
.tree details.page > summary::before { flex: 0 0 14px; margin-left: -14px; text-align: center; }
.tree details.page > summary:hover { background: none; }
.tree details.page > summary > a { flex: 1; min-width: 0; }
.tree ul.topics { margin: 2px 0 6px 12px; padding: 0 0 0 8px; border-left: 1px solid var(--border); }
.tree .topics a { padding: 3px 10px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.tree .topics a:hover { color: var(--text); }
.tree .topics a.here { color: var(--accent); font-weight: 600; background: none; }

/* Colonne de lecture centrée dans la zone principale. */
.content { width: 100%; max-width: 860px; margin: 0 auto; padding: 40px 48px 80px; }
.crumb { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
h1 { margin: 0 0 12px; font-size: 32px; line-height: 1.2; }
.lead { font-size: 18px; color: var(--text2); margin: 0 0 36px; }

.feature { border-top: 1px solid var(--border); padding-top: 36px; margin-top: 48px; }
.feature h2 { font-size: 22px; line-height: 1.3; margin: 0 0 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.feature p { margin: 0 0 12px; }
.lvl, .pro { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.lvl-p { background: var(--p-bg); color: var(--p); }
.lvl-b { background: var(--b-bg); color: var(--b); }
.lvl-a { background: var(--a-bg); color: var(--a); }
.lvl-e { background: var(--e-bg); color: var(--e); }
.pro { background: linear-gradient(135deg, #0ea5e9, #06b6d4); color: #fff; }

.box { margin: 14px 0; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.box-label { padding: 6px 14px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--side); border-bottom: 1px solid var(--border); }
.box-body { margin: 0; padding: 12px 16px; }
ol.box-body, ul.box-body { padding-left: 36px; }
.box-body li { margin: 4px 0; }
.box-example { border-color: #bae6fd; } .box-example .box-label { background: #f0f9ff; color: var(--b); }
.box-tip { border-color: #fde68a; } .box-tip .box-label { background: #fffbeb; color: var(--e); }

kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: #fff; font: 13px/1.6 ui-monospace, monospace; }
code { padding: 1px 5px; border-radius: 4px; background: #f1f5f9; font: 14px ui-monospace, monospace; }
.ui { font-weight: 600; }
table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--side); font-size: 13px; }

/* Accueil */
.brand-sub { text-decoration: none; }
.brand-sub:hover { color: var(--text); }
.entries { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 8px 0 12px; }
.entry { display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.entry:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(2, 132, 199, .12); }
.entry-icon { font-size: 26px; line-height: 1; }
.entry strong { font-size: 17px; color: var(--accent); }
.entry span:last-child { color: var(--text2); font-size: 15px; }
.home-block { border-top: 1px solid var(--border); padding-top: 36px; margin-top: 48px; }
.home-block h2 { font-size: 22px; line-height: 1.3; margin: 0 0 14px; }
.home-block td .lvl, .home-block p .pro { vertical-align: 1px; }
.toc { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 28px; }
.toc-group h3 { font-size: 15px; margin: 12px 0 6px; }
.toc-group ul { list-style: none; margin: 0; padding: 0; }
.toc-group li { margin: 2px 0; }
.toc-group a { text-decoration: none; font-size: 15px; }
.toc-group a:hover { text-decoration: underline; }

/* Sommaire : Par thème / Par niveau */
.tree-home { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin: 0 0 10px; border-radius: 6px; font-weight: 600; font-size: 14px; color: var(--text); text-decoration: none; }
.tree-home::before { content: '⌂'; font-size: 16px; line-height: 1; color: var(--muted); }
.tree-home:hover { background: #eef2f7; }
.tree-home.current { background: var(--accent-bg); color: var(--accent); }
.tree-home.current::before { color: var(--accent); }
.view-switch { display: flex; gap: 2px; padding: 3px; margin: 0 0 12px; background: #e9eef4; border-radius: 9px; }
.view-switch button { flex: 1; border: none; background: none; padding: 6px 8px; border-radius: 7px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text2); cursor: pointer; }
.view-switch button:hover { color: var(--text); }
.view-switch button[aria-selected="true"] { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.tree-level { display: none; }
.view-niveau .tree-theme { display: none; }
.view-niveau .tree-level { display: block; }
.level-group > summary { display: flex; align-items: center; gap: 8px; }
.level-group > summary::before { margin-right: -2px; }
.lv-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.lv-p .lv-dot { background: var(--p); } .lv-b .lv-dot { background: var(--b); }
.lv-a .lv-dot { background: var(--a); } .lv-e .lv-dot { background: var(--e); }
.lv-count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); background: #eef2f7; border-radius: 10px; padding: 0 7px; }

.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); }
.pager a { text-decoration: none; font-weight: 600; }

@media (max-width: 860px) {
  .entries { grid-template-columns: 1fr; }
  .menu-btn { display: block; }
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; top: 56px; left: 0; width: 300px; max-width: 85vw; z-index: 15; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 16px rgba(0,0,0,.08); }
  body.side-open .side { transform: none; }
  .content { padding: 24px 16px 60px; }
  h1 { font-size: 26px; }
}
