.nut-grid-item {
  position: relative;
  box-sizing: border-box;
  color: $grid-item-text-color;

  $block: &;

  &-text {
    color: $grid-item-text-color;
    font-size: $grid-item-text-font-size;
    line-height: 1.5;
    word-break: break-all;
    margin: $grid-item-text-margin 0 0 0;
  }

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

    &-border {
      border-right-width: 1px;
      border-bottom-width: 1px;
    }

    &-surround {
      border-top-width: 1px;
      border-left-width: 1px;
    }

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

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

    &-reverse {
      flex-direction: column-reverse;

      #{$block}-text {
        margin: 0 0 $grid-item-text-margin;
      }
    }

    &-horizontal {
      flex-direction: row;

      #{$block}-text {
        margin: 0 0 0 $grid-item-text-margin;
      }
    }

    &-horizontal#{&}-reverse {
      flex-direction: row-reverse;

      #{$block}-text {
        margin: 0 $grid-item-text-margin 0 0;
      }
    }

    &-clickable {
      cursor: pointer;

      &::before {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 100%;
        height: 100%;
        background-color: $color-mask;
        border: inherit;
        border-color: $color-mask;
        border-radius: inherit;
        transform: translate(-50%, -50%);
        opacity: 0;
        content: ' ';
      }

      &:active::before {
        opacity: 0.1;
      }
    }
  }
}

[dir='rtl'] .nut-grid,
.nut-rtl .nut-grid {
  &-item {
    $block: &;

    &-content {
      &-border {
        border-right-width: 0;
        border-left-width: 1px;
      }

      &-surround {
        border-left-width: 0;
        border-right-width: 1px;
      }

      &-horizontal {
        .nut-grid-item-text {
          margin: 0 $grid-item-text-margin 0 0;
        }
      }

      &-horizontal.nut-grid-item-content-reverse {
        .nut-grid-item-text {
          margin: 0 0 0 $grid-item-text-margin;
        }
      }

      &-clickable {
        &::before {
          left: auto;
          right: 50%;
          transform: translate(50%, -50%);
        }
      }
    }
  }
}
