@import './skiff-vars.css';

.skiff-image-view {
  clear: both;
  display: inline-block;
  line-height: 0;
  margin: 0 2px; /* This should be synced to the constant IMAGE_MARGIN in JS. */
  max-width: 100%;
  text-align: center;
  vertical-align: baseline;
}

.skiff-image-view.ProseMirror-selectednode {
  outline: none;
}

.skiff-image-view.align-left {
  float: left;
  margin: 0 40px 20px 0;
}

.skiff-image-view.align-right {
  float: right;
  margin: 0 0 20px 40px;
}

.skiff-image-view.align-center {
  clear: both;
  display: block;
  float: none;
  margin: 20px 0;
}

.skiff-image-view-body-img-clip {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  position: relative;
}

.skiff-image-view-body {
  clear: both;
  display: inline-block;
  max-width: 100%;
  position: relative;
  z-index: 1;
}

.skiff-image-view-body.loading::before {
  animation: skiff_animation_blink normal 800ms infinite ease-in-out;
  background: #cdcdcd;
  bottom: 0;
  content: '';
  cursor: wait;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 3;
}

.skiff-image-view-body.error::before {
  background: #fff;
  outline: solid 1px #cdcdcd;
  bottom: 0;
  content: '';
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 3;
}

.skiff-image-view-body .skiff-icon.error {
  color: red;
  left: 50%;
  position: absolute;
  top: 50%;
  z-index: 4;
  margin: -11px 0 0 -11px;
  font-size: 22px;
}

.skiff-image-view-body.selected::after {
  /* simulated selection highlight */
  background: var(--skiff-selection-highlight-color-dark);
  bottom: 0;
  content: '';
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 2;
}

.skiff-image-view-body.active.selected::after {
  /* hide the highlight so user can resize the image easily. */
  display: none;
}

.skiff-image-view-body.active {
  background: transparent;
  box-shadow: 0 0 0 2px var(--skiff-selection-highlight-color-dark);
}

@media only print {
  .skiff-image-view-body.active {
    box-shadow: none;
  }
}

@keyframes skiff_animation_blink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}
