/* ============================================================
   Ressources EMF — feuille de style commune
   Direction « Suisse clair » : IBM Plex, fond blanc, filets,
   accent rouge employé avec parcimonie.
   Un seul fichier à éditer pour changer le thème du site.
   ============================================================ */

:root {
  color-scheme: light;

  --bg:        #ffffff;
  --surface-2: #f4f5f7;
  --border:    #d3d7dd;
  --rule:      #15181d;
  --text:      #15181d;
  --muted:     #5c6570;
  --accent:    #c1272d;

  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;

  --col: 760px;
}

*, *::before, *::after { box-sizing: border-box; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
svg.spr { position: absolute; width: 0; height: 0; }

/* ---------- en-tête ---------- */
.site-head { border-bottom: 2px solid var(--rule); }
.site-head .inner {
  max-width: var(--col); margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.wordmark { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); }
.wordmark .mono-badge {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 6px;
  background: var(--rule); color: #fff;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.wordmark .wm-name { font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; }
.site-head .flag {
  font-size: 10.5px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--border); border-radius: 20px; padding: 3px 9px; white-space: nowrap;
}

/* ---------- fil d'Ariane ---------- */
.crumbs {
  max-width: var(--col); margin: 0 auto; padding: 16px 24px 0; width: 100%;
  font-size: 12.5px; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 7px; align-items: center;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: 0.4; }
.crumbs [aria-current] { color: var(--text); font-weight: 500; }

/* ---------- corps ---------- */
main.wrap {
  max-width: var(--col); margin: 0 auto; padding: 24px 24px 64px; width: 100%; flex: 1;
}
.page-head { margin: 6px 0 30px; }
.page-head h1 {
  font-size: 26px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 8px; text-wrap: balance;
}
.page-head p { margin: 0; color: var(--muted); max-width: 60ch; line-height: 1.55; }

.section-label {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text);
  margin: 36px 0 15px; padding-bottom: 8px; border-bottom: 1px solid var(--rule);
}
.section-label:first-of-type { margin-top: 0; }

/* ---------- cartes de navigation ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
a.card {
  display: block; text-decoration: none; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 15px 16px 16px; transition: border-color 0.14s;
}
a.card:hover { border-color: var(--accent); }
a.card .card-ic { width: 19px; height: 19px; margin-bottom: 11px; color: var(--accent); display: block; }
a.card .card-t { font-weight: 600; font-size: 13.5px; }
a.card .card-s { font-size: 11.5px; color: var(--muted); margin-top: 3px; font-family: var(--mono); }

/* ---------- liste de documents ---------- */
.doc-list { display: flex; flex-direction: column; gap: 9px; }
a.doc {
  display: flex; align-items: center; gap: 13px; text-decoration: none; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 15px; transition: border-color 0.14s;
}
a.doc:hover { border-color: var(--accent); }
a.doc .badge {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.03em;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
a.doc .doc-body { min-width: 0; flex: 1; }
a.doc .doc-t { font-weight: 500; font-size: 14.5px; }
a.doc .doc-m { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 3px; }
a.doc .doc-ic { margin-left: auto; width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); }
a.doc:hover .doc-ic { color: var(--accent); }

/* ---------- lecteur intégré (Calaméo, etc.) ---------- */
.embed-frame {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--surface-2);
}
.embed-frame iframe { display: block; width: 100%; height: min(78vh, 760px); border: 0; }
.embed-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 0; }
a.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 13px; font-weight: 500; text-decoration: none;
  transition: border-color 0.14s;
}
a.btn:hover { border-color: var(--accent); }
a.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---------- divers ---------- */
img.figure { max-width: 100%; border: 1px solid var(--border); border-radius: 10px; display: block; }
.note {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
  color: var(--muted); font-size: 12.5px; line-height: 1.55; margin-top: 28px;
}
.empty {
  border: 1px dashed var(--border); border-radius: 10px; padding: 40px 30px;
  text-align: center; color: var(--muted); font-size: 13.5px;
}

/* ---------- pied de page ---------- */
.site-foot { border-top: 1px solid var(--border); margin-top: auto; }
.site-foot .inner {
  max-width: var(--col); margin: 0 auto; padding: 20px 24px 26px;
  font-size: 11.5px; line-height: 1.6; color: var(--muted);
}
.site-foot b { color: var(--text); font-weight: 600; }

/* ---------- cartes « schéma » avec miniature (module R01) ---------- */
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
a.thumb-card {
  display: block; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  transition: border-color 0.14s;
}
a.thumb-card:hover { border-color: var(--accent); }
a.thumb-card .tc-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; }
a.thumb-card .tc-ic { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; display: block; }
a.thumb-card .tc-t { font-size: 14px; font-weight: 600; }
a.thumb-card .tc-thumb {
  background: var(--surface-2); border-top: 1px solid var(--border);
  height: 180px; display: flex; align-items: center; justify-content: center; padding: 14px;
}
a.thumb-card .tc-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
a.thumb-card .tc-path {
  padding: 0 15px 13px; font-family: var(--mono); font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- bouton retour (visionneuses plein écran) ---------- */
.back-btn {
  position: fixed; top: 16px; left: 16px; z-index: 20;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: var(--sans); font-size: 13px; font-weight: 500;
  text-decoration: none; padding: 8px 14px 8px 10px;
}
.back-btn:hover { border-color: var(--accent); }
.back-btn svg { width: 15px; height: 15px; }

@media (max-width: 560px) {
  .card-grid { grid-template-columns: 1fr; }
  main.wrap { padding: 20px 18px 56px; }
  .site-head .inner, .crumbs, .site-foot .inner { padding-left: 18px; padding-right: 18px; }
}
