.c-reveal {
  position: relative;
  aspect-ratio: 16 / 10;
}

.c-reveal__cover {
  position: absolute;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 2;
  background-color: var(--color-bg);
  transform: translate3d(0px, 0px, 0px) scale(0, 1);
  transition-duration: var(--duration-800);
  transform-origin: right top;
  transition-timing-function: var(--ease-out-cubic);
}

.c-reveal__shade {
  position: absolute;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 2;
  transform: scale(0, 1);
  animation-duration: var(--duration-1500);
  animation-delay: var(--duration-200);
  background-color: var(--color-bg-inverse);
  transition-timing-function: var(--ease-in-out-expo);
  transform-origin: left top;
  animation-fill-mode: forwards;
}

.c-reveal__cover + img {
  object-fit: cover;
  display: block;
  position: absolute;
  opacity: 1;
  left: 0;
  z-index: 0;
}

.c-reveal__shade + img {
  object-fit: cover;
  display: block;
  position: absolute;
  left: 0;
  z-index: 0;
  animation-duration: var(--duration-1500);
  animation-delay: var(--duration-200);
  transition-timing-function: var(--ease-in-out-expo);
  animation-fill-mode: forwards;
}

.c-reveal__cover + picture img {
  object-fit: cover;
  display: block;
  position: absolute;
  opacity: 1;
  left: 0;
  z-index: 0;
}

.c-reveal__cover-next {
  position: absolute;
  top: 55%;
  right: 0;
  overflow: hidden;
  z-index: 5;
  background-color: var(--color-bg);
  transition-delay: .1s;
  transform: translate3d(0px, 0px, 0px) scale(0, 1);
  transition-duration: var(--duration-800);
  transform-origin: right top;
  transition-timing-function: var(--ease-out-cubic);
}

.c-reveal__cover-next + img {
  z-index: 4;
}

.c-reveal__shade + picture img {
  animation-duration: var(--duration-1500);
  animation-delay: var(--duration-200);
  transition-timing-function: var(--ease-in-out-expo);
  animation-fill-mode: forwards;
}

/* Hidden start states apply only when JS has opted in (html.has-reveal), and never in print. */
.has-reveal .c-reveal__cover,
.has-reveal .c-reveal__cover-next {
  @media screen {
    transform: translate3d(0px, 0px, 0px) scale(1, 1);
  }
}

.has-reveal .c-reveal__cover.is-active,
.has-reveal .c-reveal__cover-next.is-active {
  transform: translate3d(0px, 0px, 0px) scale(0, 1);
}

.has-reveal .c-reveal__shade + img,
.has-reveal .c-reveal__shade + picture img {
  @media screen {
    opacity: 0;
  }
}

.has-reveal .c-reveal__shade.is-active {
  animation-name: blackHide;
}

.has-reveal .c-reveal__shade.is-active + img,
.has-reveal .c-reveal__shade.is-active + picture img {
  animation-name: blackImage;
}

.c-reveal--wide {
  aspect-ratio: 7 / 4;
}

.c-reveal--pair {
  aspect-ratio: auto;
}

.c-reveal:not(.c-reveal--pair) > img {
  inset: 0;
  width: 100%;
  height: 100%;
}

.c-reveal--pair .c-reveal__cover,
.c-reveal--pair .c-reveal__cover-next {
  width: calc(300 / 520 * 100%);
  height: 100%;
}

@keyframes blackHide {
  0% {
    transform: scale(0, 1);
    transform-origin: left top;
  }
  25% {
    transform: scale(1, 1);
    transform-origin: left top;
  }
  50% {
    transform: scale(1, 1);
    transform-origin: right bottom;
  }
  75% {
    transform: scale(0, 1);
    transform-origin: right bottom;
  }
  100% {
    transform: scale(0, 1);
  }
}

@keyframes blackImage {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 0;
  }
  51% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}
