/*
  Trois couleurs : papier (rose très pâle / violet nuit), encre (violet profond
  / rose pâle) et un rose vif. Les autres teintes sont des mélanges de ces trois-là.
  Tous les textes ont un contraste d'au moins 7:1 (niveau AAA).
  Le rose vif sert aux fonds, aux ombres et aux filets, jamais au texte seul.
*/
:root {
  --paper: #fff4fb;
  --ink: #1a0430;
  --accent: #ff6fb8;

  --on-accent: #1a0430; /* texte posé sur le rose vif */
  --surface: #ffe0f1;
  --muted: #4a2d6b;
  --line: #6b4a8c;
  --focus: var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17062b;
    --ink: #fff0f9;
    --accent: #ff6fc2;

    --on-accent: #17062b;
    --surface: #2b0f4a;
    --muted: #e0c8f2;
    --line: #b394d6;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: var(--ink);
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%; /* respecte la taille de texte choisie dans le navigateur */
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Trebuchet MS", Verdana, system-ui, sans-serif;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1.2px, transparent 1.6px);
  background-size: 20px 20px;
  font-size: 1.125rem;
  line-height: 1.6;
}

main {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

main h2::before {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-right: 0.45em;
  background: var(--accent);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

h1 {
  font-size: clamp(2.25rem, 8vw, 4.25rem);
  font-weight: 800;
  margin: 0 0 1rem;
  text-shadow: 3px 3px 0 var(--accent);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 750;
  margin: 3.5rem 0 1.25rem;
}

h3 {
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
}

p,
li {
  max-width: 68ch;
}

/* Les liens sont toujours soulignés : la couleur seule ne suffit pas */
a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 0.1em;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 0.22em;
  background: var(--accent);
  color: var(--on-accent);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--surface);
  padding: 0.05em 0.3em;
  border-radius: 0.25rem;
}

.meta {
  color: var(--muted);
  margin: 0;
}

.lead {
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  color: var(--muted);
  margin: 0;
  text-wrap: pretty;
}

/* ---------- Accessibilité ---------- */
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0.25rem;
}

.skip-link:focus {
  top: 0.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Navigation ---------- */
.site-header {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1rem 1rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.site-name {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li {
  max-width: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem; /* zone cliquable confortable */
  padding: 0 1rem;
  border-radius: 99px;
  color: var(--ink);
}

/* Page courante : fond plein, gras ET souligné (pas seulement la couleur) */
.site-nav a[aria-current="page"] {
  background: var(--accent);
  color: var(--on-accent);
  border: 2px solid var(--ink);
  font-weight: 700;
  text-decoration-thickness: 0.15em;
}

/* ---------- Accueil ---------- */
.hero {
  padding: 2.5rem 0 1rem;
}

.hero .lead {
  max-width: 40ch;
}

/* Définition : calme, en simple texte. L'accent souligne le terme défini. */
.pitch {
  margin: 1.5rem 0 0;
  font-size: 1.15rem;
  max-width: 44ch;
}

.pitch strong {
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.05em 0.35em;
  border-radius: 0.3em;
}

/* Grandes cartes vers les sous-pages : le plus fort contraste de la page */
.tiles {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 11rem;
  padding: 1.5rem;
  background: var(--accent);
  color: var(--on-accent);
  border: 3px solid var(--ink);
  border-radius: 1.25rem;
  box-shadow: 6px 6px 0 var(--ink);
  max-width: none;
}

.tile:hover {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 6px 6px 0 var(--accent);
}

.tile h2 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
}

.tile a {
  color: inherit;
}

.tile a:hover {
  background: none;
  color: inherit;
}

.tile h2::before {
  display: none;
}

/* Le lien couvre toute la carte : on clique n'importe où */
.tile a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.tile a:focus-visible {
  outline: none;
}

.tile:has(a:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.tile p {
  margin: 0;
}

.tile-go {
  margin-top: auto;
  width: 2rem;
  height: 2rem;
}

/* Trois conseils : une ligne chacun */
.steps {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  padding-top: 1rem;
  border-top: 4px solid var(--accent);
  font-weight: 650;
  max-width: none;
}

/* Numéros : seulement quand l'ordre compte (étapes) */
ol.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.5rem;
  background: var(--accent);
  color: var(--on-accent);
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-weight: 800;
}

/* ---------- Cartes ---------- */
.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 1rem;
  padding: 1.25rem;
}

.card h3 {
  margin-bottom: 0.25rem;
}

.card p {
  margin: 0;
}

.card .meta {
  margin-top: 0.25rem;
}

/* ---------- Aller à un groupe d'outils ---------- */
.jump {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.jump li {
  max-width: none;
}

.jump a {
  display: block;
  min-height: 2.75rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 1rem;
  box-shadow: 4px 4px 0 var(--accent);
  color: var(--ink);
  font-weight: 700;
}

.jump a:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.jump a:hover span {
  color: var(--on-accent);
}

.jump span {
  display: block;
  color: var(--muted);
  font-weight: 400;
}

/* ---------- Tableaux ---------- */
h2[id] {
  scroll-margin-top: 1rem;
}

.table-wrap {
  overflow-x: auto;
  border: 2px solid var(--ink);
  border-radius: 1rem;
  box-shadow: 5px 5px 0 var(--accent);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

thead th {
  background: var(--ink);
  color: var(--paper);
  border-bottom: 4px solid var(--accent);
}

tbody th {
  font-weight: 700;
  white-space: nowrap;
  width: 11rem;
}

tbody tr:nth-child(even) {
  background: var(--surface);
  background: color-mix(in srgb, var(--ink) 4%, var(--paper));
}

.group-note {
  color: var(--muted);
  margin: 0 0 1rem;
}

/* ---------- Avertissement ---------- */
.disclaimer {
  margin-top: 3.5rem;
  padding: 1.5rem;
  border: 2px solid var(--ink);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 6px 6px 0 var(--accent);
}

.disclaimer h2 {
  margin-top: 0;
}

.disclaimer h3 {
  margin-top: 1.25rem;
}

.disclaimer ul {
  padding-left: 1.25rem;
}

/* ---------- Glossaire ---------- */
dl.glossary {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  margin: 0;
}

dl.glossary div {
  padding: 1.25rem;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 1rem;
  box-shadow: 4px 4px 0 var(--accent);
}

dl.glossary dt {
  font-weight: 750;
  font-size: 1.2rem;
}

dl.glossary dd {
  margin: 0.25rem 0 0;
}

/* ---------- Encadré ---------- */
.callout {
  border: 2px solid var(--ink);
  border-radius: 1rem;
  background: var(--surface);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  box-shadow: 4px 4px 0 var(--accent);
}

.callout p {
  margin: 0;
}

ul.plain {
  padding-left: 1.25rem;
}

footer {
  margin-top: 3.5rem;
  padding-top: 1rem;
  border-top: 2px solid var(--line);
  color: var(--muted);
  font-size: 1rem;
}

@media (max-width: 40rem) {
  body {
    font-size: 1.0625rem;
  }

  .site-nav a {
    padding: 0 0.65rem;
    font-size: 0.95rem;
  }

  /* Tableaux : une fiche par outil, sans défilement sur le côté */
  .table-wrap {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  tbody tr {
    display: block;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    background: var(--surface);
    border: 2px solid var(--ink);
    border-radius: 1rem;
    box-shadow: 4px 4px 0 var(--accent);
  }

  tbody tr:nth-child(even) {
    background: var(--surface);
  }

  tbody th,
  td {
    display: block;
    width: auto;
    padding: 0.2rem 1rem;
    border: 0;
    white-space: normal;
  }

  tbody th {
    font-size: 1.15rem;
  }

  td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Mode contraste forcé de Windows */
@media (forced-colors: active) {
  .tile,
  .card,
  .table-wrap,
  .disclaimer {
    border-color: CanvasText;
  }

  a {
    color: LinkText;
  }
}

@media print {
  body {
    font-size: 12pt;
  }

  .skip-link {
    display: none;
  }
}
