/*
 * Feuille de style partagée du guide utilisateur Grape.
 * Site statique autonome : aucune police distante, aucune ressource externe.
 * Charte : Raisin (#7C3AED) pour liens/accents/remplissages, Raisin profond (#5B21B6)
 * uniquement pour les survols/états pressés (jamais du texte courant). Titres de page en
 * serif (Georgia) — règle du produit : « la serif s'arrête au titre de page ».
 */

:root {
  --raisin: #7C3AED;
  --raisin-profond: #5B21B6;
  --encre: #2D2D2D;
  --encre-attenuee: #6B7280;
  --trait: #E5E7EB;
  --surface: #FFFFFF;
  --surface-bleutee: #F4F8FB;
  --font-corps: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-titre: Georgia, "Times New Roman", Cambria, serif;
  --sidebar-largeur: 260px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--surface-bleutee);
  color: var(--encre);
  font-family: var(--font-corps);
  font-size: 1rem;
  line-height: 1.6;
}

/* --------------------------------------------------------------------- */
/* Lien d'évitement (accessibilité clavier)                              */
/* --------------------------------------------------------------------- */

.lien-evitement {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--raisin);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 6px 0;
  font-weight: 600;
  z-index: 100;
}

.lien-evitement:focus {
  left: 0;
}

/* --------------------------------------------------------------------- */
/* Mise en page générale : sommaire latéral + contenu                    */
/* --------------------------------------------------------------------- */

.mise-en-page {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sommaire {
  flex: 0 0 var(--sidebar-largeur);
  width: var(--sidebar-largeur);
  background: var(--surface);
  border-right: 1px solid var(--trait);
  padding: 22px 18px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.sommaire-titre {
  font-family: var(--font-corps);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--encre);
  margin: 0 0 4px;
}

.sommaire-sous-titre {
  font-size: 0.75rem;
  color: var(--encre-attenuee);
  margin: 0 0 18px;
}

.sommaire ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sommaire a {
  display: block;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--encre);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.sommaire a:hover {
  background: var(--surface-bleutee);
  color: var(--raisin-profond);
}

.sommaire a[aria-current="page"] {
  background: var(--raisin);
  color: #fff;
}

.contenu {
  flex: 1 1 auto;
  min-width: 0;
  padding: 44px 32px 64px;
  display: flex;
  justify-content: center;
}

.contenu > article {
  width: 100%;
  max-width: 720px;
}

/* --------------------------------------------------------------------- */
/* Typographie                                                           */
/* --------------------------------------------------------------------- */

h1 {
  font-family: var(--font-titre);
  font-weight: 400;
  font-size: 2.1rem;
  line-height: 1.2;
  color: var(--encre);
  margin: 0 0 8px;
}

.chapeau {
  font-size: 1.0625rem;
  color: var(--encre-attenuee);
  margin: 0 0 36px;
  max-width: 54ch;
}

h2 {
  font-family: var(--font-corps);
  font-weight: 700;
  font-size: 1.375rem;
  color: var(--encre);
  margin: 48px 0 10px;
  padding-top: 8px;
  border-top: 1px solid var(--trait);
}

article > h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

h3 {
  font-family: var(--font-corps);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--encre);
  margin: 28px 0 8px;
}

p {
  margin: 0 0 16px;
}

ol, ul {
  margin: 0 0 16px;
  padding-left: 1.4em;
}

li {
  margin-bottom: 6px;
}

strong {
  font-weight: 700;
}

a {
  color: var(--raisin);
  text-decoration: underline;
  text-decoration-color: rgba(124, 58, 237, 0.35);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--raisin-profond);
  text-decoration-color: currentColor;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--raisin-profond);
  outline-offset: 2px;
  border-radius: 3px;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: var(--surface-bleutee);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* --------------------------------------------------------------------- */
/* Encadrés (astuce / limite)                                            */
/* --------------------------------------------------------------------- */

.encadre {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: 6px;
  padding: 14px 18px;
  margin: 0 0 20px;
  font-size: 0.9375rem;
}

.encadre p:last-child {
  margin-bottom: 0;
}

.encadre-titre {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--encre);
}

/* --------------------------------------------------------------------- */
/* Rôles (tableau de rôles RBAC)                                         */
/* --------------------------------------------------------------------- */

.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 0 0 24px;
}

.table-roles {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.9rem;
}

.table-roles caption {
  text-align: left;
  font-size: 0.8125rem;
  color: var(--encre-attenuee);
  margin-bottom: 8px;
}

.table-roles th,
.table-roles td {
  border: 1px solid var(--trait);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}

.table-roles thead th {
  background: var(--surface-bleutee);
  font-weight: 700;
}

.table-roles th[scope="row"] {
  font-weight: 700;
  background: var(--surface);
  white-space: nowrap;
}

/* --------------------------------------------------------------------- */
/* Figures / captures d'écran                                            */
/* --------------------------------------------------------------------- */

figure.capture {
  margin: 22px 0 28px;
  padding: 0;
}

figure.capture img {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
  border: 1px solid var(--trait);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(45, 45, 45, 0.08);
}

figure.capture figcaption {
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--encre-attenuee);
  max-width: 640px;
}

/* --------------------------------------------------------------------- */
/* Pagination bas de page (section précédente / suivante)                */
/* --------------------------------------------------------------------- */

.pagination-sections {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--trait);
  font-size: 0.9375rem;
}

.pagination-sections a {
  text-decoration: none;
  font-weight: 600;
}

.pagination-sections .suivant {
  margin-left: auto;
  text-align: right;
}

.pagination-sections small {
  display: block;
  font-weight: 400;
  color: var(--encre-attenuee);
  font-size: 0.75rem;
}

/* --------------------------------------------------------------------- */
/* Note de bas de page (démo + thème sombre)                             */
/* --------------------------------------------------------------------- */

.note-demo {
  margin-top: 40px;
  font-size: 0.8125rem;
  color: var(--encre-attenuee);
  font-style: italic;
}

/* --------------------------------------------------------------------- */
/* Cartes de sommaire (page d'accueil)                                   */
/* --------------------------------------------------------------------- */

.grille-modules {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 0 0 20px;
}

.carte-module {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: 8px;
  padding: 16px 18px;
  display: block;
  text-decoration: none;
}

.carte-module:hover {
  border-color: var(--raisin);
}

.carte-module .numero {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--raisin);
  border-radius: 9999px;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  margin-bottom: 8px;
}

.carte-module h2 {
  margin: 0 0 4px;
  border-top: none;
  padding-top: 0;
  font-size: 1.0625rem;
  color: var(--raisin-profond);
}

.carte-module p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--encre-attenuee);
}

/* --------------------------------------------------------------------- */
/* Écran étroit : le sommaire passe en haut, pleine largeur               */
/* --------------------------------------------------------------------- */

@media (max-width: 760px) {
  .mise-en-page {
    flex-direction: column;
  }

  .sommaire {
    position: static;
    height: auto;
    width: 100%;
    flex: 0 0 auto;
    border-right: none;
    border-bottom: 1px solid var(--trait);
    padding: 16px;
  }

  .sommaire-sous-titre {
    margin-bottom: 10px;
  }

  .sommaire ul {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sommaire a {
    padding: 7px 10px;
    font-size: 0.8125rem;
  }

  .contenu {
    padding: 28px 16px 48px;
  }

  h1 {
    font-size: 1.6rem;
  }

  .grille-modules {
    grid-template-columns: 1fr;
  }

  .pagination-sections {
    flex-direction: column;
  }

  .pagination-sections .suivant {
    text-align: left;
  }
}

@media (max-width: 420px) {
  .contenu {
    padding: 24px 14px 40px;
  }
}
