/*
 * Elagage Langon — Custom CSS
 * Complète TailwindCSS (chargé via CDN dans head.html)
 *
 * Principes :
 *  - Typographie premium pour la lecture longue
 *  - Focus states accessibles (WCAG 2.1 AA)
 *  - Transitions sobres, pas de fioritures
 *  - Compatible reduced-motion
 */

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

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

/* Sélection : reprend la couleur primaire de la marque */
::selection {
  background-color: rgba(101, 163, 13, 0.2);
  color: #1f2937;
}

/* ---------- Transitions globales ---------- */
a, button {
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ---------- Accessibilité : focus visible WCAG ---------- */
:focus-visible {
  outline: 2px solid #4d7c0f;
  outline-offset: 3px;
  border-radius: 4px;
}

/* Liens dans le contenu prose : sous-lignement actif au focus */
.prose a:focus-visible {
  outline-offset: 2px;
}

/* Skip link (à activer si besoin) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #1f2937;
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}

/* ---------- Prose : amélioration lecture longue ---------- */
.prose {
  max-width: 68ch;
}
.prose h2 {
  font-size: 1.5rem;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.prose h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}
.prose p {
  margin-bottom: 1.5rem;
  line-height: 1.78;
  color: #374151;
}
.prose > p:first-of-type::first-letter {
  /* Lettrine sobre sur le premier paragraphe */
  font-family: 'Lora', Georgia, serif;
  font-size: 3.4rem;
  line-height: 0.95;
  font-weight: 600;
  float: left;
  margin: 0.35rem 0.6rem 0 0;
  color: #4d7c0f;
}
.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: #374151;
  line-height: 1.7;
}
.prose li::marker {
  color: #4d7c0f;
}
.prose blockquote {
  border-left: 4px solid #4d7c0f;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  font-style: normal;
  color: #1f2937;
  background: #f7fee7;
  border-radius: 0 0.5rem 0.5rem 0;
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
}
.prose blockquote p:last-child {
  margin-bottom: 0;
}
.prose a {
  text-decoration: underline;
  text-decoration-color: rgba(77, 124, 15, 0.35);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  font-weight: 500;
}
.prose a:hover {
  text-decoration-color: #4d7c0f;
  text-decoration-thickness: 2px;
}
.prose strong {
  font-weight: 600;
  color: #111827;
}
.prose img {
  border-radius: 0.5rem;
  margin: 1.75rem 0;
}
.prose hr {
  border-top: 1px solid #e5e7eb;
  margin: 2.5rem 0;
}

/* ---------- Tables ---------- */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
  font-family: 'Inter', system-ui, sans-serif;
}
.prose thead {
  border-bottom: 2px solid #4d7c0f;
}
.prose th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #1f2937;
  background: #f7fee7;
  white-space: nowrap;
}
.prose td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  color: #374151;
  vertical-align: top;
}
.prose tbody tr:hover {
  background: #fafafa;
}
@media (max-width: 640px) {
  .prose th, .prose td {
    padding: 0.6rem 0.7rem;
    font-size: 0.875rem;
  }
}

/* ---------- Utilities ---------- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Pagination Hugo ---------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  flex-wrap: wrap;
  list-style: none;
  padding-left: 0;
}
.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: 600;
  font-family: 'Inter', system-ui, sans-serif;
}
.pagination a {
  color: #374151;
  background: #fff;
  border: 1px solid #e5e7eb;
}
.pagination a:hover {
  background: #f7fee7;
  border-color: #4d7c0f;
  color: #4d7c0f;
}
.pagination .active {
  color: #fff;
  background: #4d7c0f;
  border: 1px solid #4d7c0f;
}
.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::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, aside { display: none !important; }
  .prose { max-width: 100%; color: #000; }
  .prose a { color: #000; text-decoration: underline; }
  .prose a::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #555; }
}
