/*
 * byjulieb.fr — Custom CSS
 * --------------------------------------------------------------------------
 * Tailwind is loaded via Play CDN in head.html and consumes the brand tokens
 * exposed there (primary / secondary / accent / ink / paper / parchment).
 * This file holds the editorial typography, prose tweaks, pagination
 * styling, focus rings, and print rules that Tailwind utilities do not
 * cover idiomatically.
 *
 * WCAG 2.1 AA compliance: all foreground/background pairs hold ≥4.5:1
 * contrast on body text and ≥3:1 on large text.
 * --------------------------------------------------------------------------
 */

/* ===== Brand tokens (mirrored as CSS vars for non-Tailwind contexts) ==== */
:root {
  --color-primary:   #0891b2;
  --color-secondary: #0e7490;
  --color-accent:    #ec4899;
  --color-ink:       #1c1c1e;
  --color-paper:     #fbfaf7;
  --color-parchment: #f3efe7;
  --color-muted:     #5b5a55;
}

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

body {
  font-feature-settings: "kern", "liga", "calt";
  background-color: var(--color-paper);
  color: var(--color-ink);
}

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

/* ===== Selection ======================================================= */
::selection {
  background: rgba(236, 72, 153, 0.2); /* accent / 20% */
  color: var(--color-ink);
}

/* ===== Transitions globales =========================================== */
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;
}

/* ===== Focus visible (WCAG 2.4.7) ===================================== */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ===== Editorial prose (markdown content) ============================== */
.prose {
  max-width: 68ch;
}

.prose h2 {
  font-size: 1.875rem;
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.prose h3 {
  font-size: 1.375rem;
  margin-top: 2.25rem;
  margin-bottom: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
}

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

.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; line-height: 1.7; }

.prose blockquote {
  border-left: 4px solid var(--color-accent);
  background: rgba(243, 239, 231, 0.55); /* parchment 55% */
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  border-radius: 0 0.5rem 0.5rem 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.125rem;
  color: var(--color-ink);
  font-style: normal;
}
.prose blockquote p { margin-bottom: 0.5rem; }
.prose blockquote p:last-child { margin-bottom: 0; }

.prose a {
  text-decoration: underline;
  text-decoration-color: rgba(236, 72, 153, 0.55); /* accent */
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 500;
}
.prose a:hover {
  text-decoration-color: var(--color-accent);
  text-decoration-thickness: 2px;
}

.prose strong { font-weight: 600; color: var(--color-ink); }
.prose em { font-style: italic; }

.prose img {
  border-radius: 0.75rem;
  margin: 1.75rem 0;
  box-shadow: 0 2px 4px 0 rgb(28 28 30 / 0.05),
              0 18px 40px -12px rgb(28 28 30 / 0.18);
}

/* Tables — readable on mobile by allowing horizontal scroll */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9375rem;
}
.prose thead {
  border-bottom: 2px solid var(--color-parchment);
}
.prose th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
  color: var(--color-ink);
  background: rgba(243, 239, 231, 0.6);
  border-bottom: 1px solid var(--color-parchment);
}
.prose td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--color-parchment);
  color: var(--color-ink);
}
.prose tbody tr:hover {
  background: rgba(243, 239, 231, 0.35);
}

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

/* ===== Line clamp utilities =========================================== */
.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 internal template) ============================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-parchment);
  list-style: none;
  padding-left: 0;
}
.pagination li { list-style: none; }
.pagination .page-item a,
.pagination .page-item .page-link,
.pagination a,
.pagination .active {
  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: 500;
  font-family: inherit;
  text-decoration: none;
}
.pagination a {
  color: var(--color-ink);
  background: transparent;
  border: 1px solid var(--color-parchment);
}
.pagination a:hover {
  background: var(--color-parchment);
  border-color: var(--color-parchment);
}
.pagination .active {
  color: #ffffff;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
}
.pagination .disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ===== Print styles =================================================== */
@media print {
  header, footer, nav, .no-print { display: none !important; }
  body { background: #ffffff !important; color: #000000 !important; }
  .prose { max-width: 100%; font-size: 11pt; }
  .prose a {
    color: #000;
    text-decoration: underline;
  }
  .prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }
}

/* ===== Misc tweaks ==================================================== */

/* Smooth backdrop-filter fallback for Safari < 17 */
@supports not (backdrop-filter: blur(8px)) {
  header.sticky { background-color: var(--color-paper) !important; }
}
