/* ==========================================================================
   Item 205 · Hémoptysie — styles spécifiques
   Pneumologie · urgence aiguë · double arbre décisionnel + mindmap radiale
   Composants spécifiques : mnemo-card ABCDE (5 cards · lettres géantes),
   gallery image-205 (3 scanners), schéma anastomoses bronchopulmonaires.
   ========================================================================== */

:root {
  --paper:    var(--bg-card);
  --paper-2:  #fffcf5;
  --rule:     #d7ccb4;
  --rule-2:   var(--accent-dash);
  --bg-2:     #ece5d6;
  --bg-3:     #e4dcc8;
  --ink-2:    #524a3e;
  --ink-3:    #8a8270;
  --ink-4:    #b2a98f;
  --danger:   var(--alert-red);
  --warn:     #8a5a12;
  --ok:       #4e6a2f;
  --info:     var(--accent-blue);

  --fam-pneumo:  var(--spe-pneumo);
  --fam-mir:     var(--spe-interne, #1a1713);
  --fam-warn:    var(--warn);
  --fam-info:    var(--accent-blue);
  --fam-ok:      var(--ok);
  --fam-urg:     var(--alert-red);
}

.content { max-width: 1400px; }

@keyframes pc-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.content-panel.active { animation: pc-fadeIn .35s ease-out; }

.mono   { font-family: var(--font-mono); }
.danger { color: var(--danger); }
.warn   { color: var(--warn); }
.ok     { color: var(--ok); }
.muted  { color: var(--ink-3); }

/* Sec-title + rang-tag */
.sec-title       { display: flex; align-items: baseline; gap: 16px; margin: 36px 0 18px; flex-wrap: wrap; }
.sec-num         { font-family: var(--font-mono); font-size: 11px; letter-spacing: .18em; color: var(--ink-3); text-transform: uppercase; }
.sec-title h2    { font-family: var(--font-serif); font-weight: 500; font-size: 30px; letter-spacing: -.01em; margin: 0; line-height: 1; }
.sec-title .rule { flex: 1; height: 1px; background: var(--rule); margin-bottom: 8px; min-width: 40px; }
.sec-title .hint { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }

.rang-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 2px;
  border: 1px solid var(--rule-2); color: var(--ink-2); background: var(--paper);
  vertical-align: middle;
}
.rang-tag.rang-a { color: var(--ok); border-color: color-mix(in oklab, var(--ok) 40%, var(--rule-2)); }
.rang-tag.rang-b { color: var(--ink-3); border-color: var(--rule-2); }

/* Familles de couleurs */
.fam-pneumo  { --fam: var(--fam-pneumo);  --fam-bg: #e3e8d4; }
.fam-warn    { --fam: var(--fam-warn);    --fam-bg: #f3e9cc; }
.fam-info    { --fam: var(--fam-info);    --fam-bg: #d5e3e7; }
.fam-ok      { --fam: var(--fam-ok);      --fam-bg: #dde2c8; }
.fam-mir     { --fam: var(--fam-mir);     --fam-bg: #ede1ce; }
.fam-urg     { --fam: var(--fam-urg);     --fam-bg: #fbeee3; }

/* Vignette */
.vignette {
  background: var(--paper); border: 1px solid var(--rule);
  border-left: 3px solid var(--fam-pneumo);
  border-radius: 3px; padding: 18px 22px; margin: 14px 0;
}
.vignette .vg-tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px;
}
.vignette p { margin: 0; font-size: 14px; color: var(--ink); line-height: 1.6; }
.vignette .vg-trap {
  margin-top: 14px; padding: 12px 14px; background: var(--bg-2);
  border-left: 3px solid var(--fam-pneumo); border-radius: 2px;
  font-size: 13px; color: var(--ink-2); line-height: 1.55;
}

/* Keypoints (liste numérotée) */
.kp-ol {
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 3px; padding: 14px 18px 14px 38px; margin: 12px 0;
}
.kp-ol li {
  margin: 8px 0; padding-left: 6px; line-height: 1.55;
  font-size: 13.5px; color: var(--ink-2);
}
.kp-ol li::marker { color: var(--fam-pneumo); font-weight: 600; }
.kp-ol li b { color: var(--ink); font-weight: 600; }

/* Définitions cards */
.def-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px; margin: 14px 0;
}
.def-card {
  background: var(--paper); border: 1px solid var(--rule);
  border-top: 3px solid var(--fam-pneumo);
  border-radius: 3px; padding: 14px 16px;
}
.def-card h3 {
  font-family: var(--font-serif); font-weight: 500; font-size: 18px;
  margin: 0 0 4px; letter-spacing: -.005em; color: var(--ink);
}
.def-card .def-sub {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); display: block; margin-bottom: 8px;
}
.def-card p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.def-card p b { color: var(--ink); font-weight: 600; }

/* Lane / step / flow-row */
.lane {
  background: var(--fam-bg, var(--bg-2));
  border: 1px solid color-mix(in oklab, var(--fam, var(--ink)) 30%, var(--rule));
  border-radius: 3px; padding: 16px 18px; margin: 14px 0;
}
.lane .lane-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.lane .lane-h .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--fam, var(--ink)); }
.lane .lane-h h3 { font-family: var(--font-serif); font-weight: 500; font-size: 18px; margin: 0; letter-spacing: -.005em; }
.lane .lane-h .kind { margin-left: auto; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; color: var(--ink-3); text-transform: uppercase; }
.lane > p { font-size: 13px; color: var(--ink-2); }
.lane > ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.lane > ul li { margin: 5px 0; }
.lane > ul li b { color: var(--ink); font-weight: 600; }

.flow-row     { display: grid; gap: 14px; }
.flow-row.r-2 { grid-template-columns: repeat(2, 1fr); }
.flow-row.r-3 { grid-template-columns: repeat(3, 1fr); }

.step { background: #fff; border: 1px solid var(--rule); border-radius: 3px; padding: 14px 16px; position: relative; }
.step .sn { position: absolute; top: -10px; left: 14px; background: var(--paper); padding: 0 8px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; color: var(--ink-3); text-transform: uppercase; }
.step h5 { font-family: var(--font-serif); font-weight: 500; font-size: 16px; margin: 4px 0 6px; }
.step p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.step p b { color: var(--ink); font-weight: 600; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 12px 0; }
table.matrix { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--rule); }
table.matrix th, table.matrix td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; font-size: 12.5px; }
table.matrix thead th { background: var(--bg-2); font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); font-weight: 500; border-bottom: 1px solid var(--rule-2); }
table.matrix tbody th { font-family: var(--font-serif); font-weight: 500; font-size: 14px; color: var(--ink); border-right: 1px solid var(--rule); width: 20%; }
table.matrix tbody tr:last-child th, table.matrix tbody tr:last-child td { border-bottom: none; }
table.matrix tbody tr:hover td { background: #fff; }
table.matrix.compact th, table.matrix.compact td { padding: 8px 10px; font-size: 12px; }
table.matrix ul { margin: 0; padding-left: 18px; line-height: 1.7; }
table.matrix ul li { margin: 4px 0; }

/* Hbox (callout horizontal) */
.hbox {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 3px;
  padding: 12px 16px; margin: 12px 0;
  display: grid; grid-template-columns: 64px 1fr; gap: 4px 16px; align-items: baseline;
}
.hbox > .n {
  grid-column: 1; grid-row: 1 / -1; align-self: start; padding-top: 2px;
  font-family: var(--font-mono); font-size: 18px; color: var(--fam-pneumo); font-weight: 500;
}
.hbox > p, .hbox > ul {
  grid-column: 2; margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.55;
}
.hbox > ul { padding-left: 18px; }
.hbox > ul li { margin: 4px 0; }
.hbox > p b, .hbox > ul li b { color: var(--ink); font-weight: 600; }

/* Alert clinical (encadré rouge) */
.alert-clinical {
  background: #f3dccf; border: 1px solid var(--danger);
  border-radius: 4px; padding: 16px 20px;
  display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: start;
  margin: 18px 0;
}
.alert-clinical .alert-icon {
  font-family: var(--font-serif); font-size: 32px; line-height: 1;
  color: var(--danger); font-style: italic; font-weight: 500;
}
.alert-clinical h4 {
  font-family: var(--font-serif); font-weight: 500; font-size: 18px;
  letter-spacing: -.005em; color: var(--danger); margin: 0 0 8px;
}
.alert-clinical p { font-size: 13px; color: var(--ink-2); line-height: 1.55; margin: 4px 0 0; }
.alert-clinical ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.alert-clinical ul li { margin: 4px 0; }
.alert-clinical ul li b { color: var(--ink); font-weight: 600; }

/* Mnémo ABCDE — 5 cards (lettres géantes) */
.abcde-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 14px; margin: 14px 0;
}
.mnemo-card {
  background: var(--paper); border: 1px solid var(--rule);
  border-top: 4px solid var(--fam-pneumo);
  border-radius: 4px; padding: 18px 14px; text-align: center;
  display: flex; flex-direction: column; gap: 8px;
}
.mnemo-card .mnemo-letter {
  font-family: var(--font-serif); font-weight: 600; font-size: 64px; line-height: 1;
  color: var(--fam-pneumo); margin: 0;
}
.mnemo-card .mnemo-name {
  font-family: var(--font-serif); font-weight: 500; font-size: 16px;
  letter-spacing: -.005em; color: var(--ink); margin: 0;
}
.mnemo-card .mnemo-desc {
  font-size: 12px; color: var(--ink-2); line-height: 1.5; margin: 0;
}

/* Schémas SVG natifs */
.schema-wrap {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  padding: 16px 18px; margin: 12px 0;
}
.schema-wrap svg { width: 100%; height: auto; display: block; }
.schema-legend {
  font-size: 12px; color: var(--ink-3); line-height: 1.55;
  font-style: italic; margin: 10px 0 0; max-width: 1100px;
}
.schema-legend b { color: var(--ink); font-weight: 600; }

/* Gallery imagerie (3 scanners) */
#im-gallery {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px; margin: 14px 0;
}
.image-205 {
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 4px; padding: 12px; margin: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.image-205 img {
  width: 100%; height: 220px; object-fit: cover;
  border-radius: 3px; background: #1a1713;
  display: block;
}
.image-205 figcaption {
  font-size: 12px; color: var(--ink-2); line-height: 1.5;
}
.image-205 figcaption b { color: var(--ink); font-weight: 600; }

/* Profil cards (moyens thérapeutiques) */
#moyens-host {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px; margin: 14px 0;
}
.profil-card {
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 4px; border-top: 4px solid var(--fam, var(--ink));
  padding: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
.profil-head {
  background: var(--fam-bg, var(--bg-2));
  padding: 14px 16px;
  border-bottom: 1px solid color-mix(in oklab, var(--fam, var(--ink)) 30%, var(--rule));
}
.profil-head h4 {
  font-family: var(--font-serif); font-weight: 500; font-size: 18px;
  letter-spacing: -.005em; margin: 0 0 4px; color: var(--fam, var(--ink));
}
.profil-tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3);
}
.profil-section { padding: 12px 16px; border-bottom: 1px dashed var(--rule); }
.profil-section:last-child { border-bottom: none; }
.profil-section h6 {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--fam, var(--ink-3));
  margin: 0 0 6px; font-weight: 500;
}
.profil-section ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.profil-section ul li { margin: 4px 0; }
.profil-section ul li b { color: var(--ink); font-weight: 600; }

/* Mindmap */
.mmwrap {
  position: relative; width: 100%;
  border: 1px solid var(--rule); border-radius: 4px;
  background: linear-gradient(180deg, var(--paper-2) 0%, var(--paper) 100%);
  height: 800px; overflow: hidden;
}
.mmwrap .zctl { position: absolute; top: 14px; right: 14px; z-index: 10; display: flex; gap: 4px; }
.mmwrap .zctl button {
  width: 32px; height: 32px; background: var(--paper); border: 1px solid var(--rule);
  border-radius: 3px; font-family: var(--font-mono); font-size: 14px;
  color: var(--ink-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mmwrap .zctl button:hover { background: var(--bg-2); }
.mmwrap .zhint {
  position: absolute; bottom: 14px; left: 14px; z-index: 5;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em;
  color: var(--ink-3); background: var(--paper); padding: 4px 10px;
  border-radius: 2px; border: 1px solid var(--rule);
}
.mmwrap svg.canvas { width: 100%; height: 100%; cursor: grab; }
.mmwrap svg.canvas:active { cursor: grabbing; }
.mmwrap svg.canvas .root-circle { fill: var(--fam-pneumo); }
.mmwrap svg.canvas .root-text { fill: var(--paper); font-family: var(--font-serif); font-weight: 500; }
.mmwrap svg.canvas .node-card { cursor: pointer; }
.mmwrap svg.canvas .node-card:hover .node-bg { stroke-width: 2; }
.mmwrap svg.canvas .node-bg { fill: #fff; stroke: var(--rule-2); stroke-width: 1; }
.mmwrap svg.canvas .node-accent { fill: var(--fam, var(--ink)); }
.mmwrap svg.canvas .node-title { fill: var(--ink); font-family: var(--font-serif); font-weight: 500; font-size: 15px; }
.mmwrap svg.canvas .node-sub { fill: var(--ink-2); font-size: 11px; }
.mmwrap svg.canvas .node-chip { fill: #fff; stroke: var(--rule); stroke-width: 1; }
.mmwrap svg.canvas .node-chip-t { fill: var(--ink-2); font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.mmwrap svg.canvas path.link { fill: none; stroke: var(--rule-2); stroke-width: 1.2; stroke-dasharray: 3 4; }
.mmwrap svg.canvas path.link.main { stroke-width: 1.4; }
.mmwrap svg.canvas path.link.sat { stroke: var(--rule-2); stroke-width: 1; stroke-dasharray: 1 5; opacity: .55; }
.mmwrap svg.canvas .ring { fill: none; stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 5; }
.mmwrap svg.canvas .node-sat { cursor: pointer; }
.mmwrap svg.canvas .node-sat:hover .sat-bg { fill: var(--ink); }
.mmwrap svg.canvas .node-sat:hover .sat-title,
.mmwrap svg.canvas .node-sat:hover .sat-sub { fill: var(--paper); }
.mmwrap svg.canvas .sat-bg { fill: var(--bg-2); stroke: var(--ink); stroke-width: 1; }
.mmwrap svg.canvas .sat-title { fill: var(--ink); font-family: var(--font-serif); font-weight: 500; font-size: 12.5px; }
.mmwrap svg.canvas .sat-sub { fill: var(--ink-2); font-size: 9.5px; font-family: var(--font-mono); letter-spacing: .04em; }

/* Responsive */
@media (max-width: 900px) {
  .abcde-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .mmwrap { height: 600px; }
  .flow-row.r-2, .flow-row.r-3 { grid-template-columns: 1fr; }
  .def-grid { grid-template-columns: 1fr; }
  .abcde-grid { grid-template-columns: 1fr; }
  #moyens-host { grid-template-columns: 1fr; }
  table.matrix tbody th { width: auto; }
}

/* MODE NUIT */
body.dark-mode {
  --paper:    #1f1c17;
  --paper-2:  #251f17;
  --rule:     #4a4232;
  --rule-2:   #6b5e45;
  --bg-2:     #2a241c;
  --bg-3:     #322a20;
  --ink-2:    #d7ccb4;
  --ink-3:    #a89c7d;
  --ink-4:    #786a52;
}
body.dark-mode .vignette { background: var(--paper); }
body.dark-mode .vignette p { color: var(--ink-2); }
body.dark-mode .vignette .vg-trap { background: var(--bg-2); color: var(--ink-3); }
body.dark-mode .def-card { background: var(--paper); }
body.dark-mode .def-card p { color: var(--ink-2); }
body.dark-mode .kp-ol { background: var(--paper); }
body.dark-mode .kp-ol li { color: var(--ink-2); }
body.dark-mode .step { background: var(--paper-2); }
body.dark-mode .step p { color: var(--ink-2); }
body.dark-mode .hbox { background: var(--paper); }
body.dark-mode .hbox > p, body.dark-mode .hbox > ul { color: var(--ink-2); }
body.dark-mode table.matrix { background: var(--paper); }
body.dark-mode table.matrix tbody tr:hover td { background: var(--bg-2); }
body.dark-mode .alert-clinical { background: #3a1a14; border-color: #c9624c; }
body.dark-mode .alert-clinical h4 { color: #f0a896; }
body.dark-mode .alert-clinical p, body.dark-mode .alert-clinical ul { color: #f0d5c9; }
body.dark-mode .alert-clinical ul li b { color: #fff8e1; }
body.dark-mode .schema-wrap { background: var(--paper); }
body.dark-mode .profil-card { background: var(--paper); }
body.dark-mode .profil-section ul { color: var(--ink-2); }
body.dark-mode .image-205 { background: var(--paper); }
body.dark-mode .image-205 figcaption { color: var(--ink-2); }
body.dark-mode .mnemo-card { background: var(--paper); }
body.dark-mode .mnemo-card .mnemo-desc { color: var(--ink-2); }
body.dark-mode .mmwrap { background: linear-gradient(180deg, var(--paper-2), var(--paper)); }
body.dark-mode .mmwrap .zctl button { background: var(--paper); color: var(--ink-2); border-color: var(--rule); }
body.dark-mode .mmwrap .zhint { background: var(--paper); color: var(--ink-3); border-color: var(--rule); }
body.dark-mode .mmwrap svg.canvas .node-bg { fill: var(--paper); stroke: var(--rule-2); }
body.dark-mode .mmwrap svg.canvas .node-title { fill: var(--ink-2); }
body.dark-mode .mmwrap svg.canvas .node-sub { fill: var(--ink-3); }
body.dark-mode .mmwrap svg.canvas .node-chip { fill: var(--paper-2); stroke: var(--rule); }
body.dark-mode .mmwrap svg.canvas .node-chip-t { fill: var(--ink-3); }
body.dark-mode .mmwrap svg.canvas .sat-bg { fill: var(--bg-2); stroke: var(--ink-2); }
body.dark-mode .mmwrap svg.canvas .sat-title { fill: var(--ink-2); }
body.dark-mode .mmwrap svg.canvas .sat-sub { fill: var(--ink-3); }
body.dark-mode .mmwrap svg.canvas .root-circle { fill: var(--ink-2); }
body.dark-mode .mmwrap svg.canvas .root-text { fill: var(--paper); }

/* Decision-tree racine — fix piège 2 classes (rappel mémoire projet) */
.dt-svg .dt-node.dt-root rect { fill: var(--ink); }
.dt-svg .dt-node.dt-root text { fill: var(--paper-2, #faf6ec); }
body.dark-mode .dt-svg .dt-node.dt-root rect { fill: var(--ink-2) !important; }
body.dark-mode .dt-svg .dt-node.dt-root text { fill: var(--paper) !important; }
