/*
 * un-ou-une.fr — Custom CSS
 * TailwindCSS chargé via CDN dans layouts/partials/head.html.
 * Ce fichier ajoute : la pile de polices avec fallbacks robustes,
 * le styling éditorial du contenu Markdown, et quelques utilitaires.
 */

/* ==========================================================================
   Fallbacks de polices — garantit la lisibilité même sans les WOFF2 chargés
   ========================================================================== */

.font-heading {
  font-family: 'Merriweather', Georgia, Cambria, 'Times New Roman', Times, serif;
  font-feature-settings: "kern" 1, "liga" 1;
}

.font-body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-feature-settings: "kern" 1;
}

/* ==========================================================================
   Base
   ========================================================================== */

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

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Sélection : couleur de marque */
::selection {
  background-color: #4f46e5;
  color: #fff;
}

/* Transitions douces sur tous les liens et boutons */
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;
}

/* Focus accessible */
a:focus-visible, button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ==========================================================================
   Prose éditoriale (rendu du contenu Markdown des articles)
   ========================================================================== */

.prose {
  max-width: 70ch;
}

.prose h2 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.625rem;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.prose h3 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
}

.prose p {
  margin-bottom: 1.5rem;
  line-height: 1.75;
  color: #374151;
}

/* Première lettre en lettrine sur le premier paragraphe (touche éditoriale) */
.prose > p:first-of-type::first-letter {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
  float: left;
  margin: 0.25rem 0.6rem 0 0;
  color: #4f46e5;
}

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

.prose blockquote {
  border-left: 4px solid #4f46e5;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: #4b5563;
  background: #f9fafb;
  border-radius: 0 0.5rem 0.5rem 0;
}

.prose blockquote p {
  margin-bottom: 0;
}

.prose a {
  color: #4f46e5;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 500;
}
.prose a:hover {
  color: #4338ca;
  text-decoration-thickness: 2px;
}

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

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

/* ==========================================================================
   Tables (consolidées)
   ========================================================================== */

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

.prose th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
  color: #111827;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.prose td {
  padding: 0.75rem 1rem;
  border: 1px solid #e5e7eb;
  color: #374151;
}

.prose tbody tr:nth-child(even) {
  background-color: #fafafa;
}

.prose tbody tr:hover {
  background: #f3f4f6;
}

@media (max-width: 640px) {
  .prose th, .prose td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* ==========================================================================
   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;
}

/* ==========================================================================
   Pagination (Hugo internal template)
   ========================================================================== */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
}
.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.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
}
.pagination a {
  color: #374151;
  background: #f3f4f6;
}
.pagination a:hover {
  background: #e0e7ff;
  color: #4f46e5;
}
.pagination .active {
  color: #fff;
  background: #4f46e5;
}
.pagination .disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ==========================================================================
   Print styles
   ========================================================================== */

@media print {
  header, footer, nav { display: none !important; }
  .prose { max-width: 100%; }
  .prose > p:first-of-type::first-letter {
    font-size: 1em;
    float: none;
    margin: 0;
    color: inherit;
  }
}

/* ==========================================================================
   Reduced motion : respecte les préférences utilisateur
   ========================================================================== */

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