/* =========================================================
   Sema Pointage School : palette de la plateforme + responsive
   Bleu #4e66eb (logo) / Vert #50c860 (badge « POINTAGE »)
   Chargé après custom.css : ces règles ont priorité.
   ========================================================= */
:root,
html,
html:not([data-theme]),
html[data-theme="light"],
html[data-theme="dark"] {
  --sema-blue: #4e66eb;
  --sema-blue-dark: #3a4fc9;
  --sema-blue-soft: #edf0ff;
  --sema-green: #50c860;
  --sema-green-dark: #1f9d3a;
  --sema-green-soft: #ebfaee;
  --sema-nav-accent: #4e66eb;
  --sema-nav-accent-soft: rgba(78, 102, 235, 0.1);
  --pst-color-link: #3a4fc9;
  --pst-color-link-hover: #2a3aa6;
  --pst-color-link-higher-contrast: #3a4fc9;
  --pst-color-secondary: #50c860;
  --pst-color-accent: #50c860;
  --sema-sidebar-bg: #ffffff;
  --sema-sidebar-bg-strong: #f6f8ff;
  --sema-sidebar-text: #253247;
  --sema-sidebar-text-muted: #66758b;
  --sema-sidebar-heading: #4e66eb;
  --sema-sidebar-control: #3a4fc9;
}

/* Liens : bleu lisible (le vert clair est réservé aux repères visuels) */
.bd-article a,
.bd-article a:visited {
  color: var(--sema-blue-dark);
  text-decoration: underline;
  text-decoration-color: rgba(78, 102, 235, 0.35);
  text-underline-offset: 2px;
}
.bd-article a:hover,
.bd-article a:focus {
  color: #2a3aa6;
  text-decoration-color: currentColor;
}
.bd-header .navbar-icon-links .nav-link,
.bd-sidebar-secondary .nav-link,
.page-toc .nav-link,
.bd-article .toc-entry > .nav-link,
.prev-next-area a {
  color: var(--sema-blue-dark);
}
.page-toc .nav-link.active,
.bd-sidebar-secondary .nav-link.active,
.bd-article .toc-entry > .nav-link.active {
  color: var(--sema-blue);
  box-shadow: inset 2px 0 0 var(--sema-green);
  font-weight: 600;
}

/* Barre latérale claire : le logo en couleurs reste lisible */
.bd-sidebar-primary {
  background: linear-gradient(180deg, #ffffff 0%, #f6f8ff 100%);
  border-right: 1px solid var(--pst-color-border);
  box-shadow: none;
}
.bd-sidebar-primary .sidebar-brand {
  border-bottom: 1px solid var(--pst-color-border-muted);
}
.bd-sidebar-primary .navbar-brand.logo .logo__image {
  max-height: 56px;
  width: auto;
  border-radius: 0;
}
.bd-sidebar-primary .navbar-brand.logo .logo__title {
  display: none;
}
.bd-sidebar-primary .nav-link,
.bd-sidebar-primary .nav-link .nav-link,
.bd-sidebar-primary a.reference.internal {
  color: var(--sema-sidebar-text);
}
.bd-sidebar-primary .nav-link:hover,
.bd-sidebar-primary .nav-link:focus-visible {
  background: var(--sema-blue-soft);
  color: var(--sema-blue-dark);
}
.bd-sidebar-primary .active > .nav-link,
.bd-sidebar-primary .current > .nav-link {
  background: var(--sema-blue-soft);
  color: var(--sema-blue);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--sema-green);
}
.bd-sidebar-primary .caption,
.bd-sidebar-primary .caption-text,
.bd-sidebar-primary .sidebar-heading,
.bd-sidebar-primary .nav-section-title,
.bd-sidebar-primary .bd-docs-nav .caption {
  color: var(--sema-blue);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bd-sidebar-primary .pst-sidebar-collapse button {
  background: var(--sema-blue-soft);
  border-color: var(--pst-color-border);
  color: var(--sema-blue-dark);
}
.bd-sidebar-primary .pst-sidebar-collapse button:hover,
.bd-sidebar-primary .pst-sidebar-collapse button:focus-visible {
  background: #dfe5ff;
  border-color: var(--sema-blue);
  color: var(--sema-blue-dark);
}
.bd-sidebar-primary .pst-sidebar-collapse .pst-icon {
  color: var(--sema-blue);
}

/* Titres, tableaux, encadrés aux couleurs de la plateforme */
.bd-article h2,
.bd-article h3 { color: var(--sema-blue); }
.bd-article h3 { font-size: 1.25rem; }
.bd-article table.docutils th,
.bd-article table.table th {
  background: var(--sema-blue);
  color: #ffffff;
}
.bd-article table.docutils tbody tr:nth-child(even) td,
.bd-article table.table tbody tr:nth-child(even) td {
  background: var(--sema-blue-soft);
}
.bd-article .admonition.tip,
.bd-article .admonition.important { border-left: 4px solid var(--sema-green); }
.bd-article .admonition.note { border-left: 4px solid var(--sema-blue); }
.bd-article .admonition.warning { border-left: 4px solid #e8a317; }
.bd-article .admonition.tip > .admonition-title,
.bd-article .admonition.important > .admonition-title { color: var(--sema-green-dark); }
.bd-article figure { text-align: center; }
.bd-article figure img,
.bd-article .figure img { max-width: 100%; height: auto; }
.bd-article figcaption,
.bd-article .caption { color: var(--pst-color-text-muted); font-size: 0.92rem; margin-top: 0.6rem; }
.bd-article pre {
  max-width: 100%;
  overflow-x: auto;
  font-size: 0.82rem;
}
.bd-article { overflow-wrap: anywhere; }
.bd-article pre,
.bd-article code { overflow-wrap: normal; }

/* Liens du menu latéral : texte sombre lisible sur fond clair */
.bd-sidebar-primary .bd-docs-nav a,
.bd-sidebar-primary .bd-docs-nav .reference.internal,
.bd-sidebar-primary .bd-docs-nav li > a {
  color: #253247 !important;
}
.bd-sidebar-primary .bd-docs-nav a:hover,
.bd-sidebar-primary .bd-docs-nav li.current > a,
.bd-sidebar-primary .bd-docs-nav li.active > a,
.bd-sidebar-primary .bd-docs-nav a.current {
  color: #4e66eb !important;
}
.bd-sidebar-primary .pst-sidebar-collapse button,
.bd-sidebar-primary .pst-sidebar-collapse button * {
  color: #3a4fc9 !important;
  text-decoration: none;
}
.bd-sidebar-primary label,
.bd-sidebar-primary .sidebar-primary-items__start > * > p,
.bd-sidebar-primary .bd-links__title {
  color: var(--sema-blue);
  font-weight: 700;
}

/* Logo de la plateforme dans la barre du haut, à toutes les tailles */
.bd-header .navbar-header-items__start,
.bd-header .navbar-brand.logo {
  display: flex !important;
  align-items: center;
}
.bd-header .navbar-header-items__start { margin-right: 1rem; }
.bd-header .navbar-brand.logo .logo__image { max-height: 40px; width: auto; }
.bd-header .navbar-brand.logo .logo__title { display: none; }

/* ---------- Tablette et mobile ---------- */
@media (max-width: 991.98px) {
  .bd-header .navbar-brand.logo .logo__image { max-height: 36px; }
  .bd-article-container { padding-left: 1rem; padding-right: 1rem; }
}

@media (max-width: 767.98px) {
  .bd-article h2 { font-size: 1.45rem; margin-top: 1.9rem; }
  .bd-article h3 { font-size: 1.15rem; }
  .bd-article figure,
  .bd-article .figure { padding: 0.6rem; margin: 1.25rem 0; border-radius: 0.75rem; }
  .doc-lead { padding: 0.9rem 1rem; margin-bottom: 1.25rem; }
  .doc-lead p { font-size: 1rem; line-height: 1.65; }
  .bd-article div.admonition { margin-left: 0; margin-right: 0; }

  /* Tableaux : une fiche par ligne, avec le libellé de chaque colonne */
  .bd-article .pst-scrollable-table-container { overflow: visible; }
  .bd-article table.docutils,
  .bd-article table.table {
    border: 0;
    display: block;
    width: 100%;
  }
  .bd-article table.docutils thead,
  .bd-article table.table thead { display: none; }
  .bd-article table.docutils tbody,
  .bd-article table.table tbody,
  .bd-article table.docutils tr,
  .bd-article table.table tr { display: block; width: 100%; }
  .bd-article table.docutils tr,
  .bd-article table.table tr {
    background: #ffffff;
    border: 1px solid var(--pst-color-border);
    border-left: 4px solid var(--sema-blue);
    border-radius: 0.75rem;
    margin-bottom: 0.8rem;
    overflow: hidden;
  }
  .bd-article table.docutils td,
  .bd-article table.table td {
    background: transparent !important;
    border: 0;
    border-bottom: 1px solid var(--pst-color-border-muted);
    display: block;
    padding: 0.55rem 0.8rem;
    width: 100% !important;
  }
  .bd-article table.docutils td:last-child,
  .bd-article table.table td:last-child { border-bottom: 0; }
  .bd-article table.docutils td[data-label]::before,
  .bd-article table.table td[data-label]::before {
    color: var(--sema-blue);
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem;
    text-transform: uppercase;
  }
  .bd-article table.docutils td:first-child,
  .bd-article table.table td:first-child {
    background: var(--sema-blue-soft) !important;
    font-weight: 600;
  }
}

@media (max-width: 479.98px) {
  .bd-article-container { padding-left: 0.75rem; padding-right: 0.75rem; }
  .bd-article p,
  .bd-article li { line-height: 1.65; }
}

/* Impression */
@media print {
  .bd-sidebar-primary,
  .bd-sidebar-secondary,
  .bd-header { display: none !important; }
  .bd-article a { color: inherit; text-decoration: none; }
}

/* Menu du haut : une seule ligne, libellés courts */
.bd-header .navbar-header-items__center { min-width: 0; }
.bd-header .navbar-nav .nav-link,
.bd-header .navbar-nav .nav-item > a {
  white-space: nowrap;
  font-weight: 600;
  color: var(--sema-blue-dark);
}
.bd-header .navbar-nav .nav-link:hover,
.bd-header .navbar-nav .active > .nav-link,
.bd-header .navbar-nav .nav-link.active {
  color: var(--sema-blue);
  box-shadow: inset 0 -3px 0 var(--sema-green);
}

/* Écrans très étroits */
@media (max-width: 359.98px) {
  .prev-next-area a { font-size: 0.9rem; }
  .prev-next-area .prev-next-info .prev-next-title { overflow-wrap: anywhere; }
  .search-button-field .search-button__default-text { display: none; }
}

/* Boutons du haut (menu et sommaire de la page) : bien visibles et faciles à toucher */
.bd-header .sidebar-toggle,
.bd-header .pst-navbar-icon.sidebar-toggle {
  align-items: center;
  background: var(--sema-blue-soft);
  border: 1px solid var(--pst-color-border);
  border-radius: 0.7rem;
  color: var(--sema-blue) !important;
  display: inline-flex;
  height: 2.5rem;
  justify-content: center;
  opacity: 1 !important;
  width: 2.5rem;
}
.bd-header .sidebar-toggle:hover,
.bd-header .sidebar-toggle:focus-visible {
  background: #dfe5ff;
  border-color: var(--sema-blue);
}
.bd-header .sidebar-toggle i,
.bd-header .sidebar-toggle svg {
  color: inherit !important;
  font-size: 1.2rem;
  opacity: 1 !important;
}
