/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

@import '../custom.less';
@import './vars.less';

@image-prefix-cls: ~'@{css-prefix}image';

.@{image-prefix-cls} {
  .component-css-vars-image();

  position: relative;
  display: inline-block;
  overflow: hidden;

  &__inner {
    vertical-align: top;

    &-center {
      position: relative;
      top: 50%;
      left: 50%;
      -webkit-transform: translate(-50%, -50%);
      transform: translate(-50%, -50%);
      display: block;
    }
  }

  &__error {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: var(--ti-image-error-font-size);
    color: var(--ti-image-error-text-color);
    vertical-align: middle;
  }

  &__preview {
    cursor: pointer;
  }

  &__error,
  &__placeholder {
    background: var(--ti-image-error-bg-color);
  }

  &__error {
    background: url(../images/image-error.jpg) no-repeat center/50%;
    background-color: var(--ti-image-error-bg-color);
  }

  &__error,
  &__inner,
  &__placeholder {
    width: 100%;
    height: 100%;
  }
}

.viewer-fade-enter-active {
  animation: viewer-fade-in 0.3s;
}

.viewer-fade-leave-active {
  animation: viewer-fade-out 0.3s;
}

@keyframes viewer-fade-in {
  0% {
    -webkit-transform: translate3d(0, -20px, 0);
    transform: translate3d(0, -20px, 0);
    opacity: 0;
  }

  100% {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@keyframes viewer-fade-out {
  0% {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }

  100% {
    -webkit-transform: translate3d(0, -20px, 0);
    transform: translate3d(0, -20px, 0);
    opacity: 0;
  }
}
