.fern-body {
  background-color: rgba(var(--background), 1) !important;
  z-index: 1;
}

.fern-input {
  background-color: #ffffff33 !important;
}

header#fern-header {
  font-weight: 600;
}

.fern-sidebar-heading + .fern-sidebar-group > li:last-child {
  margin-bottom: 15px !important;
}

li:has(> .fern-sidebar-link.nested) {
  margin-bottom: 0 !important;
}

.fern-sidebar-link.nested {
  margin-top: 2 !important;
  margin-bottom: 2 !important;
}

.fern-sidebar-heading + .fern-sidebar-group:after {
  position: absolute;
  content: "";
  width: 100%;
  transform: translateX(-50%);
  left: 50%;
}

:is(.dark) .fern-mdx-link {
  color: #5167ff;
}

:is(.dark) .fern-sidebar-group:after {
  border-bottom: 1px solid #1b1b1c;
}

:is(.light) .fern-sidebar-group:after {
  border-bottom: 1px solid #e2e8f0;
}

:is(.light) .toc-root:before {
  background-color: #e2e8f0 !important;
}

:is(.dark) .toc-root:before {
  background-color: #1b1b1c !important;
}

:is(.dark) .toc-root:after {
  background-color: #5167ff !important;
}

.fern-sidebar-group.fern-collapsible:after {
  border-bottom: none !important;
  content: unset !important;
}

#fern-search-button {
  background-color: var(--accent-1) !important;
  border: 1px solid var(--accent-3) !important;
}

.fern-scroll-area-scrollbar {
  display: none !important;
}

/* SIGN IN TO ALCHEMY BUTTON */
header#fern-header a.fern-button.filled.normal.primary {
  height: 2.5rem !important;
  padding: 0.4rem 1.5rem !important;
  color: white !important;
  transition: box-shadow 0.2s ease-in-out;
  position: relative;
  overflow: hidden;
}

header#fern-header a.fern-button.filled.normal.primary span {
  z-index: 1;
}

header#fern-header a.fern-button.filled.normal.primary:hover {
  box-shadow: 0px 0px 1.25rem 0px rgba(81, 103, 255, 0.5);
}

:is(.dark) header#fern-header a.fern-button.filled.normal.primary {
  background-color: #5167ff !important;
}

:is(.light) header#fern-header a.fern-button.filled.normal.primary {
  background-color: #363ff9 !important;
}

.fern-header {
  border: 0 !important;
}

.fern-header-right-menu .fern-button.filled svg {
  display: none;
}

.fern-sidebar-container .fern-button.filled {
  svg {
    display: none !important;
  }
}

.fern-header-right-menu .fern-button-group {
  flex-direction: row-reverse;
}

.fern-theme-button {
  margin-right: 12px !important;
}

.fern-header-tab-button {
  font-size: 16px !important;
}

:is(.light) .fern-header-tab-button[data-state="inactive"] {
  color: black !important;
}

:is(.dark) .fern-header-tab-button[data-state="inactive"] {
  color: white !important;
}

:is(.light) .fern-button.filled.gradient {
  background-color: black !important;
}

:is(.dark) .fern-button.filled.gradient {
  background-color: #363ff9 !important;
}

:is(.light) .beginner .fern-card .items-start:before {
  content: "Beginner";
  background-color: #eff4f9;
  color: #475569;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 400;
}

:is(.dark) .advanced .fern-card .items-start:before {
  background-color: #1f2937 !important;
  color: #e2e8f0 !important;
}

:is(.dark) .beginner .fern-card .items-start:before {
  background-color: #1f2937 !important;
  color: #e2e8f0 !important;
}

:is(.dark) .use-cases .fern-card .items-start:before {
  background-color: #1f2937 !important;
  color: #e2e8f0 !important;
}

/* search bar in sidebar */
#fern-sidebar > *:first-child > button {
  background-color: white !important;
  border: 1px solid #e2e8f0 !important;
}

/* ----- HIDE MOBILE NAV ICONS */
#fern-sidebar-scroll-area > div > div > div > a > span:first-of-type {
  display: none;
}

/* ----- HERO BUTTON ANIMATIONS ----- */
@keyframes slideBlurLeft {
  0%,
  100% {
    left: 25%;
  }
  33% {
    left: 65%;
  }
  40% {
    left: 62%;
  }
  60% {
    left: 68%;
  }
  66% {
    left: 65%;
  }
}

@keyframes slideBlurRight {
  0%,
  100% {
    right: 25%;
  }
  33% {
    right: 65%;
  }
  40% {
    right: 62%;
  }
  60% {
    right: 68%;
  }
  66% {
    right: 65%;
  }
}

@keyframes floatVerticalLeft {
  0%,
  100% {
    transform: translate(-50%, -60%);
  }
  25% {
    transform: translate(-50%, -45%);
  }
  50% {
    transform: translate(-50%, -55%);
  }
  75% {
    transform: translate(-50%, -40%);
  }
}

@keyframes floatVerticalRight {
  0%,
  100% {
    transform: translate(50%, -60%);
  }
  25% {
    transform: translate(50%, -45%);
  }
  50% {
    transform: translate(50%, -55%);
  }
  75% {
    transform: translate(50%, -40%);
  }
}

@keyframes fadeEdges {
  0%,
  100% {
    opacity: 0.3;
  }
  33%,
  66% {
    opacity: 0.5;
  }
}

@keyframes fadeEdgesDark {
  0%,
  100% {
    opacity: 0.1;
  }
  33%,
  66% {
    opacity: 0.3;
  }
}

.fern-anchor {
  border-radius: 50% !important;
}

.fern-anchor-icon {
  color: white !important;
  background-color: #5167ff !important;
  border-radius: 50% !important;
}

.tags .fern-card .items-start:before {
  position: absolute;
  top: 15px;
  right: 15px;
  content: "ðŸ• 5 min";
  background-color: #eff4f9;
  color: #475569;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 400;
}

.fern-sidebar-heading-content {
  font-size: 16px !important;
  color: var(--accent-11) !important;
}

.fern-sidebar-link {
  font-weight: 400 !important;
  border-radius: 4px !important;
  margin: 2px 0px;
}

:is(.light) .fern-sidebar-link[data-state="inactive"] {
  color: #111111 !important;
  &:hover {
    background-color: #f7f9ff !important;
  }
}

:is(.dark) .fern-sidebar-link[data-state="inactive"] {
  color: #ededed !important;
  &:hover {
    background-color: #151516 !important;
  }
}

:is(.light) .fern-sidebar-link[data-state="active"] {
  color: #111111 !important;
  background-color: #eef2fe !important;
}

:is(.dark) .fern-sidebar-link[data-state="active"] {
  color: #ffffff !important;
  background-color: #0f0f10 !important;
}

:is(.light) .fern-sidebar-link.nested[data-state="inactive"] {
  background-color: none !important;
  color: #111111 !important;
  &:hover {
    background-color: #f7f9ff !important;
  }
}

:is(.dark) .fern-sidebar-link.nested[data-state="inactive"] {
  background-color: none !important;
  &:hover {
    background-color: #151516 !important;
  }
}

.fern-header-logo-container img {
  height: unset !important;
}

.fern-header-tabs a {
  font-weight: 500 !important;
  margin-left: -6px !important;
  margin-right: -6px !important;
}

.fern-header-tabs a::before {
  padding: 0 6px !important;
}

:is(.dark) .fern-header-tabs a[data-state="inactive"] {
  color: #ededed !important;
}

:is(.dark) .fern-header-tabs a[data-state="active"] {
  color: #5167ff !important;
}

.fern-header-tabs a[data-state="active"]:after {
  margin-left: 6px !important;
  margin-right: 6px !important;
}

:is(.dark) .fern-header-tabs a[data-state="active"]:after {
  background-color: #5167ff !important;
}

:is(.light) .fern-header-tabs a[data-state="inactive"] {
  color: #111111 !important;
}

.fern-header-tabs [data-state="inactive"] {
  .truncate {
    padding: 6px !important;
  }
}

.fern-header-tabs [data-state="active"] {
  span {
    padding: 6px !important;
  }
}

:is(.light) .fern-header-tabs [data-state="inactive"] {
  span:hover {
    background-color: #eef2fe !important;
    padding: 6px !important;
    border-radius: 8px !important;
  }
}

:is(.dark) .fern-header-tabs [data-state="inactive"] {
  span:hover {
    background-color: #151516 !important;
    padding: 6px !important;
    border-radius: 8px !important;
  }
}

:is(.dark)
  .fern-sidebar-link-container[data-state="active"]
  .fern-sidebar-link {
  background-color: #1f2937 !important;
  color: #728eff !important;
}

.fern-sidebar-link-container:not([data-state="active"])
  .fern-sidebar-link-text {
  color: rgba(var(--body-text), 1) !important;
}

.fern-sidebar-link .break-words {
  overflow-wrap: anywhere !important;
}

/* this selects section headings in the sidebar */
.fern-sidebar-link-container.font-semibold:not([data-state="active"])
  .fern-sidebar-link
  span.fern-sidebar-link-content
  > span.fern-sidebar-link-text {
  color: #94a3b8 !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  font-size: 0.75rem !important;
  line-height: 120% !important;
  letter-spacing: 0.03rem !important;
}

.callout-outlined-tip {
  .w-4 {
    display: none !important;
  }
}
:is(.dark) .callout-outlined-tip {
  background-color: #052e16 !important;
  .text-intent-success {
    color: white !important;
  }
}
:is(.light) .callout-outlined-tip {
  background-color: #f0fdf4 !important;
}

/* HOME PAGE STYLING */
@keyframes moveUp {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-25%);
  }
}

.landing {
  /* ----- GENERAL LAYOUT ----- */
  .fern-background {
    background-color: rgba(var(--background), 1);
    z-index: 0;
  }

  .fern-header-content {
    #fern-search-button {
      display: none !important;
    }
  }

  /* ----- HERO TITLE BLOCK ----- */
  .hero {
    position: relative;
    text-align: center;
    padding: 6.25rem 0.625rem;
    z-index: 1;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;

    @media (min-width: 768px) {
      padding: 6.25rem 1.25rem;
    }

    h1 {
      font-size: 2.5rem;
      line-height: 2.75rem;
      font-weight: 400;
      color: var(--grayscale-12);
      margin-bottom: 1rem;
      width: fit-content;

      @media (min-width: 768px) {
        font-size: 4rem;
        line-height: 4.4rem;
      }
    }

    h4 {
      color: var(--grayscale-11);
      font-size: 1.5rem;
      line-height: 2.25rem;
      font-weight: 400;
      margin-bottom: 2rem;
      width: fit-content;
    }
  }

  @media (max-width: 768px) {
    .hero {
      padding: 3rem 0.625rem 4rem;

      h1 {
        font-size: 2rem;
        line-height: 2.25rem;
      }

      h4 {
        font-size: 1rem;
        line-height: 1.5rem;
      }
    }
  }

  /* ----- ANIMATED WARPED GRID BACKGROUND ----- */
  .hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: -15rem;
    z-index: -1;
    opacity: 1;

    /* Linear gradient mask */
    &:before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-image: linear-gradient(
        var(--background) 25%,
        color-mix(in srgb, var(--background) 0%, transparent) 100%
      );
      z-index: 1;
      pointer-events: none;
    }

    /* Latitude lines that animate */
    &:after {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-image: url("https://fern-image-hosting.s3.us-east-1.amazonaws.com/alchemy/alchemy-bg-hor-solid.svg");
      background-size: cover;
      background-position: center bottom;
      background-repeat: no-repeat;
      z-index: -1;
      animation: moveUp 12s linear infinite;
    }

    /* Longitude lines */
    .vertical-bg {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-image: url("https://fern-image-hosting.s3.us-east-1.amazonaws.com/alchemy/alchemy-bg-vert-solid.svg");
      background-size: cover;
      background-position: center bottom;
      background-repeat: no-repeat;
      z-index: -2;
    }
  }

  :is(.dark) .hero-background {
    &:before {
      background-image: linear-gradient(
        var(--background) 25%,
        color-mix(in srgb, var(--background) 70%, transparent) 100%
      );
    }
  }

  /* ----- CENTERED SEARCH BAR ----- */
  .search {
    padding: 1.875rem 3.75rem 1.25rem 3.75rem;
    border-radius: 1.5rem !important;
    backdrop-filter: blur(3px) !important;
    align-self: center;
    margin-left: auto;
    margin-right: auto;
    margin-top: 4rem;
    max-width: 62.5rem;
    width: 100%;

    .search-options {
      padding-top: 0.625rem;
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: center;

      p {
        padding-right: 0.625rem;
        text-shadow: none !important;
      }

      button {
        color: var(--accent-9) !important;
        font-size: 1rem;
      }
    }

    div.search-input-container > button {
      background-color: var(--accent-1) !important;
      width: 100%;
      svg {
        color: var(--accent-9);
      }
    }
  }

  :is(.dark) {
    .search {
      background-color: rgba(255, 255, 255, 0.1) !important;
    }
  }

  @media (max-width: 768px) {
    .search {
      padding: 1.875rem 1.25rem 1.25rem 1.25rem;
      margin-top: 2rem;
      .search-options {
        gap: 1rem !important;

        p {
          display: none !important;
        }

        button {
          font-size: 0.75rem;
          padding: 0 !important;
        }
      }
    }
  }

  /* ----- GET STARTED BUTTON ----- */
  /* ----- ANIMATIONS CAN BE FOUND IN styles.css ----- */
  #get-started-button {
    padding: 1.25rem 3rem;
    border-radius: 0.47rem !important;
    background-color: var(--grayscale-12) !important;
    transition: box-shadow 0.2s ease-in-out;
    position: relative;
    overflow: hidden;

    p {
      color: var(--grayscale-1) !important;
      font-weight: 600;
      font-size: 0.875rem !important;
      position: relative;
      z-index: 2;
    }

    &:before,
    &:after {
      content: "";
      position: absolute;
      top: 50%;
      width: 7.5rem;
      height: 7.5rem;
      background-image: url("https://fern-image-hosting.s3.us-east-1.amazonaws.com/alchemy/alchemy-bg-button-blur.png");
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center;
      opacity: 0;
      transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    &:before {
      left: 35%;
      transform: translate(-50%, -50%);
    }

    &:after {
      right: 35%;
      transform: translate(50%, -50%);
    }

    &:hover {
      box-shadow: 0px 0px 1.25rem 0px rgba(81, 103, 255, 0.5);

      &:before {
        opacity: 0.5;
        animation:
          slideBlurLeft 6s cubic-bezier(0.45, 0, 0.55, 1) infinite,
          floatVerticalLeft 4s ease-in-out infinite,
          fadeEdges 6s ease-in-out infinite;
        animation-fill-mode: both;
      }

      &:after {
        opacity: 0.5;
        animation:
          slideBlurRight 6s cubic-bezier(0.45, 0, 0.55, 1) infinite,
          floatVerticalRight 4s ease-in-out infinite,
          fadeEdges 6s ease-in-out infinite;
        animation-delay: 0.5s;
        animation-fill-mode: both;
      }
    }
  }

  :is(.dark) #get-started-button {
    background-color: white !important;

    &:hover {
      &:before {
        opacity: 0.5;
        animation:
          slideBlurLeft 6s cubic-bezier(0.45, 0, 0.55, 1) infinite,
          floatVerticalLeft 4s ease-in-out infinite,
          fadeEdgesDark 6s ease-in-out infinite;
        animation-fill-mode: both;
      }

      &:after {
        opacity: 0.5;
        animation:
          slideBlurRight 6s cubic-bezier(0.45, 0, 0.55, 1) infinite,
          floatVerticalRight 4s ease-in-out infinite,
          fadeEdgesDark 6s ease-in-out infinite;
        animation-delay: 0.5s;
        animation-fill-mode: both;
      }
    }
  }
}

@media (min-width: 768px) {
  .fern-header-tabs > div {
    display: flex;
    justify-content: flex-start;
    width: 100%;

    & > :last-child {
      margin-left: auto !important;
      margin-right: -18px !important;
    }
  }
}

/* ----- Custom styling on in body tabs ----- */
main div[role="tablist"] {
  margin-top: 48px !important;
}

main div[role="tablist"] > h6 {
  font-size: 18px !important;
}

:is(.light) main [role="tablist"] h6[data-state="active"] {
  color: #5167ff !important;
}
:is(.light) main [role="tablist"] h6[data-state="inactive"] {
  color: #111111 !important;
}
:is(.light) main [role="tablist"] h6[data-state="active"]::before {
  background-color: #5167ff !important;
}

:is(.dark) main [role="tablist"] h6[data-state="active"] {
  color: #5167ff !important;
}
:is(.dark) main [role="tablist"] h6[data-state="inactive"] {
  color: #ededed !important;
}
:is(.dark) main [role="tablist"] h6[data-state="active"]::before {
  background-color: #5167ff !important;
}
