/* ============================================================
   Discover Carousel – Jungle Running Club
   ============================================================ */

/* ── Wrapper (positions the nav buttons absolutely) ── */
.jc-carousel {
  position: relative;
}

/* ── Scrollable track ── */
.jc-carousel__track {
  display: flex;
  gap: 1rem;           /* gap-4 */
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;           /* Firefox */
  cursor: grab;
  /* Mobile: simple centering */
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Desktop: align with page content */
@media (min-width: 1024px) {
  .jc-carousel__track {
    /* Left pad so first card aligns with page content */
    padding-left: calc((100vw - min(100%, 64rem)) / 2);
    padding-right: 1rem;             /* mr-4 equivalent */
  }
}

.jc-carousel__track::-webkit-scrollbar {
  display: none;
}

/* ── Individual slide ── */
.jc-carousel__item {
  flex: 0 0 calc(100% - 2rem);    /* full width mobile with 1rem padding on each side */
  scroll-snap-align: center;      /* center snap for better mobile experience */
  border-radius: 0.5rem;          /* rounded-lg */
  overflow: hidden;
  background-color: #f3f4f6;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  /* Mobile centering */
  margin: 0 auto;
  max-width: 400px;               /* prevent items from getting too wide on mobile */
}

@media (min-width: 1024px) {
  .jc-carousel__item {
    flex: 0 0 calc(33.333% - 0.75rem);  /* lg:basis-1/3 */
    border-radius: 1rem;                 /* lg:rounded-2xl */
    scroll-snap-align: start;            /* revert to start snap on desktop */
    margin: 0;                           /* remove auto margin on desktop */
    max-width: none;                     /* remove max-width constraint on desktop */
  }
}

.jc-carousel__item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.jc-carousel__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;  /* drag doesn't grab image */
}

/* ── Nav buttons container ── */
/* Spans the same max-w-5xl container as the section title */
.jc-carousel__nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 64rem;      /* max-w-5xl */
  margin-left: auto;
  margin-right: auto;
  padding: 0 1rem;       /* px-4 */
  pointer-events: none;
  z-index: 20;
}

@media (min-width: 1024px) {
  .jc-carousel__nav {
    padding: 0 1.5rem;   /* lg:px-6 */
  }
}

/* ── Prev / Next buttons ── */
.jc-carousel__prev,
.jc-carousel__next {
  pointer-events: all;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: white;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  color: #111;
}

/* Buttons sit at the edges — spacing comes from the nav padding */

.jc-carousel__prev:hover,
.jc-carousel__next:hover {
  background: #f9fafb;
  transform: scale(1.05);
}

.jc-carousel__prev:disabled,
.jc-carousel__next:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.jc-carousel__prev svg,
.jc-carousel__next svg {
  width: 1.125rem;
  height: 1.125rem;
  stroke: currentColor;
}

/* ── Lightbox overlay ── */
.jc-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.jc-lightbox--open {
  opacity: 1;
  visibility: visible;
}

.jc-lightbox__img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 0.75rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.jc-lightbox--open .jc-lightbox__img {
  transform: scale(1);
}

.jc-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.jc-lightbox__close:hover {
  transform: scale(1.1);
}

.jc-lightbox__close svg {
  width: 1.125rem;
  height: 1.125rem;
  stroke: #111;
}
