:root {
  --background-primary: #1b1b1b;
  --background-secondary: #343434;
  --border-color: #4e4e4e;
  --text-primary: #fff;
  --code-color: #caf0f8;

  --default-border: 1px solid var(--border-color);

  --mobile-navbar-height: 4rem;

  --main-section-font-size: 1rem;
  --main-section-title-font-size: 2rem;
  --code-font-size: 1rem;
}

html {
  box-sizing: border-box;
  scroll-behavior: smooth;
}

*,
*::before,
*::after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
  /* outline: 1px solid white; */
}

body {
  font-family: sans-serif;
  line-height: 1.4;
  background-color: var(--background-primary);
  color: var(--text-primary);
}

a {
  text-decoration: none;
  color: inherit;
}

#toggle {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  z-index: 10;
}

#toggle::before,
#toggle::after {
  content: '';
  position: absolute;
  width: 1.6rem;
  height: 0.125rem;
  background-color: #fff;
  border-radius: 0.3rem;
}

#toggle::before {
  transform: translateY(-5px);
  transition: 0.3s;
}

#toggle::after {
  transform: translateY(5px);
  transition: 0.5s;
}

#toggle.active {
  background-color: var(--border-color);
}

#toggle.active::before {
  transform: translateY(0px) rotate(45deg);
}

#toggle.active::after {
  transform: translateY(0px) rotate(-45deg);
}

#navbar {
  position: sticky;
  top: 0;
  z-index: 9;
  width: 100%;
  background-color: var(--background-primary);
  color: var(--text-primary);
  border-bottom: var(--default-border);
}

#navbar header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
  font-size: 1.2rem;
  height: var(--mobile-navbar-height);
}

.navbar-links {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: -100vh;
  bottom: 0;
  z-index: 8;
  transition: 500ms ease-in-out;
  width: 100%;
  height: 70vh;
  background-color: var(--background-primary);
  overflow: auto;
}

.navbar-links.active {
  top: 0;
  background-color: var(--background-secondary);
}

.nav-link {
  text-align: center;
  color: var(--text-primary);
  border: var(--default-border);
  padding: 1.5rem 0.5rem;
}

.nav-link:hover {
  background-color: var(--background-secondary);
}

#main-doc {
  margin-bottom: calc(var(--mobile-navbar-height) + 2rem);
}

.main-section {
  padding: 0 1rem;
}

.main-section header {
  position: sticky;
  top: 0;
  padding-top: var(--mobile-navbar-height);
  background-color: var(--background-primary);
}

.main-section h2 {
  padding: 1rem 0;
  margin: 0 0 2rem 0.5rem;
  font-size: var(--main-section-title-font-size);
}

.main-section article {
  padding: 0rem 1rem;
}

.main-section p {
  margin-bottom: 2rem;
  font-size: var(--main-section-font-size);
}

.main-section ul {
  margin-left: 2rem;
}

.main-section li {
  margin-bottom: 1.5rem;
  font-size: var(--main-section-font-size);
}

.code-container {
  display: flex;
  justify-content: center;
  background-color: var(--background-secondary);
  color: var(--code-color);
  border-radius: 0.3rem;
  margin-bottom: 2rem;
}

.code-container pre {
  width: 100%;
  overflow: auto;
  padding: 1rem;
  font-size: var(--code-font-size);
}

@media screen and (min-width: 800px) {
  body {
    display: grid;
    grid-template-columns: minmax(10rem, 18rem) auto;
    gap: 1rem;
  }

  #toggle {
    display: none;
  }

  #navbar {
    height: 100vh;
    overflow: auto;
  }

  #navbar header {
    justify-content: center;
    text-align: center;
    position: sticky;
    top: 0;
    padding: 2rem 0;
    border-bottom: var(--default-border);
    background-color: var(--background-primary);
  }

  .navbar-links {
    position: unset;
    height: unset;
  }

  .nav-link {
    text-align: left;
    padding: 1.5rem;
  }

  .main-section:first-of-type header {
    padding-top: calc(var(--mobile-navbar-height) - 1rem);
  }

  .main-section header {
    padding: 0;
  }
}
