// 通用样式
@use 'sass:math';

page {
  font-family: 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', sans-serif;
  font-size: 28rpx;
  color: #333;
  background: #fff;
  /* stylelint-disable-next-line value-keyword-case */
  text-rendering: optimizeLegibility;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.c-hover {
  transition: all 0.3s;

  &:active {
    opacity: 0.7;
    transform: scale(0.95);
  }
}

.c-bold {
  font-weight: bold;
}

.c-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c-text-left {
  text-align: left;
}

.c-text-center {
  text-align: center;
}

.c-text-right {
  text-align: right;
}

.c-clear-fix {
  zoom: 1;

  &::after {
    display: block;
    width: 0;
    height: 0;
    clear: both;
    visibility: hidden;
    content: '';
  }
}

/* ---flex布局 Begin--- */
.c-flex {
  position: relative;
  display: flex;
}

.c-inline-flex {
  position: relative;
  display: inline-flex;
}

.c-wrap {
  flex-wrap: wrap;
}

.c-row {
  flex-direction: row;
}

.c-row-reverse {
  flex-direction: row-reverse;
}

.c-column {
  flex-direction: column;
}

.c-column-reverse {
  flex-direction: column-reverse;
}

.c-justify-start {
  justify-content: flex-start;
}

.c-justify-center {
  justify-content: center;
}

.c-justify-end {
  justify-content: flex-end;
}

.c-justify-between {
  justify-content: space-between;
}

.c-justify-around {
  justify-content: space-around;
}

.c-justify-evenly {
  justify-content: space-evenly;
}

.c-align-start {
  align-items: flex-start;
}

.c-align-center {
  align-items: center;
}

.c-align-end {
  align-items: flex-end;
}

.c-align-baseline {
  align-items: baseline;
}

.c-align-stretch {
  align-items: stretch;
}

.c-flex-1 {
  flex: 1;
}

.c-flex-none {
  flex: none;
}

[class*='c-col-'] {
  float: left;
}

.c-col-0 {
  display: none;
}

@for $i from 0 through 24 {
  .c-col-#{$i} {
    flex: 0 0 (math.div(1, 24) * $i * 100) * 1%;
    max-width: (math.div(1, 24) * $i * 100) * 1%;
  }

  .c-col-offset-#{$i} {
    margin-left: (math.div(1, 24) * $i * 100) * 1%;
  }

  .c-col-pull-#{$i} {
    position: relative;
    right: (math.div(1, 24) * $i * 100) * 1%;
  }

  .c-col-push-#{$i} {
    position: relative;
    left: (math.div(1, 24) * $i * 100) * 1%;
  }
}

/* ---flex布局 End--- */

/* ---常用边距Begin--- */
@each $pixel in (0, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 40, 50, 60, 70, 80, 90, 100, 120, 160, 200) {
  // 四周外边距，例：m-10 距离四周10rpx
  .m-#{$pixel} {
    margin: #{$pixel}rpx !important;
  }

  // 四周内边距，例：p-10 距离四周10rpx
  .p-#{$pixel} {
    padding: #{$pixel}rpx !important;
  }

  @each $side in (top, right, bottom, left) {
    // 指定方位外边距，例：m-t-10 距离顶部10rpx
    .m-#{str-slice($side, 0, 1)}-#{$pixel} {
      margin-#{$side}: #{$pixel}rpx !important;
    }

    // 指定方位内边距，例：p-t-10 距离顶部10rpx
    .p-#{str-slice($side, 0, 1)}-#{$pixel} {
      padding-#{$side}: #{$pixel}rpx !important;
    }
  }
}

/* ---常用边距End--- */

/* ---字体大小Begin */
@each $size in (20, 22, 24, 26, 28, 30, 32, 34, 36, 40, 42, 44, 46, 48, 50, 52, 56, 60, 70, 80, 90, 100) {
  .f-s-#{$size} {
    font-size: #{$size}rpx !important;
  }
}
