/* ------------------------------------------------------------------
 * BSim help -- "On this page" panel (right hand side) plus the compact
 * prev/next pagination that replaces the oversized absolute arrows when
 * the panel is visible.
 *
 * NOTE: the HonKit theme sets `html { font-size: 62.5% }`, so 1rem = 10px.
 * All sizes are written in px on purpose.
 * ------------------------------------------------------------------ */

.page-toc {
  display: none;               /* shown from 1200px upwards, see below */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

.page-toc h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: #17181c;
}

.page-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid #e2e4e9;
}

.page-toc li {
  list-style: none;
  margin: 0;
}

.page-toc a {
  display: block;
  margin-left: -1px;
  padding: 2px 8px;
  font-size: 13px;
  line-height: 1.4;
  color: #6b7280;
  text-decoration: none;
  overflow-wrap: anywhere;
  border-left: 1px solid transparent;
}

.page-toc a:hover {
  color: #17181c;
  text-decoration: none;
}

.page-toc li.page-toc-h3 > a {
  padding-left: 24px;
}

.page-toc a[aria-current="true"] {
  color: #2b5fc7;
  font-weight: 600;
  border-left-color: #2b5fc7;
}

/* ---- related topics ----------------------------------------------- */

.page-toc h2.page-toc-related-title {
  margin-top: 20px;
}

.page-toc ul.page-toc-related {
  border-left: 0;
}

.page-toc ul.page-toc-related > li > a {
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
  color: #2b5fc7;
}

.page-toc ul.page-toc-related > li > a:hover {
  text-decoration: underline;
}

/* ---- compact prev/next pagination -------------------------------- */

.page-inner > .page-pagination {
  margin-top: 24px;
}

.page-inner > .page-pagination::after {
  content: "";
  display: table;
  clear: both;
}

.page-inner > .page-pagination .page-pagination-label {
  display: none;
}

body.with-search .page-toc,
body.with-search .page-inner > .page-pagination {
  display: none !important;
}

/* ---- desktop layout ---------------------------------------------- */

@media screen and (min-width: 1200px) {
  .book .book-body .body-inner .page-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
  }

  .book .book-body .body-inner .page-wrapper > .page-inner {
    flex: 1 1 800px;
    min-width: 0;
    max-width: 800px;
    margin: 0;
  }

  .book .book-body .body-inner .page-wrapper > .page-toc {
    display: block;
    visibility: visible;
    flex: 0 0 220px;
    width: 220px;
    align-self: flex-start;
    position: -webkit-sticky;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    margin: 24px 16px 0 24px;
  }

  .page-inner > .page-pagination {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 16px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e2e4e9;
  }

  .page-inner > .page-pagination .page-pagination-label {
    display: inline;
  }

  .page-inner > .page-pagination > a.navigation {
    position: static;
    top: auto;
    bottom: auto;
    right: auto;
    left: auto;
    float: none;
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    align-content: center;
    justify-content: flex-start;
    gap: 8px;
    width: auto;
    min-width: 0;
    max-width: 48%;
    margin: 0 !important;
    padding: 8px 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
      "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #3b3f47;
    text-align: left;
    background: #fff;
    border: 1px solid #e2e4e9;
    border-radius: 6px;
    transition: none;
  }

  .page-inner > .page-pagination > a.navigation:hover {
    color: #2b5fc7;
    border-color: #2b5fc7;
    text-decoration: none;
  }

  .page-inner > .page-pagination > a.navigation i {
    font-size: 16px;
    line-height: 1;
  }

  .page-inner > .page-pagination > a.navigation-next {
    margin-left: auto !important;
    justify-content: flex-end;
    text-align: right;
  }
}

@media screen and (min-width: 1200px) {
  /* the "Se også:" block now lives in the panel; hide the in-content copy */
  .markdown-section .page-related-src {
    display: none;
  }

  /* keeps the gutter reserved on pages that have no headings */
  .book .book-body .body-inner .page-wrapper > .page-toc.page-toc-empty {
    visibility: hidden;
  }
}

@media print {
  .page-toc,
  .page-inner > .page-pagination { display: none !important; }
}
