/*
 * Calculateur Surface Toiture — Custom CSS
 * TailwindCSS est chargé via CDN dans head.html ; ce fichier ajoute les styles éditoriaux
 * spécifiques (prose, ornements, accessibilité) qui ne sont pas exprimables en utilities.
 *
 * WCAG AA — Toutes les couleurs déclarées ici respectent un ratio ≥ 4.5:1 sur leur fond.
 */

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

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

a, button {
  transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

/* Sélection texte — accentuée par la couleur secondaire (contraste blanc 5.56:1) */
::selection {
  background-color: #047857;
  color: #ffffff;
}

/* ------------------------------------------------------------------ Décors thématiques */
/*
 * Liseré de toiture : barre de 4 pentes qui rappelle visuellement la signature du site.
 * Utilisée en bas du header et en haut des sections "hero" pour ancrer la marque.
 */
.roof-divider {
  position: relative;
  height: 8px;
  overflow: hidden;
  background: linear-gradient(90deg, #059669 0%, #047857 50%, #6366f1 100%);
}
.roof-divider::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 8' preserveAspectRatio='none'><path d='M0 8 L10 0 L20 8 L30 0 L40 8 Z' fill='rgba(255,255,255,0.18)'/></svg>");
  background-size: 40px 8px;
  background-repeat: repeat-x;
  pointer-events: none;
}

/* ------------------------------------------------------------------ Prose éditoriale */
.prose {
  max-width: 70ch;
  font-size: 1.0625rem; /* 17px : meilleur confort longue lecture */
  line-height: 1.75;
  color: #1f2937; /* gray-800 — 12.6:1 sur blanc */
}

.prose h2 {
  font-family: var(--font-heading, Lora), Georgia, serif;
  font-size: 1.75rem;
  margin-top: 3rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.25;
  color: #0f172a;
  letter-spacing: -0.01em;
  position: relative;
  padding-left: 1rem;
}
.prose h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4em;
  bottom: 0.4em;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, #059669, #047857);
}

.prose h3 {
  font-family: var(--font-heading, Lora), Georgia, serif;
  font-size: 1.375rem;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  color: #0f172a;
}

.prose h4 {
  font-size: 1.125rem;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #0f172a;
}

.prose p {
  margin-bottom: 1.4rem;
}

.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 li {
  margin-bottom: 0.5rem;
}
.prose li::marker {
  color: #047857;
}

.prose blockquote {
  border-left: 4px solid #047857;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: #334155; /* slate-700 — 9.8:1 sur fond clair */
  background: #f0fdf4; /* emerald-50 */
  border-radius: 0 0.5rem 0.5rem 0;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose a {
  color: #047857;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  font-weight: 500;
}
.prose a:hover {
  color: #4338ca; /* indigo-700 contraste 7.7:1 */
  text-decoration-thickness: 2px;
}

.prose strong {
  font-weight: 700;
  color: #0f172a;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: #f1f5f9;
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  color: #0f172a;
}

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

/* Tableaux techniques : centraux dans le contenu (prix, coefficients) */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  display: block;
  overflow-x: auto;
}
.prose thead {
  background: #047857;
}
.prose th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #ffffff; /* contraste 5.56:1 sur secondary */
  border: none;
  white-space: nowrap;
}
.prose td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  color: #1f2937;
}
.prose tbody tr:nth-child(even) {
  background: #f9fafb;
}
.prose tbody tr:hover {
  background: #f0fdf4;
}
@media (max-width: 640px) {
  .prose th, .prose td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

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

/* Focus visible accessible (3px outline + halo) */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid #6366f1;
  outline-offset: 3px;
  border-radius: 6px;
}

/* Pagination Hugo internal */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
}
.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: var(--font-body, Inter), system-ui, sans-serif;
}
.pagination a {
  color: #1f2937;
  background: #f3f4f6;
}
.pagination a:hover {
  background: #047857;
  color: #ffffff;
}
.pagination .active {
  color: #ffffff;
  background: #047857;
}
.pagination .disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* FAQ <details> — animation douce du chevron */
details.faq-item summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary .faq-chevron {
  transition: transform .25s ease;
}
details.faq-item[open] summary .faq-chevron {
  transform: rotate(180deg);
}

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

/* Réduction des animations selon préférence système */
@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;
  }
}
