#sidebar {
  text-align: center;
  padding: 2rem 1rem;
  background-color: #f8f9fa;
}

#sidebar h2 {
  text-align: left;
  margin-bottom: 0;
}

/* Hide the blurb on a small screen */
#blurb {
  display: none;
}

#sidebar-toggle {
  display: none;
}

#collapse *:first-child {
  margin-top: 1rem;
}

/* add the three horizontal bars icon for the toggle */
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

#page-content {
  padding: 2rem 1rem;
}

@media (min-width: 48em) {
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 20rem;
    text-align: left;
    transition: margin 0.3s ease-in-out, padding 0.3s ease-in-out;
  }

  #sidebar-toggle {
    display: inline-block;
    position: relative;
    top: 0;
    transition: top 0.3s ease-in-out;
  }

  /* add negative margin to sidebar to achieve the collapse */
  #sidebar.collapsed {
    margin-left: -15.5rem;
    padding-right: 0.5rem;
  }

  /* move the sidebar toggle up to the top left corner */
  #sidebar.collapsed #sidebar-toggle {
    top: -2rem;
  }

  /* also adjust margin of page content */
  #sidebar.collapsed ~ #page-content {
    margin-left: 6.5rem;
  }

  /* move all contents of navbar other than header (containing toggle) further
     off-screen */
  #sidebar.collapsed > *:not(:first-child) {
    margin-left: -6rem;
    margin-right: 6rem;
  }

  /* reveal the blurb on a large screen */
  #blurb {
    display: block;
  }

  /* Hide the toggle on a large screen */
  #navbar-toggle {
    display: none;
  }

  #collapse {
    display: block;
  }

  /* set margins of the main content so that it doesn't overlap the sidebar */
  #page-content {
    margin-left: 22rem;
    margin-right: 2rem;
    transition: margin-left 0.3s ease-in-out;
  }
}
