@use "../utilities" as *;

/* START: Counter CSS */
.tj-counter-section {
  padding-top: 120px;
  padding-bottom: 120px;
  background-color: var(--tj-color-theme-bg);
  overflow: hidden;
  .sec-heading {
    max-width: 560px;
    width: 100%;
    margin-inline-start: auto;
    margin-inline-end: auto;
  }
  @media #{$lg} {
    padding-top: 100px;
    padding-bottom: 100px;
  }
  @media #{$md, $sm, $xs} {
    padding-top: 80px;
    padding-bottom: 80px;
  }
}

.counter-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  background-color: var(--tj-color-common-white);

  @media #{$sm} {
    max-width: 516px;
    margin: 0 auto;

    .counter-item {
      max-width: 50%;

      &:not(:nth-last-child(-n + 2)) {
        border-bottom: 1px solid var(--tj-color-border-2);

        .bottom-line {
          &::before {
            position: absolute;
            content: "";
            width: 12px;
            height: 12px;
            border-radius: 50%;
            left: 50%;
            bottom: -6px;
            border: 3px solid var(--tj-color-theme-primary);
            transform: translateX(-50%);
            background-color: var(--tj-color-common-white);
            z-index: 2;
          }
          &::after {
            position: absolute;
            content: "";
            width: 20px;
            height: 20px;
            border-radius: 50%;
            left: 50%;
            bottom: -10px;
            transform: translateX(-50%);
            background-color: var(--tj-color-common-white);
            z-index: -1;
          }
        }

        &.style-2 {
          border-color: var(--tj-color-border-1);

          .bottom-line {
            &::before {
              border: 3px solid var(--tj-color-theme-dark);
              background-color: var(--tj-color-theme-primary);
            }
            &::after {
              background-color: var(--tj-color-theme-primary);
              @media #{$md, $sm, $xs} {
                width: 16px;
                height: 16px;
                bottom: -8px;
              }
            }
          }
        }
      }
    }
  }
  @media #{$xs} {
    justify-content: center;

    .counter-item {
      max-width: 50%;

      &:not(:nth-last-child(-n + 2)) {
        border-bottom: 1px solid var(--tj-color-border-2);

        .bottom-line {
          &::before {
            position: absolute;
            content: "";
            width: 12px;
            height: 12px;
            border-radius: 50%;
            left: 50%;
            bottom: -6px;
            border: 3px solid var(--tj-color-theme-primary);
            transform: translateX(-50%);
            background-color: var(--tj-color-common-white);
            z-index: 2;
          }
          &::after {
            position: absolute;
            content: "";
            width: 20px;
            height: 20px;
            border-radius: 50%;
            left: 50%;
            bottom: -10px;
            transform: translateX(-50%);
            background-color: var(--tj-color-common-white);
            z-index: -1;
          }
        }

        &.style-2 {
          border-color: var(--tj-color-border-1);

          .bottom-line {
            &::before {
              border: 3px solid var(--tj-color-theme-dark);
              background-color: var(--tj-color-theme-primary);
            }
            &::after {
              background-color: var(--tj-color-theme-primary);
              @media #{$md, $sm, $xs} {
                width: 16px;
                height: 16px;
                bottom: -8px;
              }
            }
          }
        }
      }
    }
  }
}

.counter-item {
  position: relative;
  @media #{$sm, $xs} {
    &::before,
    &::after {
      display: none;
    }
  }
  max-width: 324px;
  width: 100%;
  border-inline-end: 1px solid var(--tj-color-border-2);
  padding: 50px 40px 60px 55px;
  z-index: 1;

  &::before {
    position: absolute;
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    top: 50%;
    inset-inline-end: -6px;
    border: 3px solid var(--tj-color-theme-primary);
    transform: translateY(-50%);
    background-color: var(--tj-color-common-white);
    z-index: 2;
  }
  &::after {
    position: absolute;
    content: "";
    width: 20px;
    height: 20px;
    border-radius: 50%;
    top: 50%;
    inset-inline-end: -10px;
    transform: translateY(-50%);
    background-color: var(--tj-color-common-white);
    z-index: -1;
  }
  &:last-child {
    border-inline-end: none;
    &::after,
    &::before {
      display: none;
    }
  }
  .number {
    display: flex;
    align-items: center;
    color: var(--tj-color-heading-primary);
    font-family: var(--tj-ff-heading);
    font-size: 70px;
    font-weight: var(--tj-fw-sbold);
    line-height: 1;
    @media #{$xl} {
      font-size: 60px;
    }
    @media #{$lg} {
      font-size: 54px;
    }
    @media #{$md} {
      font-size: 44px;
    }
    @media #{$sm, $xs} {
      font-size: 30px !important;
    }
    span {
      line-height: 1;
      font-family: inherit;
    }
  }
  .sub-title {
    line-height: 1;
    display: block;
  }
  @media #{$xl} {
    max-width: 278px;
  }
  @media #{$lg} {
    max-width: 230px;
    padding: 50px 30px 60px 31px;
  }
  @media #{$md} {
    max-width: 174px;
    padding: 30px 20px 35px 20px;
  }
  @media #{$sm} {
    max-width: 258px;
    padding: 30px 15px 35px 70px;
    .number {
      margin-bottom: 10px;
    }
    span {
      line-height: 1.4;
    }
    &:nth-child(2) {
      border-inline-end: none;
      &::after,
      &::before {
        display: none;
      }
    }
  }
  @media #{$xs} {
    justify-content: center;
    max-width: 170px;
    padding: 30px 15px;
    text-align: center;
    &:nth-child(2) {
      border-inline-end: none;
      &::after,
      &::before {
        display: none;
      }
    }
    .number {
      margin-bottom: 10px;
      justify-content: center;
    }
    span {
      line-height: 1.4;
    }
  }
}
/* !END: Counter CSS */
