@import '../../_global/styles/mixins';
@import '../../_global/styles/vars';

.btn {
  --button-bg-color: var(--theme-color-primary);
  --button-text-color: var(--theme-color-white);
  --button-padding: 16px 24px;
  --button-min-size: 60px;
  --button-icon-padding: 58px;
  --button-icon-offset: 18px;
  --button-hover-shadow-opacity: 0.3;
  --button-hover-shadow-size: 6px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Korb', sans-serif;
  border-radius: var(--border-radius-lg);
  font-size: var(--font-size-copy);
  line-height: 1;
  padding: var(--button-padding);
  text-decoration: none;
  border: 0;
  min-height: var(--button-min-size);
  min-width: var(--button-min-size);
  cursor: pointer;
  font-weight: 400;
  text-align: left;
  transition: 0.2s ease;
  @include focus-visible;

  @media(max-width: 999px) {
    --button-icon-padding: 52px;
    --button-icon-offset: 16px;
    --button-padding: 14px 20px;
    --button-min-size: 52px;
  }

  @media(max-width: 767px) {
    --button-icon-padding: 44px;
    --button-icon-offset: 12px;
    --button-padding: 12px 16px;
    --button-min-size: 44px;
    --button-hover-shadow-size: 4px;
  }
}

.btn, .btn:hover {
  background-color: var(--button-bg-color);
  color: var(--button-text-color);
}

.btn.secondary {
  --button-bg-color: var(--theme-color-secondary);
  --button-text-color: var(--theme-color-primary);
  --button-hover-shadow-opacity: 0.4;
}

.btn.white {
  --button-bg-color: var(--theme-color-white);
  --button-text-color: var(--theme-color-primary);
  --button-hover-shadow-opacity: 0.35;
}

.btn.primary-light {
  --button-bg-color: var(--theme-color-primary-dimmed-03);
  --button-text-color: var(--theme-color-primary);
  --button-hover-shadow-opacity: 0.45;
}

.btn.primary-extra-light {
  --button-bg-color: var(--theme-color-primary-dimmed-04);
  --button-text-color: var(--theme-color-primary);
  --button-hover-shadow-opacity: 0.5;
}

.btn.secondary-light {
  --button-bg-color: #9AD7A3;
  --button-text-color: var(--theme-color-primary);
  --button-hover-shadow-opacity: 0.45;
}

.btn::after {
  content: '';
  position: absolute;
  display: block;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 0 0 2px var(--button-bg-color);
  opacity: 0;
  transition: 0.3s ease;
}

.btn:hover::after {
  opacity: var(--button-hover-shadow-opacity);
  box-shadow: 0 0 0 var(--button-hover-shadow-size) var(--button-bg-color);
}

.btn-small {
  --button-icon-padding: 48px;
  --button-icon-offset: 12px;
  --button-min-size: 42px;
  --button-padding: 10px 18px;
  --button-hover-shadow-size: 4px;
  border-radius: var(--border-radius-md);

  &::after {
    border-radius: var(--border-radius-md);
  }

  @media(max-width: 999px) {
    --button-icon-padding: 46px;
    --button-min-size: 38px;
  }
}

.btn-medium {
  --button-min-size: 48px;
  --button-padding: 10px 18px;
  --button-hover-shadow-size: 5px;
  border-radius: var(--border-radius-md);

  &::after {
    border-radius: var(--border-radius-md);
  }

  @media(max-width: 999px) {
    --button-min-size: 44px;
    --button-icon-padding: 46px;
    --button-hover-shadow-size: 4px;
  }
}

button::-moz-focus-inner {
  border: 0;
}

.btn::before {
  display: none;
}

.btn.icon-left {
  padding-left: var(--button-icon-padding);
}

.btn.icon-right {
  padding-right: var(--button-icon-padding);
}

.btn.icon-left::before, .btn.icon-right::before {
  font-family: 'Icons', sans-serif;
  position: absolute;
  display: block;
  font-size: var(--icon-size);
  left: var(--button-icon-offset);
  top: 50%;
  margin-top: calc(var(--icon-size) * -0.5);
}

.btn.icon-right::before {
  left: auto;
  right: var(--button-icon-offset);
}

.btn.icon-inline {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  &::before {
    position: relative;
    display: block;
    font-family: 'Icons', sans-serif;
    font-size: var(--icon-size);
  }
}