/* Search Optimization — feuille de style du carnet d'analyste.
   Tailwind (Play CDN) gère la mise en page ; ce fichier porte la typographie,
   les composants éditoriaux et les états que Tailwind ne couvre pas. */

:root {
  --paper: #f6f1e7;
  --surface: #fffdf8;
  --ink: #16181a;
  --ink-soft: #4a4e52;
  --line: #dcd3c2;
  --vermilion: #c6402c;
  --blue: #1f3a5f;
  --highlight: #e7b84b;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

html { font-family: "Newsreader", Georgia, "Times New Roman", serif; }

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(231, 184, 75, 0.14), transparent 42%),
    radial-gradient(circle at 88% 3%, rgba(31, 58, 95, 0.10), transparent 38%);
  background-repeat: no-repeat;
}

.font-display, h1, h2, h3, h4 {
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  letter-spacing: -0.015em;
}

.font-mono, .kicker, .rail, code, kbd, th {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

::selection { background: var(--highlight); color: var(--ink); }

a { text-underline-offset: 0.18em; }

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

/* ---------- barre de lecture ---------- */
#barre-lecture {
  position: fixed;
  inset: 0 auto auto 0;
  height: 3px;
  width: 0;
  background: var(--vermilion);
  z-index: 60;
  transition: width 120ms linear;
}

/* ---------- rail de sommaire ---------- */
.rail-chapitre {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.4rem 0.6rem 0.4rem 0.55rem;
  border-left: 2px solid transparent;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.45;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.rail-chapitre:hover { color: var(--ink); background: rgba(255, 253, 248, 0.85); }

.rail-chapitre[aria-current="page"] {
  color: var(--vermilion);
  border-left-color: var(--vermilion);
  background: var(--surface);
  font-weight: 500;
}

.rail-num {
  font-size: 0.7rem;
  color: var(--line);
  letter-spacing: 0.06em;
}

.rail-chapitre[aria-current="page"] .rail-num { color: var(--vermilion); }

/* ---------- prose ---------- */
.prose p { margin: 1.05em 0; }

.prose h2 {
  font-size: clamp(1.5rem, 1.15rem + 1.1vw, 1.95rem);
  line-height: 1.2;
  margin: 2.4rem 0 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.prose h2::before {
  content: "";
  display: block;
  width: 2.2rem;
  height: 2px;
  background: var(--vermilion);
  margin-bottom: 0.85rem;
}

.prose h3 {
  font-size: 1.18rem;
  margin: 1.8rem 0 0.5rem;
  font-weight: 600;
}

.prose h2 + h3 { margin-top: 1.1rem; }

.prose strong { font-weight: 600; color: var(--ink); }

.prose em { font-style: italic; }

.prose ul, .prose ol { margin: 1em 0; padding-left: 1.35rem; }
.prose ul { list-style: none; }
.prose ul > li { position: relative; margin: 0.45em 0; }
.prose ul > li::before {
  content: "—";
  position: absolute;
  left: -1.35rem;
  color: var(--vermilion);
}
.prose ol { list-style: decimal; }
.prose ol > li { margin: 0.45em 0; padding-left: 0.2rem; }
.prose ol > li::marker { color: var(--vermilion); font-family: "JetBrains Mono", monospace; font-size: 0.85em; }

.prose a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-color: rgba(31, 58, 95, 0.35);
  text-decoration-thickness: 1px;
  transition: text-decoration-color 160ms ease, color 160ms ease;
}

.prose a:hover {
  color: var(--vermilion);
  text-decoration-color: var(--vermilion);
}

.prose blockquote {
  margin: 1.8rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 3px solid var(--vermilion);
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--ink);
}

.prose blockquote p { margin: 0.35rem 0; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0;
  font-size: 0.94rem;
  background: var(--surface);
}

.prose thead th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--ink);
  padding: 0.6rem 0.75rem;
}

.prose tbody td {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.75rem;
  vertical-align: top;
}

.prose tbody tr:hover { background: rgba(231, 184, 75, 0.10); }

.prose code {
  font-size: 0.86em;
  background: rgba(31, 58, 95, 0.07);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4rem 0;
}

/* ---------- composants ---------- */
.note {
  margin: 1.7rem 0;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--highlight);
  font-size: 0.97rem;
}

.note__label {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 0.35rem;
}

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

.cartouche {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--vermilion);
}

.figure-cadre {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.5rem;
}

.figure-cadre figcaption {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  padding: 0.6rem 0.5rem 0.35rem;
}

.suite {
  margin: 2.6rem 0 0;
  padding: 1.3rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
}

.suite__titre {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.7rem;
}

.suite a {
  display: block;
  padding: 0.45rem 0;
  border-bottom: 1px dotted var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
}

.suite a:last-child { border-bottom: 0; }
.suite a:hover { color: var(--vermilion); }
.suite a span { color: var(--vermilion); }

/* ---------- révélation au défilement ---------- */
.revele {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.revele.est-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .revele { opacity: 1; transform: none; }
}

/* ---------- entrées de glossaire ---------- */
.entree { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.entree dt { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 1.05rem; }
.entree dd { margin: 0.3rem 0 0; color: var(--ink-soft); font-size: 0.98rem; }

details.faq {
  border-bottom: 1px solid var(--line);
  padding: 0.9rem 0;
}

details.faq summary {
  cursor: pointer;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.08rem;
  font-weight: 600;
  list-style: none;
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
}

details.faq summary::-webkit-details-marker { display: none; }

details.faq summary::before {
  content: "+";
  font-family: "JetBrains Mono", monospace;
  color: var(--vermilion);
  font-size: 1rem;
}

details.faq[open] summary::before { content: "−"; }
details.faq .reponse { padding: 0.6rem 0 0.2rem 1.4rem; color: var(--ink-soft); }
details.faq .reponse p { margin: 0.5rem 0; }

@media print {
  #barre-lecture, header nav, .rail, .suite { display: none !important; }
  body { background: #fff; }
}

/* ---------- navigation active ---------- */
header nav a[aria-current="page"],
header a[aria-current="page"] {
  color: var(--vermilion);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

summary::-webkit-details-marker { display: none; }
details[open] > summary { color: var(--ink); }
