/* Couche UX contemporaine : conserve la charte du manuscrit tout en améliorant la lecture. */
:root {
  --ink: #262320;
  --muted: #6b625b;
  --paper: #f8f6f0;
  --paper-deep: #efe9dc;
  --accent: #ae4d18;
  --accent-dark: #7c3510;
  --line: #ded6c7;
  --reader-size: 1;
}

@media screen and (max-width: 736px) {
  .tiles article > a .content { max-height: 20em !important; opacity: 1 !important; }
  .accessibility-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    justify-content: center;
    padding: 0.6rem 1rem;
    background: rgba(248, 246, 240, 0.94);
    border-bottom: 1px solid var(--line);
  }
  .font-controls button { min-width: 2.7rem; min-height: 2.7rem; font-size: 0.9rem; }
}

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
}

.accessibility-bar {
  display: flex;
  justify-content: flex-end;
  max-width: 68em;
  margin: 0 auto;
  padding: 0.8rem 2.5rem 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.font-controls { display: inline-flex; align-items: center; gap: 0.35rem; }
.font-controls button {
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
.font-controls button:hover, .font-controls button:focus-visible { border-color: var(--accent); color: var(--accent); }

#header { padding: 1.25rem 0 0; }
#header .inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
#header .site-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.7rem;
  border: 0;
  color: var(--ink);
  letter-spacing: 0.03em;
  text-transform: none;
}
#header .site-brand strong { color: var(--accent); font-size: 0.82rem; letter-spacing: 0.1em; }
#header .site-brand span { font-size: 0.9rem; }
#header nav { position: static; }
#header nav ul { gap: 0.55rem; }
#header nav ul li a, #header nav ul li a[href="#menu"] {
  display: block;
  width: auto;
  height: auto;
  padding: 0.65rem 0.95rem;
  overflow: visible;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-indent: 0;
}
#header nav ul li a[href="#menu"]:before, #header nav ul li a[href="#menu"]:after { display: none; }
#header nav ul li a:hover, #header nav ul li a:focus-visible { border-color: var(--accent); color: var(--accent); }

.home-hero, .chapter-hero {
  margin: 3.25rem 0 3.5rem;
  padding: clamp(1.6rem, 4vw, 3.25rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: linear-gradient(135deg, #fffdf8 0%, var(--paper-deep) 100%);
}
.eyebrow, .chapter-index {
  margin: 0 0 0.9rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.home-hero h1, .chapter-hero h1 {
  max-width: 17ch;
  margin-bottom: 0.55rem;
  color: var(--accent) !important;
  font-size: clamp(2.15rem, 6vw, 4.4rem);
  letter-spacing: -0.055em;
  line-height: 1.04;
}
.home-hero h2, .chapter-hero .chapter-subtitle {
  max-width: 52rem;
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.55;
  text-transform: none;
}
.home-hero > p:not(.eyebrow), .chapter-summary {
  max-width: 60rem;
  margin: 1.6rem 0 0;
  color: var(--muted);
  font-size: calc(1.02rem * var(--reader-size));
  line-height: 1.8;
}
.journey-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 60rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.journey-callout p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.button-link, .chapter-pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.journey-callout .button-link { text-align: center; }
.button-link:hover, .button-link:focus-visible, .chapter-pagination a:hover, .chapter-pagination a:focus-visible { background: var(--accent-dark); color: #fff !important; }

.journey-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 0 0 1.75rem; }
.journey-heading h2 { margin: 0; color: var(--ink); font-size: 1.35rem; letter-spacing: 0; text-transform: none; }
.journey-heading p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.tiles { counter-reset: chapter; }
.tiles article { border-radius: 0.75rem; overflow: hidden; box-shadow: 0 1px 0 rgba(45, 35, 25, 0.1); }
.tiles article > a h2::before { counter-increment: chapter; content: counter(chapter, decimal-leading-zero) " / "; color: rgba(255,255,255,0.72); font-size: 0.72em; }
.tiles article > .image:before { background-color: #6a3f25 !important; opacity: 0.65; }
.tiles article > a { padding: 1.5rem; text-align: left; align-items: flex-start; }
.tiles article > a .content { text-align: left; }

.chapter-content { max-width: 49rem; margin: 0 auto; }
.chapter-content .chapter-hero { margin-top: 2.5rem; }
.chapter-content .image.main { float: none; display: block; width: fit-content; max-width: 100%; margin: 1.75rem auto 2.25rem; }
.chapter-body {
  color: #3c3732;
  font-size: calc(1.08rem * var(--reader-size));
  line-height: 1.92;
}
.chapter-body img { display: block; max-width: 100%; height: auto; margin: 2.25rem auto; border-radius: 0.5rem; }
.chapter-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin: 4rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.chapter-pagination a { text-align: center; }
.chapter-pagination a:first-child { background: transparent; color: var(--accent); }
.chapter-pagination a:first-child:hover, .chapter-pagination a:first-child:focus-visible { color: #fff; }

.site-footer {
  max-width: 68em;
  margin: 0 auto 3rem;
  padding: 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}
.site-footer p { margin: 0; }

.search-card {
  max-width: 49rem;
  margin: 2.5rem auto 4rem;
  padding: clamp(1.6rem, 4vw, 3.25rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: linear-gradient(135deg, #fffdf8 0%, var(--paper-deep) 100%);
}
.search-card h1 { margin-bottom: 0.55rem; color: var(--accent); font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -0.04em; }
.search-intro { color: var(--muted); }
.search-card table { width: 100% !important; margin: 2rem 0 0; border: 0; }
.search-card input[type="text"] { border: 1px solid var(--line); border-radius: 0.5rem; background: #fff; padding: 0.65rem 0.75rem; }
.search-card input[type="submit"] { min-height: 2.7rem; border-radius: 999px; background: var(--accent); color: #fff; }

@media screen and (max-width: 736px) {
  .accessibility-bar { padding: 0.7rem 1.25rem 0; }
  #header { padding-top: 0.8rem; }
  #header .inner { align-items: flex-start; }
  #header .site-brand span { display: none; }
  #header nav ul li a, #header nav ul li a[href="#menu"] { padding: 0.55rem 0.7rem; }
  .home-hero, .chapter-hero { margin: 2rem 0 2.5rem; border-radius: 0.75rem; }
  .journey-callout, .journey-heading { align-items: flex-start; flex-direction: column; }
  .chapter-body { font-size: calc(1rem * var(--reader-size)); line-height: 1.85; }
  .chapter-pagination { grid-template-columns: 1fr; }
  .site-footer { padding: 1.5rem 1.25rem; }
}
