/*
 * FlexCarousel styles (see js/flex-carousel.js).
 * Adapted from the React Bits FlexCarousel stylesheet. The engine sets these custom properties on the container:
 *   --flex-carousel-center  vertical centre of the card row, in px from the top of the container
 *   --flex-carousel-half    half the height of a card, in px
 *   --flex-carousel-lift    how far the open card has grown (1 = not at all)
 * Theme it with --flex-carousel-ring (focus ring colour).
 */
.flex-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: contain;
  outline: none;
}

.flex-carousel[data-hover='open'] {
  cursor: zoom-in;
}

.flex-carousel[data-hover='close'] {
  cursor: zoom-out;
}

.flex-carousel[data-dragging] {
  cursor: grabbing;
}

/* Keyboard focus: a ring around the centred card (the engine keeps it in place), instead of around the whole container. */
.flex-carousel__ring {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  border: 2px solid var(--flex-carousel-ring, rgba(128, 128, 140, 0.8));
  pointer-events: none;
  opacity: 0;
  will-change: transform;
}

.flex-carousel:focus-visible .flex-carousel__ring {
  opacity: 1;
}

.flex-carousel__caption {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--flex-carousel-center, 50%) + var(--flex-carousel-half, 25%) * var(--flex-carousel-lift, 1) + 22px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  pointer-events: none;
  text-align: center;
  animation: flex-carousel-reveal 900ms ease both;
}

.flex-carousel__caption[hidden] {
  display: none;
}

.flex-carousel__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  animation: flex-carousel-title 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.flex-carousel__subtitle {
  font-weight: 400;
  opacity: 0.6;
}

.flex-carousel__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 28px;
}

.flex-carousel__count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  opacity: 0.5;
  transition: opacity 400ms ease;
}

.flex-carousel[data-focus-open] .flex-carousel__count {
  opacity: 0;
}

.flex-carousel__digits {
  display: inline-flex;
}

.flex-carousel__digit {
  display: inline-block;
  height: 1em;
  overflow: hidden;
}

.flex-carousel__reel {
  display: flex;
  flex-direction: column;
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.flex-carousel__reel span {
  height: 1em;
}

.flex-carousel__slash {
  opacity: 0.6;
}

/* Optional link to the project (item.href) and the pause button (autoplay). These two are the only parts of the
   caption that take pointer events. */
.flex-carousel__link,
.flex-carousel__pause {
  pointer-events: auto;
  color: inherit;
  cursor: pointer;
}

.flex-carousel__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid currentColor;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 250ms ease, background-color 250ms ease, color 250ms ease;
}

.flex-carousel__link[hidden],
.flex-carousel__pause[hidden] {
  display: none;
}

.flex-carousel__link svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flex-carousel__pause {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  opacity: 0.55;
  transition: opacity 250ms ease, background-color 250ms ease;
}

.flex-carousel__pause svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flex-carousel__pause .flex-carousel__icon-play {
  display: none;
}

.flex-carousel__pause[aria-pressed='true'] .flex-carousel__icon-pause {
  display: none;
}

.flex-carousel__pause[aria-pressed='true'] .flex-carousel__icon-play {
  display: block;
}

@media (hover: hover) {
  .flex-carousel__link:hover,
  .flex-carousel__pause:hover {
    opacity: 1;
  }

  .flex-carousel__pause:hover {
    background: rgba(255, 255, 255, 0.1);
  }
}

.flex-carousel__link:focus-visible,
.flex-carousel__pause:focus-visible {
  opacity: 1;
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

@media (pointer: coarse) {
  .flex-carousel__link {
    min-height: 40px;
    padding: 0 16px;
  }

  .flex-carousel__pause {
    width: 40px;
    height: 40px;
  }

  .flex-carousel__meta {
    min-height: 40px;
  }
}

.flex-carousel__live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes flex-carousel-title {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes flex-carousel-reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flex-carousel__caption,
  .flex-carousel__title {
    animation: none;
  }

  .flex-carousel__reel {
    transition: none;
  }
}
