@media only screen and (max-width: 1439px) {
  .sidetoc {
    display: none;
  }
}

@media only screen and (min-width: 1440px) {
  main {
    position: relative;
  }
  .sidetoc {
    margin-left: auto;
    margin-right: auto;
    left: calc(100% + (var(--content-max-width)) / 4 - 160px);
    position: absolute;
  }
  .pagetoc {
    position: fixed;
    width: 200px;
    height: calc(100vh - var(--menu-bar-height) - 0.67em * 4);
    overflow: auto;
    line-hight: 1em;
    font-size: 0.8em;
  }
  .pagetoc a {
    border-left: 1px solid var(--sidebar-bg);
    color: var(--fg) !important;
    display: block;
    padding-bottom: 5px;
    padding-top: 5px;
    padding-left: 10px;
    text-align: left;
    text-decoration: none;
  }
  .pagetoc a:hover,
  .pagetoc a.active {
    background: var(--sidebar-bg);
    color: var(--sidebar-fg) !important;
  }
  .pagetoc .active {
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
  }
  .pagetoc .pagetoc-H2 {
    padding-left: 20px;
  }
  .pagetoc .pagetoc-H3 {
    padding-left: 30px;
  }
  .pagetoc .pagetoc-H4 {
    display: none;
  }
  .pagetoc .pagetoc-H5 {
    display: none;
  }
  .pagetoc .pagetoc-H6 {
    display: none;
  }
}

a[class^="pagetoc-H"]:only-child {
  display: none;
}
