/*
 * Plinko Officiel — Custom CSS
 * Tailwind est chargé via CDN dans head.html ; ce fichier ajoute :
 *   - styles éditoriaux (.prose) renforcés
 *   - utilitaires non couverts par Tailwind CDN (line-clamp, etc.)
 *   - décor "peg-pattern" évoquant la grille du Plinko
 *   - quelques gardes d'accessibilité (focus, prefers-reduced-motion)
 */

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

body {
  text-rendering: optimizeLegibility;
}

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

::selection {
  background: #7c3aed;
  color: #fff;
}

/* -------- Peg pattern (décor signature) ----------
 * Pyramide de pegs en SVG inline (data URI). Utilisé en background-image
 * sur les fonds sombres (hero fallback, sections décoratives) avec opacity
 * réduite. Le motif évoque la grille du Plinko sans cliché casino.
 */
.peg-pattern {
  background-image:
    radial-gradient(circle at 12px 12px, currentColor 1.4px, transparent 1.6px);
  background-size: 24px 24px;
  background-position: 0 0;
  color: #ffffff;
}

/* Variante fond clair (pour les sections light) */
.peg-pattern-dark {
  background-image:
    radial-gradient(circle at 12px 12px, #7c3aed 1.4px, transparent 1.6px);
  background-size: 24px 24px;
  background-position: 0 0;
}

/* -------- Prose (article body) -------- */
.prose { max-width: 70ch; }

.prose h2 {
  font-size: 1.625rem;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.prose h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
}
.prose p {
  margin-bottom: 1.5rem;
  line-height: 1.75;
  color: #374151;
}
.prose ul, .prose ol {
  margin: 1rem 0 1.5rem;
  padding-left: 1.5rem;
}
.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }
.prose li {
  margin-bottom: 0.5rem;
  color: #374151;
  line-height: 1.7;
}
.prose li::marker {
  color: #7c3aed;
  font-weight: 600;
}
.prose blockquote {
  border-left: 4px solid #f97316;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  font-style: normal;
  color: #4b5563;
  background: #fffbeb;
  border-radius: 0 0.5rem 0.5rem 0;
  font-weight: 500;
}
.prose blockquote p { margin-bottom: 0; }

.prose a {
  text-decoration: underline;
  text-decoration-color: rgba(124, 58, 237, 0.4);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  font-weight: 500;
}
.prose a:hover {
  text-decoration-color: #7c3aed;
  text-decoration-thickness: 2px;
}
.prose strong {
  font-weight: 600;
  color: #111827;
}
.prose img {
  border-radius: 0.5rem;
  margin: 1.75rem 0;
}
.prose code {
  background: #f3f4f6;
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.9em;
  color: #be185d;
}
.prose pre {
  background: #1f2937;
  color: #f9fafb;
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.875rem;
}
.prose pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* Tableaux articles — version unique, propre */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9375rem;
  display: block;
  overflow-x: auto;
}
.prose thead {
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
}
.prose th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  font-family: inherit;
}
.prose td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}
.prose tbody tr:hover { background: #faf5ff; }

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

/* -------- Utilities (non incluses dans Tailwind CDN free) -------- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* -------- Accessibility -------- */
a:focus-visible, button:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 3px;
  border-radius: 4px;
}

.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: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Respect du paramètre OS "réduire les animations" */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, ::before, ::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* -------- Pagination Hugo (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 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
}
.pagination a {
  color: #374151;
  background: #fff;
  border: 1px solid #e5e7eb;
}
.pagination a:hover {
  background: #faf5ff;
  border-color: #7c3aed;
  color: #7c3aed;
}
.pagination .active {
  color: #fff;
  background: #7c3aed;
  border: 1px solid #7c3aed;
}
.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

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

/* -------- Tabular numerals (pour les chiffres clés) -------- */
.tabular-nums { font-variant-numeric: tabular-nums; }
