/*
 * Resto de la Cale — Custom CSS
 * TailwindCSS chargé via CDN dans head.html
 * Ce fichier gère : typographie prose, composants custom, utilitaires
 */

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

a,
button {
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

/* ── Focus visible global (accessibilité clavier) ───────────────── */
:focus-visible {
  outline: 2px solid #ea580c;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Prose article — typographie longue lecture ──────────────────── */
/*
 * Classe .prose-article appliquée au div contenu dans single.html
 * Contraste : couleur texte #44403c (stone-700) sur blanc → 7.2:1 ✓ WCAG AA
 */
.prose-article {
  max-width: 70ch;
  color: #292524; /* stone-800 — 11.9:1 sur blanc */
  font-size: 1.0625rem;
  line-height: 1.8;
}

.prose-article h2 {
  font-family: Poppins, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1c1917; /* stone-900 */
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
  /* Trait orange à gauche */
  padding-left: 0.875rem;
  border-left: 3px solid #ea580c;
}

.prose-article h3 {
  font-family: Poppins, sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: #1c1917;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.35;
}

.prose-article h4 {
  font-family: Poppins, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #292524;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.prose-article p {
  margin-bottom: 1.5rem;
  color: #44403c; /* stone-700 — 7.2:1 sur blanc ✓ */
}

.prose-article ul,
.prose-article ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  color: #44403c;
}

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

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

.prose-article li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.prose-article li::marker {
  color: #ea580c; /* orange — pour les puces */
}

/* ── Blockquote ─────────────────────────────────────────────────── */
.prose-article blockquote {
  border-left: 3px solid #ea580c;
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  background: #fff7ed; /* orange-50 */
  border-radius: 0 0.5rem 0.5rem 0;
  font-style: italic;
  color: #57534e; /* stone-600 — 5.7:1 sur blanc ✓ */
}

.prose-article blockquote p {
  margin-bottom: 0;
  color: #57534e;
}

/* ── Liens dans le contenu ──────────────────────────────────────── */
/*
 * #c2410c (dark orange) sur blanc → 4.85:1 ✓ WCAG AA
 * Éviter #ea580c (light orange) pour les petits liens → 3.06:1 (fail small text)
 */
.prose-article a {
  color: #c2410c; /* secondary — 4.85:1 ✓ */
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.prose-article a:hover {
  color: #9a3412; /* orange-800 — encore plus lisible */
  text-decoration-thickness: 2px;
}

.prose-article strong {
  font-weight: 700;
  color: #1c1917;
}

.prose-article em {
  color: #57534e;
}

.prose-article img {
  border-radius: 0.75rem;
  margin: 1.75rem 0;
  max-width: 100%;
  height: auto;
}

/* ── Tables ─────────────────────────────────────────────────────── */
.prose-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}

.prose-article thead {
  border-bottom: 2px solid #e7e5e4; /* stone-200 */
}

.prose-article th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-family: Poppins, sans-serif;
  font-size: 0.8125rem;
  color: #1c1917;
  background: #f5f5f4; /* stone-100 */
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.prose-article td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e7e5e4;
  color: #44403c;
  vertical-align: top;
}

.prose-article tbody tr:hover {
  background: #fafaf9; /* stone-50 */
}

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

/* ── Code inline ────────────────────────────────────────────────── */
.prose-article code {
  font-family: 'Courier New', monospace;
  font-size: 0.875em;
  background: #f5f5f4;
  color: #c2410c;
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
}

/* ── 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 (template interne Hugo) ─────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e7e5e4;
}

.pagination li {
  list-style: none;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.875rem;
  border-radius: 0.5rem;
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
}

/* Lien de pagination — stone-700 sur stone-100 → 5.6:1 ✓ */
.pagination a {
  color: #44403c;
  background: #f5f5f4;
  text-decoration: none;
}

.pagination a:hover {
  background: #e7e5e4;
  color: #1c1917;
}

/* Page active — blanc sur primary (#ea580c) : 3.06:1 → PASS large/bold ✓ */
.pagination .active span,
.pagination li.active a {
  color: white;
  background: #ea580c;
  font-weight: 600;
}

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

/* ── Image de couverture article ────────────────────────────────── */
/*
 * article-cover.html renvoie un img si image: dans le frontmatter
 * Le partial ne génère pas de wrapper — on le stylise via le conteneur parent
 */
.prose-article > div[class*="aspect"] img,
.article-cover img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 0.75rem;
  margin-bottom: 2rem;
}

/* ── Impression ─────────────────────────────────────────────────── */
@media print {
  header,
  footer,
  nav,
  aside,
  .pagination { display: none !important; }
  .prose-article { max-width: 100%; font-size: 11pt; }
}
