/*
 * Loup y es-tu ? — Custom CSS
 * ----------------------------------------------------------
 * Note : Tailwind est chargé via le CDN Play (cf. head.html).
 * Ce fichier contient :
 *   1. Base typographique
 *   2. Prose (contenu markdown)
 *   3. Ornements éditoriaux (filets, pagination, focus)
 *   4. Utilitaires (line-clamp, scrollbar, print, motion)
 *
 * Contraste WCAG AA garanti :
 *   - Corps stone-700 (#44403c) sur blanc           : 9.4:1 (AAA)
 *   - Stone-300 (#d6d3d1) sur stone-900 (#1c1917)   : 11:1 (AAA)
 *   - Primary (#65a30d) sur stone-50                : 3.6:1 (AA grand texte)
 *   - Accent (#8b5cf6) sur stone-900                : 5.6:1 (AA)
 * ----------------------------------------------------------
 */

/* ============================================================
   1. BASE
   ============================================================ */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-feature-settings: "kern", "liga", "calt";
}

::selection {
  background: rgba(101, 163, 13, 0.25);
  color: #1c1917;
}

a, button {
  transition: color 0.2s ease, background-color 0.2s ease,
              border-color 0.2s ease, transform 0.2s ease,
              box-shadow 0.2s ease, opacity 0.2s ease;
}

/* ============================================================
   2. PROSE — Contenu markdown des articles
   ============================================================ */
.prose {
  max-width: 70ch;
  font-size: 1.0625rem;
  line-height: 1.75;
}

.prose h2 {
  font-size: 1.75rem;
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  position: relative;
  padding-left: 1rem;
}
.prose h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 4px;
  height: 1.2em;
  background: #65a30d;
  border-radius: 2px;
}

.prose h3 {
  font-size: 1.3125rem;
  margin-top: 2.25rem;
  margin-bottom: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
}

.prose p {
  margin-bottom: 1.5rem;
  color: #44403c;
}

.prose p:first-of-type::first-letter {
  font-family: 'Merriweather', Georgia, serif;
  float: left;
  font-size: 3.5rem;
  line-height: 0.9;
  padding: 0.4rem 0.6rem 0 0;
  color: #4d7c0f;
  font-weight: 700;
}

.prose ul, .prose ol {
  margin: 1.25rem 0 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;
}
.prose li::marker {
  color: #65a30d;
}

.prose blockquote {
  margin: 2rem 0;
  font-style: normal;
  color: #44403c;
}
.prose blockquote p {
  margin-bottom: 0;
}
.prose blockquote strong {
  color: #1c1917;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  font-weight: 600;
}
.prose a:hover {
  text-decoration-thickness: 2px;
  color: #4d7c0f;
}

.prose strong {
  font-weight: 700;
  color: #1c1917;
}

.prose img {
  border-radius: 0.5rem;
  margin: 2rem 0;
}

.prose hr {
  margin: 2.5rem 0;
  border: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, #d6d3d1, transparent);
}

/* Tables — un seul rendu, propre et accessible */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9375rem;
  display: block;
  overflow-x: auto;
}
.prose thead {
  border-bottom: 2px solid #65a30d;
}
.prose th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 700;
  color: #1c1917;
  background: #fafaf9;
  white-space: nowrap;
}
.prose td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e7e5e4;
  color: #44403c;
  vertical-align: top;
}
.prose tbody tr:hover {
  background: #fafaf9;
}
@media (max-width: 640px) {
  .prose th, .prose td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* ============================================================
   3. ORNEMENTS — Pagination, focus, accessibilité
   ============================================================ */

:focus-visible {
  outline: 2px solid #8b5cf6;
  outline-offset: 3px;
  border-radius: 4px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e7e5e4;
  flex-wrap: wrap;
}
.pagination li {
  list-style: none;
}
.pagination a, .pagination .active, .pagination .disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.875rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'Nunito', system-ui, sans-serif;
  transition: all 0.2s ease;
}
.pagination a {
  color: #44403c;
  background: #f5f5f4;
  border: 1px solid #e7e5e4;
  text-decoration: none;
}
.pagination a:hover {
  background: #65a30d;
  color: #ffffff;
  border-color: #65a30d;
}
.pagination .active {
  color: #ffffff;
  background: #65a30d;
  border: 1px solid #65a30d;
}
.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
  background: transparent;
  color: #78716c;
  border: 1px solid transparent;
}

/* ============================================================
   4. UTILITAIRES
   ============================================================ */

.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;
}

/* Scrollbar discrète */
* {
  scrollbar-width: thin;
  scrollbar-color: #a8a29e #f5f5f4;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: #f5f5f4;
}
*::-webkit-scrollbar-thumb {
  background: #a8a29e;
  border-radius: 5px;
}
*::-webkit-scrollbar-thumb:hover {
  background: #78716c;
}

/* Réduction des animations selon 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;
  }
}

/* Print */
@media print {
  header, footer, nav, .no-print { display: none !important; }
  .prose { max-width: 100%; }
  .prose a { color: #1c1917; text-decoration: underline; }
  .prose h2::before { display: none; }
  body { background: #ffffff; color: #1c1917; }
}
