@import '../config/import';

// avatar-logo() - Generates styles for Avatars or Logos component
//
// Logos & avatars look almost the same with tiny difference. They're
// supposed to be separate components so for that reason they have
// separate classes. Because of that we have mixing which is meant to
// generate specific styles for both.
//
// @param {string} $name        Name of the component, will be included in class name
// @param {number} $radius      Value for border-radius
// @param {color} $background   Background visible until image loads in.

@mixin avatar-logo($name, $radius, $background) {
  .crayons-#{$name} {
    display: inline-block;
    border-radius: $radius;
    position: relative;
    background-color: $background;
    width: var(--su-6);
    height: var(--su-6);
    overflow: hidden;
    vertical-align: middle;
    flex-shrink: 0;

    &__image {
      border-radius: $radius;
      width: 100%;
      height: 100%;
      display: inline-block;
      vertical-align: bottom; // todo: do we need it?
    }

    &::after {
      content: '';
      border: 1px solid var(--body-color);
      opacity: 0.15;
      width: 100%;
      height: 100%;
      position: absolute;
      left: 0;
      top: 0;
      border-radius: $radius;
      pointer-events: none;
    }

    &--l {
      width: var(--su-7);
      height: var(--su-7);
    }

    &--xl {
      width: var(--su-8);
      height: var(--su-8);
    }

    &--2xl {
      width: var(--su-9);
      height: var(--su-9);
    }

    &--3xl {
      width: var(--su-10);
      height: var(--su-10);
    }
  }

  @media (min-width: $breakpoint-s) {
    .s\:crayons-#{$name} {
      &--l {
        width: var(--su-7);
        height: var(--su-7);
      }

      &--xl {
        width: var(--su-8);
        height: var(--su-8);
      }

      &--2xl {
        width: var(--su-9);
        height: var(--su-9);
      }

      &--3xl {
        width: var(--su-10);
        height: var(--su-10);
      }
    }
  }

  @media (min-width: $breakpoint-m) {
    .m\:crayons-#{$name} {
      &--l {
        width: var(--su-7);
        height: var(--su-7);
      }

      &--xl {
        width: var(--su-8);
        height: var(--su-8);
      }

      &--2xl {
        width: var(--su-9);
        height: var(--su-9);
      }

      &--3xl {
        width: var(--su-10);
        height: var(--su-10);
      }
    }
  }

  @media (min-width: $breakpoint-l) {
    .l\:crayons-#{$name} {
      &--l {
        width: var(--su-7);
        height: var(--su-7);
      }

      &--xl {
        width: var(--su-8);
        height: var(--su-8);
      }

      &--2xl {
        width: var(--su-9);
        height: var(--su-9);
      }

      &--3xl {
        width: var(--su-10);
        height: var(--su-10);
      }
    }
  }
}

@include avatar-logo('avatar', 100%, var(--card-color-tertiary));
@include avatar-logo('logo', var(--radius), var(--body-color-inverted));
