/*
 * Petit Cadeau Pas Cher — Custom CSS
 * Note: TailwindCSS is loaded via Play CDN in head.html.
 *       This file holds custom layer additions, prose typography, pagination
 *       and accessibility utilities that Tailwind doesn't cover out of the box.
 */

/* ------------------------------------------------------------------
 * 1. Base — smooth scroll, font smoothing, focus reset
 * ------------------------------------------------------------------ */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

/* Reduced-motion respect */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------------
 * 2. Accessibility — focus-visible + skip link safety
 * ------------------------------------------------------------------ */
a:focus-visible, button:focus-visible {
  outline: 2px solid #0891b2;
  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;
}

/* ------------------------------------------------------------------
 * 3. Prose — markdown content typography (Tailwind Typography overrides)
 *    Used in single.html, list.html intro and page templates.
 * ------------------------------------------------------------------ */
.prose {
  max-width: 68ch;
}

.prose h2 {
  scroll-margin-top: 6rem;
}
.prose h3 {
  scroll-margin-top: 6rem;
}

.prose p {
  margin-bottom: 1.5rem;
  line-height: 1.75;
}

.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 blockquote {
  padding: 1rem 1.25rem;
  margin: 2rem 0;
  border-left-width: 4px;
  border-radius: 0 0.5rem 0.5rem 0;
  font-style: normal;
}
.prose blockquote p:last-of-type { margin-bottom: 0; }

.prose a {
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.prose a:hover {
  text-decoration-thickness: 2px;
}

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

.prose hr {
  margin: 2.5rem 0;
  border-color: #e7e5e4;
}

/* ------------------------------------------------------------------
 * 4. Tables inside prose — readable, scrollable on mobile
 * ------------------------------------------------------------------ */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9375rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.prose thead {
  border-bottom: 2px solid #d6d3d1;
}
.prose th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #1c1917;
  background: #fafaf9;
  white-space: nowrap;
}
.prose td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e7e5e4;
  color: #44403c;
  vertical-align: top;
}
.prose tbody tr:hover {
  background: #fafaf9;
}
@media (max-width: 640px) {
  .prose th, .prose td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* ------------------------------------------------------------------
 * 5. Line-clamp utilities (Tailwind ships these, kept as fallback)
 * ------------------------------------------------------------------ */
.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;
}

/* ------------------------------------------------------------------
 * 6. Pagination (Hugo internal _internal/pagination.html)
 * ------------------------------------------------------------------ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e7e5e4;
  list-style: none;
  padding-left: 0;
  flex-wrap: wrap;
}
.pagination li { list-style: none; }

.pagination a,
.pagination .page-item .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.875rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #44403c;
  background: #fafaf9;
  border: 1px solid #e7e5e4;
  text-decoration: none;
}
.pagination a:hover {
  background: #ecfeff;
  color: #0891b2;
  border-color: #0891b2;
}
.pagination .active a,
.pagination .active .page-link {
  background: #0891b2;
  color: #fff;
  border-color: #0891b2;
}
.pagination .disabled a,
.pagination .disabled .page-link {
  opacity: 0.4;
  pointer-events: none;
}

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