/* JSCMS — homepage slider plugin (public). Mobile-first: below 768px,
   a slide with no dedicated mobile image is hidden entirely rather than
   showing a stretched/empty box (see MANIFEST.md's explicit requirement). */

.jscms-slider {
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
  display: grid;
  /* Match #content's width exactly (css/site.css) so the slider lines up
     with the content column below it instead of spanning #wrapper's
     near-full width. #wrapper's own `align-items: center` centers this
     the same way it centers #content, no extra margin needed. */
  width: calc(100% - 50px);
  max-width: 1300px;
}

/* Crossfade: every slide occupies the same grid cell (so the container
   stays sized to the tallest slide with no JS height calc needed) and
   fades via opacity — display:none/block (the old approach) can't be
   CSS-transitioned, which is why this couldn't just add a transition. */
.jscms-slider__slide {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 600ms ease-in-out, visibility 0s linear 600ms;
}

.jscms-slider__slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 1;
  transition: opacity 600ms ease-in-out;
}

.jscms-slider__img {
  width: 100%;
  display: block;
  /* Crop (never stretch/letterbox) to a fixed ratio so every slide renders
     at the same box size regardless of what an editor uploads — the ratio
     matches the "recommended dimensions" hint in the admin UI, but any
     image with the same proportions (e.g. a sharper 2000x750 upload for
     the 1200x450 desktop slot) still shows in full since aspect-ratio is
     a proportion, not a pixel size. */
  object-fit: cover;
  object-position: center;
}

.jscms-slider__img--pc {
  aspect-ratio: 1200 / 450;
}

.jscms-slider__img--mobile {
  display: none;
  aspect-ratio: 400 / 400;
}

@media (max-width: 768px) {
  .jscms-slider__slide:not([data-has-mobile="1"]) {
    display: none;
  }
  .jscms-slider__img--pc {
    display: none;
  }
  .jscms-slider__img--mobile {
    display: block;
  }
}

.jscms-slider__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.85);
  color: var(--jscms-accent, #135428);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  /* Must outrank .jscms-slider__slide.is-active's z-index: 1 (needed for the
     crossfade), or the active slide covers these completely except for a
     brief flash during the .is-active class swap on slide change. */
  z-index: 2;
}

.jscms-slider__arrow:hover {
  background: #fff;
  color: var(--jscms-accent-hover, #239e4a);
}

.jscms-slider__arrow--prev {
  left: 12px;
}

.jscms-slider__arrow--next {
  right: 12px;
}

.jscms-slider__dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 2;
}

.jscms-slider__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid var(--jscms-accent, #135428);
  cursor: pointer;
  padding: 0;
}

.jscms-slider__dot.is-active {
  background: var(--jscms-accent, #135428);
}
