$color--warn: #f1dc99; // partial support
$color--success: #a2e9c1; // full support
$color--error: #ffa5a5; // no support
$color--text--light: #fff; // text color on dark backgrounds
$color--text--dark: #000; // text color on light backgrounds

$font__browser--size: 32px;
$font__version--size: 24px;
$font__meta--size: 18px;
$border-radius: 2px;
$li-margin: 10px;
$icon-width: 120px;

// Text Contrast Mixin
// Determines font color based
// on background color
$contrast-settings: (
  'light-color': $color--text--light,
  'dark-color': $color--text--dark
);

@mixin contrast-me($bg-color) {
  @if lightness($bg-color) < 40% {
    color: map-get($contrast-settings, 'light-color');
  } @else {
    color: map-get($contrast-settings, 'dark-color');
  }

  background-color: $bg-color;
}

#caniuse--result-list {
  display: flex;
  flex-wrap: wrap;
  font-family: inherit;
  margin: 0;
  padding: 0;

  li {
    border-radius: $border-radius;
    flex: 1;
    list-style: none;
    margin: $li-margin;
    padding: $li-margin;
    text-align: center;
  }

  .caniuse {
    &--browser-img {
      height: $icon-width;
      margin: $li-margin * 2 auto 0;
      width: $icon-width;
    }

    &--browser-name {
      font-size: $font__browser--size;
      line-height: 1;
    }

    &--browser-results {
      font-size: $font__version--size;
      line-height: 0;
    }

    &--support-level {
      font-size: $font__meta--size;
    }
  }

  .support--partial {
    @include contrast-me($color--warn);
  }

  .support--full {
    @include contrast-me($color--success);
  }

  .support--none {
    @include contrast-me($color--error);
  }
}
