/* Navigation commune et recherche du site de documentation */
.sitebar { flex-wrap: nowrap; row-gap: 12px; }
.sitebar .brand-link { display: block; line-height: 0; border-radius: 8px; }
.sitebar .brand-link svg { width: 170px; height: auto; }
.topnav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 0; min-width: 0; justify-content: center; }
.topnav a { font-size: .84rem; font-weight: 600; color: var(--muted); text-decoration: none; padding: 6px 9px; border-radius: 100px; white-space: nowrap; }
.topnav a:hover { color: var(--heading); background: var(--surface); }
.topnav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-wash); }
.sitebar-right { display: flex; align-items: center; gap: 10px; flex: none; }

.search-box { position: relative; }
.search-box input { font: inherit; font-size: .9rem; width: 180px; max-width: 100%; color: var(--text); background: var(--card); border: 1px solid var(--rule); border-radius: 100px; padding: 8px 14px 8px 36px; outline: none; }
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.search-box::before { content: ""; position: absolute; left: 13px; top: 50%; width: 13px; height: 13px; transform: translateY(-50%);
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23665C7A' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E"); }
.search-results { position: absolute; right: 0; top: calc(100% + 8px); width: min(520px, 92vw); max-height: 70vh; overflow-y: auto; background: var(--card); border: 1px solid var(--rule); border-radius: 16px; box-shadow: 0 18px 40px rgba(22,16,31,.22); z-index: 60; display: none; padding: 6px; }
.search-results.open { display: block; }
.search-results a { display: block; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--text); }
.search-results a:hover, .search-results a.sel { background: var(--surface); }
.search-results .sr-path { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.search-results .sr-title { display: block; font-weight: 700; color: var(--heading); margin: 2px 0; }
.search-results .sr-snip { display: block; font-size: .85rem; color: var(--muted); line-height: 1.45; }
.search-results mark { background: var(--yellow-wash); color: inherit; padding: 0 1px; border-radius: 3px; }
.search-results .sr-empty { padding: 14px; color: var(--muted); font-size: .9rem; }
.search-results .sr-count { padding: 6px 12px 4px; font-size: .75rem; color: var(--muted); }

/* Grande recherche de la page d'accueil */
.search-box.big { width: 100%; max-width: 640px; }
.search-box.big input { width: 100%; font-size: 1.05rem; padding: 14px 18px 14px 44px; border-color: transparent; }
.search-box.big::before { left: 17px; width: 17px; height: 17px; }
.search-box.big .search-results { left: 0; right: auto; width: 100%; }
.hero .search-box.big input { background: #fff; color: #2B2237; }

@media (max-width: 1180px) {
  .sitebar { flex-wrap: wrap; }
  .topnav { order: 3; flex-basis: 100%; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
}
@media (max-width: 640px) {
  .sitebar-right { flex: 1 1 100%; order: 2; }
  .search-box { flex: 1 1 auto; }
  .search-box input { width: 100%; }
  .search-results { left: 0; right: 0; width: auto; }
  .sitebar .brand-link svg { width: 140px; }
}
@media print { .topnav, .search-box { display: none !important; } }

/* Page d'accueil */
.home { max-width: 1240px; margin: 0 auto; padding: 48px 28px 90px; display: flex; flex-direction: column; gap: 56px; }
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.tool-card { position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--rule); border-radius: 22px; padding: 30px 26px 24px; display: flex; flex-direction: column; gap: 14px; text-decoration: none; color: var(--text); transition: transform .15s ease, box-shadow .15s ease; }
.tool-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--c, var(--accent)); }
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(22,16,31,.12); }
.tool-card .tc-head { display: flex; align-items: center; gap: 14px; }
.tool-card .ico { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--w, var(--accent-wash)); color: var(--i, var(--accent-ink)); }
.tool-card h3 { font-size: 1.3rem; }
.tool-card .for { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tool-card ul { margin: 0; padding-left: 1.1em; font-size: .93rem; }
.tool-card li + li { margin-top: 3px; }
.tool-card .more { margin-top: auto; font-weight: 700; color: var(--accent-ink); font-size: .92rem; }
.c-ba { --c: var(--accent); } .c-fid { --c: var(--pink); --w: var(--pink-wash); --i: var(--pink-ink); }
.c-red { --c: var(--yellow); --w: var(--yellow-wash); --i: var(--yellow-ink); } .c-cha { --c: var(--heading); --w: var(--surface); --i: var(--heading); }
.c-ach { --c: var(--muted); --w: var(--surface); --i: var(--muted); }
.usecase-band { background: var(--hero); color: var(--on-hero); border-radius: 24px; padding: 36px 34px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 30px; align-items: center; }
.usecase-band h2 { color: #fff; }
.usecase-band p { color: var(--on-hero-mut); }
.usecase-band .qs { display: flex; flex-direction: column; gap: 8px; }
.usecase-band .qs a { display: block; background: rgba(255,255,255,.07); border: 1px solid rgba(241,236,248,.16); border-radius: 12px; padding: 10px 14px; color: #fff; text-decoration: none; font-weight: 600; font-size: .95rem; }
.usecase-band .qs a:hover { background: rgba(121,198,192,.18); border-color: var(--accent); }
.btn-link { display: inline-block; margin-top: 14px; background: var(--accent); color: #16101F; font-weight: 700; text-decoration: none; border-radius: 100px; padding: 11px 20px; }
@media (max-width: 860px) { .usecase-band { grid-template-columns: 1fr; padding: 28px 22px; } }
@media (max-width: 640px) { .home { padding: 32px 16px 70px; } }

/* ---- Couleurs des univers (cartes d'accueil) ---- */
.c-accent { --c: var(--accent); }
.c-pink { --c: var(--pink); --w: var(--pink-wash); --i: var(--pink-ink); }
.c-yellow { --c: var(--yellow); --w: var(--yellow-wash); --i: var(--yellow-ink); }

/* ---- Menu de l'univers, en tête du sommaire ---- */
.unav { margin-bottom: 26px; }
.unav-title { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-ink); text-decoration: none; margin-bottom: 10px; }
.unav-title:hover { color: var(--heading); }
.unav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.unav li { margin: 0; }
.unav a, .unav span { display: block; padding: 6px 12px; border-radius: 10px; font-size: .9rem; line-height: 1.35; color: var(--muted); text-decoration: none; }
.unav a:hover { color: var(--heading); background: var(--surface); }
.unav li.here span { color: var(--heading); font-weight: 700; background: var(--accent-wash); }

/* ---- Pages précédente / suivante ---- */
.pager-wrap { max-width: 1240px; margin: -60px auto 0; padding: 0 28px 48px; }
.pager-wrap:empty { display: none; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-left: 288px; }
.pager a { display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--rule); border-radius: 16px; padding: 16px 20px; text-decoration: none; color: var(--heading); font-weight: 700; }
.pager a:hover { border-color: var(--accent); }
.pager a.next { text-align: right; grid-column: 2; }
.pager small { font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 980px) { .pager { padding-left: 0; } .pager-wrap { margin-top: -40px; } }
@media (max-width: 640px) { .pager-wrap { padding-left: 16px; padding-right: 16px; } .pager { grid-template-columns: 1fr; } .pager a.next { grid-column: auto; } }

/* ---- Cartes des pages d'un univers ---- */
.page-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.page-card { position: relative; background: var(--card); border: 1px solid var(--rule); border-radius: 20px; padding: 24px 24px 20px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--text); transition: transform .15s ease, box-shadow .15s ease; }
a.page-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(22,16,31,.12); border-color: var(--accent); }
.page-card h3 { font-size: 1.08rem; }
.page-card p { font-size: .93rem; color: var(--muted); }
.page-card .more { margin-top: auto; font-weight: 700; color: var(--accent-ink); font-size: .9rem; }
.page-card.todo { background: transparent; border-style: dashed; }
.page-card.todo h3 { color: var(--muted); }
.page-card .pc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

/* ---- Bouton de thème (icône) ---- */
.theme-btn { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; flex: none; }
.sitebar .theme-btn svg { width: 18px; height: 18px; }

/* ---- Figures côte à côte (captures étroites) ---- */
.figrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.figrow figure img { max-height: 640px; width: auto; max-width: 100%; }

/* ---- Menu du haut : 10 entrées sur une ligne en bureau ---- */
.topnav { gap: 0; }
.topnav a { padding: 6px 7px; font-size: .82rem; }
.sitebar-right .search-box input { width: 160px; }

/* ======================================================================
   Mega-menu des univers
   Bureau : panneau sous la barre, ouvert au survol (avec délai) ou au clavier (flèche bas).
   ≤ 980 px : bouton « Menu », tiroir vertical et accordéons.
   ====================================================================== */
.sitebar { position: relative; }
.mm-item { position: static; display: flex; align-items: center; }
.mm-toggle, .menu-btn { display: none; }
.topnav .mm-link { font-size: .82rem; font-weight: 600; color: var(--muted); text-decoration: none; padding: 6px 7px; border-radius: 100px; white-space: nowrap; }
.topnav .mm-link:hover, .mm-item.open > .mm-link { color: var(--heading); background: var(--surface); }
.topnav .mm-link[aria-current="page"] { color: var(--accent-ink); background: var(--accent-wash); }

.mm-panel { display: none; position: absolute; left: 28px; right: 28px; top: calc(100% - 8px); z-index: 70;
  background: var(--card); border: 1px solid var(--rule); border-top: 5px solid var(--c, var(--accent)); border-radius: 20px;
  box-shadow: 0 22px 48px rgba(22,16,31,.22); padding: 24px 26px; grid-template-columns: 250px minmax(0,1fr); gap: 28px; text-align: left; }
.mm-item.open > .mm-panel { display: grid; }
.mm-head { display: flex; flex-direction: column; gap: 10px; }
.mm-head a { font-size: 1.15rem; font-weight: 700; color: var(--heading); text-decoration: none; line-height: 1.3; }
.mm-head a .script { font-size: 1.2em; }
.mm-head a:hover { color: var(--accent-ink); }
.mm-head p { font-size: .88rem; color: var(--muted); line-height: 1.5; }
.mm-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 4px 16px; }
.mm-list li { margin: 0; }
.topnav .mm-list a { display: block; padding: 9px 12px; border-radius: 12px; text-decoration: none; white-space: normal; background: none; font-size: inherit; }
.topnav .mm-list a:hover, .topnav .mm-list a:focus-visible { background: var(--surface); }
.mm-list b { display: block; font-size: .92rem; color: var(--heading); }
.mm-list span { display: block; font-size: .8rem; color: var(--muted); line-height: 1.4; margin-top: 2px; font-weight: 400; }
.mm-list a[aria-current="page"] { background: var(--accent-wash); }
.mm-list a[aria-current="page"] b { color: var(--accent-ink); }
.mm-list .mm-opt { display: inline-block; margin: 0 0 0 4px; font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--yellow-ink); background: var(--yellow-wash); border-radius: 100px; padding: 1px 7px; vertical-align: 2px; }

@media (max-width: 1180px) {
  .topnav { overflow: visible; flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 980px) {
  .menu-btn { display: grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0; cursor: pointer;
    color: var(--muted); background: var(--card); border: 1px solid var(--rule); border-radius: 100px; }
  .menu-btn:hover, .menu-btn[aria-expanded="true"] { color: var(--heading); }
  .sitebar .menu-btn svg { width: 20px; height: 20px; }
  .topnav { display: none; }
  .sitebar.menu-open .topnav { display: flex; order: 3; flex: 1 1 100%; flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--card); border: 1px solid var(--rule); border-radius: 18px; padding: 8px; max-height: 75vh; overflow-y: auto; }
  .mm-item { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; border-radius: 12px; }
  .topnav .mm-link { font-size: .95rem; padding: 11px 12px; border-radius: 12px; }
  .mm-toggle { display: grid; place-items: center; width: 40px; height: 40px; border: 0; background: none; cursor: pointer; color: var(--muted); border-radius: 10px; }
  .mm-toggle::after { content: ""; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .15s ease; }
  .mm-item.open > .mm-toggle::after { transform: rotate(-135deg) translateY(-2px); }
  .mm-toggle:hover { background: var(--surface); }
  .mm-panel { position: static; grid-column: 1 / -1; border: 0; box-shadow: none; border-radius: 0; padding: 0 0 8px 8px; }
  .mm-item.open > .mm-panel { display: block; }
  .mm-head { display: none; }
  .mm-list { grid-template-columns: 1fr; }
  .mm-list span { display: none; }
  .topnav .mm-list a { padding: 8px 12px; }
}
@media print { .menu-btn, .mm-panel { display: none !important; } }
@media (max-width: 980px) {
  .sitebar.menu-open .topnav { flex-wrap: nowrap; justify-content: flex-start; overflow-x: hidden; }
  .topnav .mm-item { width: 100%; }
}

/* ---- Bouton « haut de page » ---- */
.to-top { position: fixed; right: 24px; bottom: 24px; z-index: 40; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #16101F; background: var(--accent); box-shadow: 0 10px 24px rgba(22,16,31,.25);
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--accent-ink); color: #fff; }
.to-top:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (max-width: 640px) { .to-top { right: 16px; bottom: 16px; width: 42px; height: 42px; } }
@media (prefers-reduced-motion: reduce) { .to-top { transition: none; } }
@media print { .to-top { display: none !important; } }
