.headingWrapper {
  display: flex;
  flex-direction: column;
  margin-top: 2rem;
  gap: 0.5rem;

  @media screen and (min-width: 1024px) {
    grid-column: span 2;
    margin-top: 1.5rem;
  }

  .back {
    align-items: center;
    color: var(--extra-light-body-color);
    display: flex;
    font-size: 15px;
    gap: 0.25rem;
    text-decoration: none;
    transition: color .3s;

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

      svg {
        fill: var(--light-body-color);
        transform: translateX(-0.25rem);
      }
    }

    svg {
      height: 0.75em;
      width: 0.75em;
      fill: var(--extra-light-body-color);
      transition: transform .3s, color .3s;
    }
  }
}

.heading {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  
  @media screen and (min-width: 1024px) {
    align-items: center;
    flex-direction: row;
    gap: 1.5rem;
    grid-column: span 2;
  }

  h1 {
    font-family: var(--font-headline);
    font-size: rfs(3.5rem);
    margin: 0;
  }

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

.pill {
  background-color: var(--light-bg-color);
  border-radius: 2rem;
  color: var(--light-body-color);
  display: inline-block;
  font-size: 15px;
  padding: 0.2rem 0.825rem;
  white-space: nowrap;

  &.isLight {
    background-color: #fff;
  }

  &.isDark {
    background-color: var(--base-body-color);
    color: #fff;
  }
}

.video {
  background-color: var(--light-bg-color);
  border-radius: 0.5rem;
  overflow: hidden;
  width: 100%;

  @media screen and (min-width: 1024px) {
    border-radius: 1rem;
    grid-template-columns: 1fr 2fr;
  }

  &:empty {
    aspect-ratio: 16/9;
  }
}

.container {
  display: grid;
  gap: 2.5rem;
  margin-top: 1rem;

  @media screen and (min-width: 1024px) {
    margin-top: 3rem;
    gap: 3rem;
    grid-template-columns: 1fr 380px;
  }
}

.contentVideo {
  margin-bottom: 40px;
}

.asideWrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;

  a {
    color: inherit;
    text-decoration: none;
  }
}

.aside {
  position: sticky;
  top: var(--page-margin);

  @media screen and (min-width: 1126px) {
    top: 100px;
  }
}

.asideCurrentChapter {
  background-color: var(--light-bg-color);
  border-radius: 0.5rem;
  overflow: auto;
  padding: 0 0 10px 0;
  scrollbar-width: none;

  &::-webkit-scrollbar {
    display: none;
  }

  @media screen and (min-width: 1024px) {
    border-radius: 1rem;
    max-height: calc(100dvh - var(--page-margin) * 2);
  }

  @media screen and (min-width: 1126px) {
    max-height: calc(100dvh - 100px - var(--page-margin));
  }
}

.asideHeadingWrapper {
  background: linear-gradient(180deg, var(--light-bg-color) 0%, var(--light-bg-color) 88%, transparent 100%); 
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 20px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.asideHeadingIntro {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.asideChapterLabel,
.otherChaptersLabel {
  color: var(--extra-light-body-color);
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  text-transform: uppercase;
}

.asideListTitle {
  font-size: 20px;
  margin: 0;

  @media screen and (min-width: 1024px) {
    font-size: 22px;
  }
}

.asideList {
  display: flex;
  flex-direction: column;
  font-size: 15px;
  list-style-type: none;
  margin: 0;
  overflow: hidden;
  padding: 0;
  transition: opacity .3s, padding .3s;

  @media screen and (max-width: 1023px) {
    &.isOpen {
      max-height: auto;
      opacity: 1;
      padding-bottom: 10px;
    }
  
    &.isClosed {
      opacity: 0;
      height: 0;
      padding-bottom: 0;
    }
  }
}

.asideListItem {
  a {
    align-items: center;
    display: grid;
    gap: 1rem;
    grid-template-columns: 70px 1fr;
    padding: 10px 20px;
    transition: background-color .3s;
    width: 100%;

    @media screen and (min-width: 768px) {
      grid-template-columns: 80px 1fr;
    }

    &:hover {
      background-color: #fff;

      h4 {
        color: var(--body-color);
      }
    }
  
    figure {
      background-color: #fff;
      border-radius: 3px;
      margin: 0;
      overflow: hidden;

      /* 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;
      }
    }

    h4 {
      color: var(--light-body-color);
      font-size: 15px;
      font-weight: 400;
      margin: 0;
      transition: color .3s;
    }
  }

  &.activeListItem {
    h4 {
      font-weight: bold;
      color: var(--body-color)
    }
  }
}

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

.mobileAccordionCta {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 10px 0;

  @media screen and (min-width: 1024px) {
    display: none;
  }

  .mobileAccordionCtaIcon {
    transition: transform .3s, opacity .3s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: .5;

    &:hover {
      opacity: 1;
    }

    &.isRotated {
      transform: rotate(180deg);
      transform-origin: center;
    }
  }
}

.otherChaptersWrapper {
  margin-top: 2rem;
  padding: 0 20px;
  display: none;

  @media screen and (min-width: 1024px) {
    display: block;
  }
}

.otherChaptersTitle {
  font-size: 22px;
  color: var(--extra-light-body-color);
  margin: 1.5rem 0;
}

.otherChapters {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.otherChaptersItem {
  display: flex;
  flex-direction: column;
  font-size: 22px;
  gap: 0.25rem;
  margin: 0;
  overflow: hidden;
}

.otherChaptersIntro {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.otherChaptersHeading {
  font-size: 18px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nextVideo {
  border-radius: 0.5rem;
  border: 1px solid var(--light-bg-color);
  margin-top: 4rem;
  padding: 20px;
  transition: border-color .3s;
  width: 100%;

  &:hover {
    border: 1px solid var(--border-color);
  }

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

  a {
    align-items: center;
    color: inherit;
    display: grid;
    gap: 1rem;
    text-decoration: none;
    
    @media screen and (min-width: 1024px) {
      grid-template-columns: 160px 1fr;
    }
  }

  figure {
    background-color: var(--light-bg-color);
    border-radius: 3px;
    display: none;
    margin: 0;
    overflow: hidden;

    @media screen and (min-width: 1024px) {
      display: block;
    }

    /* 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;
    }
  }

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

  h2 {
    font-size: 20px;
    margin: 0.25rem 0 0 0;

    @media screen and (min-width: 1024px) {
      font-size: 22px;
      margin: 0.25rem 0;
    }
  }
}