/* =================================================
   CATALOGUE — viewer slide + fade (sans 3D, sans dépendance)
   ================================================= */

/* === Conteneur stage === */
.catalogue-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 60vh;
  perspective: 2400px;
}
.catalogue-loading,
.catalogue-empty {
  margin: 60px auto;
  color: var(--ink-soft);
  text-align: center;
  font-size: 16px;
}

/* === Le flipbook === */
.flipbook {
  display: flex;
  justify-content: center;
  align-items: center;
  transform-style: preserve-3d;  /* propage la perspective de .catalogue-stage */
}

/* Le livre = 2 faces côte à côte (ou 1 sur mobile) */
.bk {
  position: relative;
  background: #f5f4ee;
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.22),
    0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  border-radius: 4px;
  cursor: pointer;
  transform-style: preserve-3d;
}
.bk.single { box-shadow: 0 14px 40px rgba(0, 0, 0, 0.2); }

/* === LE FLIPPER (page qui tourne en 3D) === */
.bk-flipper {
  position: absolute;
  top: 0;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.42, 0, 0.2, 1);
  z-index: 30;                /* au-dessus du pli central (::after, z-index 5) */
  will-change: transform;
  /* État initial EXPLICITE en CSS — sans ça, l'interpolation
     depuis "none" vers "rotateY(-180)" ne se déclenche pas toujours. */
  transform: rotateY(0deg);
}
.bk-flipper-fwd {
  left: 50%;
  transform-origin: left center;
}
.bk-flipper-bwd {
  left: 0;
  transform-origin: right center;
}
.bk-flipper.go { transform: rotateY(-180deg); }
.bk-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #fff;
  overflow: hidden;
}
.bk-face-back { transform: rotateY(180deg); }
/* Pli sur les faces du flipper aussi */
.bk-flipper-fwd .bk-face-front::after,
.bk-flipper-bwd .bk-face-front::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 24px;
  pointer-events: none;
  z-index: 6;
}
.bk-flipper-fwd .bk-face-front::after { left: 0;  background: linear-gradient(to right, rgba(0,0,0,0.16), transparent); }
.bk-flipper-bwd .bk-face-front::after { right: 0; background: linear-gradient(to left,  rgba(0,0,0,0.16), transparent); }
.bk-flipper-fwd .bk-face-back::after,
.bk-flipper-bwd .bk-face-back::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 24px;
  pointer-events: none;
  z-index: 6;
}
.bk-flipper-fwd .bk-face-back::after { right: 0; background: linear-gradient(to left,  rgba(0,0,0,0.16), transparent); }
.bk-flipper-bwd .bk-face-back::after { left: 0;  background: linear-gradient(to right, rgba(0,0,0,0.16), transparent); }

.bk-side {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #fff;
}
/* Pli central (ombre du papier au centre du livre) */
.bk-side.bk-l::after,
.bk-side.bk-r::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 24px;
  pointer-events: none;
  z-index: 5;
}
.bk-side.bk-l::after {
  right: 0;
  background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.16));
}
.bk-side.bk-r::after {
  left: 0;
  background: linear-gradient(to left, transparent, rgba(0, 0, 0, 0.16));
}
.bk-side.bk-only::after { display: none; }

/* === Pages === */
.bk-page,
.bk-blank,
.bk-cover,
.bk-back {
  position: absolute;
  inset: 0;
  z-index: 8;                /* AU-DESSUS du pli central (::after, z-index 5) */
}
.bk-blank { background: #fff; }

.bk-page img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bk-cap {
  position: absolute;
  bottom: 14px;
  left: 18px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.88);
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 600;
  pointer-events: none;
  color: rgba(0, 0, 0, 0.75);
}
.bk-num {
  position: absolute;
  bottom: 14px;
  right: 18px;
  font-size: 12px;
  font-style: italic;
  color: rgba(0, 0, 0, 0.5);
  background: rgba(255, 255, 255, 0.85);
  padding: 2px 10px;
  border-radius: 999px;
  pointer-events: none;
}

/* === Couverture === */
.bk-cover {
  /* Couleurs explicites en fallback pour ne JAMAIS apparaître blanc, peu importe le thème */
  background-color: #2d5f2e;
  background-image: linear-gradient(135deg, #2d5f2e, #7AC143);
  overflow: hidden;
}
.bk-cover-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.32;
  filter: blur(2px) saturate(1.2);
  z-index: 1;
}
.bk-cover-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;                /* au-dessus de l'image de fond */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 36px 30px;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}
.bk-cover-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.85;
  margin-bottom: 10px;
}
.bk-cover-overlay h2 {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: clamp(26px, 3.4vw, 42px);
  line-height: 1.05;
  margin-bottom: 14px;
  color: #fff;
}
.bk-cover-cta {
  font-size: 13px;
  font-style: italic;
  opacity: 0.9;
  cursor: pointer;
}

/* === Dos === */
.bk-back {
  background: var(--bg-soft, #f1f3ea);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px 24px;
  text-align: center;
  gap: 12px;
  color: var(--ink, #1a1a1a);
}
.bk-back-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}
.bk-back h3 {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: clamp(22px, 2.8vw, 32px);
  font-style: italic;
  color: var(--brand-deep);
}

/* === Contrôles === */
.catalogue-controls {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--card, #fff);
  border: 1px solid var(--line, #e3e8d8);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.catalogue-ctrl {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--bg-soft, #f1f3ea);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink, #1a1a1a);
  transition: all 0.18s ease;
}
.catalogue-ctrl:hover {
  background: var(--brand-deep, #2d5f2e);
  color: #fff;
  transform: translateY(-1px);
}
.catalogue-pageinfo {
  font-family: var(--font-display, 'Fraunces', serif);
  font-style: italic;
  font-size: 16px;
  color: var(--ink, #1a1a1a);
  min-width: 60px;
  text-align: center;
}

/* === Plein écran === */
.catalogue-stage:fullscreen {
  background: #0a0a0a;
  padding: 30px;
}
.catalogue-stage:fullscreen .bk { box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.catalogue-stage:fullscreen .catalogue-controls { background: rgba(255, 255, 255, 0.95); }

/* === Theme dark === */
[data-theme="dark"] .catalogue-controls {
  background: var(--card);
  border-color: var(--line);
}
[data-theme="dark"] .catalogue-ctrl {
  background: var(--bg-soft);
  color: var(--ink);
}

/* =====================================================
   VERSION HOME (intégrée à index.html, full viewport)
   ===================================================== */
.catalogue-home {
  height: 100vh;
  height: 100svh;
  min-height: 580px;
  display: flex;
  flex-direction: column;
  padding: 84px 0 18px;
  background: var(--bg-soft, #f1f3ea);
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .catalogue-home { background: var(--bg-soft, #131e16); }

.catalogue-home-head {
  text-align: center;
  flex-shrink: 0;
  margin-bottom: 10px;
  padding: 0 16px;
}
.catalogue-home-head h2 {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: clamp(26px, 3.4vw, 40px);
  line-height: 1.05;
  margin: 6px 0 4px;
  color: var(--ink);
}
.catalogue-home-head h2 em { font-style: italic; color: var(--brand-deep); }
.catalogue-home-head .lead {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 540px;
  margin: 0 auto;
}

.catalogue-home #cataStage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
  min-height: 0;
  overflow: visible;
}
.catalogue-home #flipbook { flex: 0 1 auto; margin: 0; }
.catalogue-home #cataControls {
  flex: 0 0 auto;
  margin-top: auto;
  margin-bottom: 4px;
}

@media (max-width: 760px) {
  .catalogue-home {
    padding: 70px 0 14px;
    min-height: 520px;
  }
  .catalogue-home-head { margin-bottom: 6px; }
  .catalogue-home-head h2 { font-size: clamp(22px, 6vw, 30px); }
  .catalogue-home-head .lead { font-size: 13px; }
}
