/* layout-with-toc */

:root {
  --toc-layout-transition: 0.5s;

  --toc-list-padding: 10px;
  --toc-font-size: 14px;
  --toc-panel-bg: var(--color-bg-mac);
  --toc-panel-bg-hover: var(--color-bg-main);
  --toc-link-color: var(--color-text-lighter);
  --toc-active-link-color: var(--color-text-main);

  --toc-width: 330px;
  --toc-bar-width: 44px;
  --toc-button-height: 48px;
}

.layout-with-toc main {
  position: relative;
}

.layout-with-toc header.document-header {
  position: fixed;
  z-index: 1;
  top: 0;
  width: 100%;
  height: var(--toc-bar-width);

  display: flex;
  align-items: center;

  padding: var(--toc-font-size);
  padding-left: calc(var(--toc-bar-width) + var(--toc-bar-width));
  padding-right: calc(var(--toc-bar-width) + var(--toc-width));

  background-color: var(--toc-panel-bg);
  border-bottom: 2px solid var(--code-border-color);
  box-shadow: 0 24px 24px var(--toc-panel-bg);

  font-size: 1.6rem;
  font-weight: bold;
  margin: 0;
  color: var(--color-accent-dark);
}

.layout-with-toc article {
  margin: calc(var(--toc-bar-width) * 2);
  box-sizing: content-box;
}

.layout-with-toc article + article {
  margin-top: calc(var(--toc-bar-width) * (-1));
}

/* *** */

.section-number {
  font-size: 1em;
  padding-right: 0.25em;
}

.link-back-to-index {
  float: right;
  font-size: 14px;
  color: var(--color-text-lighter);
}

.link-back-to-index:hover {
  color: var(--color-text-main);
}


/* aside.toc */

.toc {
  position: fixed;
  z-index: 10;
  width: var(--toc-width);
  top: 0;
  bottom: 0;
}

.toc_header {
  position: absolute;
  padding:           var(--toc-font-size);
  padding-left: calc(var(--toc-font-size) * 1.75);
  top: 0;
  left: 0;
  right: 0;
  height: var(--toc-bar-width);
  background-color: var(--toc-panel-bg);
  border-bottom: 1px solid var(--code-border-color);
}

.toc_title {
  font-weight: bold;
}

.toc_container {
  position: absolute;
  top: var(--toc-bar-width);
  bottom: 0;
  left: 0;
  right: 0;
  padding-left:   calc(var(--toc-font-size) * 1.75);
  padding-right:  calc(var(--toc-font-size) * 1);
  padding-top:    calc(var(--toc-font-size) * 1);
  padding-bottom: calc(var(--toc-font-size) * 3);
  background-color: var(--toc-panel-bg);
  overflow: auto;
}

.toc_bar {
  position: absolute;
  left: 100%;
  top: 0;
  bottom: 0;
  width: var(--toc-bar-width);
  box-sizing: content-box;

  background-color: var(--toc-panel-bg);
  border-right: 4px solid var(--code-border-color);

  display: flex;
  flex-flow: column nowrap;
}

/* list */

.toc_list,
.toc_list ul,
.toc_list li {
  padding: 0;
  margin: 0;
  list-style: none;
}

.toc_list ul {
  padding-left: var(--toc-list-padding);
}

.toc_list li {
  padding-top: calc(var(--toc-font-size) * 0.75);
  font-size: var(--toc-font-size);
}

.toc_list a:link {
  color: var(--toc-link-color);
  text-decoration: none;
}

.toc_list a:visited {
  color: var(--toc-link-color);
  text-decoration: none;
}

.toc_list a:focus {
  background: yellow;
}

.toc_list a:hover {
  color: var(--toc-active-link-color);
  background-color: var(--toc-panel-bg-hover);
}

.toc_list a:active {
  background: yellow;
}

/* menu */

.toc_menu {
  display: flex;
  flex-flow: column nowrap;
  width: 100%;
}

.toc_menu-spacer {
  width: var(--toc-bar-width);
  height: var(--toc-bar-width);
}

.toc_menu-btn {
  display: flex;
  justify-content: center;
  align-items: center;

  width: var(--toc-bar-width);

  cursor: pointer;
}

a.toc_menu-btn {
  width: var(--toc-bar-width);
  height: var(--toc-button-height);
  font-size: 11px;
  font-weight: bold;
  text-decoration: none;
}

.btn-toggle {
  height: var(--toc-bar-width);
  font-size: 20px;
  font-weight: bold;
}

.toc_menu-btn:hover {
  background-color: var(--toc-panel-bg-hover);
}

body.document .btn-document,
body.document .btn-document:hover,
body.table .btn-table,
body.table .btn-table:hover,
body.traceability .btn-traceability,
body.traceability .btn-traceability:hover,
body.deep-traceability .btn-deep-traceability,
body.deep-traceability .btn-deep-traceability:hover {
  /* background-color: rgba(0,0,0,0.2); */
  background-color: var(--code-border-color);
  cursor: default;
}

/* open / close */

.layout-with-toc[data-state="close"] {
  transition: var(--toc-layout-transition);
  margin-left: 0;
}

.layout-with-toc,
.layout-with-toc[data-state="open"] {
  margin-left: var(--toc-width);
  transition: var(--toc-layout-transition);
}

.layout-with-toc[data-state="close"] .toc {
  left: calc(var(--toc-width) * (-1));
  right: 100%;
  transition: var(--toc-layout-transition);
}

.layout-with-toc .toc,
.layout-with-toc[data-state="open"] .toc {
  left: 0;
  right: auto;
  transition: var(--toc-layout-transition);
}

.layout-with-toc .btn-toggle::before,
.layout-with-toc[data-state="open"] .btn-toggle::before {
    /* ╳ */
  /* content: '\2573'; */
  /* ✕ */
  content: '\2715';
  /* × */
  /* content: '\00D7'; */
}

.layout-with-toc[data-state="close"] .btn-toggle::before {
  /* Ξ */
  /* content: '\039E'; */
  /* TRICOLON */
  /* content: '\205D'; */
  /* ≡ */
  /* content: '\2261'; */
  /* ☰ */
  content: '\2630';
}