/*
 * Cabinet CDSA — Custom CSS éditorial
 * TailwindCSS chargé via CDN dans head.html.
 * Ce fichier ajoute la typographie éditoriale et les détails finition.
 */

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

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

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

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

/* Sélection texte — couleur de marque */
::selection {
  background-color: rgba(79, 70, 229, 0.18);
  color: #1f2937;
}

/* ==========================================================================
   Focus visible — accessibilité (WCAG 2.4.7)
   ========================================================================== */

a:focus-visible,
button:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ==========================================================================
   Article body — typographie éditoriale
   ========================================================================== */

.article-body p {
  margin-bottom: 1.5rem;
  line-height: 1.85;
  color: #374151;
}

/* Drop cap éditorial sur le premier paragraphe d'introduction */
.article-body > p:first-of-type::first-letter {
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-size: 4.2em;
  font-weight: 700;
  float: left;
  line-height: 0.85;
  margin: 0.08em 0.12em -0.05em 0;
  color: #4f46e5;
  padding-right: 0.1em;
}

/* Conserve le drop cap uniquement quand p:first-of-type contient du texte direct */
@media (max-width: 480px) {
  .article-body > p:first-of-type::first-letter {
    font-size: 3.4em;
  }
}

/* H2 — sous-titres avec filet décoratif */
.article-body h2 {
  position: relative;
  padding-top: 0.5rem;
}

.article-body h2::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 2px;
  background-color: #4f46e5;
  margin-bottom: 1rem;
  border-radius: 1px;
}

/* H3 — sous-sections sans filet pour respiration */
.article-body h3 {
  color: #1f2937;
}

/* Liens dans le corps */
.article-body a {
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(79, 70, 229, 0.4);
  font-weight: 500;
}

.article-body a:hover {
  text-decoration-color: #4f46e5;
  text-decoration-thickness: 2px;
}

/* Listes */
.article-body ul,
.article-body ol {
  margin-bottom: 1.5rem;
  padding-left: 1.75rem;
}

.article-body ul {
  list-style-type: disc;
}

.article-body ol {
  list-style-type: decimal;
}

.article-body li {
  margin-bottom: 0.5rem;
  color: #374151;
  line-height: 1.75;
}

.article-body li::marker {
  color: #4f46e5;
}

/* Citations */
.article-body blockquote {
  border-left: 2px solid #4f46e5;
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: #4b5563;
  font-family: "Lora", Georgia, serif;
  font-size: 1.075em;
  line-height: 1.7;
}

.article-body blockquote p {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

/* Strong — soutien typographique */
.article-body strong {
  color: #111827;
  font-weight: 600;
}

/* Code inline */
.article-body code {
  background-color: #f3f4f6;
  color: #4338ca;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.9em;
  font-family: "JetBrains Mono", "SF Mono", Monaco, Consolas, monospace;
}

/* Images dans le corps */
.article-body img {
  border-radius: 0.5rem;
  margin: 2rem auto;
  max-width: 100%;
  height: auto;
}

/* HR éditorial */
.article-body hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #d1d5db, transparent);
  margin: 3rem 0;
}

/* ==========================================================================
   Tables — éditoriales
   ========================================================================== */

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9375rem;
  display: block;
  overflow-x: auto;
}

.article-body thead {
  border-bottom: 2px solid #4f46e5;
}

.article-body th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #111827;
  font-family: "Inter", sans-serif;
  background: #f9fafb;
  white-space: nowrap;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}

.article-body td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  color: #374151;
  vertical-align: top;
  line-height: 1.6;
}

.article-body tbody tr:hover {
  background: #fafbfc;
}

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

/* ==========================================================================
   Utilitaires line-clamp
   ========================================================================== */

.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 (template interne)
   ========================================================================== */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
  list-style: none;
  padding-left: 0;
}

.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: 500;
  font-family: "Inter", sans-serif;
  transition: all 0.2s;
}

.pagination a {
  color: #374151;
  background: #f3f4f6;
}

.pagination a:hover {
  background: #e5e7eb;
  color: #4f46e5;
}

.pagination .active {
  color: #ffffff;
  background: #4f46e5;
}

.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
  color: #9ca3af;
}

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

@media print {
  header,
  footer,
  nav,
  aside {
    display: none !important;
  }

  .article-body {
    max-width: 100%;
  }

  .article-body a {
    color: #000;
    text-decoration: underline;
  }

  .article-body a::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #6b7280;
  }
}

/* ==========================================================================
   Reduced motion — respect preferences accessibilité
   ========================================================================== */

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