/* =========================================================================
   Standard radiographique CHSJSL — charte graphique
   Palette officielle extraite du logo CHSJSL :
   navy #0c233c · vert #25816d · bleu #31a7d1 · orange #ec4303 · or #ddca00
   Typographie : Noto Sans / Noto Sans Display
   ========================================================================= */

:root {
  --navy: #0c233c;
  --green: #25816d;
  --blue: #31a7d1;
  --orange: #ec4303;
  --gold: #ddca00;

  --ink: #1a2230;
  --muted: #5a6b7b;
  --bg: #f5f8f9;
  --card: #ffffff;
  --line: #e2e8ec;

  --green-soft: #eaf3f1;
  --blue-soft: #e8f4fa;
  --orange-soft: #fdeee7;
  --gold-soft: #fbf6df;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(12, 35, 60, 0.06), 0 6px 24px rgba(12, 35, 60, 0.06);
  --maxw: 1000px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Noto Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: "Noto Sans Display", "Noto Sans", system-ui, sans-serif;
  color: var(--navy);
  line-height: 1.25;
  margin: 0 0 .4em;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ----------------------------- En-tête --------------------------------- */
.site-header {
  background: var(--navy);
  color: #fff;
  border-bottom: 4px solid var(--green);
}
.site-header .container {
  display: flex; align-items: center; gap: 18px;
  padding-top: 16px; padding-bottom: 16px;
}
.site-header .logo {
  background: #fff; border-radius: 10px; padding: 8px 12px;
  display: flex; align-items: center; height: 56px;
}
.site-header .logo img { height: 40px; width: auto; display: block; }
.site-header .titles { display: flex; flex-direction: column; }
.site-header .titles .t1 {
  font-family: "Noto Sans Display", sans-serif; font-weight: 700;
  font-size: 1.25rem; color: #fff; letter-spacing: .2px;
}
.site-header .titles .t2 { color: #b9c6d4; font-size: .92rem; }
.site-header .baseline {
  margin-left: auto; color: #8aa0b4; font-style: italic; font-size: .85rem;
  text-align: right; max-width: 220px;
}

/* ----------------------------- Bandeau ---------------------------------- */
.notice {
  background: var(--gold-soft);
  border-bottom: 1px solid #efe3ad;
  color: #6b5a05;
  font-size: .85rem;
}
.notice .container { padding-top: 9px; padding-bottom: 9px; }

/* ----------------------------- Accueil ---------------------------------- */
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: 2rem; }
.hero p.lead { color: var(--muted); font-size: 1.05rem; max-width: 70ch; }

.section-title {
  display: flex; align-items: center; gap: 10px;
  margin: 34px 0 14px; font-size: 1.35rem;
}
.section-title .dot { width: 12px; height: 12px; border-radius: 50%; }

.regions { display: grid; gap: 22px; padding: 8px 0 50px; }
.region-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.region-card .region-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-left: 6px solid var(--green);
}
.region-card.green  .region-head { border-left-color: var(--green); }
.region-card.blue   .region-head { border-left-color: var(--blue); }
.region-card.orange .region-head { border-left-color: var(--orange); }
.region-card .region-head h3 { margin: 0; font-size: 1.15rem; }

.artic-list { list-style: none; margin: 0; padding: 4px 0 10px; }
.artic-list li {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 11px 20px; border-top: 1px solid var(--line);
}
.artic-list li .artic-name { font-weight: 600; color: var(--navy); }
.fiche-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  background: var(--green-soft); color: var(--green); font-size: .85rem;
  font-weight: 600; border: 1px solid #cfe5df;
}
.chip:hover { background: var(--green); color: #fff; text-decoration: none; }
.chip .chip-num { font-weight: 800; margin-right: 6px; opacity: .7; }
.badge-soon {
  font-size: .78rem; color: var(--muted); background: #f0f3f5;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
}

/* ----------------------------- Fiche ------------------------------------ */
.breadcrumb { padding: 18px 0 0; font-size: .9rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }

.fiche-header { padding: 10px 0 6px; }
.fiche-header .numero {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--green); margin-bottom: 6px;
}
.fiche-header h1 { font-size: 1.9rem; margin-bottom: 4px; }
.fiche-header .sub { color: var(--muted); font-size: 1.05rem; }
.status {
  display: inline-block; margin-top: 10px; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; padding: 4px 12px;
  border-radius: 999px;
}
.status.brouillon { background: var(--gold-soft); color: #7a6605; border: 1px solid #ecd98a; }
.status.valide { background: var(--green-soft); color: var(--green); border: 1px solid #bfe0d8; }

.fiche-body { padding: 14px 0 70px; display: grid; gap: 18px; }

.block {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px;
}
.block > h2 {
  font-size: 1.12rem; display: flex; align-items: center; gap: 9px;
  margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.block .num {
  flex: 0 0 26px; height: 26px; border-radius: 7px; background: var(--navy);
  color: #fff; font-size: .8rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.block ul { margin: 0; padding-left: 20px; }
.block ul li { margin: 6px 0; }
.block .kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 16px; }
.block .kv dt { font-weight: 700; color: var(--navy); }
.block .kv dd { margin: 0; }
.block p { margin: 0; }

/* Accents thématiques */
.block.intention { background: var(--green-soft); border-color: #cfe5df; }
.block.intention > h2 { border-bottom-color: #cfe5df; color: var(--green); }
.block.intention .num { background: var(--green); }
.block.intention .ctx {
  font-size: .85rem; color: var(--green); font-weight: 600;
  margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid #cfe5df;
}

.block.pieges { background: var(--orange-soft); border-color: #f7d6c5; }
.block.pieges > h2 { border-bottom-color: #f7d6c5; color: var(--orange); }
.block.pieges .num { background: var(--orange); }

.block.implants { background: var(--blue-soft); border-color: #cfe8f4; }
.block.implants > h2 { border-bottom-color: #cfe8f4; color: #1f7fa8; }
.block.implants .num { background: var(--blue); }
.block.implants .ctx {
  font-size: .85rem; color: #1f7fa8; font-weight: 600; margin-bottom: 8px;
}

/* Images */
.img-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.img-slot {
  border: 2px dashed #c4d0d8; border-radius: 10px; background: #fafcfd;
  min-height: 200px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 18px; color: var(--muted);
}
.img-slot .ico { font-size: 1.8rem; opacity: .5; margin-bottom: 8px; }
.img-slot.reference { border-color: #bfe0d8; background: #f4faf8; }
.img-slot.contre-exemple { border-color: #f7d6c5; background: #fdf6f2; }
.img-slot .tag {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 8px; padding: 3px 10px; border-radius: 999px;
}
.img-slot.reference .tag { background: var(--green-soft); color: var(--green); }
.img-slot.contre-exemple .tag { background: var(--orange-soft); color: var(--orange); }
.img-slot .cap { font-size: .88rem; }

/* Note de discipline (source primaire) sous l'en-tête de fiche */
.src-primaire {
  margin: 12px 0 0; font-size: .8rem; color: var(--muted);
  background: #fff; border: 1px dashed var(--line);
  padding: 8px 12px; border-radius: 8px; max-width: 78ch;
}

/* Emplacement contenant une vraie image de référence */
.img-slot.has-img {
  display: block; padding: 0; min-height: 0; text-align: left;
  background: #fff; border-style: solid; overflow: hidden;
}
.img-ref { display: block; width: 100%; height: auto; background: #0c233c; }
.img-slot.has-img figcaption { display: block; padding: 12px 14px; }
.img-slot.has-img .tag { display: inline-block; margin-bottom: 8px; }
.img-slot.has-img .cap { display: block; color: var(--ink); }
.img-slot.has-img .oslegend {
  display: block; margin-top: 7px; font-size: .8rem; color: var(--muted);
}
.img-slot.has-img .credit {
  display: block; margin-top: 9px; padding-top: 8px; border-top: 1px dotted var(--line);
  font-size: .74rem; color: var(--muted); font-style: italic;
}

/* ----------------------------- Visionneuse (lightbox) ------------------- */
.img-slot.has-img { position: relative; }
.img-ref { cursor: zoom-in; }

.zoom-hint {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(12, 35, 60, .72); color: #fff;
  font-size: .74rem; font-weight: 600; letter-spacing: .2px;
  pointer-events: none; opacity: .85; transition: opacity .15s ease;
}
.img-slot.has-img:hover .zoom-hint,
.img-ref:focus-visible + .zoom-hint { opacity: 1; }
.zoom-hint svg { display: block; }

body.lb-open { overflow: hidden; }

.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px; background: rgba(8, 20, 34, .93); cursor: zoom-out;
}
.lightbox[hidden] { display: none; }

.lightbox-fig {
  margin: 0; cursor: default;
  display: flex; flex-direction: column; align-items: center;
  max-width: 96vw; max-height: 92vh;
}
.lightbox-img {
  display: block; max-width: 96vw; max-height: 80vh; width: auto; height: auto;
  object-fit: contain; border-radius: 8px; background: var(--navy);
  box-shadow: 0 12px 48px rgba(0, 0, 0, .55);
}
.lightbox-cap {
  margin-top: 14px; max-width: min(900px, 92vw); text-align: center;
  color: #e8eef4; font-size: .9rem; line-height: 1.5;
}
.lightbox-cap .lb-cap-main { display: block; font-weight: 600; }
.lightbox-cap .lb-cap-os { display: block; margin-top: 6px; color: #aebccb; font-size: .82rem; }

.lightbox-close {
  position: fixed; top: 18px; right: 22px;
  width: 44px; height: 44px; border-radius: 999px; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff;
  font-size: 1.9rem; line-height: 1; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .26); }
.lightbox-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* Sources */
.block.sources { background: #fbfcfd; }
.block.sources ul { list-style: none; padding-left: 0; }
.block.sources li {
  font-size: .88rem; color: var(--muted); padding: 6px 0;
  border-top: 1px dotted var(--line);
}
.block.sources li:first-child { border-top: none; }

/* ----------------------------- Assistant (Phase 2) ---------------------- */
.assistant-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 900;
  background: var(--navy); color: #fff; border: none;
  border-radius: 999px; padding: 12px 22px; font-weight: 600; font-size: .95rem;
  font-family: inherit; box-shadow: var(--shadow); cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background .15s ease, transform .1s ease;
}
.assistant-fab:hover { background: #123150; }
.assistant-fab:active { transform: translateY(1px); }
.assistant-fab:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.assistant-fab[disabled] { cursor: not-allowed; opacity: .85; }
.assistant-fab .soon {
  font-size: .7rem; background: var(--gold); color: var(--navy);
  padding: 2px 8px; border-radius: 999px; font-weight: 700;
}
body.asst-open .assistant-fab { display: none; }

.assistant-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 950;
  width: 390px; max-width: calc(100vw - 28px);
  height: 72vh; max-height: 680px;
  display: flex; flex-direction: column;
  background: #fff; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: 0 18px 56px rgba(8, 20, 34, .30);
}
.assistant-panel[hidden] { display: none; }

.asst-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--navy); color: #fff;
}
.asst-id { display: flex; flex-direction: column; line-height: 1.2; flex: 1; }
.asst-title { font-weight: 700; }
.asst-sub { font-size: .72rem; opacity: .82; }
.asst-close {
  background: rgba(255, 255, 255, .14); color: #fff; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px; font-size: 1.5rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.asst-close:hover { background: rgba(255, 255, 255, .26); }

.asst-log {
  flex: 1; overflow-y: auto; padding: 14px; background: var(--bg);
  display: flex; flex-direction: column; gap: 12px;
}
.asst-msg { max-width: 88%; font-size: .9rem; line-height: 1.5; }
.asst-msg .msg-body { padding: 10px 12px; border-radius: 12px; }
.asst-msg.user { align-self: flex-end; }
.asst-msg.user .msg-body { background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.asst-msg.bot { align-self: flex-start; }
.asst-msg.bot .msg-body { background: #fff; border: 1px solid var(--line); color: var(--navy); border-bottom-left-radius: 4px; }
.asst-msg.intro .msg-body { background: var(--green-soft); border-color: #cfe5df; color: #2b4a43; }
.asst-msg.escalated .msg-body { background: var(--orange-soft); border-color: #f7d6c5; color: #8a3310; }
.asst-msg.simulated .msg-body { background: var(--gold-soft); border-color: #ecd98a; color: #6b5a05; }

.asst-cite { font-weight: 600; color: var(--green); }
.msg-cites { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.cites-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.cite-chip {
  display: block; padding: 7px 10px; border-radius: 8px; font-size: .8rem;
  background: var(--green-soft); color: var(--green); border: 1px solid #cfe5df;
}
.cite-chip:hover { background: var(--green); color: #fff; text-decoration: none; }

.msg-feedback {
  margin-top: 8px; background: none; border: none; cursor: pointer; padding: 0;
  color: var(--muted); font-size: .75rem; font-family: inherit; text-decoration: underline;
}
.msg-feedback:hover { color: var(--green); }
.feedback-form { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.feedback-form textarea {
  width: 100%; resize: vertical; font-family: inherit; font-size: .82rem;
  padding: 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--navy);
}
.feedback-actions { display: flex; gap: 8px; }
.feedback-actions button {
  font-family: inherit; font-size: .78rem; padding: 6px 12px; border-radius: 7px;
  cursor: pointer; border: none;
}
.fb-send { background: var(--green); color: #fff; }
.fb-cancel { background: #e7ecf0; color: var(--navy); }
.feedback-thanks { font-size: .8rem; color: var(--green); margin: 4px 0 0; }

.asst-input {
  display: flex; gap: 8px; padding: 10px; align-items: flex-end;
  border-top: 1px solid var(--line); background: #fff;
}
.asst-input textarea {
  flex: 1; resize: none; font-family: inherit; font-size: .9rem; line-height: 1.4;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--navy); max-height: 120px;
}
.asst-input textarea:focus { outline: none; border-color: var(--green); }
.asst-send {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; border: none;
  cursor: pointer; background: var(--green); color: #fff; font-size: 1.2rem; line-height: 1;
}
.asst-send:hover { background: #1d6b5a; }

.dots { display: inline-flex; gap: 4px; padding: 3px 0; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: asst-blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes asst-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* ----------------------------- Pied de page ----------------------------- */
.site-footer {
  border-top: 1px solid var(--line); color: var(--muted);
  font-size: .82rem; padding: 22px 0; background: #fff;
}
.site-footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ----------------------------- Responsive ------------------------------- */
@media (max-width: 720px) {
  .site-header .baseline { display: none; }
  .block .kv { grid-template-columns: 1fr; }
  .img-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.6rem; }
  .lightbox { padding: 12px; }
  .lightbox-img { max-height: 74vh; }
  .lightbox-close { top: 8px; right: 10px; width: 40px; height: 40px; }
  .assistant-panel {
    right: 0; bottom: 0; width: 100vw; max-width: 100vw;
    height: 82vh; max-height: none; border-radius: 14px 14px 0 0;
  }
}
