/* ==== Palette douce bleu-gris nuit (override) ==== */
:root {
  /* Fonds (plus doux) */
  --soft-900: #141a22;   /* page background (bleu-gris nuit) */
  --soft-800: #1b2330;   /* header / sidebar */
  --soft-700: #242e3d;   /* cartes / blocs / code */
  --soft-600: #324055;   /* bordures discrètes */

  /* Texte (moins blanc, plus confortable) */
  --ink-90:  #e7ebf2;    /* texte principal */
  --ink-80:  #dfe4ec;    /* titres/contraste fort */

  /* Accents bleus (désaturés) */
  --accent:   #8fb4ff;   /* liens/hover */
  --accent-2: #6aa3ff;   /* actif/surligné */
  --accent-3: #bcd0ff;   /* hover plus clair */
}

[data-md-color-scheme="slate"] {
  /* Page & texte */
  --md-default-bg-color: var(--soft-900);
  --md-default-fg-color: var(--ink-90);
  --md-typeset-color:    var(--ink-90);

  /* Header / nav primaires */
  --md-primary-bg-color: var(--soft-800);
  --md-primary-fg-color: var(--ink-80);

  /* Liens & accents */
  --md-accent-fg-color: var(--accent);
  --md-typeset-a-color: var(--accent);

  /* Code blocks */
  --md-code-bg-color: var(--soft-700);
  --md-code-fg-color: #eef3fa;
  --md-code-hl-color: rgba(143, 180, 255, 0.15);

  /* Footer */
  --md-footer-bg-color: var(--soft-800);
  --md-footer-fg-color: var(--ink-80);
}

/* Header plus lisible (texte/icônes) */
[data-md-color-scheme="slate"] .md-header { background-color: var(--soft-800); }
[data-md-color-scheme="slate"] .md-header,
[data-md-color-scheme="slate"] .md-header a,
[data-md-color-scheme="slate"] .md-header .md-icon { color: var(--ink-90); }
[data-md-color-scheme="slate"] .md-header a:hover,
[data-md-color-scheme="slate"] .md-header .md-icon:hover { color: var(--accent); }

/* Recherche */
[data-md-color-scheme="slate"] .md-search__form {
  background: var(--soft-700);
  border: 1px solid var(--soft-600);
}
[data-md-color-scheme="slate"] .md-search__input { color: var(--ink-90); }
[data-md-color-scheme="slate"] .md-search__icon { color: #9aa7bb; }

/* Navigation gauche (lisible, harmonisée) */
[data-md-color-scheme="slate"] .md-nav__link { color: var(--ink-90); }
[data-md-color-scheme="slate"] .md-nav__link:hover { color: var(--accent-3); }
[data-md-color-scheme="slate"] .md-nav__link--active { color: var(--accent-2); }

/* Footer links = même style que la nav */
[data-md-color-scheme="slate"] footer.md-footer a,
[data-md-color-scheme="slate"] footer.md-footer .md-footer__link { color: var(--ink-90); }
[data-md-color-scheme="slate"] footer.md-footer a:hover,
[data-md-color-scheme="slate"] footer.md-footer .md-footer__link:hover { color: var(--accent-3); }
[data-md-color-scheme="slate"] footer.md-footer a:visited { color: var(--ink-90); }

/* Code inline lisible mais doux */
[data-md-color-scheme="slate"] .md-typeset code:not(pre code) {
  background: var(--md-code-bg-color);
  color: var(--md-code-fg-color);
  border: 1px solid var(--soft-600);
  padding: 0.08em 0.35em;
  border-radius: .25rem;
}

/* Blocs de code lisibles (bord fin) */
[data-md-color-scheme="slate"] .md-typeset pre > code {
  box-shadow: inset 0 0 0 1px var(--soft-600);
}

/* Tables / admonitions sur fond doux */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) td,
[data-md-color-scheme="slate"] .md-typeset table:not([class]) th { border-color: var(--soft-600); }
[data-md-color-scheme="slate"] .md-typeset .admonition,
[data-md-color-scheme="slate"] .md-typeset details {
  background: var(--soft-800);
  border-color: var(--soft-600);
}

/* Mermaid : fond transparent (intègre au thème) */
.mermaid { background: transparent; }

/* Traits Mermaid un poil plus épais (sans changer les couleurs) */
[data-md-color-scheme="slate"] .mermaid .messageLine0,
[data-md-color-scheme="slate"] .mermaid .messageLine1,
[data-md-color-scheme="slate"] .mermaid .actor line,
[data-md-color-scheme="slate"] .mermaid .lifeline { stroke-width: 2.1px; }


/* ==== Mobile fixes: keep header dark + neutral source badge ==== */
@media (max-width: 960px) {
  /* Keep header background/text identical to desktop */
  [data-md-color-scheme="slate"] .md-header,
  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__title[for=__drawer],
  [data-md-color-scheme="slate"]  .md-nav__source
  {
    background-color: var(--soft-800) !important;
  }
  [data-md-color-scheme="slate"] .md-header,
  [data-md-color-scheme="slate"] .md-header a,
  [data-md-color-scheme="slate"] .md-header .md-nav__title a,
  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__title[for=__drawer],
  [data-md-color-scheme="slate"]  .md-nav__source,
  [data-md-color-scheme="slate"] .md-header .md-icon,
  [data-md-color-scheme="slate"] .md-header .md-header__button {
    color: var(--ink-90) !important;
  }

  /* Tabs bar that appears under the header on small screens */
  [data-md-color-scheme="slate"] .md-tabs {
    background: var(--soft-800) !important;
    color: var(--ink-90) !important;
    border-top: 1px solid var(--soft-600);
  }
  [data-md-color-scheme="slate"] .md-tabs__link {
    color: var(--ink-90) !important;
  }
  [data-md-color-scheme="slate"] .md-tabs__link:hover {
    color: var(--accent-3) !important;
  }

  /* “Git/source” block in header: remove blue pill, make it match the theme */
  [data-md-color-scheme="slate"] .md-header__source .md-source {
    background: var(--soft-700) !important;     /* no blue */
    color: var(--ink-90) !important;
    border: 1px solid var(--soft-600);
    box-shadow: none;
  }
  [data-md-color-scheme="slate"] .md-header__source .md-source:hover {
    background: var(--soft-700) !important;
    color: var(--accent-3) !important;
  }
  [data-md-color-scheme="slate"] .md-header__source .md-source__icon,
  [data-md-color-scheme="slate"] .md-header__source .md-source__repository,
  [data-md-color-scheme="slate"] .md-header__source .md-source__facts {
    color: inherit !important;
  }
}

/* Also apply to narrow “tablet” widths where Material switches layouts */
@media (max-width: 1216px) {
  [data-md-color-scheme="slate"] .md-header { background-color: var(--soft-800) !important; }
  [data-md-color-scheme="slate"] .md-header,
  [data-md-color-scheme="slate"] .md-header a,
  [data-md-color-scheme="slate"] .md-header .md-icon { color: var(--ink-90) !important; }
}
