.screenshot-carousel-panel {
  /* In cqw rather than %, so the same width works for the grid columns and for
     reserving the height below. */
  --item-width: calc(20cqw - (6 * var(--space-large)) / 7);
  /* The carousel is only built once every screenshot has preloaded. Reserve its
     height up front (item height plus the carousel's padding) so the page below
     does not jump down when it appears. */
  min-height: calc(var(--item-width) * 19.5 / 9 + var(--space-large) + var(--space-huge));

  .overlay-text {
    position: absolute;
    z-index: 1;
    font-size: min(15vw, 10rem);
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    pointer-events: none;

    .bg,
    .main {
      display: flex;
      justify-content: center;
      align-items: center;
      position: absolute;
      top: 0;
      left: 0;
      height: 100%;
      width: 100%;
    }

    .bg {
      opacity: 0.2;
      position: absolute;
      background: linear-gradient(to right, var(--turquoise), var(--purple));
      background-clip: text;
      color: transparent;
      transition: transform var(--transition) ease-in;
    }

    .main {
      position: relative;
      z-index: 1;
      color: #fffe;
      text-shadow: 0 0 50px #000;
      transition: opacity var(--transition) ease-in, transform var(--transition) ease-in;

      display: flex;
      flex-direction: column;
      gap: 0.4em;

      &:after {
        content: 'APP';
        font-size: 0.3em;
        line-height: 1;
        display: block;
        font-weight: 900;
        padding: 0.6rem 1.2rem 0.4rem;
        border-radius: 100px;
        background: var(--purple);
      }
    }
  }

  .carousel {
    padding-bottom: var(--space-huge);

    .items {
      grid-template-columns: repeat(21, var(--item-width));

      .item {
        aspect-ratio: 9 / 19.5;
        background: var(--bg-dark) center center no-repeat;
        background-size: cover;

        .caption {
          position: absolute;
          bottom: -2.5rem;
          left: 0;
          width: 100%;
          text-align: center;
          opacity: 0;
          pointer-events: none;
        }

        &:hover {
          box-shadow: 0 0 0 3px #fff4;

          .caption {
            opacity: 1;
          }
        }
      }
    }
  }

  &.loaded {
    .carousel {
      opacity: 0.5;
    }
  }

  &:hover {
    .carousel {
      opacity: 1;
    }

    .overlay-text {
      .bg-1 {
        transform: translateX(-100%);
      }

      .bg-2 {
        transform: translateX(100%);
      }

      .main {
        opacity: 0;
        transform: scale(1.3);
      }
    }
  }

  @media (max-width: 800px) {
    --item-width: calc(33.33cqw - (6 * var(--space-large)) / 7);

    .carousel {
      padding-bottom: var(--space-huge);

      .items {
        .item {
          .caption {
            font-size: 0.8rem;
          }
        }
      }
    }
  }
}