/* ─────────────────────────────────────────────────────────────────────────────
   public/css/site-map.css — page « Plan du site » (/site-map)
   Aucune couleur nouvelle : tokens de nav-c4c.css et data-c4c.css (charte C4C).
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --f-display: 'Fraunces', Georgia, serif;
  --f-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --f-mono: 'Plus Jakarta Sans', system-ui, sans-serif;
  --sm-card: #FFFFFF;
  --sm-shadow: 0 3px 14px -2px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05);
}
html.dark { --sm-card: #242422; }

.sm-page { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--f-body); -webkit-font-smoothing: antialiased; }
.sm-page *, .sm-page *::before, .sm-page *::after { box-sizing: border-box; }
/* `display` posé plus bas l'emporterait sur l'attribut `hidden`. */
.sm-main [hidden] { display: none !important; }
.sm-main { padding: 32px 0 64px; }
.sm-main :focus-visible { outline: 2px solid var(--btn-fill); outline-offset: 3px; }

/* ── Recherche ── */
.sm-search { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-bottom: 20px; margin-bottom: 28px; border-bottom: 1px solid var(--rule); }
.sm-search label { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.sm-search input {
  flex: 1 1 240px; max-width: 420px; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--ink-4); border-radius: 8px; background: var(--paper); color: var(--ink); font: 400 15px var(--f-body);
}
.sm-count { display: flex; gap: 4px; font-size: 13px; color: var(--ink-3); }
.sm-empty { font-size: 15px; line-height: 24px; color: var(--ink-2); }

.sm-head { margin-bottom: 24px; }
.sm-head h2 { margin: 0 0 8px; font-family: var(--f-display); font-size: 28px; line-height: 1.2; font-weight: 400; }
.sm-head p { margin: 0; max-width: 68ch; font-size: 15px; line-height: 24px; color: var(--ink-2); }

/* ── Sommaire ── */
.sm-link { color: var(--ink); text-decoration: none; }
a.sm-link { border-bottom: 1px solid var(--rule); transition: border-color .15s; }
a.sm-link:hover { border-bottom-color: #D25D38; }
.sm-desc { margin: 2px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-3); max-width: 62ch; }
.sm-badge { display: inline-block; margin-inline-start: 10px; font-size: 11px; line-height: 1.4; color: var(--ink-3); border: 1px solid var(--rule); border-radius: 2px; padding: 1px 6px; vertical-align: 1px; }

.sm-root { display: grid; grid-template-columns: 72px minmax(0, 1fr); padding: 0 0 24px; border-bottom: 1px solid var(--ink); }
.sm-root::before { content: ""; grid-row: span 2; width: 14px; height: 14px; margin-top: 8px; border-radius: 50%; border: 3px solid #D25D38; }
.sm-root > .sm-link { justify-self: start; font-family: var(--f-display); font-size: 28px; }

.sm-toc { list-style: none; margin: 0; padding: 0; columns: 2 340px; column-gap: 48px; }
.sm-chap { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-content: start; break-inside: avoid; padding: 28px 0; border-bottom: 1px solid var(--rule); }
.sm-chap > * { grid-column: 2; }
.sm-chap > .sm-num { grid-column: 1; grid-row: 1 / span 3; margin: 0; font-family: var(--f-display); font-weight: 300; font-size: 44px; line-height: 1; color: var(--ink-3); font-variant-numeric: lining-nums tabular-nums; }
.sm-chap-title { margin: 0 0 6px; font-family: var(--f-display); font-size: 26px; line-height: 1.15; font-weight: 400; }
.sm-chap-title a { color: var(--ink); text-decoration: none; }
.sm-chap-title a:hover { text-decoration: underline; text-decoration-color: #D25D38; text-underline-offset: 5px; text-decoration-thickness: 2px; }
.sm-chap-desc { margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.sm-list { list-style: none; margin: 0; padding: 0; }
.sm-list > li { padding: 10px 0; border-top: 1px solid var(--rule); }
.sm-list .sm-link { font-size: 15px; font-weight: 500; }
.sm-list--sub { margin-block: 10px -10px; margin-inline-start: 2px; padding-inline-start: 16px; border-inline-start: 1px solid var(--rule); }
.sm-list--sub > li:first-child { border-top: 0; }
.sm-list--sub .sm-link { font-weight: 400; }
.sm-list li[data-sm-kind="soon"] > .sm-link { color: var(--ink-3); }

.sm-badge--here { border-color: #D25D38; color: var(--accent-text); font-weight: 600; }
.sm-badge--here::before, .sm-here-btn::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 6px; border-radius: 50%; background: #D25D38; animation: sm-beacon 2.4s ease-out infinite; }
@keyframes sm-beacon { 0% { box-shadow: 0 0 0 0 rgba(210, 93, 56, .6); } 70%, 100% { box-shadow: 0 0 0 7px rgba(210, 93, 56, 0); } }

.sm-fiches { margin-top: 6px; }
.sm-fiches summary { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; cursor: pointer; font-size: 13px; color: var(--accent-text); }
.sm-fiches summary .sm-n { font-weight: 600; }
.sm-fiches ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; padding: 0; }
.sm-fiches li a { display: inline-block; padding: 5px 9px; border: 1px solid var(--rule); border-radius: 2px; font-size: 12px; color: var(--ink-2); text-decoration: none; }
.sm-fiches li a:hover { background: var(--paper-2); border-color: var(--ink-4); color: var(--ink); }

/* ── Scènes dessinées ── */
.sm-stage { position: relative; }
.sm-stage--3d { height: clamp(440px, 74vh, 720px); border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; background: var(--paper); }
.sm-stage--night { background: var(--ink); border-color: var(--ink); }
html.dark .sm-stage--night { background: var(--paper); border-color: var(--rule); }
.sm-canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.sm-canvas.is-dragging { cursor: grabbing; }
.sm-canvas.is-over { cursor: pointer; }
.sm-stage:fullscreen { height: 100vh; border: 0; border-radius: 0; }
.sm-stage:fullscreen .sm-canvas { touch-action: none; }

.sm-controls { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; }
.sm-controls button {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--ink-4); border-radius: 8px; background: var(--paper); color: var(--ink); cursor: pointer; font: 500 18px/1 var(--f-body);
}
.sm-controls button:hover { background: var(--paper-2); border-color: var(--ink); }
.sm-controls svg { width: 18px; height: 18px; pointer-events: none; }
.sm-hint { position: absolute; left: 12px; bottom: 10px; margin: 0; padding: 3px 8px; border-radius: 2px; background: var(--paper); font-size: 12px; color: var(--ink-3); pointer-events: none; }

.sm-jump { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.sm-jump button {
  min-height: 36px; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); color: var(--ink-2);
  cursor: pointer; font: 500 13px var(--f-body);
}
.sm-jump button:hover { border-color: var(--ink); color: var(--ink); }
.sm-jump button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.sm-jump button.sm-dim { opacity: .45; }
.sm-jump button.sm-here-btn { border-color: #D25D38; color: var(--accent-text); font-weight: 600; }
.sm-jump button.sm-here-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ── Légende du système solaire ── */
.sm-legend-title { margin: 24px 0 12px; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.sm-legend { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); column-gap: 24px; margin: 0; padding: 0; }
.sm-legend li { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); }
.sm-legend canvas { grid-row: span 2; width: 44px; height: 44px; }
.sm-key { grid-column: 2; justify-self: start; padding: 0; border: 0; border-bottom: 1px solid transparent; background: none; color: var(--ink); cursor: pointer; font: 500 15px var(--f-body); text-align: start; }
.sm-key::after { content: ""; position: absolute; inset: 0; } /* toute la ligne se touche */
.sm-legend li:hover .sm-key, .sm-key[aria-pressed="true"] { border-bottom-color: #D25D38; }
.sm-key-desc { grid-column: 2; font-size: 13px; line-height: 1.5; color: var(--ink-3); }
#sm-card-search { cursor: pointer; }

/* ── Cartes dessinées en SVG (fleuve, musée) ── */
.sm-drawing { width: 100%; }
.sm-svg { display: block; width: 100%; height: auto; font-family: var(--f-body); }
html[dir="rtl"] .sm-svg { direction: rtl; } /* le dessin est mis en miroir par site-map-svg.js */
.sm-svg text { fill: var(--ink); }
.sm-svg .t-title { font-family: var(--f-display); font-size: 21px; }
.sm-svg .t-name { font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; fill: var(--ink-3); }
.sm-svg .t-label { font-size: 13.5px; font-weight: 500; }
.sm-svg .t-sub { font-size: 12.5px; font-weight: 400; fill: var(--ink-2); }
.sm-svg .t-quiet { fill: var(--ink-3); }
.sm-svg .t-halo { stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; paint-order: stroke; }
.sm-svg a { cursor: pointer; outline: none; }
.sm-svg a .hit { fill: transparent; }
.sm-svg a .mark { transition: fill .15s, stroke .15s, stroke-width .15s; }
.sm-svg a:hover .mark, .sm-svg a:focus-visible .mark, .sm-svg a.is-selected .mark { stroke: #D25D38; stroke-width: 3; }
.sm-svg a:hover text, .sm-svg a:focus-visible text, .sm-svg a.is-selected text { text-decoration: underline; text-decoration-color: #D25D38; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.sm-svg a:focus-visible .hit { stroke: var(--btn-fill); stroke-width: 2; }
.sm-svg .sm-node { transition: opacity .2s; }
.sm-svg.is-searching .sm-node:not(.is-match) { opacity: .18; }

/* Fleuve */
.sm-svg .water { fill: var(--data-2); stroke: var(--data-3); stroke-width: 1.2; }
.sm-svg .bank { fill: none; stroke: var(--data-3); stroke-linecap: round; }
.sm-svg .stream { fill: none; stroke: var(--data-2); stroke-linecap: round; }
.sm-svg .flow { fill: none; stroke: var(--paper); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 3 21; animation: sm-flow 3.2s linear infinite; pointer-events: none; }
.sm-svg .decor { fill: none; stroke: var(--ink-4); stroke-width: 1; stroke-linejoin: round; stroke-linecap: round; opacity: .75; }
.sm-svg .decor-fill { fill: var(--data-1); stroke: var(--data-3); stroke-width: 1; }
.sm-svg .mark { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; }
.sm-svg .mark--solid { fill: var(--ink); }
.sm-svg .mark--ext { stroke-dasharray: 2 2; }
.sm-svg .mark--soon { stroke: var(--ink-4); stroke-dasharray: 2 3; }
.sm-svg .mark--fiche { fill: var(--sm-card); stroke: var(--ink-3); stroke-width: 1; }
.sm-svg .mark--source { fill: var(--paper); stroke: #D25D38; stroke-width: 3.5; }
.sm-svg .twig { fill: none; stroke: var(--data-3); stroke-width: 2; stroke-linecap: round; }
@keyframes sm-flow { to { stroke-dashoffset: -48; } }

/* « Vous êtes ici » */
.sm-svg .mark.mark--here { fill: #D25D38; stroke: var(--paper); stroke-width: 2; }
.sm-svg .here-ring { fill: none; stroke: #D25D38; animation: sm-ripple 2.4s ease-out infinite; }
@keyframes sm-ripple { 0% { stroke-width: 1; stroke-opacity: .9; } 70%, 100% { stroke-width: 14; stroke-opacity: 0; } }
.sm-svg .here-pill { fill: var(--sm-card); stroke: #D25D38; stroke-width: 1.5; }
.sm-svg text.t-here { fill: var(--accent-text); font-size: 12px; font-weight: 600; }
.sm-svg a text.t-here { text-decoration: none; }
.sm-svg .boat-hull { fill: var(--ink); }
.sm-svg .boat-sail { fill: var(--paper); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.sm-svg .boat-flag { fill: #D25D38; }
.sm-svg .rope { fill: none; stroke: var(--ink-3); stroke-width: 1; }

/* Musée */
.sm-svg .room { fill: var(--sm-card); stroke: var(--ink); stroke-width: 4; }
.sm-svg .room--hall { fill: var(--paper-2); }
.sm-svg .garden { fill: var(--data-1); stroke: var(--data-3); stroke-width: 1; }
.sm-svg .door-gap { stroke: var(--sm-card); stroke-width: 6; }
.sm-svg .door-arc { fill: none; stroke: var(--ink-3); stroke-width: 1; }
.sm-svg .route { fill: none; stroke: #D25D38; stroke-width: 2; stroke-dasharray: 6 6; stroke-linecap: round; stroke-linejoin: round; }
.sm-svg .badge-num { fill: var(--paper); stroke: #D25D38; stroke-width: 2; }
.sm-svg .badge-txt { font-family: var(--f-display); font-size: 16px; text-anchor: middle; }

/* ── Fiche de la page choisie ── */
.sm-card { position: relative; margin-top: 16px; padding-block: 20px; padding-inline: 20px 56px; border: 1px solid var(--rule); border-radius: 3px; background: var(--sm-card); box-shadow: var(--sm-shadow); }
.sm-card-path { margin: 0 0 4px; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.sm-card-title { margin: 0 0 6px; font-family: var(--f-display); font-size: 22px; line-height: 1.25; font-weight: 400; }
.sm-card-desc, .sm-card-badge { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: var(--ink-2); max-width: 64ch; }
.sm-card-badge { font-size: 13px; color: var(--ink-3); }
.sm-card-badge:empty, .sm-card-desc:empty { display: none; }
.sm-card-close { position: absolute; top: 8px; inset-inline-end: 8px; width: 40px; height: 40px; border: 0; border-radius: 8px; background: none; color: var(--ink-3); font-size: 22px; cursor: pointer; }
.sm-card-close:hover { background: var(--paper-2); color: var(--ink); }
.sm-card-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--rule); }
.sm-card-list:empty { display: none; }
.sm-card-list span { display: inline-block; padding: 5px 9px; border: 1px dashed var(--rule); border-radius: 2px; font-size: 13px; color: var(--ink-3); }
.sm-card-list a, .sm-card-list button { display: inline-block; padding: 5px 9px; border: 1px solid var(--rule); border-radius: 2px; background: none; font: 400 13px var(--f-body); color: var(--ink-2); text-decoration: none; cursor: pointer; }
.sm-card-list button:hover,
.sm-card-list a:hover { background: var(--paper-2); border-color: var(--ink-4); color: var(--ink); }

/* Sur une scène : la fiche se pose dans la vue, en bas à gauche. */
.sm-stage--3d > .sm-card { position: absolute; left: 12px; bottom: 12px; z-index: 2; width: min(400px, calc(100% - 24px)); max-height: calc(100% - 76px); overflow: auto; margin: 0; }
/* Sur une carte longue : elle suit le bas de l'écran. */
.sm-stage--map > .sm-card { position: sticky; bottom: 12px; z-index: 2; width: min(440px, 100%); max-height: 60vh; overflow: auto; }

.sm-footer { padding: 24px 40px; background: var(--paper-2); border-top: 1px solid var(--rule); text-align: center; font-size: 13px; color: var(--ink-3); }
.sm-footer p { margin: 0; }

/* Écriture arabe : l'interlettrage rompt les liaisons entre les lettres. */
html[dir="rtl"] .sm-search label,
html[dir="rtl"] .sm-card-path,
html[dir="rtl"] .sm-svg .t-name { letter-spacing: 0; }

@media (max-width: 767px) {
  .sm-main { padding-top: 24px; }
  .sm-root, .sm-chap { grid-template-columns: 48px minmax(0, 1fr); }
  .sm-chap > .sm-num { font-size: 30px; }
  .sm-toc { columns: 1; }
  .sm-stage--3d { height: 68vh; min-height: 400px; }
  .sm-jump { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .sm-jump button { flex: none; }
  .sm-stage--3d > .sm-card { position: relative; left: 0; bottom: 0; width: 100%; max-height: none; }
  .sm-stage--3d.has-card { height: auto; overflow: visible; }
  .sm-stage--3d.has-card > .sm-canvas { height: 56vh; min-height: 340px; }
  .sm-hint { display: none; }
  .sm-footer { padding: 24px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sm-svg .flow, .sm-svg .here-ring, .sm-badge--here::before, .sm-here-btn::before { animation: none; }
}
