/* This is used for mobile and tablet devices */
/* #region Navbar */
/* Navbar Burger */
.navbar-menu {
  display: none;
}

.navbar-menu.is-active {
  display: block;
  position: fixed;
  top: 4rem;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: var(--mantle);
  overflow-y: auto;
}

.navbar-start {
  display: flex;
  flex-direction: column;
  height: 70%;
}

.navbar-end {
  justify-content: center;
  display: inline-flex;
  flex-direction: row;
  width: 100%;
  > .navbar-item {
    font-size: 1.25em;
    padding: 1em;
  }
}

.navbar-burger {
  position: relative;
  width: 4rem;
  margin-left: auto;
  color: var(--text);
  > span {
    background-color: currentColor;
    height: 2px;
    left: calc(50% - 8px);
    position: absolute;
    transform-origin: center;
    transition-duration: 86ms;
    transition-property: background-color, opacity, transform;
    transition-timing-function: ease-out;
    width: 16px;

    &:nth-child(1) {
      top: calc(50% - 6px);
    }

    &:nth-child(2) {
      top: calc(50% - 1px);
    }

    &:nth-child(3) {
      top: calc(50% + 4px);
    }
  }
}

.navbar-burger.is-active span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

.navbar-burger.is-active span:nth-child(2) {
  opacity: 0;
}

.navbar-burger.is-active span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
    /* 从下方15px处开始 */
  }

  to {
    opacity: 1;
    transform: translateY(0);
    /* 移动到原始位置 */
  }
}

.navbar-start .navbar-item {
  /* 先将元素设置为透明，为动画做准备 */
  opacity: 0;
  animation-name: fadeInUp;
  animation-duration: 0.56s;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
  font-size: 2rem;
  font-family: var(--font-serif);
  color: var(--rosewater);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;

  &:nth-child(1) {
    animation-delay: 0.08s;
  }

  &:nth-child(2) {
    animation-delay: 0.16s;
  }

  &:nth-child(3) {
    animation-delay: 0.24s;
  }

  &:nth-child(4) {
    animation-delay: 0.32s;
  }

  &:nth-child(5) {
    animation-delay: 0.4s;
  }

  &:nth-child(6) {
    animation-delay: 0.48s;
  }

  &:nth-child(7) {
    animation-delay: 0.56s;
  }
}

/* #endregion Navbar */

.theme-selector-content {
  width: 80%;
  padding: 1.5rem;
}

/* #region TOC  */
#icarus-toc-container .toc-button:hover {
  transform: scale(1.1);
  color: var(--lavender);
}

#icarus-toc-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99;
}

#icarus-toc-container .toc-body {
  position: fixed;
  inset: 0;
  background: hsl(from var(--mantle) h s l / 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem;
  visibility: hidden;
  pointer-events: none;
  font-weight: 800;
}

#icarus-toc-container.is-open .toc-body {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#icarus-toc-container .toc {
  max-height: 80vh;
  overflow-y: auto;
  padding: 0;
  list-style: none;
}

#icarus-toc-container .toc-item {
  margin-bottom: 0.5rem;
}

#icarus-toc-container .toc-text {
  font-family: var(--font-article);
}

.toc-level-2 span {
  color: var(--peach);
  font-size: 1.875rem;
}

.toc-level-3 span {
  color: var(--yellow);
  font-size: 1.5rem;
}

.toc-level-4 span {
  color: var(--green);
  font-size: 1.25rem;
}

.toc-level-5 span {
  color: var(--blue);
  font-size: 1rem;
}

.toc-level-6 span {
  color: var(--mauve);
  font-size: 0.875rem;
}

#icarus-toc-container .toc-item.is-active > .toc-link {
  color: var(--lavender);
  font-weight: bold;
}

/* Indentation for mobile */
#icarus-toc-container .toc-child {
  padding-left: 1.5rem;
  list-style: none;
}

#icarus-toc-container .toc-text {
  /* Ensure text is visible on mobile */
  display: inline;
}

.toc-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: hsl(from var(--mantle) h s l / 0.9);
  color: var(--text);
  border: 2px solid var(--surface0);
}

.searchbox-container {
  top: 15px;
  width: 90%;
}

/* #endregion TOC  */
