/* --- INTRO IMAGE GALLERY --- */
.intro-image-gallery {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 1200px; /* rendre la galerie plus large */
  margin: 0 auto;
  padding: 0.5rem 2rem; /* réduire l'espace au-dessus et au-dessous */
}
.intro-image-gallery .archive-gallery-item {
  width: clamp(300px, 28vw, 480px); /* images plus larges */
  height: auto;
  flex: 0 0 auto;
}

@media (max-width: 1024px) {
  .intro-image-gallery {
    gap: 18px;
    max-width: 95vw;
    padding: 0.25rem 1rem; /* réduire l'espace sur mobile */
  }
  .intro-image-gallery .archive-gallery-item {
    width: clamp(220px, 38vw, 340px); /* images plus larges sur mobile */
  }
}

/* --- GENERAL LAYOUT & SCROLL --- */
.archives-scroll {
  height: 100vh;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE & Edge */
}
.archives-scroll::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.archives-content {
  min-height: 100vh;
  background: var(--main-bg-color);
  /* Contenu occupe toute la largeur; le menu flottera par-dess us */
  padding: 5vh 0 0 0;
  font-size: 1.2em;
  font-weight: 400;
  opacity: 1;
  margin: 0;
  position: relative; /* nécessaire pour les images flottantes */
}

/* --- HERO SECTION --- */
.archive-hero {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 2560px;
  margin: 0 auto;
}
.archive-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18vh;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    var(--main-bg-color) 100%
  );
  z-index: 2;
  pointer-events: none;
}
.archive-hero video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: 1;
}
.archive-hero .archive-title {
  position: relative;
  z-index: 3;
  color: #fff;
  font-family: "Libre Baskerville", serif;
  font-size: 3vw;
  text-align: center;
}

/* --- NAVIGATION MENU (single canonical block) --- */
.archive-nav-container {
  position: fixed; /* Assure que le menu flotte */
  left: 2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 300px;
  z-index: 10000; /* Au-dessus du contenu */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  pointer-events: none; /* désactivé quand caché */
  font-family: libre baskerville, serif;
}
.archive-nav-container.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.archive-nav-container ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.archive-nav-container .nav-link {
  display: block;
  padding: 10px 15px;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}
.archive-nav-container .nav-link:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.05);
}
.archive-nav-container .nav-link.active {
  color: #e0ded8;
  border-left-color: #fff;
  font-weight: bold;
}

/* Guard: ensure fixed even if parents have transforms */
.archive-nav-container {
  position: fixed !important;
  left: 2rem !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 220px !important;
}
.archive-nav-placeholder {
  display: none;
}

/* --- NARRATIVE & INTRO --- */
.archives-narrative {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 2rem;
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.archives-intro {
  /* Container centered within parent; width grows symmetrically */
  width: 100%;
  max-width: 900px;
  box-sizing: border-box;
  margin: 0;
  color: #fff;
  text-align: center;
  font-family: "Libre Baskerville", sans-serif;
}
.archives-intro p {
  font-size: clamp(1.1rem, 2.2vw, 1.3rem);
  font-weight: 400;
  margin-top: 0;
  margin-bottom: 1rem; /* réduire l'espace entre paragraphes d'intro */
  /* Espace plus grand entre les paragraphes d'intro */
  line-height: 1.8;
}

/* Réduire spécifiquement l'espace entre le 2ème paragraphe d'intro et la galerie */
.archives-intro > p:last-of-type {
  margin-bottom: 0.2rem; /* moins d'espace avant la galerie */
}

.archives-intro > .intro-image-gallery {
  margin-top: 0; /* aucun espace supplémentaire au-dessus de la galerie */
  padding-top: 0; /* écrase le padding général si nécessaire */
  border-radius: 0 !important;
}

/* DEBUG: outline helper — n'ajoutez cette classe que temporairement via la console
   pour voir quelles boîtes occupent l'espace entre paragraphes.
   Usage dans la console: document.querySelector('.archives-intro').classList.add('debug-outline')
   Supprimer: document.querySelector('.archives-intro').classList.remove('debug-outline') */
.archives-intro.debug-outline * {
  outline: 2px dashed rgba(255, 120, 90, 0.85);
  background: rgba(255, 255, 255, 0.01);
}

/* Premier paragraphe percutant dans l'intro */

.archive-chapter {
  max-width: 75ch;
  margin: 0 auto 0 auto; /* réduit l'espace entre chapitres */
  padding: 0 2rem;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.archive-chapter h3 {
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
  color: #e0ded8;
  border-left: 3px solid #fff;
  padding-left: 1rem;
  font-family: "Libre Baskerville", serif;
}
.archive-chapter p {
  font-size: 1.1rem;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.8);
  white-space: pre-wrap;
  text-align: justify;
  text-indent: 2em;
  margin-bottom: 1em;
}

/* Indentation: applique un retrait de première ligne aux paragraphes
   de la zone narrative et des chapitres, sauf le paragraphe intro "percutant" */
.archives-narrative p,
.archive-chapter p {
  text-indent: 2em;
  margin-top: 0.8rem;
  margin-bottom: 1em;
  text-align: justify;
}

/* --- ARCHIVES GALLERY (GRID & OVERLAY) --- */
.archives-gallery-section {
  margin-top: 8rem;
  padding-top: 4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.gallery-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 4rem;
  color: #e0ded8;
  font-family: "Libre Baskerville", serif;
}
.archive-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 50px;
  justify-content: center;
}
.archive-gallery-item {
  width: clamp(200px, 20vw, 340px);
  margin: 12px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.archive-gallery-item img {
  width: 100%;
  display: block;
  transition: transform 0.2s;
}
.archive-gallery-item:hover {
  transform: scale(1.05);
}
.archive-gallery-item:hover img {
  transform: scale(1.05);
}

.archive-overlay {
  position: fixed;
  z-index: 2000;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.archive-overlay-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
}
.archive-overlay-content {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 95vw;
  width: 95vw;
  max-height: 90vh;
  position: relative;
  gap: 70px;
}
.archive-overlay-photo {
  flex: 0 1 auto;
}
.archive-overlay-photo img {
  max-width: 65vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6);
}
.archive-overlay-info {
  flex: 0 0 320px;
  color: #fff;
  padding: 40px 40px 40px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: clamp(1rem, 1.8vw, 1.3rem);
  text-shadow: 0 2px 8px #000a;
  min-width: 250px;
  max-width: 400px;
  word-break: break-word;
}
.archive-overlay-title {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  margin-bottom: 0.5em;
  font-family: "Libre Baskerville", serif;
  font-weight: bold;
}
.archive-overlay-close {
  position: absolute;
  top: 24px;
  right: 36px;
  color: #fff;
  font-size: 2.2em;
  cursor: pointer;
  z-index: 20;
}
.archive-overlay-arrow {
  display: none;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s, transform 0.3s;
}
.archive-overlay-arrow.left {
  left: 2vw;
}
.archive-overlay-arrow.right {
  right: 2vw;
}
.archive-overlay-arrow img {
  width: 32px;
  opacity: 0;
  animation-duration: 2s;
  animation-iteration-count: infinite;
}
.archive-overlay-arrow.left img {
  transform: rotate(-90deg);
  animation-name: scroll-side-left;
}
.archive-overlay-arrow.right img {
  transform: rotate(90deg);
  animation-name: scroll-side-right;
}
.archive-overlay[style*="display: block"] .archive-overlay-arrow,
.archive-overlay[style*="display: flex"] .archive-overlay-arrow {
  display: flex !important;
}

@keyframes scroll-side-right {
  0%,
  100% {
    opacity: 0;
    transform: rotate(90deg) translateX(0);
  }
  50% {
    opacity: 1;
    transform: rotate(90deg) translateX(10px);
  }
}
@keyframes scroll-side-left {
  0%,
  100% {
    opacity: 0;
    transform: rotate(-90deg) translateX(0);
  }
  50% {
    opacity: 1;
    transform: rotate(-90deg) translateX(-10px);
  }
}

/* --- FLOATING IMAGES (background) --- */
.floating-images-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
}
.floating-image {
  position: absolute;
  display: block;
  opacity: 0.1;
  filter: grayscale(80%) blur(1px);
  z-index: 1;
  transform: translateY(var(--translate-y, 0px));
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s ease,
    filter 0.4s ease;
}
.floating-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.floating-image:hover {
  opacity: 1;
  filter: grayscale(0%) blur(0);
  z-index: 3;
  transform: translateY(var(--translate-y, 0px)) scale(1.1);
  cursor: pointer;
}

#float-img-1 {
  top: 20vh;
  left: 5vw;
  width: 20vw;
  max-width: 250px;
}
#float-img-2 {
  top: 120vh;
  right: 8vw;
  width: 18vw;
  max-width: 220px;
}
#float-img-3 {
  top: 250vh;
  left: 10vw;
  width: 15vw;
  max-width: 180px;
}
#float-img-4 {
  top: 350vh;
  right: 5vw;
  width: 22vw;
  max-width: 280px;
}
#float-img-5 {
  top: 480vh;
  left: 8vw;
  width: 17vw;
  max-width: 200px;
}

/* Keep text above floating images */
.archives-narrative {
  position: relative;
  z-index: 2;
}
.tp-paragraph {
  margin: 2rem 0;
}
.tp-image img {
  display: block;
  margin: 2rem auto;
  max-width: 600px;
}
.tp-img-left-text-right {
  display: flex;
  gap: 2rem;
  align-items: center;
}
.tp-img-left-text-right img {
  max-width: 350px;
}
.tp-img-left-text-right .tp-text {
  flex: 1;
}
.tp-text-left-img-right {
  display: flex;
  gap: 2rem;
  align-items: center;
}
.tp-text-left-img-right .tp-text {
  flex: 1;
}
.tp-text-left-img-right img {
  max-width: 350px;
}
.tp-img-top-text-bottom img {
  display: block;
  margin: 0 auto 1rem auto;
  max-width: 500px;
}
.tp-img-top-text-bottom p {
  text-align: center;
}
