/*
 * Reparemontel — Custom CSS
 * - TailwindCSS Play est chargé via head.html (avec plugin typography)
 * - Ce fichier ajoute les styles custom (prose, focus, pagination, anti-FOIT)
 * - Couleurs primaires injectées par Tailwind config (cf. head.html)
 */

/* -----------------------------------------------------------
   Base : confort de lecture, antialiasing, smooth scroll
----------------------------------------------------------- */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

/* Transitions globales */
a, button {
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

/* -----------------------------------------------------------
   Accessibilité : focus visible, skip-link, prefer-reduced-motion
----------------------------------------------------------- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* -----------------------------------------------------------
   Prose (markdown) — typographie soignée des articles
----------------------------------------------------------- */
.prose {
  max-width: 70ch;
}

.prose h2 {
  font-size: clamp(1.5rem, 2.4vw, 1.875rem);
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.prose h3 {
  font-size: clamp(1.125rem, 1.8vw, 1.375rem);
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.prose p {
  margin-bottom: 1.5rem;
  line-height: 1.75;
  color: #44403c; /* stone-700 */
}

/* Première lettre de l'introduction (lettrine subtile) */
.prose > p:first-of-type::first-letter {
  font-weight: 600;
  color: #0e7490; /* secondary */
}

.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 ul ul, .prose ol ol, .prose ul ol, .prose ol ul {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.prose li {
  margin-bottom: 0.5rem;
  color: #44403c;
  padding-left: 0.25rem;
}
.prose li::marker {
  color: #0891b2; /* primary */
}

/* Citations / encadrés conseil */
.prose blockquote {
  border-left: 4px solid #ec4899; /* accent */
  background: #fafaf9; /* stone-50 */
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  font-style: normal;
  color: #44403c;
  border-radius: 0 0.5rem 0.5rem 0;
  font-weight: 400;
}
.prose blockquote p {
  margin-bottom: 0;
}
.prose blockquote p:not(:last-child) {
  margin-bottom: 0.75rem;
}
.prose blockquote strong {
  color: #0e7490;
  font-weight: 700;
}

/* Liens dans le corps */
.prose a {
  color: #0891b2;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  font-weight: 500;
  transition: color 0.2s, text-decoration-thickness 0.2s;
}
.prose a:hover {
  color: #ec4899;
  text-decoration-thickness: 2px;
}

.prose strong {
  font-weight: 700;
  color: #1c1917; /* stone-900 */
}

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

/* -----------------------------------------------------------
   Tables
----------------------------------------------------------- */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9375rem;
  display: block;
  overflow-x: auto;
  border: 1px solid #e7e5e4; /* stone-200 */
  border-radius: 0.5rem;
}
.prose thead {
  background: #f5f5f4; /* stone-100 */
  border-bottom: 2px solid #e7e5e4;
}
.prose th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 700;
  color: #1c1917;
  white-space: nowrap;
  font-family: 'Oswald', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8125rem;
}
.prose td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e7e5e4;
  color: #44403c;
  vertical-align: top;
}
.prose tbody tr:hover {
  background: #fafaf9;
}
.prose tbody tr:last-child td {
  border-bottom: none;
}
@media (max-width: 640px) {
  .prose th, .prose td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* -----------------------------------------------------------
   Line clamp utilitaires (pour les cards)
----------------------------------------------------------- */
.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: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #e7e5e4;
  list-style: none;
  padding-left: 0;
}
.pagination li {
  list-style: none;
  margin: 0;
}
.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.85rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'Oswald', system-ui, sans-serif;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}
.pagination a {
  color: #44403c;
  background: #f5f5f4;
}
.pagination a:hover {
  background: #0891b2;
  color: white;
}
.pagination .active {
  color: white;
  background: #0891b2;
  cursor: default;
}
.pagination .disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* -----------------------------------------------------------
   Print
----------------------------------------------------------- */
@media print {
  header, footer, nav { display: none !important; }
  .prose { max-width: 100%; }
  body { background: white !important; color: black !important; }
  a { color: black !important; text-decoration: underline !important; }
}

/* -----------------------------------------------------------
   Skip-link visible au focus (déjà géré inline, mais sécurité ici)
----------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.focus\:not-sr-only:focus,
.focus\:not-sr-only:focus-visible {
  position: fixed;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* -----------------------------------------------------------
   Table des matières article (Hugo .TableOfContents)
----------------------------------------------------------- */
.toc-article ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.toc-article ul ul {
  padding-left: 1rem;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}
.toc-article li {
  margin: 0.4rem 0;
  padding-left: 0.75rem;
  border-left: 2px solid transparent;
}
.toc-article li:hover {
  border-left-color: #0891b2;
}
.toc-article a {
  color: #44403c;
  text-decoration: none;
  display: inline-block;
  transition: color 0.2s;
}
.toc-article a:hover {
  color: #0891b2;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* -----------------------------------------------------------
   Misc UX
----------------------------------------------------------- */
::selection {
  background: #0891b2;
  color: white;
}
