/* -----------------------------BOUTONS TRI---------------- */
#buttonCategoryOne {
  display: flex;
  justify-content: center;
  gap: 4rem;
  margin-bottom: 2rem;
  font-family: sans-serif;
  font-size: 19px;
  margin-top: 2rem;
}

#buttonCategoryOne .buttonCategory a {
  text-decoration: none;
  color: #8b4f4b;
  position: relative;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

#buttonCategoryOne .buttonCategory a.active {
  text-decoration: underline 2px #8b4f4b;
  text-underline-offset: 8px;
}

#buttonCategoryOne .buttonCategory a:hover {
  color: #fd7361;
}

#buttonCategoryTwo {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 4rem;
}

#buttonCategoryTwo .buttonCategory {
  padding: 8px 16px;
  border-radius: 16px;
  background-color: #f77a67;
  color: white;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  font-family: inherit;
}

#buttonCategoryTwo .buttonCategory:hover {
  background-color: #9b5c50;
  transform: translateY(-2px);
}

#buttonCategoryTwo .buttonCategory.selected {
  background-color: #9b5c50;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* ---------------------------GALLERY---------------------------- */
.gallery-container {
  max-width: 1200px;
  margin: 0 auto;
  margin-bottom: 100px;
}

.gallery {
  column-count: 3;
  column-gap: 15px;
  column-fill: balance;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 15px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  cursor: pointer;
  border-radius: 7px;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.image-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  padding: 80px 15px 15px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.gallery-item:hover .image-overlay {
  transform: translateY(0);
}

.image-title {
  font-weight: bold;
}
.image-author {
  font-weight: bold;
  margin-bottom: 5px;
  font-size: 0.9em;
}
.image-description {
  font-size: 0.9em;
  opacity: 0.9;
}

.loading {
  text-align: center;
  padding: 50px;
  font-size: 1.2em;
  color: #666;
}

.error {
  text-align: center;
  padding: 50px;
  font-size: 1.2em;
  color: #e74c3c;
}

.no-results {
  text-align: center;
  padding: 50px;
  font-size: 1.2em;
  color: #666;
  display: contents;
}

/* Article Page Styles */
.article-page {
  display: none;
  max-width: 800px;
  margin: 0 auto;
  background: white;
  min-height: 100vh;
  padding: 40px;
  scroll-margin-top: 0;
}

.article-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  padding: 8px 18px;
  border-radius: 50px;
  transition: background-color 0.3s ease;
  font-size: 20px;
}

.back-btn:hover {
  background-color: #f0f0f0;
}

.article-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
  margin-bottom: 100px;
}

.article-image {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  cursor: zoom-in;
  transition: transform 0.3s ease;
  transform: translateZ(0); /* Force l'accélération GPU */
  -webkit-transform: translateZ(0);
}

.article-text {
  padding-left: 20px;
}

.article-title {
  font-size: 2.5em;
  color: #d4721a;
  margin-bottom: 20px;
  font-weight: normal;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.article-description {
  /* font-size: 1.1em;
  color: #555;
  margin-bottom: 25px;
  text-align: justify;
  font-weight: 300; */
  font-size: 16px;
  color: #171717;
  margin-bottom: 25px;
  text-align: justify;
  font-weight: 300;
  text-align: left;
}

.article-meta {
  font-size: 0.95em;
  color: #888;
  margin-bottom: 30px;
  line-height: 1.8;
}

.read-more-btn {
  background-color: #d4721a;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 25px;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition:
    background-color 0.3s ease,
    transform 0.2s ease;
}

.read-more-btn:hover {
  background-color: #b8611a;
  transform: translateY(-2px);
}

/* Responsive design */
@media (max-width: 768px) {
  .gallery {
    column-count: 2;
    column-gap: 10px;
  }

  .gallery-item {
    margin-bottom: 10px;
  }

  .article-content {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .article-text {
    padding-left: 0;
  }

  .article-page {
    padding: 20px;
  }

  .article-title {
    font-size: 2em;
  }

  #buttonCategoryOne {
    gap: 2rem;
    font-size: 16px;
  }

  #buttonCategoryTwo {
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .gallery {
    column-count: 1;
  }

  .article-title {
    font-size: 1.8em;
  }

  #buttonCategoryOne {
    gap: 1rem;
    font-size: 14px;
  }
}

/* ---------------------------RESPONSIVE---------------------------- */

/* Large Tablets and Small Desktops */
@media screen and (max-width: 1024px) {
  .gallery {
    column-count: 3;
  }

  .imageIntro {
    height: 300px;
  }

  #rightGridIntro {
    margin: 20px;
    padding: 15px;
  }
}

/* Tablets */
@media screen and (max-width: 768px) {
  .gallery {
    column-count: 2;
    column-gap: 10px;
  }

  .gallery-item {
    margin-bottom: 10px;
  }

  .grid-50 {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .imageIntro {
    height: 250px;
    order: 1;
  }

  #rightGridIntro {
    order: 2;
    margin: 20px;
    padding: 15px;
    text-align: center;
  }

  #texteIntro {
    margin-left: 0;
    padding-left: 0;
  }

  #texteIntro::before {
    display: none;
  }

  .article-content {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .article-text {
    padding-left: 0;
  }

  .article-page {
    padding: 15px;
  }

  #logo {
    margin: 15px;
  }

  .nav {
    width: 200px;
  }

  #buttonCategoryOne {
    gap: 1.5rem;
    margin-bottom: 1.5rem;
  }

  #buttonCategoryTwo {
    gap: 0.5rem;
    margin-bottom: 2rem;
  }
}

/* Mobile Landscape */
@media screen and (max-width: 640px) {
  #buttonCategoryOne {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  #buttonCategoryOne .buttonCategory {
    width: 100%;
    text-align: center;
    max-width: 200px;
  }

  #buttonCategoryTwo {
    justify-content: center;
    gap: 0.5rem;
  }

  #buttonCategoryTwo .buttonCategory {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* Mobile Portrait */
@media screen and (max-width: 480px) {
  .gallery {
    column-count: 1;
    column-gap: 0;
  }

  .gallery-container {
    padding: 0 10px;
  }

  .gallery-item {
    margin-bottom: 20px;
  }

  #logo {
    margin: 10px;
  }

  .menu-btn {
    top: 10px;
    right: 10px;
    width: 25px;
    height: 20px;
    background: #ffffff8c;
    padding: 10px;
    border-radius: 10px;
  }

  .nav {
    width: 100%;
  }

  .imageIntro {
    height: 200px;
  }

  #rightGridIntro {
    margin: 15px;
    padding: 10px;
  }

  .article-page {
    padding: 30px;
  }

  .article-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
  }

  footer {
    padding: 20px 15px;
  }

  footer img {
    max-width: 250px;
  }

  #buttonCategoryOne {
    padding: 0 10px;
  }

  #buttonCategoryTwo {
    padding: 0 10px;
  }
}

/* Very Small Mobile Devices */
@media screen and (max-width: 360px) {
  /* .gallery-container {
    padding: 0 5px;
  } */

  #rightGridIntro {
    margin: 10px;
    padding: 5px;
  }

  .article-page {
    padding: 5px;
  }

  footer {
    padding: 15px 10px;
  }

  #buttonCategoryOne,
  #buttonCategoryTwo {
    padding: 0 5px;
  }
}

/* Landscape Orientation Fix for Mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .imageIntro {
    height: 150px;
  }

  #rightGridIntro {
    margin: 10px;
    padding: 10px;
  }

  #titreIntro {
    margin-bottom: 10px;
  }

  #sousTitreIntro {
    margin: 10px 15px 10px;
  }
}

/* High DPI/Retina Display Adjustments */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .gallery-item {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .gallery-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }
}

/* Print Styles */
@media print {
  .menu-btn,
  .nav,
  #buttonCategoryOne,
  #buttonCategoryTwo,
  .back-btn {
    display: none;
  }

  .gallery {
    column-count: 2;
    column-gap: 20px;
  }

  .gallery-item {
    break-inside: avoid;
    margin-bottom: 20px;
  }

  .image-overlay {
    position: static;
    background: white;
    color: black;
    padding: 10px 0;
    transform: none;
  }
}

/* ZOOM */
#fullscreen-viewer {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  overflow: hidden;
  touch-action: none;
  /* let pointer events control gestures */
}

#fullscreen-viewer[aria-hidden="false"] {
  display: flex;
}

#fullscreen-img {
  max-width: 92%;
  max-height: 92%;
  transform-origin: center center;
  transition: transform 120ms ease-out;
  user-select: none;
  -webkit-user-drag: none;
  cursor: grab;
  will-change: transform;
}

#fullscreen-img.dragging {
  cursor: grabbing;
  transition: none;
}

/* Bottom controls container */
#fullscreen-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 10010;
  background: rgba(0, 0, 0, 0.3);
  padding: 12px 16px;
  border-radius: 30px;
  backdrop-filter: blur(10px);
}

#fullscreen-controls button {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#fullscreen-controls button:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#fullscreen-controls button:active {
  transform: scale(0.95);
}

/* Hide the original close button from controls */
#fullscreen-controls #close-fullscreen {
  display: none;
}

/* Create a new close button at top right using ::after pseudo-element */
#fullscreen-viewer::after {
  content: "✕";
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10011;
  transition:
    background-color 0.2s ease,
    transform 0.1s ease;
  font-weight: bold;
  line-height: 1;
  pointer-events: auto;
}

#fullscreen-viewer:hover::after {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.05);
}

/* Zoom In Icon */
#zoom-in::before {
  content: "🔍";
  position: relative;
}

.article-image:hover {
  cursor: zoom-in;
  transform: translateY(-5px) translateZ(0); /* Gardez translateZ ici aussi */
  -webkit-transform: translateY(-5px) translateZ(0);
}

/* #zoom-in::after {
          content: "+";
          position: absolute;
          font-size: 12px;
          font-weight: bold;
          top: 6px;
          right: 6px;
          background: white;
          border-radius: 50%;
          width: 14px;
          height: 14px;
          display: flex;
          align-items: center;
          justify-content: center;
          line-height: 1;
      } */

/* Zoom Out Icon */
#zoom-out::before {
  content: "🔍";
  position: relative;
}

/* #zoom-out::after {
          content: "−";
          position: absolute;
          font-size: 14px;
          font-weight: bold;
          top: 6px;
          right: 6px;
          background: white;
          border-radius: 50%;
          width: 14px;
          height: 14px;
          display: flex;
          align-items: center;
          justify-content: center;
          line-height: 1;
      } */

/* Reset Icon */

#zoom-reset::before {
  content: "⟲";
  font-size: 20px;
  font-weight: bold;
}

/* Alternative reset icon using Unicode */
/* #zoom-reset::before {
    content: "↻";
    font-size: 22px;
    font-weight: bold;
} */

/* Responsive adjustments */
@media (max-width: 768px) {
  #close-fullscreen {
    top: 15px !important;
    right: 15px !important;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  #fullscreen-controls {
    bottom: 15px;
    gap: 10px;
    padding: 10px 14px;
  }

  #fullscreen-controls button:not(#close-fullscreen) {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  #zoom-in::after,
  #zoom-out::after {
    width: 12px;
    height: 12px;
    font-size: 10px;
    top: 5px;
    right: 5px;
  }
}
/* Timeline Range Slider */
#timeline-slider-container {
  padding: 40px 0px;
  background: #f8f9fa;
  border-radius: 8px;
  margin: 20px 0;
  width: 100%;
}

.timeline-wrapper {
  max-width: 800px; /* Plus large */
  margin: 0 auto;
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  font-size: 16px; /* Plus grand */
  color: #666;
  font-weight: 600; /* Plus gras */
}

.timeline-track {
  position: relative;
  height: 4px;
  background: #ddd;
  border-radius: 5px;
  margin: 50px 0; /* Plus d'espace */
  cursor: pointer;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1); /* Légère ombre interne */
  width: 800px;
  max-width: 70%;
  margin: auto;
}

.timeline-range {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, #fb7767, #ca5b4d);
  border-radius: 5px;
  pointer-events: none;
  box-shadow: 0 2px 4px rgba(251, 119, 103, 0.3); /* Ombre pour le relief */
}

.timeline-handle {
  position: absolute;
  width: 20px; /* Plus gros - était 10px */
  height: 20px;
  background: white;
  border: 4px solid #fb7767; /* Bordure plus épaisse */
  border-radius: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); /* Ombre pour le relief */
}

.timeline-handle:hover {
  transform: translate(-50%, -50%) scale(1.3); /* Effet hover plus prononcé */
  border-color: #ca5b4d;
  box-shadow: 0 3px 10px rgba(251, 119, 103, 0.4);
}

.timeline-handle:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 2px 8px rgba(251, 119, 103, 0.5);
}

.timeline-tooltip {
  position: absolute;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  background: #8b4f4b;
  color: white;
  padding: 6px 12px; /* Plus de padding */
  border-radius: 5px;
  font-size: 13px; /* Légèrement plus grand */
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); /* Ombre */
}

.timeline-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent; /* Flèche plus grande */
  border-top-color: #8b4f4b;
}

.timeline-values {
  text-align: center;
  margin-top: 25px;
  font-size: 18px;
  color: #333;
}

.timeline-value-display strong {
  color: #fb7767;
  font-size: 20px; /* Plus grand */
  font-weight: 700; /* Plus gras */
}
/* ===============================
   Loading Spinner Styles
   =============================== */

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  width: 100%;
  min-height: 300px;

  grid-column: 1 / -1 !important;
  column-span: all !important;
}

.spinner-circle {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top-color: #333;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

.spinner-text {
  margin-top: 20px;
  font-size: 16px;
  color: #666;
  font-weight: 500;
}

@keyframes spinner-rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ===============================
   Fullscreen Viewer Loading
   =============================== */

.fullscreen-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.fullscreen-loading-overlay .spinner-circle {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
}

.fullscreen-loading-overlay .spinner-text {
  color: #fff;
}

#fullscreen-img {
  transition: opacity 0.3s ease;
}

/* ===============================
   Gallery Item Loading State
   =============================== */

.gallery-item {
  position: relative;
  overflow: hidden;
}

.gallery-item.loading::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(240, 240, 240, 0) 0%,
    rgba(240, 240, 240, 0.5) 50%,
    rgba(240, 240, 240, 0) 100%
  );
  animation: shimmer 1.5s infinite;
  z-index: 1;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* ===============================
   No Results / Error States
   =============================== */

.no-results,
.error {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-size: 18px;
  width: 100%;
}

.error {
  color: #d32f2f;
}

/* ===============================
   Responsive Adjustments
   =============================== */

@media (max-width: 768px) {
  .spinner-circle {
    width: 40px;
    height: 40px;
    border-width: 3px;
  }

  .spinner-text {
    font-size: 14px;
  }

  .loading-spinner {
    min-height: 200px;
    padding: 40px 20px;
  }
}
.fullscreen-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none; /* Caché par défaut */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.fullscreen-loading-overlay .spinner-circle {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

.fullscreen-loading-overlay .spinner-text {
  margin-top: 20px;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
}

@keyframes spinner-rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

#fullscreen-img {
  transition: opacity 0.3s ease;
}
