@import "./variables";

.#{$component-prefix}grid-item {
  position: relative;
  box-sizing: border-box;

  &--square {
    height: 0;
  }

  &__icon {
    font-size: $grid-item-icon-font-size;

    .#{$component-prefix}icon {
      font-size: inherit;
    }
  }

  &__text {
    font-size: $grid-item-text-font-size;
    line-height: 1.5;
    color: $grid-item-text-color;
    // https://github.com/youzan/vant/issues/3894
    word-break: break-all;
  }

  &__icon + &__text {
    margin-top: var(--padding-xs, $padding-xs);
  }

  &__content {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: $grid-item-content-padding;
    background-color: $grid-item-content-background-color;

    &::after {
      z-index: 1;
      border-width: 0 var(--border-width-base, $border-width-base) var(--border-width-base, $border-width-base) 0;
    }

    &--square {
      position: absolute;
      top: 0;
      right: 0;
      left: 0;
    }

    &--centered {
      align-items: center;
      justify-content: center;
    }

    &--surround {
      &::after {
        border-width: var(--border-width-base, $border-width-base);
      }
    }

    &--horizontal {
      flex-direction: row;

      .#{$component-prefix}grid-item__icon + .#{$component-prefix}grid-item__text {
        margin-top: 0;
        margin-left: var(--padding-xs, $padding-xs);
      }
    }

    &--clickable {
      cursor: pointer;

      &:active {
        background-color: $grid-item-content-active-color;
      }
    }
  }
}
