/* ==========================================================
   Karussell-Slider (Scroll-Snap, ohne Plugin)
   ========================================================== */

:root {
  --carousel-gap: 16px;
  --carousel-radius: 10px;
  --carousel-accent: #00000086;
  --carousel-line: #ffffff;
  --carousel-bg: #ffffff9d;
}

.carousel-wrap {
  position: relative;
  max-width: 100%;
}

.carousel-track {
  display: flex;
  gap: var(--carousel-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 4px;
  scrollbar-width: none; /* Firefox */
}
.carousel-track::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.carousel-track > .carousel-card {
  flex: 0 0 calc((100% - var(--carousel-gap) * 3) / 4); /* Desktop: 4 Karten */
  scroll-snap-align: start;
  margin: 0;
}

.carousel-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--carousel-radius); /* neu, hierhin verschoben */
}

.carousel-card figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 8px;
  box-sizing: border-box;
  display: table-cell;
  vertical-align: middle;
  text-align: left;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  font-size: var(--wp--preset--font-size--medium);
}

.carousel-card figcaption {
  pointer-events: none;
}

.carousel-card figcaption a {
  pointer-events: auto;
  color: inherit;
  text-decoration: underline;
}

.carousel-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}

.carousel-card img {
  transition: opacity 0.25s ease, filter 0.25s ease;
}
.carousel-card a:hover img,
.carousel-card a:focus-visible img {
  opacity: 0.85;
  filter: blur(2px);
}
.carousel-card > a {
  display: block;
  cursor: pointer;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  height: clamp(32px, 4vw, 80px);
  width: auto;
  border-radius: 0;
  border: 1px solid var(--carousel-line);
  background: var(--carousel-bg);
  color: #000000b6;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.carousel-arrow svg {
  height: clamp(28px, 3vw, 60px);
  width: auto;
}
.carousel-arrow:hover {
  background: var(--carousel-accent);
  color: #fff;
  border-color: var(--carousel-accent);
}
.carousel-arrow:focus-visible {
  outline: 2px solid var(--carousel-accent);
  outline-offset: 2px;
}
.carousel-arrow[disabled] {
  opacity: 0.3;
  cursor: default;
}
.carousel-arrow[disabled]:hover {
  background: var(--carousel-bg);
  color: #1f2422;
  border-color: var(--carousel-line);
}

.carousel-arrow.prev { left: 0px; }
.carousel-arrow.next { right: 0px; }

/* Tablet: 3 Karten */
@media (max-width: 860px) {
  .carousel-track > .carousel-card {
    flex-basis: calc((100% - var(--carousel-gap) * 2) / 3);
  }
}

/* Ab hier Pfeile in den sichtbaren Bereich holen, statt außerhalb */
@media (max-width: 900px) {
  .carousel-arrow.prev { left: 4px; }
  .carousel-arrow.next { right: 4px; }
}

/* Mobile: 1 Karte */
@media (max-width: 560px) {
  .carousel-track > .carousel-card {
    flex-basis: calc(100% - 44px);
  }
}
