@import "./_vars.scss";

* {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
  background: #f6f7fd;
  color: #51526f;
  line-height: 1.6;
}

code {
  background: radial-gradient(circle at 30% 50%, #f2f8ff, #e4edff);
  color: #4b47c7;
  padding: 2px 3px;
  border-radius: 2px;
  font-size: 90%;
  overflow-wrap: break-word;
}

a {
  position: relative;
  color: #3065e4;
  text-decoration: none;

  &:not(.btn)::after {
    content: "";
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    height: 1px;
    width: 100%;
    transform: scaleX(0);
    transition: transform 0.25s ease-out, color 0.25s;
    background: #4885ff;
  }

  &:hover {
    color: #4885ff;

    &::after {
      transform: scaleX(1);
    }
  }
}

.container {
  max-width: 1000px;
  padding: 0 2%;
  margin: 0 auto;
  position: relative;

  @media (min-width: $breakpoint-md) {
    padding: 0 25px;
  }
}

.btn {
  background: white;
  border: none;
  color: #8385aa;
  border: 1px solid #c8cbf2;
  font-weight: 700;
  font-size: 17px;
  padding: 8px 16px;
  border-radius: 4px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  outline: 0;
  cursor: pointer;

  &:active {
    box-shadow: inset 0 4px 4px 0px rgba(0, 32, 128, 0.1);
  }

  &.focus-visible {
    outline: 4px solid rgba(131, 133, 170, 0.5);
  }

  &__icon {
    vertical-align: -6px;
  }

  span {
    margin-right: 8px;
  }
}

html:not(.browser-touch) {
  .btn {
    &:hover {
      background: #8385aa;
      color: white;
      border-color: #8385aa;
    }
  }
}

@media (min-width: $breakpoint-md) {
  [data-tooltip] {
    position: relative;

    &::before,
    &::after {
      visibility: hidden;
      opacity: 0;
      transition: visibility 0.2s, opacity 0.2s;
      will-change: opacity;
      pointer-events: none;
      z-index: 999;
      position: absolute;
      left: 50%;
    }

    &::before {
      content: attr(data-tooltip);
      background: #444;
      color: white;
      padding: 4px 8px;
      font-size: 14px;
      border-radius: 4px;
      line-height: 1.5;
      top: calc(100% + 10px);
      left: 50%;
      transform: translateX(-50%);
      white-space: nowrap;
      text-transform: initial;
      max-width: 300px;
      text-align: center;
      box-shadow: 0 8px 16px -2px rgba(0, 32, 64, 0.2);
    }

    &::after {
      content: "";
      top: calc(100% + 4px);
      transform: translateX(-50%);
      border-bottom: 6px solid #444;
      border-left: 6px solid transparent;
      border-right: 6px solid transparent;
    }

    &:hover {
      &::before,
      &::after {
        visibility: visible;
        opacity: 1;
      }
    }
  }
}
