.embla {
  position: relative;
  margin: auto;
  overflow: hidden;
}

.embla__viewport {
  width: 100%;
  overflow: hidden;
}

.embla__viewport.is-draggable {
  cursor: grab;
}

.embla__viewport.is-dragging {
  cursor: grabbing;
}

.embla__container {
  display: flex;
  flex-wrap: nowrap;
  margin: 0;
  padding: 0;
  gap: var(--spacing);
  list-style: none;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* Key: auto width, fixed max-height */
.embla__slide {
  position: relative;
  flex: 0 0 auto; /* don't force 100% width */
  min-width: 0;
}

.embla__slide,
.embla__slide * {
  display: block;
  width: auto;
  max-width: none; /* override any Drupal theme reset */
  height: 50lvh;
}

.embla__slide img {
  object-fit: cover;
}

.slide__inner {
  position: relative;
}

/* Hide the checkbox itself */
.slide__toggle {
  position: absolute;
  width: 0;
  height: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.slide__caption {
  display: flex;
  position: absolute;
  bottom: 3.25rem; /* leave room for the button */
  left: 0.75rem;
  column-gap: 0.15em;
  width: max-content;
  max-width: calc(100% - 1.5rem);
  height: auto !important;
  padding: 0.4rem 0.75rem;
  transform: translateY(4px);
  transform-origin: center;
  border-radius: 4px;
  background: var(--color-brand);
  color: var(--color-invert);
  font-size: 0.8rem;
  white-space: normal;

  /* hidden by default */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.slide__caption-btn {
  display: flex;
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  align-items: center;
  align-items: center;
  justify-content: center;
  justify-content: center;
  width: 2rem;
  height: 2rem !important;
  transform-origin: center;
  border-radius: 50%;
  background: var(--color-brand);
  color: var(--color-invert);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  user-select: none;
}

/* Checked state */
.slide__toggle:checked ~ .slide__caption {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.slide__toggle:checked ~ .slide__caption-btn {
  transform: rotate(45deg); /* + becomes × */
}

.slide__caption,
.slide__caption .slide__text,
.slide__caption .slide__credit {
  height: auto !important;
}

/* Controls */
.embla__controls {
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem 0;
  gap: 0.5rem;
}

.embla__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--color-brand);
  border-radius: 50%;
  background: none;
  background-color: var(--color-brand);
  color: var(--color-invert);
  cursor: pointer;
}

.embla__btn--prev,
.embla__btn--next {
  position: static;
  transform: none;
}

.embla__btn.is-disabled {
  cursor: default;
  opacity: 0.3;
  pointer-events: none;
}

@media screen and (min-width: 768px) {
  .embla__slide,
  .embla__slide * {
    height: 75lvh;
  }
}