/*
 * La Librairie du Square — Custom CSS
 *
 * TailwindCSS Play CDN charge les utilitaires dans head.html.
 * Ce fichier rassemble les styles éditoriaux et les surcharges typographiques
 * que les utilitaires Tailwind ne couvrent pas naturellement.
 *
 * Couleurs (Palette 7 — Orange / Teal) :
 *   --color-primary   #ea580c
 *   --color-secondary #c2410c   ← privilégié pour les textes/liens (contraste AA)
 *   --color-accent    #14b8a6
 *   --color-ink       #1c1917   (stone-900)
 *   --color-paper     #fafaf9   (stone-50)
 *
 * Notes WCAG :
 *   - #ea580c sur blanc : 3.78:1 → AA pour gros texte uniquement
 *   - #c2410c sur blanc : 4.93:1 → AA pour texte normal ✓
 *   - Texte blanc sur fond #1c1917 : 16.4:1 → AAA ✓
 *   On utilise donc systématiquement secondary pour les liens/boutons texte.
 */

:root {
  --color-primary: #ea580c;
  --color-secondary: #c2410c;
  --color-accent: #14b8a6;
  --color-ink: #1c1917;
  --color-paper: #fafaf9;
}

/* Base & rendu typographique */
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;
}

/* Headings : ligature + tracking serré pour un rendu de titrage de magazine */
h1, h2, h3, h4, h5, h6 {
  font-feature-settings: "kern" 1, "liga" 1, "dlig" 1;
}

/* Transitions globales — limitées aux éléments interactifs */
a, button {
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Focus visible : anneau secondary (meilleur contraste qu'un orange clair) */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: none;
}

/* ============================================================
   Prose — corps d'article
   ============================================================ */

.prose {
  max-width: 68ch;
}

.prose p {
  hyphens: auto;
}

.prose h2 {
  letter-spacing: -0.01em;
}

.prose h2::after {
  content: '';
  display: block;
  width: 2.5rem;
  height: 2px;
  background: var(--color-primary);
  margin-top: 0.75rem;
}

/* Liens dans la prose : soulignement subtil au survol */
.prose a {
  text-decoration: underline;
  text-decoration-color: rgba(194, 65, 12, 0.3);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.2s ease;
}

.prose a:hover {
  text-decoration-color: var(--color-secondary);
  text-decoration-thickness: 2px;
}

/* Liste : petite touche éditoriale */
.prose ul > li::marker {
  color: var(--color-primary);
}

.prose ol > li::marker {
  color: var(--color-secondary);
  font-weight: 600;
}

/* Citations bloquantes */
.prose blockquote {
  position: relative;
  margin: 2rem 0;
}

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

/* Tables : style éditorial */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
  border: 1px solid #e7e5e4;  /* stone-200 */
}

.prose thead {
  border-bottom: 2px solid var(--color-primary);
}

.prose th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--color-ink);
  background: #fafaf9;        /* stone-50 */
}

.prose td {
  padding: 0.875rem 1rem;
  border-top: 1px solid #f5f5f4; /* stone-100 */
  color: #44403c;                /* stone-700 */
}

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

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

/* ============================================================
   Utilitaires — line-clamp (fallback car parfois absent du CDN)
   ============================================================ */

.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 _internal/pagination.html)
   ============================================================ */

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

.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: 500;
  font-family: inherit;
  transition: all 0.2s;
}

.pagination a {
  color: #44403c;        /* stone-700 */
  background: transparent;
  border: 1px solid #e7e5e4; /* stone-200 */
  text-decoration: none;
}

.pagination a:hover {
  background: #fafaf9;
  border-color: var(--color-secondary);
  color: var(--color-secondary);
}

.pagination .active {
  color: white;
  background: var(--color-secondary);
  border: 1px solid var(--color-secondary);
}

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

/* ============================================================
   Reduced motion — respect des préférences utilisateur
   ============================================================ */

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

/* ============================================================
   Print — styles pour impression
   ============================================================ */

@media print {
  header, footer, nav { display: none !important; }
  .prose { max-width: 100%; color: #000; }
  a { color: #000 !important; text-decoration: underline; }
  .prose h2::after { background: #000; }
}

/* ============================================================
   Sélection texte — couleur de marque
   ============================================================ */

::selection {
  background: var(--color-primary);
  color: #ffffff;
}
