@layer components {
  /* One slide per page, with the controls along the bottom */
  .slideshow {
    display: grid;
    gap: var(--block-space-double);
    grid-template-rows: 1fr auto;
    padding-block-start: var(--block-space-double);

    #main:has(&) {
      display: grid;
    }
  }

  .slideshow__nav {
    align-items: center;
    display: grid;
    gap: var(--inline-space);
    grid-template-columns: 1fr auto 1fr;
  }

  .slideshow__back {
    justify-self: start;
  }

  /* Keeps to the middle column, including on pages with no Back */
  .slideshow__exit {
    grid-column: 2;
  }

  /* Keeps to the last column, so the controls hold their places on the final slide */
  .slideshow__next {
    grid-column: 3;
    justify-self: end;
  }

  .slide {
    align-content: center;
    align-items: center;
    display: grid;
    gap: var(--block-space-double) calc(var(--inline-space) * 6);
    inline-size: 100%;
    margin-inline: auto;
    max-inline-size: 70ch;
    text-align: start;
  }

  /* Text on the left and image on the right, stacked on narrow screens */
  .slide--with-image {
    max-inline-size: 140ch;

    @media (min-width: 800px) {
      grid-template-columns: 1fr 1fr;
    }
  }

  .slide__title {
    font-size: var(--text-xx-large);
    line-height: 1.15;
    margin: 0;
    text-wrap: balance;
  }

  .slide__body {
    font-size: var(--text-medium);

    p {
      margin-block: var(--block-space) 0;
    }
  }

  /* The whole image, never cropped, and never taller than most of the screen */
  .slide__image {
    border-radius: var(--radius);
    justify-self: center;
    max-block-size: 70dvh;
  }

  .slide-thumbnail {
    border-radius: var(--radius);
    margin-block: var(--block-space-half);
    max-block-size: 10rem;
  }
}
