/* ============================================================
   citations-proverbes.fr — La Bibliotheque des Sagesses
   Design tokens + base styles
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Bodoni+Moda:ital,opsz,wght@0,6..96,600;0,6..96,700;1,6..96,600&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400;1,600&family=Outfit:wght@300;400;500;600&display=swap');

/* --- Design Tokens --- */
:root {
  /* Couleurs principales */
  --encre: #1A1210;
  --bordeaux: #7B2D3B;
  --or: #C4956A;
  --sauge: #5A7266;
  --parchemin: #F4EDE4;
  --ivoire: #EDE5D8;

  /* Derives opacite — encre */
  --encre-80: rgba(26, 18, 16, 0.8);
  --encre-65: rgba(26, 18, 16, 0.65);
  --encre-40: rgba(26, 18, 16, 0.4);
  --encre-20: rgba(26, 18, 16, 0.2);
  --encre-10: rgba(26, 18, 16, 0.1);
  --encre-06: rgba(26, 18, 16, 0.06);

  /* Derives opacite — parchemin */
  --parchemin-95: rgba(244, 237, 228, 0.95);
  --parchemin-75: rgba(244, 237, 228, 0.75);
  --parchemin-40: rgba(244, 237, 228, 0.4);

  /* Derives opacite — or */
  --or-15: rgba(196, 149, 106, 0.15);
  --or-30: rgba(196, 149, 106, 0.3);
  --or-50: rgba(196, 149, 106, 0.5);

  /* Derives opacite — bordeaux */
  --bordeaux-10: rgba(123, 45, 59, 0.1);
  --bordeaux-20: rgba(123, 45, 59, 0.2);

  /* Polices */
  --ff-display: 'Bodoni Moda', Georgia, serif;
  --ff-quote: 'Cormorant Garamond', Georgia, serif;
  --ff-body: 'Outfit', system-ui, sans-serif;

  /* Mesures */
  --measure-article: 720px;
  --measure-wide: 1280px;
  --measure-hero: 1440px;
  --gutter: clamp(1rem, 4vw, 2rem);

  /* Transitions */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 300ms;
  --dur: 500ms;
  --dur-slow: 700ms;

  /* Ombres */
  --shadow-sm: 0 1px 3px rgba(26, 18, 16, 0.08);
  --shadow-md: 0 4px 12px rgba(26, 18, 16, 0.1);
  --shadow-lg: 0 8px 30px rgba(26, 18, 16, 0.12);
  --shadow-lift: 0 12px 40px rgba(26, 18, 16, 0.16);

  /* Rayons */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--ff-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--encre);
  background-color: var(--parchemin);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--bordeaux);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

a:hover {
  color: var(--or);
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--ff-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--encre);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  position: relative;
  padding-bottom: 0.75rem;
}

h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--or);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-slow) var(--ease);
}

h2.visible::after {
  transform: scaleX(1);
}

h3 {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1.25rem;
}

/* --- Kicker --- */
.kicker {
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--or);
  display: block;
  margin-bottom: 0.5rem;
}

/* --- Lettrine --- */
.article-body > p:first-of-type::first-letter {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 3.5em;
  float: left;
  line-height: 0.8;
  margin-right: 0.1em;
  margin-top: 0.05em;
  color: var(--bordeaux);
}

/* --- Container --- */
.section {
  padding: 4rem 0;
}

.container {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.container--narrow {
  max-width: var(--measure-article);
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 50vh;
  display: flex;
  align-items: flex-end;
  padding: 4rem 0 3rem;
  overflow: hidden;
  background-color: var(--encre);
}

.hero--home {
  min-height: 80vh;
  align-items: center;
  text-align: center;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.4;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--encre) 0%, transparent 60%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
  color: var(--parchemin);
}

.hero--home .hero-content {
  text-align: center;
}

.hero h1 {
  color: var(--parchemin);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
  font-family: var(--ff-quote);
  font-style: italic;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: var(--or);
  margin-top: 0.75rem;
}

.hero-description {
  font-family: var(--ff-body);
  font-size: 1.05rem;
  color: var(--parchemin-75);
  max-width: 600px;
  margin: 1rem auto 0;
  line-height: 1.6;
}

/* --- Breadcrumb --- */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--parchemin-75);
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: var(--or-50);
  transition: color var(--dur-fast) var(--ease);
}

.breadcrumb a:hover {
  color: var(--or);
}

.breadcrumb span {
  margin: 0 0.4rem;
  opacity: 0.5;
}

/* --- Article Summary (chapeau) --- */
.article-summary {
  font-family: var(--ff-quote);
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.7;
  color: var(--encre-65);
  border-left: 3px solid var(--or);
  padding-left: 1.5rem;
  margin: 2rem 0;
}

/* --- Article Body --- */
.article-body {
  font-size: 1.05rem;
  line-height: 1.8;
  max-width: var(--measure-article);
}

.article-body h2 {
  margin-top: 3rem;
}

.article-body ul,
.article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.article-body li {
  margin-bottom: 0.5rem;
}

.article-body img {
  border-radius: var(--radius-md);
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
}

/* --- Citation Block (signature) --- */
.citation-block {
  position: relative;
  background: var(--ivoire);
  border-radius: var(--radius-md);
  padding: 2.5rem 2rem 2rem;
  margin: 1.5rem 0;
  transition: box-shadow var(--dur-fast) var(--ease);
}

.citation-block:hover {
  box-shadow: var(--shadow-md);
}

.citation-block::before {
  content: '\00AB';
  font-family: var(--ff-display);
  font-size: 5rem;
  line-height: 1;
  color: var(--or-15);
  position: absolute;
  top: 0.25rem;
  left: 1rem;
}

.citation-block::after {
  content: '\00BB';
  font-family: var(--ff-display);
  font-size: 5rem;
  line-height: 1;
  color: var(--or-15);
  position: absolute;
  bottom: 0.5rem;
  right: 1rem;
}

.citation-text {
  font-family: var(--ff-quote);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--encre);
  position: relative;
  z-index: 1;
}

.citation-author {
  font-family: var(--ff-body);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--bordeaux);
  margin-top: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.citation-origin {
  font-family: var(--ff-body);
  font-weight: 300;
  font-size: 0.8rem;
  color: var(--encre-40);
  margin-top: 0.25rem;
}

/* --- Cards --- */
.card {
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card-body {
  padding: 1.25rem;
}

.card-title {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--encre);
}

.card-desc {
  font-size: 0.9rem;
  color: var(--encre-65);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--encre-40);
  margin-top: 0.75rem;
}

/* --- Category Card (with count badge) --- */
.category-card {
  position: relative;
}

.category-card .card-count {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bordeaux);
  color: var(--parchemin);
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

/* --- Card Grid --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* --- Numbered Cards (author cards without image) --- */
.card--numbered {
  position: relative;
  counter-increment: card-count;
  background: linear-gradient(135deg, var(--ivoire) 0%, var(--parchemin) 50%, rgba(196, 149, 106, 0.08) 100%);
  border-left: 3px solid var(--or-30);
  overflow: hidden;
}

.card--numbered::before {
  content: counter(card-count, decimal-leading-zero);
  font-family: var(--ff-display);
  font-size: 5rem;
  font-weight: 700;
  color: var(--or-15);
  position: absolute;
  top: -0.25rem;
  right: 0.75rem;
  line-height: 1;
  z-index: 0;
}

.card--numbered::after {
  content: '\00AB';
  font-family: var(--ff-display);
  font-size: 8rem;
  color: var(--bordeaux-10);
  position: absolute;
  bottom: -2rem;
  left: -0.5rem;
  line-height: 1;
  z-index: 0;
}

.card--numbered .card-body {
  position: relative;
  z-index: 1;
}

.card--numbered .card-title {
  color: var(--bordeaux);
}

.card--numbered .card-meta {
  font-weight: 500;
  color: var(--or);
}

/* --- Pull Quote --- */
.pull-quote {
  border-left: 3px solid var(--or);
  padding: 1.5rem 0 1.5rem 2rem;
  margin: 2.5rem 0;
  font-family: var(--ff-quote);
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.5;
  color: var(--encre-80);
}

/* --- Table of Contents (TOC) --- */
.toc {
  background: var(--ivoire);
  border-radius: var(--radius-md);
  padding: 1.5rem 2rem;
  margin-bottom: 2.5rem;
}

.toc-title {
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--encre-40);
  margin-bottom: 0.75rem;
}

.toc-list {
  list-style: none;
  padding: 0;
}

.toc-list li {
  margin-bottom: 0.5rem;
}

.toc-list a {
  font-size: 0.95rem;
  color: var(--encre-65);
  transition: color var(--dur-fast) var(--ease), padding-left var(--dur-fast) var(--ease);
  display: block;
  padding-left: 0;
}

.toc-list a:hover {
  color: var(--bordeaux);
  padding-left: 0.5rem;
}

/* --- FAQ Accordion --- */
.faq-section {
  margin-top: 3rem;
}

.faq-item {
  border-bottom: 1px solid var(--encre-10);
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 1.25rem 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--ff-body);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--encre);
  text-align: left;
  line-height: 1.4;
}

.faq-question:hover {
  color: var(--bordeaux);
}

.faq-icon {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--or);
  transition: transform var(--dur-fast) var(--ease);
  flex-shrink: 0;
  margin-left: 1rem;
}

.faq-item.open .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--dur) var(--ease), padding var(--dur) var(--ease);
}

.faq-item.open .faq-answer {
  max-height: 500px;
  padding-bottom: 1.25rem;
}

.faq-answer p {
  font-size: 0.95rem;
  color: var(--encre-65);
  line-height: 1.7;
}

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent;
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.site-header.scrolled {
  background: var(--parchemin-95);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 1rem var(--gutter);
}

.logo {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--parchemin);
  transition: color var(--dur-fast) var(--ease);
}

.scrolled .logo {
  color: var(--encre);
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 1.75rem;
  align-items: center;
}

.nav-link {
  font-family: var(--ff-body);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--parchemin-75);
  transition: color var(--dur-fast) var(--ease);
}

.scrolled .nav-link {
  color: var(--encre-65);
}

.nav-link:hover {
  color: var(--or);
}

/* Hamburger */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--parchemin);
  margin: 5px 0;
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}

.scrolled .hamburger span {
  background: var(--encre);
}

/* --- Footer --- */
.site-footer {
  background: var(--encre);
  color: var(--parchemin-75);
  padding: 4rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.footer-brand {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--parchemin);
  margin-bottom: 0.75rem;
}

.footer-slogan {
  font-family: var(--ff-quote);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--or);
  margin-bottom: 1rem;
}

.footer-heading {
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--or);
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  padding: 0;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  font-size: 0.9rem;
  color: var(--parchemin-75);
  transition: color var(--dur-fast) var(--ease);
}

.footer-links a:hover {
  color: var(--or);
}

.footer-bottom {
  max-width: var(--measure-wide);
  margin: 3rem auto 0;
  padding: 2rem var(--gutter) 0;
  border-top: 1px solid rgba(244, 237, 228, 0.1);
  text-align: center;
  font-size: 0.8rem;
  color: var(--encre-40);
}

/* --- Section alternee (fond ivoire) --- */
.section--alt {
  background: var(--ivoire);
}

/* --- Section sombre (hero-style) --- */
.section--dark {
  background: var(--encre);
  color: var(--parchemin);
}

.section--dark h2 {
  color: var(--parchemin);
}

.section--dark h2::after {
  background: var(--or);
}

/* --- Boutons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ff-body);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}

.btn--primary {
  background: var(--bordeaux);
  color: var(--parchemin);
}

.btn--primary:hover {
  background: #8d3545;
  color: var(--parchemin);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--outline {
  background: transparent;
  color: var(--parchemin);
  border: 1px solid var(--or-50);
}

.btn--outline:hover {
  background: var(--or-15);
  color: var(--parchemin);
  border-color: var(--or);
}

/* --- Scroll indicator --- */
.scroll-indicator {
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--or-50);
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.scroll-indicator::after {
  content: '';
  width: 1px;
  height: 40px;
  background: var(--or-30);
  animation: scroll-line 2s ease-in-out infinite;
}

@keyframes scroll-line {
  0%, 100% { opacity: 0.3; transform: scaleY(0.5); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* --- Reveal animation --- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Search Bar --- */
.search-bar {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
}

.search-bar input {
  width: 100%;
  padding: 0.9rem 1.25rem 0.9rem 3rem;
  font-family: var(--ff-body);
  font-size: 1rem;
  border: 2px solid var(--encre-10);
  border-radius: var(--radius-lg);
  background: white;
  color: var(--encre);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--or-15);
}

.search-bar input::placeholder {
  color: var(--encre-40);
}

/* --- Reading meta --- */
.reading-meta {
  font-size: 0.85rem;
  color: var(--encre-40);
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

/* --- Related Grid --- */
.related-section {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--encre-10);
}

.related-section h2 {
  font-size: 1.3rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hamburger {
    display: block;
  }

  .nav-list {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--encre);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    z-index: 99;
  }

  .nav-open .nav-list {
    display: flex;
  }

  .nav-open .nav-link {
    color: var(--parchemin);
    font-size: 1.2rem;
  }

  .nav-open .hamburger {
    position: fixed;
    top: 1rem;
    right: var(--gutter);
    z-index: 101;
  }

  .nav-open .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .nav-open .hamburger span:nth-child(2) {
    opacity: 0;
  }

  .nav-open .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .hero--home {
    min-height: 70vh;
  }

  .toc {
    position: static;
  }

  .citation-block {
    padding: 2rem 1.25rem 1.5rem;
  }

  .citation-block::before {
    font-size: 3.5rem;
  }

  .citation-block::after {
    font-size: 3.5rem;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.75rem;
  }

  .hero--home {
    min-height: 60vh;
  }
}
