.center-xy() {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.dsm-vc-preview-expanded {
  position: fixed;
  .center-xy();
  z-index: 999;
  width: 100vw;
  height: 100vh;
  background: rgb(0 0 0 / 80%);
  font-size: 160%;
}

.dsm-vc-preview-inner {
  margin-top: 5px;
  // display: flex used to vertically stretch + center .dsm-vc-preview-carousel
  display: flex;

  .dsm-vc-preview-expanded & {
    position: absolute;
    .center-xy();
    width: 80%;
    height: 80%;
    padding: 20px;
    background: white;
    border-radius: 5px;
  }
}

.dsm-vc-preview-carousel {
  width: 100%;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;

  .dsm-vc-preview-expanded & {
    display: flex;
    align-items: center;
    // @width-center: 10fr;
    // @width-side: 4fr;
    // @height-side: ((@width-center - @width-side)/2);
    // grid-template-columns: @width-side @width-center @width-side;
    // grid-template-rows: @height-side @width-side @height-side;
  }

  & > div {
    position: relative;

    & > img {
      width: 100%;
      height: 100%;
      border-radius: 5px;
      box-shadow: 0px 1px 5px 0 rgb(0 0 0 / 20%);
    }
  }
}

.dsm-vc-preview-prev-frame {
  grid-column: 1;
  grid-row: 2;

  .dsm-vc-preview-expanded & {
    order: 1;
    flex: 1;
  }
}

.dsm-vc-preview-next-frame {
  grid-column: 2;
  grid-row: 2;

  .dsm-vc-preview-expanded & {
    order: 3;
    flex: 1;
  }
}

.dsm-vc-preview-current-frame {
  grid-column: 1 / span 2;
  grid-row: 1;

  .dsm-vc-preview-expanded & {
    order: 2;
    flex: 3;
  }
}

.dsm-vc-preview-wrapped-frame {
  filter: brightness(75%);
}

.dsm-vc-preview-index {
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 4px;
  color: black;
  text-shadow:
    -1px -1px 0 white,
    1px -1px 0 white,
    -1px 1px 0 white,
    1px 1px 0 white;
}

.oversetbutton() {
  position: absolute;
  padding: 5%;
  color: white;
  text-shadow: 0.5px 1px 3px rgb(0 0 0 / 80%);
  font-size: 160%;
}

.dsm-vc-preview-expand {
  .oversetbutton();
  top: 0;
  left: 0;
}

.dsm-vc-preview-play-pause {
  .oversetbutton();
  bottom: 0;
  right: 0;
}

.dsm-vc-remove-frame {
  .oversetbutton();
  top: 0;
  right: 0;
}

.dsm-vc-exit-expanded {
  position: absolute;
  color: rgb(0 0 0 / 20%);
  font-size: 160%;
  padding: 20px;
  top: 0;
  right: 0;
}

.dcg-container.dcg-inverted-colors {
  // In 2d, the images truly are inverted, so invert it back.
  // In 3d, the images are not inverted, but Desmos doesn't
  // add an extra invert filter, so this is the original invert.
  .dsm-vc-preview-carousel img {
    filter: invert(100%);
  }
}
