@use "sass:color";

@use '@uppy/core/src/_variables.scss' as *;
@use '@uppy/core/src/_utils.scss' as *;

.uppy-Dashboard-Item-previewInnerWrap {
  // For :after positioning
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 3px;
  box-shadow: 0 0 2px 0 rgba($black, 0.4);

  .uppy-size--md & {
    box-shadow: 0 1px 2px rgba($black, 0.15);
  }

  .uppy-Dashboard--singleFile & {
    box-shadow: none;
  }
}

.uppy-Dashboard-Item-previewInnerWrap::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: $zIndex-2;
  display: none;
  background-color: rgba($black, 0.65);
  content: '';
}

.uppy-Dashboard-Item-previewLink {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: $zIndex-3;

  &:focus {
    box-shadow: inset 0 0 0 3px color.adjust($blue, $lightness: 20%, $space: hsl);
  }

  [data-uppy-theme='dark'] &:focus {
    box-shadow: inset 0 0 0 3px color.adjust($highlight--dark, $lightness: -20%, $space: hsl);
  }
}

.uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  // We need a repeated border-radius because of the transform.
  border-radius: 3px;
  // Fixes file previews being partially invisible in safari (for some pics only).
  // (https://stackoverflow.com/a/27971913/3192470)
  transform: translateZ(0);

  .uppy-Dashboard--singleFile & {
    object-fit: contain;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    padding: 10px;
  }
}
// ...uppy-Dashboard-Item-previewInnerWrap|
