:root{
  --uqam-blue:#005DAA;
  --maxw:48rem;
  --lh:1.35;           /* body line-height */
  --para-after:0.6rem; /* space after paragraphs/lists */
}

/* ===== Base typography & layout ===== */
html{scroll-behavior:smooth;}
body{
  margin:0 auto; max-width:var(--maxw); padding:1rem;
  font:16px/1.55 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  line-height:var(--lh);
}
p{margin:0 0 var(--para-after);}
p,li{hyphens:auto;}
a{color:var(--uqam-blue); text-decoration:none;}
a:hover{text-decoration:underline;}
/* Long external URLs shouldn’t blow the layout */
a[href^="http"]{overflow-wrap:anywhere; word-break:break-word;}

/* Headings */
h1,h2,h3,h4,h5,h6{color:var(--uqam-blue); line-height:1.25; margin-top:1.1rem; margin-bottom:.35rem;}
h1{font-size:1.8rem;}
h2{font-size:1.4rem;}
h3{font-size:1.2rem;}
h4{font-size:1.05rem;}
h5{font-size:.97rem;}
h6{font-size:.9rem;}

/* Lists */
ul,ol{margin:0 0 var(--para-after) 1.25rem;}

/* Tables */
table{width:100%; border-collapse:collapse; display:block; overflow-x:auto;}
th,td{border:1px solid #ddd; padding:.5rem; vertical-align:top;}
th{background:#f6f8fa; text-align:left; position:sticky; top:0;}

/* Footnotes */
section.footnotes,.footnotes{border-top:2px solid #eee; margin-top:3rem; padding-top:1rem;}
sup.note-ref a{text-decoration:none;}

/* Blockquotes */
blockquote{border-left:4px solid #cfd9e3; margin:1rem 0; padding:.5rem 1rem; background:#f8fbff;}

/* ===== Header bar (if present in template) ===== */
.topbar{display:flex; justify-content:space-between; align-items:center; gap:.75rem; padding:.5rem 0; margin-bottom:.5rem;}
.badge-mobile{display:inline-flex; align-items:center; justify-content:center; padding:.15rem .5rem; border-radius:999px; background:var(--uqam-blue); color:#fff; font-size:.75rem; white-space:nowrap; text-align:center; line-height:1; hyphens:none; word-break:normal; flex-shrink:0;}
.doc-actions .btn{display:inline-block; padding:.45rem .7rem; border-radius:.5rem; border:1px solid #cfd9e3; background:#f6f8fa; text-decoration:none; margin-left:.35rem;}

/* ===== Sommaire (ToC) ===== */
details.toc{margin:.75rem 0 1.25rem; border:1px solid #e5e7eb; border-radius:.5rem; padding:.5rem .75rem; background:#fafbfc;}
details.toc summary{cursor:pointer; font-weight:600; color:var(--uqam-blue);}

/* ===== Masthead from the DOCX’s first 5 paragraphs ===== */
body>p:nth-of-type(-n+5){text-align:center; margin:.2rem 0;}
body>p:nth-of-type(1),
body>p:nth-of-type(2),
body>p:nth-of-type(3){font-variant-caps:small-caps; letter-spacing:.03em; font-weight:600; color:#374151; font-size:.95rem;}
body>p:nth-of-type(4){
  margin:.4rem 0 .2rem; color:var(--uqam-blue); font-weight:800; line-height:1.25;
  font-size:clamp(1.2rem, 1rem + 2.6vw, 2rem); text-wrap:balance; hyphens:auto;
}
body>p:nth-of-type(5){color:#6b7280; font-size:.95rem; margin-bottom:.6rem;}

/* ===== Bibliographie: hanging indents ===== */
/* Primary: paragraphs wrapped by Lua as .ref-entry */
.ref-entry>p{
  margin:0 0 var(--para-after);
  padding-left:1.5em !important;
  text-indent:-1.5em !important;
}
/* Fallback: if a ref has an italicised title but wasn’t tagged */
@supports selector(p:has(em)){
  section[id*="bibliographie"] section.level4 p:has(em){
    padding-left:1.5em !important;
    text-indent:-1.5em !important;
  }
  /* Don’t indent the first explanatory paragraph or list items */
  section[id*="bibliographie"] section.level4>p:first-of-type,
  section[id*="bibliographie"] section.level4 li p{
    padding-left:0 !important; text-indent:0 !important;
  }
}

/* ===== Images ===== */
img{max-width:100%; height:auto;}

/* Annex image cards (static PNGs) */
.annex-figure img{
  width:100%; height:auto; display:block;
  background:#fff; border:1px solid #e5e7eb; border-radius:.6rem;
  box-shadow:0 1px 2px rgba(0,0,0,.05);
  margin:1rem auto 1.25rem; max-width:36rem;
}
.annex-figure figcaption{
  text-align:center; font-size:.9rem; color:#6b7280; margin-top:.4rem;
}

/* ===== Print tweaks ===== */
@media print{
  a[href^="http"]:after{content:" (" attr(href) ")"; font-size:90%;}
  body{color:#000;}
}
