/*
 * Boucherie du Rocher — feuille de styles éditoriaux
 *
 * Tailwind est chargé via CDN et étendu dans head.html avec :
 *   - Couleurs : primary, secondary, accent, paper, paper-soft, ink, ink-soft
 *   - Polices  : font-heading (DM Serif Display), font-body (DM Sans)
 *
 * Ce fichier contient uniquement les styles transverses qui ne
 * peuvent pas s'exprimer en utilitaires Tailwind. Il vise un confort
 * de lecture optimal et un respect strict des contrastes WCAG AA.
 */

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

/* Selection : reprend les tokens éditoriaux */
::selection {
  background: #f97316;
  color: #1a1614;
}

/* Transitions globales sobres */
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;
}

/* ------------------------------------------------------------------
 * ACCESSIBILITÉ
 * ------------------------------------------------------------------ */
/* Anneau de focus visible (WCAG 2.4.7) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 3px;
  border-radius: 4px;
}

/* Lien d'évitement (skip link) — masqué hors focus */
.sr-only:not(:focus):not(:focus-within) {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Respect du mouvement réduit */
@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;
  }
}

/* ------------------------------------------------------------------
 * PROSE — typographie éditoriale du corps d'article
 * Surcharge minimale de @tailwindcss/typography
 * ------------------------------------------------------------------ */
.prose {
  max-width: 68ch;
}

.prose > * + * {
  margin-top: 1.25em;
}

.prose h2 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.prose h3 {
  font-size: clamp(1.15rem, 1rem + 0.5vw, 1.375rem);
  line-height: 1.3;
}

.prose p {
  line-height: 1.8;
}

/* Lettrines facultatives — appliquées uniquement au premier paragraphe
   d'un article si l'auteur le souhaite via la classe `.has-dropcap` */
.prose .has-dropcap::first-letter {
  font-family: "DM Serif Display", Georgia, serif;
  float: left;
  font-size: 4em;
  line-height: 0.85;
  margin: 0.05em 0.1em 0 0;
  color: #7c3aed;
}

/* Listes : puces accentuées */
.prose ul {
  list-style: none;
  padding-left: 0;
}
.prose ul > li {
  position: relative;
  padding-left: 1.5rem;
}
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 0.5rem;
  height: 1px;
  background-color: #f97316;
}

.prose ol {
  list-style: decimal;
  padding-left: 1.5rem;
}
.prose ol > li::marker {
  color: #7c3aed;
  font-weight: 600;
}

/* Citations éditoriales */
.prose blockquote {
  position: relative;
  font-style: normal;
  font-weight: 500;
  color: #3a312c;
}
.prose blockquote p:first-of-type {
  margin-top: 0;
}
.prose blockquote p:last-of-type {
  margin-bottom: 0;
}

/* Liens dans le contenu — soulignement raffiné */
.prose a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(124, 58, 237, 0.4);
}
.prose a:hover {
  text-decoration-thickness: 2px;
  text-decoration-color: currentColor;
}

/* ------------------------------------------------------------------
 * TABLES — design éditorial cohérent (utilisé pour les comparatifs)
 * ------------------------------------------------------------------ */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.prose thead {
  background: #f3efe6;
  border-bottom: 2px solid rgba(26, 22, 20, 0.15);
}

.prose th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 600;
  color: #1a1614;
  white-space: nowrap;
}

.prose td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(26, 22, 20, 0.08);
  color: #3a312c;
  vertical-align: top;
}

.prose tbody tr:hover {
  background: rgba(124, 58, 237, 0.04);
}

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

/* ------------------------------------------------------------------
 * UTILITAIRES TRUNCATE — line-clamp (compat Tailwind ≥ 3.3)
 * ------------------------------------------------------------------ */
.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;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(26, 22, 20, 0.1);
}

.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-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.pagination a {
  color: #1a1614;
  background: #f3efe6;
}
.pagination a:hover {
  background: #fff;
  border-color: rgba(124, 58, 237, 0.3);
  color: #7c3aed;
}

.pagination .active {
  color: #fff;
  background: #7c3aed;
  border-color: #7c3aed;
}

.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

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