If your Mac is showing as offline after rebooting the Mac then it might be because FileVault is enabled on the Mac. When Filevault is enabled, your disk is locked after a restart and nothing is allowed to run - not even the OS - until you enter your password at to unlock the disk. You will not be able to connect to the machine unless someone physically unlocks the disk. There are ways around this though, see the solution section below.
Determine if Filevault is enabled on your Mac
Open up System Preferences -> Security & Privacy -> FileVault. If Filevault is enabled you should see a message saying that "Filevault is turned on for the disk".
Solution 1 (Recommended): Use authenticated restarts when restarting the Mac remotely
If you want to restart the machine remotely, don't restart it from Finder. Instead use the authenticated restart sequence. This has to be done on the remote machine using the Terminal app. Open up the Terminal app and enter the following command and press enter:
sudo fdesetup authrestart
You will be asked for your user name and password. Once you enter this, the mac will immediately reboot and you should be able to connect.
Solution 2 (Not recommend): Turn off FileVault
On your Mac: System Preferences -> Security & Privacy -> FileVault. Click the lock icon, enter your password and turn click 'Turn Off FileVault'.