#img-gallery-view figure {
  display: inline-block;
  margin: 2px;
  border: 0;
  padding: 8px;
  width: 190px;
  height: 140px;
  font-size: 16px;
}

@media screen and (max-width: 1008px) {
  #img-gallery-view figure {
    margin: 1.5px;
    padding: 6px;
    width: 145px;
    height: 105px;
    font-size: 14px;
  }
}

@media screen and (max-width: 640px) {
  #img-gallery-view figure {
    margin: 1px;
    padding: 4px;
    width: 110px;
    height: 80px;
    font-size: 12px;
  }
}

#img-gallery-view figure div {
  position: relative;
  width: 100%;
  height: calc(100% - 1em);
}

#img-gallery-view figure img,
#img-gallery-view figure audio,
#img-gallery-view figure video {
  position: absolute;
  display: block;
  margin: auto;
  border: 0;
  padding: 0;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  max-width: 100%;
  max-height: 100%;
}

#img-gallery-view figure audio,
#img-gallery-view figure video {
  cursor: default;
}

#img-gallery-view figure a {
  display: block;
  margin: auto;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  text-decoration: none;
}

#img-gallery-view figure a:hover {
  text-decoration: underline;
}

#img-gallery-view .icon {
  background-size: 2em;
}

.previewer {
  position: fixed;
  z-index: 2015;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, .9);
}

.previewer-toolbar {
  position: absolute;
  z-index: 8;
  left: 0;
  top: 0;
  width:100%;
  height: 2.5em;
  background-color: rgba(0, 0, 0, 0.5);
  text-align: right;
  white-space: nowrap;
  overflow: auto;
}

.previewer-toolbar button {
  display: inline-block;
  margin: .25em;
  border: 0;
  padding: 0;
  font-size: 1.5em;
  line-height: 1;
  vertical-align: middle;
  font-weight: bolder;
  color: rgba(216, 216, 216, .9);
  background: none;
  text-shadow: .5em .5em 1em black;
}

.previewer-toolbar button:hover,
.previewer-toolbar button:focus {
  color: #FFF;
}

.previewer-infobar {
  position: absolute;
  z-index: 7;
  display: none;
  left: 0;
  right: 0;
  top: 100%;
  bottom: 0;
  width: 100%;
  height: 15%;
  min-height: 2em;
  transform: translateY(-100%);
  overflow: auto;
  background-color: rgba(255, 255, 255, .9);
}

.previewer.show-infobar .previewer-infobar,
.previewer figure[data-type="file"] ~ .previewer-infobar,
.previewer figure[data-type="dir"] ~ .previewer-infobar,
.previewer figure[data-type="link"] ~ .previewer-infobar {
  display: block;
}

.previewer-infobar a {
  display: block;
  margin: auto;
  padding: .5em;
  width: -moz-fit-content;
  width: fit-content;
  word-break: break-all;
}

.previewer-tooltip {
  position: absolute;
  z-index: 9;
  border-radius: 1em;
  padding: .5em 1em;
  left: 50%;
  top: 50%;
  background-color: rgba(0, 0, 0, .8);
  color: #FFF;
  transform: translateX(-50%) translateY(-50%);
  width: -moz-fit-content;
  width: fit-content;
}

.previewer figure {
  display: block;
  position: relative;
  left: 0;
  top: 2.5em;
  right: 0;
  bottom: 0;
  margin: auto;
  border: 0;
  padding: 0;
  width: 100%;
  height: calc(100% - 2.5em);
}

.previewer figure div.icon,
.previewer figure img,
.previewer figure audio,
.previewer figure video {
  position: relative;
  display: block;
  margin: 0;
  border: 0;
  padding: 0;
  left: 50%;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
  max-width: 100%;
  max-height: 100%;
}

.previewer figure div.icon {
  width: 100%;
  height: 100%;
  background-size: 2em;
  background-color: rgba(255, 255, 255, .3);
}

.previewer figure audio {
  width: 100%;
  height: 100%;
}
