/*
 * Institut Laur — feuille de style éditoriale
 * -------------------------------------------
 * TailwindCSS est chargé via CDN dans head.html.
 * Ce fichier complète Tailwind avec :
 *   - rythme typographique magazine (titres, paragraphes, blockquote)
 *   - amélioration du `prose` pour la lisibilité longue
 *   - utilitaires (line-clamp, pagination, focus visible)
 *   - styles d'impression
 */

/* ---------- Base ---------- */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body {
  font-feature-settings: "kern" 1, "liga" 1;
}

/* Sélection — couleur subtile cohérente avec la marque */
::selection {
  background: rgba(8, 145, 178, 0.20); /* primary @20% */
  color: #0e2025;
}

/* Transitions globales (douces, sans excès) */
a, button {
  transition: color 0.18s ease, background-color 0.18s ease,
              border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

/* Ancres avec décalage pour ancres internes (offset header sticky) */
:target {
  scroll-margin-top: 8rem;
}

/* ---------- Typographie longue (`prose`) ---------- */
/*
 * Le plugin `@tailwindcss/typography` est chargé via CDN.
 * Ces règles renforcent le rythme magazine sans le contredire.
 */
.prose {
  /* Mesure optimale lecture : 65-70 caractères par ligne */
  max-width: 68ch;
}
.prose h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 1.875rem);
  margin-top: 3rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.prose h3 {
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.375rem);
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}
.prose p {
  margin-bottom: 1.5rem;
  line-height: 1.78;
  color: #44403c; /* stone-700 */
}
.prose ul, .prose ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}
.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }
.prose li {
  margin-bottom: 0.5rem;
  color: #44403c; /* stone-700 */
}
.prose li::marker {
  color: #0891b2; /* primary */
}
.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  font-weight: 500;
}
.prose a:hover {
  text-decoration-thickness: 2px;
}
.prose strong {
  font-weight: 600;
  color: #1c1917; /* stone-900 */
}
.prose img {
  border-radius: 0.5rem;
  margin: 2rem 0;
}
.prose blockquote {
  border-left: 3px solid #0891b2; /* primary */
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  background: #fafaf9; /* stone-50 */
  border-radius: 0 0.375rem 0.375rem 0;
  font-style: normal;
  color: #44403c;
}
.prose blockquote p:last-child {
  margin-bottom: 0;
}
.prose code {
  font-size: 0.92em;
}

/* ---------- Tableaux dans la prose ---------- */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9375rem;
  display: block;
  overflow-x: auto;
  border: 1px solid #e7e5e4; /* stone-200 */
  border-radius: 0.5rem;
}
.prose thead {
  background: #fafaf9; /* stone-50 */
}
.prose thead th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #1c1917; /* stone-900 */
  border-bottom: 2px solid #e7e5e4;
  font-family: inherit;
  white-space: nowrap;
}
.prose tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f5f5f4; /* stone-100 */
  color: #44403c;
  vertical-align: top;
}
.prose tbody tr:last-child td {
  border-bottom: none;
}
.prose tbody tr:nth-child(even) {
  background: #fafaf9;
}
@media (max-width: 640px) {
  .prose th, .prose td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* ---------- Utilitaires ---------- */
/* Clamp lignes (utilisé dans les cartes) */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Accessibilité ---------- */
/* Anneau de focus visible — contraste fort, indépendant du thème */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 4px;
}
/* Lien d'évitement (skip link) — caché jusqu'au focus clavier */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: auto;
  height: auto;
  padding: 0.75rem 1.25rem;
  background: #0891b2;
  color: #fff;
  z-index: 100;
  border-radius: 0.375rem;
  font-weight: 600;
}

/* ---------- Pagination Hugo (template interne) ---------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid #e7e5e4;
}
.pagination li {
  list-style: none;
}
.pagination a,
.pagination .active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.85rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}
.pagination a {
  color: #44403c;
  background: #f5f5f4; /* stone-100 */
  border: 1px solid transparent;
}
.pagination a:hover {
  background: #fff;
  border-color: #0891b2;
  color: #0891b2;
}
.pagination .active {
  color: #fff;
  background: #0891b2;
}
.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ---------- Impression ---------- */
@media print {
  header, footer, nav, .pagination { display: none !important; }
  body { background: #fff; color: #000; }
  .prose { max-width: 100%; }
  .prose a { color: #000; text-decoration: underline; }
  .prose a::after { content: " (" attr(href) ")"; font-size: 0.85em; }
}

/* ---------- Préférences utilisateur ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
