/*
 * Les Volailles de Flo — feuille de style éditoriale.
 * TailwindCSS est chargé via CDN dans head.html. Ce fichier contient les
 * compléments custom (prose, composants, accessibilité) qui ne sont pas
 * exprimables proprement uniquement via les classes utilitaires.
 *
 * Palette "Verger" :
 *   --c-primary:   #047857  (emerald-700)  — bio, jardin
 *   --c-secondary: #065f46  (emerald-800)  — fonds profonds
 *   --c-accent:    #c2410c  (orange-700)   — terre cuite, accents
 *   contraste min. blanc-sur-couleur : 5:1 (AA pour texte normal)
 */

/* ----------------------------------------------------------
   Variables CSS (utilisées par les composants non-Tailwind)
---------------------------------------------------------- */
:root {
  --c-primary: #047857;
  --c-primary-hover: #065f46;
  --c-secondary: #065f46;
  --c-accent: #c2410c;
  --c-accent-soft: #fed7aa;
  --c-emerald-50: #ecfdf5;
  --c-emerald-100: #d1fae5;
  --c-emerald-700: #047857;
  --c-emerald-800: #065f46;
  --c-text-strong: #111827; /* gray-900 */
  --c-text-body: #1f2937;   /* gray-800 — contrast 12.6:1 sur blanc */
  --c-text-muted: #4b5563;  /* gray-600 — contrast 7.5:1 sur blanc */
  --c-border: #d1fae5;      /* emerald-100 */
}

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

body {
  /* Tailwind impose font-body via classes utilitaires sur <body> */
  text-rendering: optimizeLegibility;
}

/* Réduit le motion pour les utilisateurs sensibles (accessibilité) */
@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;
  }
}

/* Transitions globales sur éléments interactifs */
a, button {
  transition: color 0.18s ease, background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

/* ----------------------------------------------------------
   Focus visible — anneau visible et lisible (WCAG 2.4.7)
---------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: 4px;
}
/* Texte foncé sur fond foncé : on vire la pseudo-classe contradictoire
   (les éléments sur fond emerald-800 utilisent leur propre focus blanc) */
.bg-secondary :focus-visible,
.bg-primary   :focus-visible {
  outline-color: #ffffff;
}

/* ----------------------------------------------------------
   Prose — corps d'article (override Tailwind typography)
---------------------------------------------------------- */
.prose {
  max-width: 68ch;
}

.prose p {
  /* gray-800 contraste 12.6:1 — large marge pour lisibilité éditoriale */
  color: var(--c-text-body);
  line-height: 1.8;
  margin-bottom: 1.4rem;
}

.prose h2 {
  font-size: 1.6rem;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--c-text-strong);
  /* Léger underline décoratif à l'accent */
  position: relative;
  padding-bottom: 0.4rem;
}
.prose h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 3rem;
  height: 3px;
  background: var(--c-accent);
  border-radius: 2px;
}

.prose h3 {
  font-size: 1.3rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  color: var(--c-text-strong);
}

.prose ul, .prose ol {
  margin-bottom: 1.4rem;
  padding-left: 1.5rem;
}
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li {
  margin-bottom: 0.4rem;
  color: var(--c-text-body);
  line-height: 1.7;
}
.prose li::marker {
  color: var(--c-primary);
}

.prose blockquote {
  border-left: 4px solid var(--c-accent);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  background: var(--c-emerald-50);
  border-radius: 0 0.6rem 0.6rem 0;
  color: var(--c-text-body);
  font-style: normal;
}
.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose a {
  color: var(--c-primary);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.prose a:hover {
  color: var(--c-primary-hover);
  border-bottom-color: currentColor;
}

.prose strong {
  color: var(--c-text-strong);
  font-weight: 700;
}

.prose img {
  border-radius: 0.75rem;
  margin: 1.75rem 0;
  box-shadow: 0 4px 12px -2px rgba(6, 95, 70, 0.12);
}

.prose hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 2.5rem 0;
}

.prose code {
  background: var(--c-emerald-50);
  color: var(--c-emerald-800);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.prose pre {
  background: #0f172a; /* slate-900 — contraste élevé pour code */
  color: #f1f5f9;
  padding: 1rem 1.25rem;
  border-radius: 0.6rem;
  overflow-x: auto;
}
.prose pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* ----------------------------------------------------------
   Tables — responsive horizontal scroll
---------------------------------------------------------- */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
}
.prose thead {
  border-bottom: 2px solid var(--c-emerald-700);
}
.prose th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 700;
  color: var(--c-text-strong);
  background: var(--c-emerald-50);
  white-space: nowrap;
  font-family: 'Merriweather', Georgia, serif;
}
.prose td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-body);
}
.prose tbody tr:hover {
  background: rgba(236, 253, 245, 0.5);
}
@media (max-width: 640px) {
  .prose th, .prose td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* ----------------------------------------------------------
   Line clamp — Tailwind v3 inclut déjà ces classes mais le CDN
   peut varier ; on les redéfinit pour garantir le rendu.
---------------------------------------------------------- */
.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;
}
.line-clamp-4 {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ----------------------------------------------------------
   Pagination Hugo — _internal/pagination.html
---------------------------------------------------------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--c-border);
}
.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.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Nunito', system-ui, sans-serif;
}
.pagination a {
  color: var(--c-secondary);
  background: var(--c-emerald-50);
  border: 1px solid var(--c-border);
}
.pagination a:hover {
  background: var(--c-emerald-100);
  color: var(--c-primary);
}
.pagination .active {
  color: #ffffff;
  background: var(--c-primary);
  border: 1px solid var(--c-primary);
}
.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ----------------------------------------------------------
   Print — masque le chrome de navigation
---------------------------------------------------------- */
@media print {
  header, footer, nav, .skip-link { display: none !important; }
  .prose { max-width: 100%; }
  a { color: black; text-decoration: underline; }
  a::after { content: ' (' attr(href) ')'; font-size: 0.8em; }
}

/* ----------------------------------------------------------
   Selection — sélection de texte cohérente avec la marque
---------------------------------------------------------- */
::selection {
  background: var(--c-accent-soft);
  color: var(--c-secondary);
}
