.allChapters {
  max-width: var(--page-width-with-margin);
  margin: 0 auto;

  @media screen and (min-width: 1200px) {
    max-width: calc(var(--page-width-with-margin) + var(--page-margin) * 2);
  }
}

.chapter {
  margin-bottom: 6rem;
  width: 100%;

  @media screen and (min-width: 768px) {
    margin-bottom: 9rem;
  }
}

.chapterIntroWrapper {
  align-items: flex-start;
  column-gap: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  margin-bottom: 2rem;
  padding: 0 var(--page-margin);
  row-gap: 0.75rem;
  width: 100%;

  @media screen and (min-width: 768px) {
    grid-template-columns: calc(50% + 0.375rem) 1fr;
    margin-bottom: 2rem;
  }

  @media screen and (min-width: 1200px) {
    padding: 0 calc(var(--page-margin) * 2);
  }

  p {
    color: var(--light-body-color);
    font-weight: 500;
    line-height: 1.3;
    margin: 0;
  }
}

.chapterIntro {
  align-items: center;
  display: flex;
  gap: 1rem;

  @media screen and (min-width: 768px) {
    grid-column: span 2;
  }
}

.chapterIntroHeading {
  font-family: var(--font-headline);
  font-size: rfs(3rem);
  line-height: 1.2;
  margin: 0;
}

.chapterIntroDescription {
  margin-top: 0.5rem;

  @media screen and (min-width: 768px) {
    margin-top: 1.25rem;
  }
}

.chapterNumber {
  color: var(--extra-light-body-color);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
}

.chapterIntroPills {
  display: flex;
  gap: 0.25rem;
}

.pill {
  align-items: center;
  background-color: var(--light-bg-color);
  border-radius: 2rem;
  color: var(--light-body-color);
  display: flex;
  font-size: 15px;
  gap: 0.5rem;
  padding: 0.2rem 0.825rem;

  svg {
    fill: var(--light-body-color);
  }
}

.chapterVideosWrapper {
  position: relative;
  margin-top: 2.5rem;

  @media screen and (min-width: 768px) {
    margin-top: 3rem;

    &::before,
    &::after {
      content: '';
      height: 100%;
      position: absolute;
      top: 0;
      width: var(--page-margin);
      z-index: 10;
  
      @media screen and (min-width: 1200px) {
        width: calc(var(--page-margin) * 2);
      }
    }
  
    &::before {
      background-image: linear-gradient(to right, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
      left: 0;
    }
  
    &::after {
      background-image: linear-gradient(to left, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
      right: 0;
    }
  }
}

/* only desktop */
.embla {
  display: none;
  
  @media screen and (min-width: 768px) {
    display: block;
    overflow: hidden;
    padding: 0 var(--page-margin);
  }

  @media screen and (min-width: 1200px) {
    padding: 0 calc(var(--page-margin) * 2);
  }

  &:hover {
    .prevSlide,
    .nextSlide {
      opacity: 1;
      pointer-events: all;
      
      &.isDisabled svg {
        opacity: 0.3;
      }
    }
  }
}

.emblaContainer {
  display: flex;
  gap: 0.75rem;
  cursor: grab;

  &:active {
    cursor: grabbing;
  }
}

.prevSlide,
.nextSlide {
  align-items: center;
  background-color: #fff;
  border-radius: 50%;
  box-shadow: var(--box-shadow);
  cursor: pointer;
  display: flex;
  height: 44px;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 30%;
  transition: opacity .3s, transform .3s;
  width: 44px;
  z-index: 20;
  transform: translateY(-50%);
}

.prevSlide {
  left: var(--page-margin);
  transform: translateX(-50%);

  @media screen and (min-width: 1200px) {
    left: calc(var(--page-margin) * 2);
    
    &:hover {
      transform: translateX(-50%) scale(1.1);
    }
  }
}

.nextSlide {
  right: var(--page-margin);
  transform: translateX(50%);

  @media screen and (min-width: 1200px) {
    right: calc(var(--page-margin) * 2);

    &:hover {
      transform: translateX(50%) scale(1.1);
    }
  }
}

/* only mobile */
.chapterVideosList {
  display: flex;
  gap: 1rem;
  padding: 0 var(--page-margin);
  flex-direction: column;
  
  @media screen and (min-width: 768px) {
    display: none;
  }
}

.chapterItem {
  align-items: center;
  display: grid;
  font-size: 15px;
  gap: 0.875rem;
  grid-template-columns: 90px 1fr;
  
  @media screen and (min-width: 768px) {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 25%;
    min-width: 240px
  }

  &:hover {
    a {
      color: var(--light-body-color);
    }

    .itemVideoImage {
      transform: scale(1.05);
    }
  }

  a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
  }

  h4 {
    font-weight: 600;
    margin: 0;
  }
}

.itemVideo {
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  width: 100%;
  background-color: var(--light-bg-color);

  @media screen and (min-width: 768px) {
    border-radius: 0.675rem;
  }

  /* ugly fix for weird wrappers in Nextjs 12 */
  &:empty {
    aspect-ratio: 1864 / 1080; 
  }

  a {
    overflow: hidden;
    display: block;
  }

  span {
    display: block !important;
    height: 100% !important;
  }
}

.itemVideoImage {
  height: 100%;
  object-fit: cover;
  transform-origin: top center;
  transition: transform 0.5s;
  width: 100%;
}

.videoDuration {
  color: var(--extra-light-body-color)
}
