/* ==========================================================================
   BIMsmarter.eu - guide-bim.css
   Styles du guide BIM interactif. Charges uniquement sur /guide-bim
   (front-matter page_css). Tout est scope sous .bim-guide pour ne jamais
   fuir vers le reste du site.
   Repris du module Zyro, nettoye de ses contournements :
     - plus de header fixe duplique (le site en a deja un)
     - plus de --zyro-nav-height
     - plus de bouton retour-haut cree en JS (il est global, voir site.css)
   ========================================================================== */

.bim-guide {
  --wip: hsl(38, 92%, 50%);
  --shared: hsl(199, 89%, 48%);
  --published: hsl(142, 71%, 38%);
  --archived: hsl(0, 0%, 50%);
  --g-border: hsla(199, 89%, 48%, 0.25);
  --g-border-strong: hsla(199, 89%, 48%, 0.5);
  --g-soft: hsla(199, 89%, 48%, 0.10);
  --g-deeper: #f8fafc;
  --g-elevated: #f1f5f9;
}

/* Ancres : compense la hauteur du header du site + la nav du guide */
html { scroll-padding-top: 124px; }
@media (min-width: 1024px) { html { scroll-padding-top: 132px; } }

/* ---------- Nav interne sticky ---------- */
.guide-nav {
  position: sticky; top: 64px; z-index: 900;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--g-border);
}
@media (min-width: 1024px) { .guide-nav { top: 72px; } }

.guide-nav ul {
  display: flex; gap: 4px; list-style: none; margin: 0; padding: 8px 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.guide-nav li { margin: 0; }
.guide-nav a {
  display: block; white-space: nowrap; padding: 8px 12px; border-radius: 8px;
  border: 1px solid transparent; color: var(--text-muted);
  font-size: 0.88rem; font-weight: 500;
}
.guide-nav a:hover, .guide-nav a.active {
  color: var(--accent-dark); border-color: var(--g-border);
  background: var(--g-soft); text-decoration: none;
}

/* ---------- Structure ---------- */
.bim-guide .guide-section { margin-bottom: 3rem; scroll-margin-top: 8px; }
.bim-guide .guide-section > p { color: var(--text-muted); }
.bim-guide h3 { font-size: 1.15rem; }
.bim-guide h4 { font-size: 1rem; margin-bottom: 0.5rem; }
.bim-guide code {
  font-family: var(--font-mono); color: var(--accent-dark);
  background: var(--g-soft); padding: 1px 6px; border-radius: 3px; font-size: 0.9em;
}

.guide-badges { display: flex; gap: 8px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 2rem; }
.guide-badges li {
  margin: 0; font-size: 0.75rem; background: var(--g-soft); color: var(--accent-dark);
  border: 1px solid var(--g-border-strong); border-radius: 4px; padding: 4px 10px;
}

.panel {
  background: #fff; border: 1px solid var(--g-border);
  border-radius: 8px; padding: 1.25rem; margin-bottom: 1rem;
}

/* ---------- Schemas SVG ---------- */
.svg-wrap {
  background: var(--g-deeper); border: 1px solid var(--g-border);
  border-radius: 8px; padding: 1rem; margin: 1rem 0 1.5rem; overflow-x: auto;
}
.svg-wrap svg { display: block; width: 100%; max-width: 900px; height: auto; margin: 0 auto; min-width: 600px; }
.svg-caption { text-align: center; color: var(--text-muted); font-size: 0.85rem; font-style: italic; margin: 0.5rem 0 0; }

@media (max-width: 700px) {
  .svg-wrap { position: relative; padding-bottom: 1.75rem; }
  .svg-wrap::after {
    content: "\2190 faire glisser pour voir le schema complet \2192";
    position: absolute; bottom: 0.3rem; left: 0; right: 0; text-align: center;
    font-size: 0.72rem; color: var(--accent-dark); font-style: italic; pointer-events: none;
  }
}

/* ---------- Chaine ISO 19650 ---------- */
.iso-flow {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem; margin: 1.5rem 0; padding: 0; list-style: none;
}
.iso-flow li { margin: 0; }
.iso-step {
  width: 100%; text-align: left; font: inherit; cursor: pointer;
  background: var(--g-elevated); border: 1px solid var(--g-border);
  border-radius: 6px; padding: 0.9rem; transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.iso-step:hover { border-color: var(--accent); transform: translateY(-2px); }
.iso-step[aria-selected="true"] { border-color: var(--accent); background: var(--g-soft); }
.iso-step .step-num { font-family: var(--font-mono); color: var(--accent-dark); font-size: 0.75rem; display: block; margin-bottom: 0.25rem; }
.iso-step .step-name { font-weight: 700; color: var(--navy); font-size: 0.95rem; display: block; margin-bottom: 0.25rem; }
.iso-step .step-fr { color: var(--text-muted); font-size: 0.78rem; display: block; line-height: 1.4; }

.iso-detail {
  background: var(--g-deeper); border: 1px solid var(--g-border);
  border-radius: 8px; padding: 1.5rem; margin-top: 1rem;
}
.iso-detail h3 { margin-top: 0.75rem; }
.iso-detail .sub { color: var(--text-muted); font-size: 0.9rem; margin-top: -0.4rem; }
.iso-detail .block { margin-bottom: 1.25rem; }
.iso-detail .block:last-child { margin-bottom: 0; }
.iso-detail .block h4 {
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); border-bottom: 1px solid var(--g-border);
  padding-bottom: 0.3rem; margin-bottom: 0.6rem;
}
.example {
  background: var(--g-elevated); border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem; border-radius: 0 4px 4px 0; font-size: 0.92rem;
}
.lux-case {
  background: hsla(199, 89%, 48%, 0.08); border: 1px solid var(--g-border);
  border-radius: 4px; padding: 0.75rem 1rem; font-size: 0.92rem;
}
.lux-case::before {
  content: "Cas Luxembourg / Benelux"; display: block; font-weight: 600;
  color: var(--accent-dark); font-size: 0.8rem; margin-bottom: 0.4rem;
}

/* ---------- Roles ---------- */
.role-card {
  background: #fff; border: 1px solid var(--g-border); border-radius: 8px;
  padding: 1.25rem; margin-bottom: 1rem; transition: border-color 0.2s;
}
.role-card:hover { border-color: var(--g-border-strong); }
.role-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem;
}
.role-card h3 { color: var(--accent-dark); font-size: 1.1rem; margin: 0; }
.role-card .role-fr { color: var(--text-muted); font-size: 0.85rem; display: block; margin-top: 2px; }
.role-level {
  background: var(--g-soft); color: var(--accent-dark); border: 1px solid var(--g-border-strong);
  border-radius: 4px; padding: 2px 10px; font-size: 0.75rem;
  font-family: var(--font-mono); white-space: nowrap;
}
.role-card h4 { margin-top: 1rem; }
.role-card ul { font-size: 0.92rem; }

/* ---------- Cycle de vie ---------- */
.lifecycle { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; margin: 1.5rem 0; }
.lifecycle > div {
  border: 1px solid var(--g-border); border-radius: 8px; padding: 1rem; background: var(--g-elevated);
}
.lifecycle h4 { margin-top: 0; }
.lifecycle [data-state="wip"] { border-left: 4px solid var(--wip); }
.lifecycle [data-state="shared"] { border-left: 4px solid var(--shared); }
.lifecycle [data-state="published"] { border-left: 4px solid var(--published); }
.lifecycle [data-state="archived"] { border-left: 4px solid var(--archived); }
.lifecycle [data-state="wip"] h4 { color: hsl(38, 92%, 38%); }
.lifecycle [data-state="shared"] h4 { color: var(--accent-dark); }
.lifecycle [data-state="published"] h4 { color: var(--published); }
.lifecycle [data-state="archived"] h4 { color: hsl(0, 0%, 35%); }
.lifecycle p { font-size: 0.88rem; }
.lifecycle .who { color: var(--text-muted); font-size: 0.78rem; margin-bottom: 0.4rem; }
.lifecycle .who strong { color: var(--navy); }

/* ---------- CDE ---------- */
.cde-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.75rem; margin: 1.5rem 0; }
.cde-rules > div {
  background: var(--g-elevated); border: 1px solid var(--g-border);
  border-top: 3px solid var(--accent); border-radius: 8px; padding: 1.1rem;
}
.cde-rules h4 { color: var(--accent-dark); margin-top: 0; }
.cde-rules p { font-size: 0.9rem; margin: 0; }

.bim-guide table { font-size: 0.9rem; }
.bim-guide table td:first-child { font-weight: 600; color: var(--navy); }
.check { color: hsl(142, 71%, 32%); font-weight: 700; }
.cross { color: hsl(0, 72%, 45%); font-weight: 700; }
.partial { color: hsl(38, 92%, 38%); font-weight: 700; }

.lux-example {
  background: hsla(199, 89%, 48%, 0.06); border: 1px solid var(--g-border);
  border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0;
  padding: 1.25rem; margin-top: 1.25rem;
}
.lux-example::before {
  content: "Déroulé type au Luxembourg"; display: block; font-weight: 700;
  color: var(--accent-dark); font-size: 0.85rem; margin-bottom: 0.75rem; letter-spacing: 0.3px;
}
.steps { list-style: none; padding: 0; counter-reset: s; }
.steps li {
  display: flex; gap: 0.75rem; align-items: flex-start;
  margin-bottom: 0.6rem; font-size: 0.9rem; counter-increment: s;
}
.steps li::before {
  content: counter(s); background: var(--accent); color: #fff;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  min-width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px;
}

/* ---------- Clash detection ---------- */
.clash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.clash-card {
  background: var(--g-elevated); border: 1px solid var(--g-border);
  border-radius: 8px; padding: 1.25rem; position: relative; overflow: hidden;
}
.clash-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.clash-card.hard::before { background: hsl(0, 72%, 50%); }
.clash-card.soft::before { background: hsl(30, 100%, 55%); }
.clash-card.workflow::before { background: hsl(270, 70%, 60%); }
.clash-card .label {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; display: block; margin-bottom: 0.4rem;
}
.clash-card.hard .label { color: hsl(0, 72%, 42%); }
.clash-card.soft .label { color: hsl(30, 100%, 34%); }
.clash-card.workflow .label { color: hsl(270, 70%, 45%); }
.clash-card h3 { margin-top: 0; font-size: 1.1rem; }
.clash-card p { font-size: 0.88rem; }
.clash-card .ex {
  font-size: 0.82rem; color: var(--text-muted); background: var(--g-deeper);
  border-radius: 4px; padding: 0.5rem 0.75rem; font-style: italic; margin: 0;
}
.clash-card .ex strong { color: var(--navy); font-style: normal; }

.sev {
  display: inline-block; padding: 2px 9px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700; white-space: nowrap;
}
.sev-critique { background: hsla(0, 72%, 55%, 0.12); color: hsl(0, 72%, 40%); border: 1px solid hsl(0, 72%, 50%); }
.sev-majeur { background: hsla(30, 100%, 45%, 0.12); color: hsl(30, 100%, 32%); border: 1px solid hsl(30, 100%, 50%); }
.sev-mineur { background: hsla(45, 90%, 50%, 0.15); color: hsl(40, 85%, 30%); border: 1px solid hsl(45, 90%, 45%); }

.bcf-box {
  background: #fff; border: 1px solid var(--g-border); border-radius: 8px;
  padding: 1.25rem; margin-top: 1.5rem;
  display: grid; grid-template-columns: 1fr; gap: 1.25rem;
}
@media (min-width: 720px) { .bcf-box { grid-template-columns: 1fr 1fr; } }
.bcf-box h3 { grid-column: 1 / -1; color: var(--accent-dark); margin-top: 0; }
.bcf-box ul { font-size: 0.88rem; }

/* ---------- Lexique ---------- */
.lex-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.lex-search {
  flex: 1; min-width: 220px; background: var(--g-elevated);
  border: 1px solid var(--g-border); color: var(--text); border-radius: 6px;
  padding: 0.6rem 0.85rem; font-family: inherit; font-size: 0.95rem;
}
.lex-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.lex-filter {
  background: var(--g-elevated); border: 1px solid var(--g-border); color: var(--text-muted);
  border-radius: 6px; padding: 0.55rem 0.9rem; font: inherit; font-size: 0.85rem;
  cursor: pointer; transition: all 0.2s;
}
.lex-filter:hover { color: var(--accent-dark); border-color: var(--g-border-strong); }
.lex-filter[aria-pressed="true"] { background: var(--g-soft); color: var(--accent-dark); border-color: var(--accent); }

.lex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.lex-card {
  background: #fff; border: 1px solid var(--g-border); border-radius: 6px;
  padding: 1rem; transition: border-color 0.2s;
}
.lex-card:hover { border-color: var(--g-border-strong); }
.lex-card[hidden] { display: none; }
.lex-term { font-weight: 700; color: var(--accent-dark); font-size: 1rem; }
.lex-cat {
  display: inline-block; background: var(--g-soft); color: var(--accent-dark);
  border: 1px solid var(--g-border); border-radius: 3px; padding: 1px 6px;
  font-size: 0.7rem; font-family: var(--font-mono); margin-left: 0.4rem;
}
.lex-fr { color: var(--text-muted); font-size: 0.78rem; display: block; margin: 2px 0 0.5rem; }
.lex-def { font-size: 0.88rem; margin: 0; }
.lex-empty { text-align: center; color: var(--text-muted); padding: 2rem; grid-column: 1 / -1; }
.lex-count { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 1rem; }
