/* ── Variables ───────────────────────────────────────────── */
:root {
  --cream:   #f5f0e8;
  --paper:   #ede8dc;
  --ink:     #1a1712;
  --ink-mid: #3d3830;
  --ink-low: #7a7267;
  --red:     #9b1c1c;
  --rule:    #c8bfaa;
  --serif:   'IBM Plex Serif', Georgia, serif;
}

@font-face {
  font-family: 'Retail';
  src: url('RetailVariable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; scroll-behavior: smooth; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.75;
}

/* ── Barre de navigation ─────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ink);
  border-bottom: 2px solid var(--red);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.2rem;
}

.site-nav-home {
  font-family: 'Retail', sans-serif;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream);
  text-decoration: none;
  transition: color 0.2s;
}
.site-nav-home:hover { color: var(--red); }

.site-nav-chapter {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--ink-low);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

/* ── En-tête de chapitre ─────────────────────────────────── */
.chapter-header {
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
  padding: 3rem 2rem 2rem;
  position: relative;
  overflow: hidden;
}

.chapter-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 47px,
    var(--rule) 47px,
    var(--rule) 48px
  );
  opacity: 0.25;
  pointer-events: none;
}

.chapter-header-inner {
  max-width: 860px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.chapter-part {
  font-family: 'Retail', sans-serif;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.75rem;
}

.chapter-num {
  font-family: 'Retail', sans-serif;
  font-weight: 300;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-low);
  margin-bottom: 0.4rem;
}

.chapter-title {
  font-family: 'Retail', sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 1.5rem;
}

.chapter-resume {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 0.95rem;
  color: var(--ink-mid);
  border-left: 2px solid var(--red);
  padding-left: 1rem;
  line-height: 1.6;
  max-width: 600px;
}

/* ── Corps du texte ──────────────────────────────────────── */
.chapter-body {
  max-width: 680px;
  margin: 0 auto;
  padding: 3.5rem 2rem 5rem;
}

.chapter-body p {
  margin-bottom: 1.4em;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--ink-mid);
  hyphens: auto;
}

.chapter-body p i,
.chapter-body p em {
  font-style: italic;
  color: var(--ink);
}

.chapter-body h2 {
  font-family: 'Retail', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 3rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.chapter-body h3 {
  font-family: 'Retail', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  margin: 2.5rem 0 0.75rem;
}

.chapter-body blockquote {
  border-left: 2px solid var(--red);
  padding-left: 1.25rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.7;
}

.chapter-body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 3rem 0;
}

.ponthiere {
  background: var(--paper);
  border-left: 2px solid var(--rule);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  font-size: 0.88rem;
  color: var(--ink-low);
  line-height: 1.65;
}

.ponthiere::before {
  content: 'Ponthière, 1935 —';
  display: block;
  font-family: 'Retail', sans-serif;
  font-style: normal;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rule);
  margin-bottom: 0.6rem;
}

/* ── Navigation bas de page ──────────────────────────────── */
.chapter-nav {
  border-top: 3px solid var(--ink);
  background: var(--paper);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 100%;
}

.chapter-nav-back {
  font-family: 'Retail', sans-serif;
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-low);
  text-decoration: none;
  transition: color 0.2s;
}
.chapter-nav-back:hover { color: var(--ink); }

.chapter-nav-next {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--ink);
  color: var(--cream);
  font-family: 'Retail', sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  transition: background 0.2s;
}
.chapter-nav-next:hover { background: var(--red); }
.chapter-nav-next::after { content: '→'; font-size: 0.9rem; }

/* ── Progress bar ────────────────────────────────────────── */
.progress-bar {
  position: fixed;
  top: 3.2rem;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--red);
  z-index: 99;
  transition: width 0.1s linear;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .chapter-title { font-size: 2rem; }
  .chapter-body { padding: 2rem 1.25rem 4rem; }
  .site-nav-chapter { display: none; }
}

/* ── Lightbox illustration ───────────────────────────────── */
.chapter-illus img {
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.chapter-illus img:hover { opacity: 0.92; }

.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(26, 23, 18, 0.92);
  cursor: zoom-out;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.lightbox-overlay.is-open {
  display: flex;
}
.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 0 80px rgba(0,0,0,0.6);
  cursor: zoom-out;
}
.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  color: #f5f0e8;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
  font-family: 'Retail', sans-serif;
  font-weight: 300;
  z-index: 1000;
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-hint {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: #7a7267;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: 'Retail', sans-serif;
  pointer-events: none;
}

/* ── Logo cabinet ────────────────────────────────────────── */
.site-footer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}
.site-footer-logo img {
  height: 22px;
  width: auto;
  opacity: 0.55;
  filter: var(--logo-filter, none);
  transition: opacity 0.2s;
}
.site-footer-logo img:hover { opacity: 0.85; }
.site-footer-logo-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-low);
  font-family: 'Retail', sans-serif;
}

/* ── Mode sombre ─────────────────────────────────────────── */
.dark-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--rule);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  z-index: 90;
  transition: background 0.2s, border-color 0.2s;
  box-shadow: 0 2px 8px rgba(26,23,18,0.15);
}
.dark-toggle:hover { border-color: var(--ink-low); }

/* Variables mode sombre */
:root[data-theme='dark'] {
  --cream:   #1a1712;
  --paper:   #211f1a;
  --ink:     #ede8dc;
  --ink-mid: #c8bfaa;
  --ink-low: #7a7267;
  --red:     #c0392b;
  --rule:    #3d3830;
  --logo-filter: invert(1) brightness(0.7);
}
:root[data-theme='dark'] .site-header {
  border-bottom-color: var(--rule);
}
:root[data-theme='dark'] .chapter-illus img {
  box-shadow: 0 6px 32px rgba(0,0,0,0.5);
}
:root[data-theme='dark'] .dark-toggle {
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
