/* ==========================================================================
   NRH STORE — Conditions d'utilisation
   Feuille de style minimale : fond blanc, texte noir, priorité à la lisibilité.
   ========================================================================== */

/* Thème clair (par défaut). */
:root {
  --texte: #000;
  --texte-doux: #333;
  --fond: #fff;
  --survol: #f2f2f2;
  --bordure: #d6d6d6;
  --bordure-douce: #e8e8e8;
  --lien: #0b3d91;

  /* Hauteur de la barre fixe : sert aussi de référence au scroll-margin-top. */
  --hauteur-barre: 52px;
}

/* Thème sombre suivant le réglage du système, sauf si le thème clair a été
   choisi manuellement (data-theme="light" posé par le bouton). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --texte: #e9e9e9;
    --texte-doux: #b4b4b4;
    --fond: #121212;
    --survol: #1f1f1f;
    --bordure: #3a3a3a;
    --bordure-douce: #272727;
    --lien: #8ab4f8;
  }
}

/* Thème sombre choisi manuellement. */
:root[data-theme="dark"] {
  --texte: #e9e9e9;
  --texte-doux: #b4b4b4;
  --fond: #121212;
  --survol: #1f1f1f;
  --bordure: #3a3a3a;
  --bordure-douce: #272727;
  --lien: #8ab4f8;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color-scheme: light dark;
}

/* --------------------------------------------------------------------------
   Barre de navigation fixe
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--fond);
  border-bottom: 1px solid var(--bordure);
}

.topbar-inner {
  max-width: 820px;
  margin: 0 auto;
  min-height: var(--hauteur-barre);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-title {
  color: var(--texte);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;

  /* Le titre est tronqué plutôt que de faire grandir la barre sur petit écran. */
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Bouton de thème : même gabarit que le bouton « Sommaire ». */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--fond);
  color: var(--texte);
  border: 1px solid var(--bordure);
  border-radius: 3px;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--survol);
}

/* Sommaire replié : <details> native, donc fonctionnel sans JavaScript. */
.toc-menu {
  position: relative;
}

.toc-menu > summary {
  cursor: pointer;
  list-style: none;
  padding: 5px 12px;
  border: 1px solid var(--bordure);
  background: var(--fond);
  border-radius: 3px;
  font-size: 14px;
  white-space: nowrap;
}

.toc-menu > summary::-webkit-details-marker {
  display: none;
}

.toc-menu > summary::after {
  content: " \25BE";
}

.toc-menu[open] > summary::after {
  content: " \25B4";
}

.toc-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 40px);
  max-height: 70vh;
  overflow-y: auto;
  margin: 0;
  padding: 8px 8px 8px 0;
  list-style: none;
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 3px;
}

.toc-list a {
  display: block;
  padding: 7px 14px;
  color: var(--texte);
  text-decoration: none;
  font-size: 15px;
  line-height: 1.4;
}

.toc-list a:hover,
.toc-list a:focus {
  background: var(--survol);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Contenu
   -------------------------------------------------------------------------- */

.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

h1 {
  margin: 0 0 24px;
  font-size: 30px;
  line-height: 1.3;
}

.lead {
  margin: 0 0 8px;
  color: var(--texte-doux);
}

section {
  margin-top: 56px;
  padding-top: 8px;
  border-top: 1px solid var(--bordure-douce);

  /* Évite que les titres passent sous la barre fixe lors d'un saut d'ancre. */
  scroll-margin-top: calc(var(--hauteur-barre) + 16px);
}

h2 {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.35;
}

h3 {
  margin: 32px 0 12px;
  font-size: 18px;
  line-height: 1.4;
}

p {
  margin: 0 0 16px;
}

ul {
  margin: 0 0 16px;
  padding-left: 24px;
}

li {
  margin-bottom: 8px;
}

a {
  color: var(--lien);
}

.contact-list {
  list-style: none;
  padding-left: 0;
}

/* --------------------------------------------------------------------------
   Retour en haut / pied de page
   -------------------------------------------------------------------------- */

.back-to-top {
  margin: 56px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--bordure-douce);
}

.back-to-top a {
  text-decoration: none;
}

.back-to-top a:hover,
.back-to-top a:focus {
  text-decoration: underline;
}

.page-footer {
  border-top: 1px solid var(--bordure);
}

.page-footer p {
  max-width: 820px;
  margin: 0 auto;
  padding: 20px;
  font-size: 14px;
  color: var(--texte-doux);
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .page {
    padding: 32px 18px 48px;
  }

  h1 {
    font-size: 25px;
  }

  h2 {
    font-size: 20px;
  }

  section {
    margin-top: 44px;
  }

  .topbar-inner,
  .page-footer p {
    padding-left: 18px;
    padding-right: 18px;
  }

  .topbar-actions {
    gap: 8px;
  }

  /* Sur mobile, le bouton de thème se réduit à son icône. */
  .theme-label {
    display: none;
  }

  .theme-toggle {
    padding: 5px 10px;
  }
}

/* Respecte le réglage système « réduire les animations ». */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* --------------------------------------------------------------------------
   Impression
   -------------------------------------------------------------------------- */

@media print {
  .topbar,
  .back-to-top {
    display: none;
  }

  body {
    font-size: 12pt;
  }

  section {
    page-break-inside: avoid;
  }
}
