.reading-mode-buttons {
  --reading-mode-button-alignment: flex-start;

  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  justify-content: var(--reading-mode-button-alignment);
  // width: max-content;
  // max-width: 100% !important;

  & > span {
    margin: 5px 7px;

    &:first-child {
      margin-left: 0;
    }

    &:last-child {
      margin-right: 0;
    }

  }

  &:empty {
    display: none;
  }

}

.reading-mode-button {
  --reading-mode-bg-color: -webkit-linear-gradient(-90deg, rgb(255, 255, 255) 0%, rgb(221, 221, 221) 100%);
  --reading-mode-text-color: #2F80ED;
  --reading-mode-button-size: 40px;

  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all .2s ease-in-out;
  background: var(--reading-mode-bg-color);
  color: var(--reading-mode-text-color);
  line-height: 1;
  user-select: none;
  height: var(--reading-mode-button-size);
  padding: 9px 10px;
  position: relative;
  font-size: 14px;
  font-weight: normal;
  box-sizing: border-box;

  &-wrap {
    display: inline-flex;
  }

  .reading-mode-icon-wrap {
    width: 18px;
    aspect-ratio: 1;
    margin-right: 10px;
    box-sizing: border-box;
  }

  .reading-mode-icon-only{
    margin-right: 0;
  }

  &__icon {
    width: 100%;
    height: 100%;
    display: block;
    transition: all .2s ease-in-out;

    &:not(.custom-icon) {
      mask: var(--reading-mode-icon);
      background-color: var(--reading-mode-text-color);
    }
  }

  &__text {
    white-space: nowrap;
  }

  &:hover {
    background: var(--reading-mode-bg-darker);
  }

  &.style-default {
    background: var(--reading-mode-bg-color);
    color: var(--reading-mode-text-color);
    border: 1px solid rgb(222, 222, 222);
    border-radius: 3px;

    &:hover {
      opacity: .8;
    }
  }

  &.style-solid {
    background: var(--reading-mode-bg-color);
    border-radius: 3px;

    &:hover {
      background: var(--reading-mode-bg-darker);
    }
  }

  &.style-outline {
    border: 2px solid var(--reading-mode-text-color);
    border-radius: var(--reading-mode-button-size);
    background: transparent;
    color: var(--reading-mode-text-color);

    .reading-mode-button__icon {
      &:not(.custom-icon) {
        background-color: var(--reading-mode-text-color);
      }
    }

    &:hover {
      background: var(--reading-mode-text-color);
      color: #FFF;

      .reading-mode-button__icon {
        &:not(.custom-icon) {
          background-color: #FFF;
        }
      }
    }
  }

  &.style-shadow {
    border-radius: 3px;
    box-shadow: inset 0 0 0 0 var(--reading-mode-bg-darker), 0 3px 0 0 var(--reading-mode-bg-darker);

    &:hover {
      color: #FFF;
      box-shadow: inset 0 calc(0px - var(--reading-mode-button-size)) 0 0 var(--reading-mode-bg-darker), 0 3px 0 0 var(--reading-mode-bg-darker);

      .reading-mode-button__icon {
        &:not(.custom-icon) {
          background-color: #FFF;
        }
      }

    }
  }

  &.style-shadow-alt {
    background: transparent;
    color: var(--reading-mode-bg-color);
    box-shadow: inset 0 0 0 0 var(--reading-mode-bg-color), 0 3px 0 0 var(--reading-mode-bg-color), 0px 0px 5px 0px rgb(0 0 0 / 13%);
    border-radius: 5px;

    .reading-mode-button__icon {
      &:not(.custom-icon) {
        background-color: var(--reading-mode-bg-color);
      }
    }

    &:hover {
      background: transparent;
      color: var(--reading-mode-text-color);
      box-shadow: inset 0 calc(0px - var(--reading-mode-button-size)) 0 0 var(--reading-mode-bg-color), 0 3px 0 0 var(--reading-mode-bg-color);

      .reading-mode-button__icon {
        &:not(.custom-icon) {
          background-color: var(--reading-mode-text-color);
        }
      }
    }

  }

  &.style-icon {
    border-radius: 7px;
    border: 2px solid var(--reading-mode-bg-color);
    background: transparent;
    color: var(--reading-mode-bg-color);
    padding: 0;
    padding-right: 10px;
    overflow: hidden;

    .reading-mode-icon-wrap {
      width: var(--reading-mode-button-size);
      padding: 10px;
      background: var(--reading-mode-bg-color);

      &:after {
        content: "";
        background: var(--reading-mode-bg-color);
        width: 0;
        height: 100%;
        position: absolute;
        top: 0;
        left: var(--reading-mode-button-size);
        z-index: 1;
        transition: all .3s ease-in-out;
      }
    }

    &__icon {
      &:not(.custom-icon) {
        background-color: var(--reading-mode-text-color);
      }
    }

    &:hover {
      color: var(--reading-mode-text-color);

      .reading-mode-icon-wrap {
        &:after {
          width: 100%;
        }
      }

      .reading-mode-button__text {
        position: relative;
        z-index: 2;
      }
    }
  }

  &.style-icon-alt {
    border-radius: 7px;
    color: var(--reading-mode-text-color);
    padding: 0;
    padding-right: 10px;
    overflow: hidden;

    .reading-mode-icon-wrap {
      width: var(--reading-mode-button-size);
      padding: 10px;
      background: var(--reading-mode-bg-darker);

      &:after {
        content: "";
        background: var(--reading-mode-bg-darker);
        width: 0;
        height: 100%;
        position: absolute;
        top: 0;
        left: var(--reading-mode-button-size);
        z-index: 1;
        transition: all .3s ease-in-out;
      }
    }

    &__icon {
      &:not(.custom-icon) {
        background-color: var(--reading-mode-text-color);
      }
    }

    &:hover {
      background: var(--reading-mode-bg-color);

      .reading-mode-icon-wrap {
        &:after {
          width: 100%;
        }
      }

      .reading-mode-button__text {
        position: relative;
        z-index: 2;
      }
    }
  }

  &.style-icon.reading-mode-icon-only,
  &.style-icon-alt.reading-mode-icon-only{
    padding-right: 0;
  }

  &.size-small {
    --reading-mode-button-size: 30px;
    padding: 7px 10px;
    font-size: 13px;

    .reading-mode-icon-wrap {
      width: 15px;
      margin-right: 7px;
    }

    &.style-icon,
    &.style-icon-alt {
      padding: 0;
      padding-right: 7px;

      .reading-mode-icon-wrap {
        width: var(--reading-mode-button-size);
        padding: 7px;
      }
    }

  }

  &.size-large {
    --reading-mode-button-size: 50px;
    padding: 15px 20px;
    font-size: 18px;

    .reading-mode-icon-wrap {
      width: 25px;
      margin-right: 15px;
    }

    &.style-icon,
    &.style-icon-alt {
      padding: 0;
      padding-right: 15px;

      .reading-mode-icon-wrap {
        width: var(--reading-mode-button-size);
        padding: 12px;
      }
    }
  }

  @media (max-width: 767px) {
    --reading-mode-button-size: 30px;
    padding: 7px 10px;
    font-size: 13px;

    .reading-mode-icon-wrap {
      width: 15px;
      margin-right: 7px;
    }

    &.style-icon,
    &.style-icon-alt {
      padding: 0;
      padding-right: 7px;

      .reading-mode-icon-wrap {
        width: var(--reading-mode-button-size);
        padding: 7px;
      }
    }


    &.size-small {
      --reading-mode-button-size: 25px;
      padding: 5px 8px;
      font-size: 11px;

      .reading-mode-icon-wrap {
        width: 12px;
        margin-right: 5px;
      }

      &.style-icon,
      &.style-icon-alt {
        padding: 0;
        padding-right: 5px;

        .reading-mode-icon-wrap {
          width: var(--reading-mode-button-size);
          padding: 5px;
        }
      }

    }

    &.size-large {
      --reading-mode-button-size: 40px;
      padding: 12px 15px;
      font-size: 15px;

      .reading-mode-icon-wrap {
        width: 20px;
        margin-right: 12px;
      }

      &.style-icon,
      &.style-icon-alt {
        padding: 0;
        padding-right: 12px;

        .reading-mode-icon-wrap {
          width: var(--reading-mode-button-size);
          padding: 10px;
        }
      }
    }


  }
}