#sidenotes-toggle[type='checkbox'] {
  z-index: 2;
  position: fixed;
  top: 0;
  right: 0;
  visibility: hidden;
}

#sidenotes {
  font: var(--cs-tny);
  line-height: var(--fs-sml) / var(--lh-reg);
  margin-right: var(--ma-reg);
  min-width: 15rem;
  max-width: 16.5rem;
  position: relative;
  display: none;
}

#sidenotes.enabled {
  display: initial;
}

#sidenotes .sidenote {
  position:relative;
  width: -webkit-fill-available;
  width: 100%;
  margin-bottom: var(--ma-sml);
  z-index: 50;
  transition: all 200ms; 
}

#sidenotes.sidenote-hover .sidenote {
  opacity: 0.5
}

#sidenotes .sidenote label {
  display: block;
}

#sidenotes .sidenote a {
  color: var(--co-pri);
}

#sidenotes .sidenote a:hover {
  text-decoration: underline;
}

#sidenotes.sidenote-hover .sidenote.sidenote-hover {
  opacity: 1 !important
}

#sidenotes .sidenote-cover-switch {
  position: absolute;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 999;
}

#sidenotes .sidenote-container {
  position: relative;
  display: flex;
  flex-direction: column;
}

#sidenotes .fn-book img {
  float: left;
  max-width: 4rem;
  margin-right: var(--ma-sml);
}

#sidenotes .fn-image img {
  width: 100%;
  margin-bottom: var(--ma-tny);
}


#sidenotes .fn-video video {
  height: auto;
  width: 100%;
}

#sidenotes .ndc {
  border: 1px solid var(--co-pri);
  padding: 0.5rem;
}

#sidenotes.is-hovered .sidenote {
  opacity: 0.2;
  filter: grayscale(1)
}
#sidenotes.is-hovered .sidenote.hover,
#sidenotes .sidenote:hover {
  opacity: 1;
  filter: grayscale(0) !important;
}


@media screen and (max-width: 990px) {
  #sidenotes {
    min-width: 13rem;
  }
}

@media screen and (max-width: 769px) {
  #sidenotes {
    opacity: 0.5;
    min-width: 12rem;
  }

  #sidenotes-toggle[type='checkbox']:checked ~ #document #sidenotes {
    opacity: 1;
  }
  

  #sidenotes .sidenote-cover-switch {
    display: initial;
  }

  #sidenotes-toggle[type='checkbox']:checked ~ #document article content .clear-toc-toggle {
    display: none;
  }

  #sidenotes-toggle[type='checkbox']:checked ~ #document article content,
  #sidenotes .sidenote-cover-switch .clear-sidenotes-toggle {
    display: block;
  }
}

@media screen and (max-width: 480px) {
  #sidenotes {
    min-width: 13rem;
  }
}