:root {
  --oc-blue: #057dc9;
  --oc-green: #72b003;
  --oc-orange: #f96800;
  --oc-red: #c0392b;

  --doc-bg: #ffffff;
  --doc-text: #1f2933;
  --doc-muted: #5b6875;
  --doc-border: #d9e2ec;
  --doc-border-strong: #bcccdc;

  --doc-soft: #f7fafc;
  --doc-toc-bg: #f8fbff;
  --doc-code-bg: #f0f4f8;
  --doc-table-header-bg: #eef6fb;

  --doc-info-bg: #eef7fd;
  --doc-warning-bg: #fff4e8;
  --doc-danger-bg: #fdeeee;

  --doc-quote-bg: #f7efff;
  --doc-quote-text: #3f2a56;
  --doc-quote-border: #8e44ad;
  --doc-quote-rule: #d6b3f0;

  --doc-meta-bg: #f8f1ff;
  --doc-meta-border: #e6d8f5;
  --doc-meta-text: #4b2e68;
  --doc-meta-label: #7a5195;
  --doc-meta-strong: #3f2a56;
}

/* Mode sombre synchronisé avec PaperMod.
   Le script Pandoc doit ajouter class="dark" sur <html>
   quand localStorage["pref-theme"] vaut "dark". */
html.dark {
  --doc-bg: #1d1e20;
  --doc-text: #dadadb;
  --doc-muted: #b0b0b0;
  --doc-border: #3f3f46;
  --doc-border-strong: #52525b;

  --doc-soft: #2e2e33;
  --doc-toc-bg: #2e2e33;
  --doc-code-bg: #2e2e33;
  --doc-table-header-bg: #2e2e33;

  --doc-info-bg: #102a43;
  --doc-warning-bg: #3a2a12;
  --doc-danger-bg: #3a1616;

  --doc-quote-bg: #2d2438;
  --doc-quote-text: #e9d5ff;
  --doc-quote-border: #a78bfa;
  --doc-quote-rule: #6d4d8f;

  --doc-meta-bg: #2e2e33;
  --doc-meta-border: #3f3f46;
  --doc-meta-text: #dadadb;
  --doc-meta-label: #8cc8ff;
  --doc-meta-strong: #ffffff;
}

/* Base */
html {
  font-size: 16px;
}

body {
  font-family: "DejaVu Sans", "Noto Sans", Arial, sans-serif;
  color: var(--doc-text);
  line-height: 1.7;
  max-width: 980px;
  margin: 0 auto;
  padding: 2.2rem 1.6rem 4rem;
  background: var(--doc-bg);
}

p,
ul,
ol,
blockquote,
pre,
table,
div.info,
div.warning,
div.danger {
  max-width: 860px;
}

p {
  margin: 0 0 1em 0;
}

/* Titres */
h1,
h2,
h3,
h4 {
  line-height: 1.25;
  margin-top: 1.6em;
  margin-bottom: 0.65em;
  font-weight: 700;
}

h1 {
  font-size: 2.2rem;
  color: var(--oc-blue);
  border-bottom: 3px solid var(--oc-blue);
  padding-bottom: 0.35rem;
  margin-top: 0;
}

h2 {
  font-size: 1.5rem;
  color: var(--oc-blue);
  border-left: 6px solid var(--oc-green);
  padding-left: 0.65rem;
}

h3 {
  font-size: 1.18rem;
  color: var(--doc-text);
}

h4 {
  font-size: 1rem;
  color: var(--doc-muted);
}

/* Liens */
a {
  color: var(--oc-blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

html.dark a,
html.dark h1,
html.dark h2 {
  color: #8cc8ff;
}

html.dark h1 {
  border-bottom-color: #8cc8ff;
}

/* Listes */
ul,
ol {
  margin: 0 0 1em 1.5em;
  padding-left: 0.4em;
}

li {
  margin-bottom: 0.35em;
}

li > ul,
li > ol {
  margin-top: 0.35em;
  margin-bottom: 0.35em;
}

/* Code */
code {
  font-family: "DejaVu Sans Mono", "Noto Sans Mono", monospace;
  font-size: 0.94em;
  background: var(--doc-code-bg);
  border: 1px solid var(--doc-border);
  border-radius: 4px;
  padding: 0.08em 0.35em;
}

pre {
  background: #0f1720;
  color: #f8fafc;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  overflow-x: auto;
  margin: 1.2em 0;
}

html.dark pre {
  background: #111827;
}

pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
}

/* Citations */
blockquote {
  position: relative;
  margin: 1.6em 0;
  padding: 1.2em 1.4em 1.2em 2.4em;
  border-left: 6px solid var(--doc-quote-border);
  background: var(--doc-quote-bg);
  color: var(--doc-quote-text);
  border-radius: 0 12px 12px 0;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.65;
}

blockquote::before {
  content: "“";
  position: absolute;
  left: 0.6rem;
  top: 0.2rem;
  font-size: 2.6rem;
  color: var(--doc-quote-border);
  opacity: 0.25;
  pointer-events: none;
}

blockquote p:last-child {
  margin-bottom: 0;
}

blockquote::after {
  content: "";
  display: block;
  width: 40px;
  height: 2px;
  background: var(--doc-quote-rule);
  margin-top: 0.6em;
}

hr {
  border: 0;
  border-top: 1px solid var(--doc-border);
  margin: 2rem 0;
}

/* Images */
img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem auto;
  border: 1px solid var(--doc-border);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(15, 23, 32, 0.08);
}

html.dark img {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

figure {
  margin: 1.5rem auto;
  text-align: center;
}

figcaption {
  margin-top: 0.55rem;
  font-size: 0.92rem;
  color: var(--doc-muted);
}

p > img:only-child {
  margin-top: 1.2rem;
  margin-bottom: 1.2rem;
}

/* Tableaux */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4rem 0;
  font-size: 0.96rem;
  background: var(--doc-bg);
}

th,
td {
  border: 1px solid var(--doc-border);
  padding: 0.65rem 0.8rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--doc-table-header-bg);
  color: var(--doc-text);
}

/* Métadonnées Pandoc */
.subtitle,
.author,
.date {
  color: var(--doc-muted);
}

.author,
.date {
  margin: 0.25rem 0;
}

/* Sommaire Pandoc */
nav#TOC,
#TOC {
  background: var(--doc-toc-bg);
  border: 1px solid var(--doc-border);
  border-left: 6px solid var(--oc-blue);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin: 1.6rem 0 2rem;
  max-width: 860px;
}

nav#TOC::before,
#TOC::before {
  content: "Sommaire";
  display: block;
  font-weight: 700;
  color: var(--oc-blue);
  margin-bottom: 0.6rem;
  font-size: 1.05rem;
}

nav#TOC ul,
#TOC ul {
  margin: 0.3rem 0 0.3rem 1.2rem;
}

nav#TOC li,
#TOC li {
  margin-bottom: 0.25rem;
}

/* Blocs d'information */
.info,
.warning,
.danger {
  margin: 1.4rem 0;
  padding: 1rem 1.1rem;
  border-left: 6px solid;
  border-radius: 10px;
  background: var(--doc-soft);
}

.info {
  border-color: var(--oc-blue);
  background: var(--doc-info-bg);
}

.warning {
  border-color: var(--oc-orange);
  background: var(--doc-warning-bg);
}

.danger {
  border-color: var(--oc-red);
  background: var(--doc-danger-bg);
}

.info > :first-child,
.warning > :first-child,
.danger > :first-child {
  margin-top: 0;
}

.info > :last-child,
.warning > :last-child,
.danger > :last-child {
  margin-bottom: 0;
}

/* En-tête documentaire */
.l4a-page-header {
  text-align: center;
  margin: 0 auto 2rem auto;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--doc-border);
}

.l4a-logo {
  display: block;
  max-width: 260px;
  width: 55%;
  height: auto;
  margin: 0 auto 1rem auto;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.l4a-doc-title {
  max-width: 900px;
  margin: 1.2rem auto 0 auto;
  padding: 0;
  border: none;
  color: var(--oc-blue);
  font-size: 2.15rem;
  text-align: center;
}

html.dark .l4a-doc-title {
  color: #8cc8ff;
}

/* Métadonnées compactes */
.l4a-meta-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin: 0.4rem auto 1.4rem auto;
  max-width: 860px;
}

.l4a-meta-card div {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--doc-meta-border);
  border-radius: 999px;
  background: var(--doc-meta-bg);
  color: var(--doc-meta-text);
  font-size: 0.86rem;
  line-height: 1.2;
}

.l4a-meta-card span {
  color: var(--doc-meta-label);
  font-weight: 600;
}

.l4a-meta-card strong {
  color: var(--doc-meta-strong);
  font-weight: 700;
}

/* Métadonnées secondaires : date + licence */
.l4a-extra-meta {
  margin: -0.6rem auto 1.2rem auto;
  text-align: center;
  font-size: 0.86rem;
  color: var(--doc-muted);
}

.l4a-extra-meta div {
  margin: 0.25rem 0;
}

.l4a-updated,
.l4a-license {
  color: var(--doc-muted);
}

.l4a-updated strong,
.l4a-license strong {
  color: var(--doc-text);
  font-weight: 600;
}

/* Évite un doublon trop massif si le H1 Markdown suit juste après */
main > h1:first-child {
  font-size: 1.7rem;
  text-align: center;
  color: var(--doc-muted);
  border-bottom: none;
  margin-top: 1.2rem;
}

/* Responsive */
@media screen and (max-width: 900px) {
  body {
    padding: 1.4rem 1rem 3rem;
  }

  h1 {
    font-size: 1.9rem;
  }

  h2 {
    font-size: 1.35rem;
  }
}

@media screen and (max-width: 700px) {
  .l4a-logo {
    width: 70%;
    max-width: 220px;
  }

  .l4a-meta-card {
    display: block;
    text-align: left;
  }

  .l4a-meta-card div {
    margin-bottom: 0.25rem;
  }
}

/* Impression */
@page {
  size: A4;
  margin: 18mm 16mm 18mm 16mm;
}

@media print {
  body {
    max-width: none;
    padding: 0;
    font-size: 11pt;
    background: #ffffff;
    color: #000000;
  }

  h1,
  h2,
  h3 {
    page-break-after: avoid;
  }

  img,
  table,
  pre,
  blockquote {
    page-break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  img {
    width: 95%;
    max-width: 95%;
    height: auto;
    box-sizing: border-box;
    box-shadow: none;
  }

  nav#TOC,
  #TOC {
    box-shadow: none;
  }
}

.doc-list {
  display: grid;
  gap: 1rem;
  margin: 2rem 0;
}

.doc-card {
  display: block;
  padding: 1.3rem 1.5rem;
  border-radius: 18px;
  background: #eef4ee;
  border: 1px solid #c9d8c9;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
}

.doc-card:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.doc-card h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.doc-card p {
  margin-bottom: 0.7rem;
}

.doc-card span {
  font-size: 0.9rem;
  color: #6b7280;
}

html[data-theme="dark"] .doc-card,
html.dark .doc-card {
  background: #2e2e33;
  border-color: #3f3f46;
}

html[data-theme="dark"] .doc-card span,
html.dark .doc-card span {
  color: #b0b0b0;
}

html.dark body,
html[data-theme="dark"] body {
  background: #1d1e20;
  color: #dadadb;
}

html.dark .doc-card,
html[data-theme="dark"] .doc-card {
  background: #2e2e33;
  border-color: #3f3f46;
}

html.dark .doc-card span,
html[data-theme="dark"] .doc-card span {
  color: #b0b0b0;
}
