:root {
  --bsj-main-color: #134b9a;
  --bsj-hover-color: #1659b7;
  --bsj-gall_font-size: 26px;
  --bsj-gall-font-spacing: -0.2;
}

.bsj-hero-swiper img{ 
  width: 100%;
  height: 100%;
  object-fit:cover;
  display:block;
}

/* Disable flickty */
body.single-st_rental .carousel.flickity-enabled.is-draggable {
  display: none;
}

/* Gallery */
body.single-st_activity .tour-featured-image.featured-image-background,
body.single-st_rental .st-flickity.st-gallery {
  width: 100%;
  padding: 0 12% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  max-height: 720px;
  overflow: hidden !important;
  margin-bottom: 0 !important;
  margin-top: 40px;
  position: relative !important;
  z-index: 1;
  border-radius: 18px;
}

@media (max-width: 991px) {

  /* Main view */
  body.single-st_activity .tour-featured-image.featured-image-background,
  body.single-st_rental .st-flickity.st-gallery {
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0px !important;
    height: clamp(380px, 46vh, 640px) !important;
  }

}

/* Swiper prend toute la zone */
.bsj-hero-host,
.bsj-hero-swiper,
.bsj-hero-swiper .swiper-wrapper,
.bsj-hero-swiper .swiper-slide{
  height: 100%;
}

.bsj-hero-swiper img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==============================
*     NAV BUTTONS (prev/next)
================================= */

.bsj-hero-prev,
.bsj-hero-next{
  width: 36px !important;
  height: 36px !important;
  border-radius: 999px !important;

  background: rgba(255,255,255,.72) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  border: 1px solid rgba(255,255,255,.55) !important;
  box-shadow: 0 10px 24px rgba(0,0,0,.18) !important;

  transition: transform .16s ease, background .16s ease, box-shadow .16s ease, opacity .16s ease;
  opacity: .92 !important;
}

.bsj-hero-prev{ left: 20px !important; }
.bsj-hero-next{ right: 20px !important; }

.bsj-hero-prev::after,
.bsj-hero-next::after{
  font-size: 12px !important;
  font-weight: 900;
  color: rgba(15,15,15,.88) !important;
}

@media (hover:hover){
  .bsj-hero-prev:hover,
  .bsj-hero-next:hover{
    transform: translateY(-1px) scale(1.03);
    background: rgba(255,255,255,.86) !important;
    box-shadow: 0 14px 30px rgba(0,0,0,.22) !important;
    opacity: 1 !important;
  }
}

.bsj-hero-prev:active,
.bsj-hero-next:active{
  transform: scale(.98);
}

@media (max-width: 575px){
  .bsj-hero-prev,
  .bsj-hero-next{
    width: 28px !important;
    height: 28px !important;
  }
}

.bsj-hero-prev.swiper-button-disabled,
.bsj-hero-next.swiper-button-disabled{
  opacity: .35 !important;
  pointer-events: none;
}

/* ==============================
   HERO MOSAIC
   Desktop only
============================== */
@media (min-width: 991px) {

  .bsj-hero-mosaic {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 0 !important;
  }

  .bsj-hero-mosaic .bsj-hero-swiper {
    position: relative;
    padding: 10px;
    box-sizing: border-box;
    border-radius: 18px;
  }

  .bsj-hero-mosaic .bsj-hero-allphotos {
    position:absolute;
    bottom: 5%;
    right: 2.5%;
    z-index: 80;

    display:flex;
    align-items:center;
    gap: 8px;

    padding: 12px 10px;
    border-radius: 14px !important;

    background: rgba(223, 244, 255, 0.8);
    border: 1px solid rgba(15,23,42,.12);
    box-shadow: 0 8px 18px rgba(15,23,42,.14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    font-size: 19px;
    font-weight: 500;
    color: rgba(15,23,42,.88);
    line-height: 1;

    cursor: pointer;
    transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
  }

  .bsj-hero-mosaic .bsj-hero-swiper .bsj-hero-allphotos:hover{
    transform: translateY(-1px);
    background: rgba(247, 252, 255, 0.92);
    box-shadow: 0 12px 26px rgba(15,23,42,.16);
  }

  .bsj-hero-mosaic .bsj-hero-swiper .bsj-hero-allphotos:active{
    transform: translateY(0);
  }

  /* Icône */
  .bsj-hero-mosaic .bsj-hero-swiper .bsj-hero-allphotos__icon svg{
    display:flex;
    width: 24px;
    height: 24px;
    color: rgba(15,23,42,.82);
  }

  /* Texte */
  .bsj-hero-mosaic .bsj-hero-swiper .bsj-hero-allphotos__text{
    white-space: nowrap;
  }

  /* Wrapper grid */
  .bsj-hero-mosaic .bsj-hero-swiper .swiper-wrapper {
    position: relative;
    display: grid !important;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 10px;

    height: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    border-radius: 18px;

    transform: none !important;
    transition: none !important;
  }

  /* Slides */
  .bsj-hero-mosaic .bsj-hero-swiper .swiper-slide{
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    height: 100%;
    border-radius: 18px;
  }

  /* 1 grande à gauche */
  .bsj-hero-mosaic .bsj-hero-swiper .swiper-slide:nth-child(1){
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  /* 4 petites à droite (2x2) */
  .bsj-hero-mosaic .bsj-hero-swiper .swiper-slide:nth-child(2){ grid-column: 2; grid-row: 1; }
  .bsj-hero-mosaic .bsj-hero-swiper .swiper-slide:nth-child(3){ grid-column: 3; grid-row: 1; }
  .bsj-hero-mosaic .bsj-hero-swiper .swiper-slide:nth-child(4){ grid-column: 2; grid-row: 2; }
  .bsj-hero-mosaic .bsj-hero-swiper .swiper-slide:nth-child(5){ grid-column: 3; grid-row: 2; }

  /* Cache le reste */
  .bsj-hero-mosaic .bsj-hero-swiper .swiper-slide:nth-child(n+6){
    display: none !important;
  }

  /* Images */
  .bsj-hero-mosaic .bsj-hero-swiper img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* Cache nav/pagination */
  .bsj-hero-mosaic .bsj-hero-pagination,
  .bsj-hero-mosaic .bsj-hero-prev,
  .bsj-hero-mosaic .bsj-hero-next {
    display: none !important;
  }

  /* 1) Par défaut: aucune arrondi sur les tuiles (angles intérieurs carrés) */
  .bsj-hero-mosaic
  .bsj-hero-swiper .swiper-slide {
    border-radius: 0 !important;
  }

  /* 2) Radius uniquement sur les 4 coins externes */
  /* TOP-LEFT = grande image (slide 1) */
  .bsj-hero-mosaic .bsj-hero-swiper .swiper-slide:nth-child(1) {
    border-top-left-radius: 22px !important;
    border-bottom-left-radius: 22px !important; /* bottom-left aussi sur la grande */
  }

  /* TOP-RIGHT = slide 3 */
  .bsj-hero-mosaic .bsj-hero-swiper .swiper-slide:nth-child(3){
    border-top-right-radius: 22px !important;
  }

  /* BOTTOM-RIGHT = slide 5 */
  .bsj-hero-mosaic .bsj-hero-swiper .swiper-slide:nth-child(5){
    border-bottom-right-radius: 22px !important;
  }

  /* (Optionnel) Assure que les images respectent bien le radius */
  .bsj-hero-mosaic .bsj-hero-swiper .swiper-slide{
    overflow: hidden !important;
  }

}

/* ==============================
   BSJ PHOTO TOUR
============================== */
.bsj-tour-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: block;
  background: #fffffffa;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .12s ease, visibility .12s ease;
}

.bsj-tour-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.bsj-tour-modal.is-closing{
  opacity: 0;
  visibility: visible;
  pointer-events: none;
}

body.bsj-no-scroll { 
  overflow:hidden !important; 
}

.bsj-tour {
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.bsj-tour__topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 18px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15,23,42,.08);
  transform: translateY(-6px);
  opacity: 0;
  transition: transform .48s ease, opacity .48s ease;
}

.bsj-tour-modal.is-open .bsj-tour__topbar{
  transform: translateY(0);
  opacity: 1;
}

.bsj-tour__iconbtn {
  width: 40px; height: 40px;
  border-radius: 999px;
  display:grid; place-items:center;
  border: 1px solid rgba(15,23,42,.12);
  background:#fff;
  cursor:pointer;
}

.bsj-tour__right { 
  display:flex; 
  gap:10px; 
  align-items:center; 
}

.bsj-tour__action {
  display:flex; align-items:center; gap:8px;
  padding: 14px 16px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.12);
  background:#fff;
  cursor:pointer;
  font-weight: 500;
  font-size: 13px;
  color: var(--bsj-main-color);
  transition: all .3s ease;
}

.bsj-tour__action:hover {
  background:#eaf5ff;
  color: var(--bsj-hover-color);
  transform: scale(1.02);
}

.bsj-tour__action.is-ok{ 
  outline: 3px solid rgba(19,75,154,.18); 
}

.bsj-tour__wrap {
  padding: 20px 10%;
  transform: translateY(10px) scale(.985);
  opacity: 0;
  transition: transform .32s cubic-bezier(.2,.8,.2,1), opacity .28s ease;
  will-change: transform, opacity;
}

.bsj-tour-modal.is-open .bsj-tour__wrap{
  transform: translateY(0) scale(1);
  opacity: 1;
}

.bsj-tour__title {
  font-size: var(--bsj-gall_font-size);
  letter-spacing: var(--bsj-gall-font-spacing);
  font-weight: 500;
  margin: 10px 0 14px;
}

.bsj-tour__cats {
  display:flex;
  gap: 14px;
  overflow:auto;
  padding: 6px 0 14px;
  scrollbar-width: none;
}

.bsj-tour__cats::-webkit-scrollbar { 
  display:none; 
}

.bsj-cat { 
  flex: 0 0 auto; 
  width: 160px; 
  color: inherit; 
  text-decoration:none !important;
  transform: translateY(6px);
  opacity: 0;
  transition: transform .28s ease, opacity .28s ease;
}

.bsj-tour-modal.is-open .bsj-tour__cats .bsj-cat {
  transform: translateY(0);
  opacity: 1;
}

.bsj-cat__thumb {
  width: 160px; height: 92px;
  border-radius: 10px;
  overflow:hidden;
  border: 1px solid rgba(15,23,42,.10);
  background:#f3f4f6;
}

.bsj-cat__thumb img { 
  width:100%; 
  height:100%; 
  object-fit:cover; 
  display:block; 
}

.bsj-cat__label { 
  font-size: 13px; 
  margin-top: 8px; 
  color: rgba(15,23,42,.88); 
}

.bsj-section { 
  padding-top: 18px;
  opacity: 0;
  transform: translateY(14px);
  will-change: opacity, transform;
  transition: opacity .45s ease, transform .45s cubic-bezier(.2,.8,.2,1);
}

.bsj-section.is-inview {
  opacity: 1;
  transform: translateY(0);
}

.bsj-tour-modal.is-open .bsj-section {
  opacity: 1;
  transform: translateY(0);
}

.bsj-section__h { 
  font-size: var(--bsj-gall_font-size);
  letter-spacing: var(--bsj-gall-font-spacing);
  font-weight: 500;
  margin: 16px 0 14px;
  line-height: normal !important;
}

.bsj-grid {
  display:grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.bsj-grid__img {
  border-radius: 12px;
  overflow:hidden;
  background:#f3f4f6;
  border: 1px solid rgba(15,23,42,.08);
  cursor:pointer;
  padding:0;
  opacity: 0;
  transform: translateY(10px) scale(.99);
  transition:
    opacity .42s ease,
    transform .42s cubic-bezier(.2,.8,.2,1);
  will-change: opacity, transform;
}

.bsj-section.is-inview .bsj-grid__img{
  opacity: 1;
  transform: translateY(0) scale(1);
}

.bsj-grid__img img {
  width:100%;
  height: 220px;
  object-fit: cover;
  display:block;
  transition: transform .45s ease;
}

@media (hover:hover){
  .bsj-grid__img:hover img {
    transform: scale(1.03);
  }
}

/* Viewer */
.bsj-viewer{
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
}

.bsj-viewer.is-open { 
  display:block; 
}

.bsj-viewer__inner {
  position:absolute;
  inset: 24px;
  border-radius: 18px;
  overflow:hidden;
  display: flex !important;
  flex-direction: column !important;
  background: rgba(10,10,10,.55);
}

.bsj-viewer__close {
  position:absolute;
  top:14px;
  right:14px;
  z-index:10;
  width:42px; 
  height:42px;
  border-radius:999px;
  color: var(--bsj-main-color);
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  color:#fff;
  display:grid;
  place-items:center;
  cursor:pointer;
  transition: all .3s ease;
}

.bsj-viewer .bsj-viewer-swiper,
.bsj-viewer .swiper-wrapper,
.bsj-viewer .swiper-slide{ height:100%; }
.bsj-viewer .swiper-slide img{
  width:100%;
  height:100%;
  object-fit: contain;
  display:block;
}

.bsj-viewer .bsj-viewer-swiper .swiper-wrapper,
.bsj-viewer .bsj-viewer-swiper .swiper-slide{
  height: 100% !important;
  width: 100% !important;
}

.bsj-viewer .bsj-viewer-swiper .swiper-slide{
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.bsj-viewer .bsj-viewer-swiper {
  flex: 1 1 auto !important;
  min-height: 0 !important; /* critical for flex children */
  width: 100% !important;
}

.bsj-viewer .bsj-viewer-swiper .swiper-slide img{
  width: auto !important;
  height: auto !important;

  max-width: 100% !important;
  max-height: 100% !important;

  object-fit: contain !important;
  display: block !important;
}

/* Safety: remove any forced aspect-ratio from theme */
.bsj-viewer .bsj-viewer-swiper .swiper-slide,
.bsj-viewer .bsj-viewer-swiper .swiper-slide img{
  aspect-ratio: auto !important;
}

.bsj-viewer .swiper-button-prev,
.bsj-viewer .swiper-button-next{
  width:44px; height:44px;
  border-radius:999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  color:#fff;
}

.bsj-viewer .swiper-button-prev:after,
.bsj-viewer .swiper-button-next:after{ font-size:14px; font-weight:900; }
.bsj-viewer .swiper-pagination-bullet{ background: rgba(255,255,255,.7); opacity:.45; }
.bsj-viewer .swiper-pagination-bullet-active{ opacity:1; }

@media (max-width: 991px){
  .bsj-tour__wrap{ padding: 14px 14px 50px; }
  .bsj-tour__title{ font-size: 22px; }
  .bsj-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bsj-grid__img img{ height: 170px; }
  .bsj-cat{ width: 132px; }
  .bsj-cat__thumb{ width: 132px; height: 82px; }
  .bsj-viewer__inner{ inset: 0; border-radius: 0; }
  .bsj-viewer__close{ top: 12px; right: 12px; }
}

@media (prefers-reduced-motion: reduce){
  .bsj-tour-modal,
  .bsj-tour__topbar,
  .bsj-tour__wrap,
  .bsj-tour__cats .bsj-cat,
  .bsj-section,
  .bsj-section .bsj-grid__img{
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}