:root {
  --color-violet-50: #f5f3ff;
  --color-violet-100: #ede9fe;
  --color-violet-200: #ddd6fe;
  --color-violet-300: #c4b5fd;
  --color-violet-400: #a78bfa;
  --color-violet-500: #8b5cf6;
  --color-violet-600: #7c3aed;
  --color-violet-800: #5b21b6;
  --color-violet-900: #4c1d95;
  --color-violet-950: #2e1065;

  --color-neutral-50: #fafafa;
  --color-neutral-100: #f5f5f5;
  --color-neutral-200: #e5e5e5;
  --color-neutral-300: #d4d4d4;
  --color-neutral-400: #a3a3a3;
  --color-neutral-500: #737373;
  --color-neutral-600: #525252;
  --color-neutral-700: #404040;
  --color-neutral-800: #262626;
  --color-neutral-900: #171717;
  --color-neutral-950: #0a0a0a;
}

[data-md-color-scheme="slate"] {
  --md-primary-fg-color: var(--color-violet-500);
  --md-primary-fg-color--light: var(--color-violet-300);
  --md-primary-fg-color--dark: var(--color-violet-700);
  --md-default-bg-color: #0a0a0a;

  /* --color-violet-300 #c4b5fd is rgba(196, 181, 254, 1) */
  --md-accent-fg-color: rgba(196, 181, 254, 1);
  --md-accent-fg-color--transparent: rgba(196, 181, 254, 0.1);

  /* Make link text brighter */
  --md-typeset-a-color: var(--color-violet-400);
}

/* Make the title text brighter */
h1 {
  color: var(--md-default-fg-color) !important;
}
.md-nav__title {
  color: var(--md-default-fg-color) !important;
}

/* Make the logo bigger */
.md-logo {
  padding: 0 !important;
  height: 40px;
  width: 40px;
}

.md-logo > img {
  height: 100% !important;
  width: 100% !important;
}

/* Add a indicator that the search bar can be opened via shortcut */
[data-md-toggle="search"]:not(:checked) ~ .md-header .md-search__form::after {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  display: block;
  padding: 0.1rem 0.4rem;
  color: var(--md-default-fg-color);
  font-weight: bold;
  font-size: 0.8rem;
  border: 0.05rem solid var(--md-default-fg-color--lighter);
  border-radius: 0.1rem;
  content: "/";
}

/* Class to apply to code blocks to get wrapping behavior without adding newlines to the copy output */
.pre-wrap > pre > code {
  white-space: pre-wrap;
}
.hanging > pre > code {
  /* text-indent: 1em hanging; is a thing, but no browsers support it, so make our own */
  text-indent: -1.5em;
  padding-left: 2.5em;
}

/* Stop the copy icon from overlapping with code blocks */
.copy > pre > code {
  padding-right: 3em;
}

/* Dark theme code blocks */
.md-typeset pre {
  background-color: #111111;
  border: 1px solid #333;
  border-radius: 6px;
}

.md-typeset code {
  background-color: #111111;
}

.md-typeset pre > code {
  background-color: transparent;
}

/* Inline code styling */
.md-typeset :not(pre) > code {
  background-color: #111111;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0.1em 0.3em;
}

/* Minimal header styling */
.md-header {
  background-color: #111111;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Responsive sidebar styling */
@media (max-width: 960px) {
  .md-nav--primary {
    background-color: #0a0a0a !important;
  }

  .md-nav__title {
    background-color: #0a0a0a !important;
  }

  .md-nav__list {
    background-color: #0a0a0a !important;
  }
}

@media (max-width: 768px) {
  .md-nav--primary {
    background-color: #0a0a0a !important;
  }

  .md-nav__title {
    background-color: #0a0a0a !important;
  }

  .md-nav__list {
    background-color: #0a0a0a !important;
  }

  .md-nav__link {
    color: #e5e5e5 !important;
  }

  .md-nav__link:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
  }
}

/* Consistent dark theme improvements */
.md-nav__link--active {
  color: var(--color-violet-400) !important;
  background-color: rgba(196, 181, 254, 0.1) !important;
}

.md-nav__link:hover {
  color: var(--color-violet-300) !important;
  background-color: rgba(196, 181, 254, 0.05) !important;
}

/* Add arrow to external links in the sidebar */
.md-nav__link[href^="http"]::after {
  content: " ↗";
  opacity: 0.7;
}

/* Sidebar branded icons for Reference external links */
.md-nav__link[href^="https://github.com/"]::before,
.md-nav__link[href^="https://pypi.org/"]::before,
.md-nav__link[href^="https://docs.rs/"]::before,
.md-nav__link[href^="https://pkg.go.dev/"]::before {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  margin-right: 0.45em;
  vertical-align: -0.15em;
}

/* GitHub mark */
.md-nav__link[href^="https://github.com/"]::before {
  content: "";
  background-color: currentColor;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg>')
    center / contain no-repeat;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg>')
    center / contain no-repeat;
}

/* Python badge */
.md-nav__link[href^="https://pypi.org/"]::before {
  content: "Py";
  font-size: 0.75em;
  line-height: 1.1em;
  font-weight: 700;
  text-align: center;
  border-radius: 4px;
  color: #0b1021;
  background: linear-gradient(135deg, #3776ab 50%, #ffd343 50%);
}

/* Rust badge */
.md-nav__link[href^="https://docs.rs/"]::before {
  content: "Rs";
  font-size: 0.75em;
  line-height: 1.1em;
  font-weight: 700;
  text-align: center;
  border-radius: 50%;
  color: #0b1021;
  background: radial-gradient(circle at 30% 30%, #d6d6d6 0%, #bdbdbd 40%, #9e9e9e 100%);
}

/* Go badge */
.md-nav__link[href^="https://pkg.go.dev/"]::before {
  content: "Go";
  font-size: 0.75em;
  line-height: 1.1em;
  font-weight: 700;
  text-align: center;
  border-radius: 4px;
  color: #0b1021;
  background: #00add8;
}

/* Improve search styling */
.md-search__form {
  background-color: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.md-search__form:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

.md-search__input {
  color: #e5e5e5 !important;
}

.md-search__input::placeholder {
  color: rgba(255, 255, 255, 0.6) !important;
}

/* Consistent button styling */
.md-header__button {
  color: #e5e5e5 !important;
}

.md-header__button:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Keep header dark like website */
.md-header {
  background-color: #0a0a0a !important;
}

/* Fix footer to match dark theme */
.md-footer {
  background-color: #0a0a0a !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.md-footer__link {
  color: #e5e5e5 !important;
}

.md-footer__link:hover {
  color: var(--color-violet-400) !important;
}

.md-footer__title {
  color: #e5e5e5 !important;
}

.md-footer__description {
  color: rgba(255, 255, 255, 0.7) !important;
}

/* Improve mobile navigation */
@media (max-width: 768px) {
  .md-nav__link--active {
    color: var(--color-violet-400) !important;
    background-color: rgba(196, 181, 254, 0.1) !important;
  }

  .md-nav__link:hover {
    color: var(--color-violet-300) !important;
    background-color: rgba(196, 181, 254, 0.05) !important;
  }
}
