/* Ax Collection list */

.ax-collection-card {
  position: relative;
  display: block;
  height: 220px;
  background-color: rgb(var(--color-background));
  transition: background-color 0.3s ease-in-out;
  overflow: hidden;

  .card,
  .card__inner {
    height: 100%;
  }

  .card__inner.ratio {
    padding-bottom: 0;
  }

  .card__media {
    position: absolute;
    inset: 0;

    .media {
      height: 100%;
    }

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }

  .card__content {
    display: none;
  }

  .ax-collection-card__cover-link {
    position: absolute;
    inset: 0;
    z-index: 3;
    cursor: pointer;
    pointer-events: auto;
  }

  &:is(:hover, :focus-within) .ax-collection-card__cta-link::after {
    transform: scaleX(0);
  }
  
  &:hover {
    background-color: rgb(var(--color-button));
  }

  &:hover .ax-collection-card__image img {
    transform: scale(1.08);
  }
}

/* Card overlay */
.ax-collection-card__overlay {
  position: absolute;
  inset: 0;
  padding: 28px 24px 24px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 2;

  .ax-collection-card__title {
    margin: 0;
    font-size: calc(var(--font-heading-scale) * 2.4rem);
    line-height: 1.15;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }

  .ax-collection-card__cta {
    pointer-events: auto;
  }

  .ax-collection-card__cta-link {
    color: currentColor;
    text-decoration: none;
    text-transform: uppercase;
    font-weight: 700;
    font-size: calc(var(--font-body-scale) * 1.4rem);
    letter-spacing: 0.3px;
    display: inline-block;
    position: relative;

    &::after {
      content: "";
      display: block;
      margin-top: 4px;
      height: 2px;
      width: 100%;
      background: currentColor;
      transform-origin: left center;
      transform: scaleX(1);
      will-change: transform;
      transition: transform 250ms ease-in-out;
    }

    &:hover::after,
    &:focus-visible::after {
      transform: scaleX(0);
    }
  }
}

/* Card image */
.ax-collection-card__image {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;

  img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: right center;
    transition: transform 0.4s ease-in-out;
  }
}
