@use 'sass:map';

$progress-bar-colors: (
  'blue': #048dff,
  'yellow': #eebb4d,
  'pink': #ed63d2,
  'green': #2dca73,
  'sky': #00c9e3,
  'orange': #ff7c7c,
);

@mixin circular-progress-bar-color() {
  @each $color, $value in $progress-bar-colors {
    &.#{$color} {
      .circular-progress-bar {
        border-color: $value;
      }
    }
  }
}

@mixin circular-progress-animation-breakpoints() {
  $progress: 50;
  $duration: 0;

  @for $i from 1 through 10 {
    .circular-progress-percentage-#{$progress} {
      animation: circular-loading-#{$progress} #{$duration}s linear forwards 1.8s;
    }
    $progress: $progress + 5;
    $duration: $duration + 0.18;
  }
}

@mixin circular-progress-animation-keyframes($progress, $degree, $keyframes) {
  @for $i from 1 through $keyframes {
    @keyframes circular-loading-#{$progress} {
      0% {
        transform: rotate(0);
      }
      100% {
        transform: rotate(#{$degree}deg);
      }
    }
    $progress: $progress + 5;
    $degree: $degree + 18;
  }
}

.about-section {
  .social-link {
    list-style: none;
    padding: 0.2rem;

    a {
      font-size: 1.5rem;
      color: get-light-color('text-color');
      padding: 0.5rem;

      &:hover {
        color: get-light-color('accent-color');
        @include transition();
      }
    }
  }

  .circular-progress {
    width: 150px;
    height: 150px;
    line-height: 150px;
    background: none;
    margin: 0 auto;
    box-shadow: none;
    position: relative;

    &::after {
      content: '';
      width: 100%;
      height: 100%;
      border-radius: 50%;
      border: 12px solid get-light-color('bg-primary');
      position: absolute;
      top: 0;
      left: 0;
    }
    span {
      width: 50%;
      height: 100%;
      overflow: hidden;
      position: absolute;
      top: 0;
      z-index: 1;
    }

    .circular-progress-bar {
      width: 100%;
      height: 100%;
      background: none;
      border-width: 12px;
      border-style: solid;
      position: absolute;
      top: 0;
    }

    .circular-progress-left {
      left: 0;

      .circular-progress-bar {
        left: 100%;
        border-top-right-radius: 80px;
        border-bottom-right-radius: 80px;
        border-left: 0;
        transform-origin: center left;
      }
    }
    .circular-progress-right {
      right: 0;

      .circular-progress-bar {
        left: -100%;
        border-top-left-radius: 80px;
        border-bottom-left-radius: 80px;
        border-right: 0;
        transform-origin: center right;
        animation: circular-loading-1 1.8s linear forwards;
      }
    }
    .circular-progress-value {
      width: 90%;
      height: 90%;
      padding: 1rem;
      border-radius: 50%;
      background: get-light-color('text-color');
      font-size: 1rem;
      color: get-light-color('bg-primary');
      line-height: initial;
      text-align: center;
      position: absolute;
      top: 5%;
      left: 5%;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    @include circular-progress-bar-color();
    @include circular-progress-animation-breakpoints();
    @include circular-progress-animation-keyframes($progress: 50, $degree: 0, $keyframes: 10);
    @include circular-progress-animation-keyframes($progress: 1, $degree: 180, $keyframes: 5);
  }

  @include media('<=large') {
    .circular-progress {
      margin-bottom: 20px;
    }
  }

  @include media('<=medium') {
    .about-section.container {
      max-width: 100%;
    }

    .circular-progress {
      width: 135px;
      height: 135px;
    }
  }
  @include media('<=small') {
    .circular-progress {
      width: 150px;
      height: 150px;
    }

    .circular-progress .circular-progress-value {
      font-size: 1rem;
    }
  }
  @include media('<=tiny') {
    .col-6 {
      flex: auto;
      max-width: 100%;
    }

    .social-link {
      flex-wrap: wrap;
    }
    .certificate-badge {
      padding-left: 2rem;
      padding-right: 2rem;
    }
    .circular-progress {
      width: 200px;
      height: 200px;

      .circular-progress-left .circular-progress-bar {
        border-top-right-radius: 100px;
        border-bottom-right-radius: 100px;
      }
      .circular-progress-right .circular-progress-bar {
        border-top-left-radius: 100px;
        border-bottom-left-radius: 100px;
      }
    }
  }
}

html[data-theme='dark'] {
  .about-section {
    .social-link {
      a {
        color: get-dark-color('text-color');

        &:hover {
          color: get-dark-color('accent-color');
        }
      }
    }

    .circular-progress {
      &::after {
        border: 12px solid get-dark-color('bg-primary');
      }

      .circular-progress-value {
        background: get-dark-color('inverse-text-color');
        color: get-dark-color('text-color');
      }
    }
  }
}
