/* ============================================================
   SECTION NOS TROUVAILLES  (mobile-first)
   Figma desktop : node 600:4446
   Figma mobile  : node 600:2498
============================================================ */

.link-decouvrir {
  display: block;
  font-family: 'Lexend Deca', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  color: #9f9a7c;
  text-decoration: underline;
  text-decoration-skip-ink: none;
}

.link-decouvrir:hover{
  color: #9f9a7c;
  text-decoration: underline;
  text-decoration-skip-ink: none;
}
.section-trouvailles {
  background-color: #efece9;
  padding: 40px 0;
}

.section-trouvailles .container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.section-trouvailles .section-header-row {
  padding: 0 20px 0 30px;
}

/* Hide arrows on mobile – swipe carousel only */
.section-trouvailles .nav-arrows {
  display: none;
}

.nav-arrows { display: flex; gap: 10px; align-items: center; }

.arrow-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #9f9a7c;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.arrow-btn img { width: 20px; height: 20px; }

.section-trouvailles .arrow-btn:hover { opacity: 0.65; }
.section-trouvailles .arrow-btn:active { transform: scale(0.92); }
.section-trouvailles .arrow-btn.is-disabled {
  opacity: 0.25;
  pointer-events: none;
  cursor: default;
}
.section-trouvailles .arrow-btn:focus-visible {
  outline: 2px solid #9f9a7c;
  outline-offset: 4px;
}

/* Mobile carousel scroll */
.section-trouvailles .cards-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 30px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.section-trouvailles .cards-scroll-wrap::-webkit-scrollbar {
  display: none;
}

/* Padding on the grid (not the wrap) so the first card aligns with the
   30px-indented title regardless of scrollLeft initial value. */
.section-trouvailles .cards-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  width: max-content;
  padding-left: 30px;
  padding-right: 20px;
}

.section-trouvailles .cards-grid > * {
  width: 320px;
  flex-shrink: 0;
  scroll-snap-align: start;
}

.trouvaille-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  color: #0f1b24;
}

.trouvaille-card__image {
  width: 320px;
  height: 189px;
  overflow: hidden;
}
.trouvaille-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.trouvaille-card__body { display: flex; flex-direction: column; gap: 5px; }

/* ============================================================
   TROUVAILLES  – Desktop  (Figma 600:4446)
   Layout 50% | 100% | 50% sur toute la largeur de l'écran.
   Largeur de carte = (100vw - 2 × gap) / 2 → les 3 cartes débordent
   le conteneur de W/2 de chaque côté, qui sont masqués par
   overflow:hidden ⇒ on voit 50% + 100% + 50%.
============================================================ */
@media (min-width: 769px) {
  .section-trouvailles {
    overflow: hidden;
    /* Padding on the section (mirrors .header) so that the inner container
       (max-width 1366 / margin auto) lines its left edge with .header__nav's
       at any viewport ≥ 1366. */
    padding: 40px 100px;
  }

  .section-trouvailles .container {
    gap: 30px;
    padding: 0;
  }

  .section-trouvailles .section-header-row {
    padding: 0;
  }

  /* Show arrows on desktop */
  .section-trouvailles .nav-arrows {
    display: flex;
  }

  /* ≥ 3 cards : full-bleed scrollable carousel.
     Initial scrollLeft (set via JS) puts card 2 at viewport centre
     → 50% / 100% / 50% layout at rest. Mandatory snap aligned on the
     CENTER of every middle card (excluding first & last) keeps the
     50/100/50 framing on every settled scroll position, both when
     driven by JS arrows and by user wheel/trackpad. */
  .section-trouvailles .cards-scroll-wrap {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 0;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    scroll-padding: 0;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .section-trouvailles .cards-scroll-wrap::-webkit-scrollbar { display: none; }

  .section-trouvailles .cards-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 40px;
    width: max-content;
    padding: 0;
  }

  .section-trouvailles .cards-grid > * {
    /* (100vw − 2 × gap) / 2 → 0.5 × W + W + 0.5 × W + 2 × gap = 100vw */
    width: calc((100vw - 80px) / 2);
    flex-shrink: 0;
    scroll-snap-align: none;
  }

  /* Snap only on cards 2 … N-1 → keeps card 1 (50%) | card 2 (100%) | card 3 (50%) framing */
  .section-trouvailles .cards-grid > *:not(:first-child):not(:last-child) {
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  .section-trouvailles .trouvaille-card {
    gap: 20px;
  }

  .section-trouvailles .trouvaille-card__image {
    width: 100%;
    /* Garde l'aspect ratio Figma 583:344 quelle que soit la largeur */
    aspect-ratio: 583 / 344;
    height: auto;
  }

  /* ----------------------------------------------------------
     < 3 cartes : pas de carousel pleine largeur. Cartes fixées à
     la taille Figma desktop (583×344) ; la 1re est alignée sur
     le titre. Si la 2e carte déborde du container (viewports
     étroits), un scroll horizontal prend le relais.
  ---------------------------------------------------------- */
  .section-trouvailles:not(:has(.cards-grid > :nth-child(3))) .cards-scroll-wrap {
    width: auto;
    margin-left: 0;
    margin-right: 0;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .section-trouvailles:not(:has(.cards-grid > :nth-child(3))) .cards-scroll-wrap::-webkit-scrollbar {
    display: none;
  }

  .section-trouvailles:not(:has(.cards-grid > :nth-child(3))) .cards-grid {
    width: max-content;
    padding: 0;
    /* Override the ≥ 3 negative margin so card 1 starts at the container's
       left edge (= same X as the title). */
    margin-left: 0;
    margin-right: 0;
  }

  .section-trouvailles:not(:has(.cards-grid > :nth-child(3))) .cards-grid > * {
    /* Figma desktop fixed size */
    width: 583px;
    flex-shrink: 0;
    flex-grow: 0;
    scroll-snap-align: start;
  }
}
