@include comp(image-selector) {
  $num: 3;
  $gutter: 1em;

  .image-select-option {
    display: inline-flex;
    margin-right: $gutter;
    margin-bottom: $gutter;
    border: solid 2px plv(border-color);
    padding: 10px;
    box-sizing: border-box;
    position: relative;

    width: calc((100% - (#{$gutter} * (#{$num} - 1))) / #{$num});
    aspect-ratio: var(--aspect-ratio);
    overflow: hidden;
    cursor: pointer;
    transition: all ease 300ms;

    .image-select-option-checked {
      position: absolute;
      bottom: 0;
      right: 0;
      height: 36px;
      width: 36px;
      display: flex;
      align-items: flex-end;
      justify-content: flex-end;
      color: white;
      opacity: 0;
      transition: all ease 300ms;

      &:before {
        position: absolute;
        inset: 0;
        content: '';
        background-color: plv(primary-6);
        transform: translateX(50%) translateY(50%) rotate(45deg);
        transform-origin: center;
        z-index: 1;
      }

      & > .#{componentName(icon)} {
        z-index: 2;
        transform: rotate(-4.5deg);
      }
    }

    & > img {
      width: 100%;
      aspect-ratio: inherit;
    }

    &:nth-child(#{$num}n) {
      margin-right: 0;
    }

    &:hover {
      border-color: plv(primary-3);
    }

    &[data-selected=true] {
      border-color: plv(primary-6);

      .image-select-option-checked {
        opacity: 1;
      }
    }
  }
}
