/* CSS for UI elements (a.k.a. chrome) */

@import "variables.css";

#searchresults a,
.content a:link,
a:visited,
a > .hljs {
  color: var(--links);
}

/* Menu Bar */

#menu-bar,
#menu-bar-hover-placeholder {
  z-index: 101;
  margin: auto calc(0px - var(--page-padding));
}

#menu-bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 4px 0;
}

#menu-bar.sticky,
.js #menu-bar-hover-placeholder:hover + #menu-bar,
.js #menu-bar:hover,
.js.sidebar-visible #menu-bar {
  position: -webkit-sticky;
  position: sticky;
  top: 0 !important;
}

#menu-bar-hover-placeholder {
  position: sticky;
  position: -webkit-sticky;
  top: 0;
  height: var(--menu-bar-height);
}

#menu-bar i,
#menu-bar .icon-button {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  position: relative;
  color: var(--icon-button-color);
  z-index: 10;
  height: 40px;
  width: 40px;
  cursor: pointer;
  transition: all 0.2s;
}
#menu-bar i:hover,
#menu-bar .icon-button:hover {
  background: var(--icon-button-hover-color);
}
#menu-bar i:active,
#menu-bar .icon-button:active {
  background: var(--icon-button-active-color);
}

hr {
  border: none;
  height: 1px;
  background: var(--hr-bg);
}

.icon-button {
  border: none;
  background: none;
  padding: 0;
  color: var(--icon-button-color);
}

.icon-button i {
  margin: 0;
}

.right-buttons {
  display: flex;
  margin: 0 15px;
}

.right-buttons a {
  text-decoration: none;
}

.left-buttons {
  display: flex;
  margin: 0 5px;
}

.no-js .left-buttons {
  display: none;
}

.menu-title {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  font-weight: 400;
  font-size: 22px;
  line-height: var(--menu-bar-height);
  color: transparent;
  text-align: center;
  margin: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

.menu-title::after {
  content: "";
  background-image: url("https://playcover.io/static/media/play-cover.0e542de331f48c6bf8cf.png");
  border-radius: 8px;
  height: 34px;
  width: 34px;
  background-size: 34px 34px;
}

.js .menu-title {
  cursor: pointer;
}

.menu-bar,
.menu-bar:visited,
.nav-chapters,
.nav-chapters:visited,
.mobile-nav-chapters,
.mobile-nav-chapters:visited,
.menu-bar .icon-button,
.menu-bar a i {
  color: var(--icons);
}

.menu-bar i:hover,
.menu-bar .icon-button:hover,
.nav-chapters:hover,
.mobile-nav-chapters i:hover {
  color: var(--icons-hover);
}

/* Nav Icons */

.nav-chapters {
  display: none;

  font-size: 2.5em;
  text-align: center;
  text-decoration: none;

  position: fixed;
  top: 0;
  bottom: 0;
  margin: 0;
  max-width: 150px;
  min-width: 90px;

  transition: color 0.5s, background-color 0.5s;
}

.nav-chapters:hover {
  text-decoration: none;
  background-color: var(--theme-hover);
  transition: background-color 0.15s, color 0.15s;
}

.nav-wrapper {
  margin-top: 50px;
  display: none;
}

.mobile-nav-chapters {
  font-size: 2.5em;
  text-align: center;
  text-decoration: none;
  width: 90px;
  border-radius: 5px;
  background-color: var(--sidebar-bg);
}

.previous {
  float: left;
}

.next {
  float: right;
  right: var(--page-padding);
}

@media only screen and (max-width: 1080px) {
  .nav-wide-wrapper {
    display: none;
  }

  .nav-wrapper {
    display: block;
  }
}

@media only screen and (max-width: 1380px) {
  .sidebar-visible .nav-wide-wrapper {
    display: none;
  }

  .sidebar-visible .nav-wrapper {
    display: block;
  }
}

/* Inline code */

:not(pre) > .hljs {
  display: inline;
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

:not(pre):not(a) > .hljs {
  color: var(--inline-code-color);
  overflow-x: initial;
}

.hljs {
  background: var(--hljs-background-color) !important;
  border: 1px solid var(--table-border-color);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 10%);
  border-radius: 6px !important;
  color: var(--hljs-text-color) !important;
}

a:hover > .hljs {
  text-decoration: underline;
}

pre {
  position: relative;
}

pre > .buttons {
  position: absolute;
  z-index: 100;
  right: 0px;
  top: 2px;
  margin: 0px;
  padding: 2px 0px;

  color: var(--sidebar-fg);
  cursor: pointer;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.1s linear, opacity 0.1s linear;
}

pre:hover > .buttons {
  visibility: visible;
  opacity: 1;
}

pre > .buttons :hover {
  color: var(--sidebar-active);
  border-color: var(--icons-hover);
  background-color: var(--theme-hover);
}

pre > .buttons i {
  margin-left: 8px;
}

pre > .buttons button {
  cursor: inherit;
  margin: 0px 5px;
  padding: 3px 5px;
  font-size: 14px;

  border-style: solid;
  border-width: 1px;
  border-radius: 4px;
  border-color: var(--icons);
  background-color: var(--theme-popup-bg);
  transition: 100ms;
  transition-property: color, border-color, background-color;
  color: var(--icons);
}

@media (pointer: coarse) {
  pre > .buttons button {
    /* On mobile, make it easier to tap buttons. */
    padding: 0.3rem 1rem;
  }
}

pre > code {
  padding: 1rem;
}

/* FIXME: ACE editors overlap their buttons because ACE does absolute
   positioning within the code block which breaks padding. The only solution I
   can think of is to move the padding to the outer pre tag (or insert a div
   wrapper), but that would require fixing a whole bunch of CSS rules.
*/
.hljs.ace_editor {
  padding: 0rem 0rem;
}

pre > .result {
  margin-top: 10px;
}

/* Search */

#searchresults a {
  text-decoration: none;
}

mark {
  border-radius: 2px;
  padding: 0 3px 1px 3px;
  margin: 0 -3px -1px -3px;
  background-color: var(--search-mark-bg);
  transition: background-color 300ms linear;
  cursor: pointer;
}

mark.fade-out {
  background-color: rgba(0, 0, 0, 0) !important;
  cursor: auto;
}

.searchbar-outer {
  z-index: 1000;
  position: relative;
  margin-left: auto;
  margin-right: auto;
  max-width: var(--content-max-width);
  border-radius: 8px;
  margin-bottom: 40px;
}

.searchbar-outer::before {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: -2px;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  content: "\f002";
  font-family: "FontAwesome";
  color: var(--searchbar-icon-color);
}

#searchbar {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--searchbar-border-color);
  box-shadow: 0 1px 1px var(--searchbar-shadow-color);
  transition: all 0.2s;
  font-family: inherit;
  font-size: 14px;
  border-radius: 8px;
  background-color: var(--searchbar-bg);
  padding-left: 36px;
  outline: none;
  color: var(--searchbar-fg);
}
#searchbar:focus,
#searchbar.active {
  border-color: var(--searchbar-border-active);
  box-shadow: 0 0 0 3px var(--searchbar-shadow-active);
}

#searchbar::placeholder {
  color: var(--searchbar-placeholder-color);
}

.searchresults-header {
  align-items: center;
  gap: 8px;
  display: flex;
  color: var(--sidebar-part-text-color);
  font-family: "Roboto Mono";
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  margin: 20px 0;
}

.searchresults-header::after {
  flex-grow: 1;
  content: "";
  height: 1px;
  background: var(--sidebar-part-bg-color);
}

.searchresults-outer {
  margin-left: auto;
  margin-right: auto;
  max-width: var(--content-max-width);
  border-bottom: 1px solid var(--sidebar-part-border-color);
}

ul#searchresults {
  list-style: none;
  padding-left: 20px;
}

ul#searchresults li {
  margin: 10px 0px;
  padding: 2px;
  border-radius: 2px;
}

ul#searchresults li.focus {
  background-color: var(--searchresults-li-bg);
}

ul#searchresults span.teaser {
  display: block;
  clear: both;
  margin: 5px 0 0 20px;
  font-size: 0.8em;
}

ul#searchresults span.teaser em {
  font-weight: bold;
  font-style: normal;
}

/* Sidebar */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  padding: 0 14px;
  width: var(--sidebar-width);
  font-size: 0.875em;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: scroll;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 1px 1px 1px var(--sidebar-shadow);
  color: var(--sidebar-fg);
}

.sidebar-resizing {
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.js:not(.sidebar-resizing) .sidebar {
  transition: transform 0.3s;
  /* Animation: slide away */
}

.sidebar code {
  line-height: 2em;
}

.sidebar .sidebar-resize-handle {
  position: absolute;
  cursor: col-resize;
  width: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

.js .sidebar .sidebar-resize-handle {
  cursor: col-resize;
  width: 5px;
}

.sidebar-hidden .sidebar {
  transform: translateX(calc(0px - var(--sidebar-width)));
}

.sidebar-visible .page-wrapper {
  transform: translateX(var(--sidebar-width));
}

@media only screen and (min-width: 620px) {
  .sidebar-visible .page-wrapper {
    transform: none;
    margin-left: var(--sidebar-width);
  }
}

.chapter {
  list-style: none outside none;
  padding-left: 0;
  line-height: 2.2em;
}

.chapter li {
  display: block;
  color: var(--sidebar-non-existant);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  cursor: default;
}

.chapter li a,
.chapter li div {
  display: block;
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  word-break: break-word;
  transition: all 0.2s;
}
.chapter li a {
  color: var(--sidebar-fg);
}

.chapter li a:hover {
  background: var(--sidebar-hover-color);
}
.chapter li a:active {
  background: var(--sidebar-active-color);
}

.chapter a strong[aria-hidden="true"] {
  opacity: 0.5;
}

.chapter li a.active {
  background-color: var(--sidebar-active);
  color: var(--sidebar-text-active);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 10%);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 10%);
}
.chapter a.active strong[aria-hidden="true"] {
  opacity: 1;
}

.chapter li > a.toggle {
  cursor: pointer;
  display: block;
  margin-left: auto;
  padding: 0 10px;
  user-select: none;
  opacity: 0.68;
}

.chapter li > a.toggle div {
  transition: transform 0.5s;
}

/* collapse the section */
.chapter li:not(.expanded) + li > ol {
  display: none;
}

.chapter li.chapter-item {
  line-height: 1.5em;
}

.chapter li.expanded > a.toggle div {
  transform: rotate(90deg);
}

.spacer {
  width: 100%;
  height: 3px;
  margin: 5px 0px;
}

.chapter .spacer {
  background-color: var(--sidebar-spacer);
}

@media (-moz-touch-enabled: 1), (pointer: coarse) {
  .chapter li a {
    padding: 5px 0;
  }

  .spacer {
    margin: 10px 0;
  }
}

.section {
  padding-left: 20px;
}

blockquote strong {
  font-family: "Roboto Mono";
  font-size: 15px;
}
