/* Always reserve space for scrollbar to prevent content shift */
html {
  scrollbar-gutter: stable;
}

:root {
  --ct-theme-transition: 220ms ease;
}

@media (prefers-reduced-motion: no-preference) {
  body,
  .md-header,
  .md-tabs,
  .md-content,
  .md-content__inner,
  .md-main,
  .md-footer,
  .md-sidebar,
  .ct-mobile-drawer,
  .md-search,
  .md-search__form,
  .md-search__input,
  .md-typeset,
  .md-typeset a,
  .md-nav__link,
  .md-header__button,
  .md-icon svg {
    transition:
      background-color var(--ct-theme-transition),
      color var(--ct-theme-transition),
      border-color var(--ct-theme-transition),
      box-shadow var(--ct-theme-transition),
      fill var(--ct-theme-transition),
      stroke var(--ct-theme-transition);
  }
}

.md-grid {
  max-width: 900px;
}

.md-sidebar--primary,
.md-sidebar--post {
    display: none;
}

.md-sidebar {
  width: 20%;
}

.md-sidebar.md-sidebar--post {
  width: 18%;
}

/* Hide the logo icon but keep hamburger menu */
.md-header__button.md-logo,
.md-nav__button.md-logo {
  display: none;
}

/* Align header content to the left */
.md-header__inner {
  padding-left: 0;
}

.md-header__title {
  margin-left: 0;
}

/* Site name styling: codeTango (header and sidebar) */
.md-header__topic:first-child .md-ellipsis,
.md-nav__title .md-ellipsis {
  font-weight: 900;
  font-size: 1.3rem;
}

/* Keep header title stable during instant navigation */
[data-md-component="header-topic"] {
  display: none;
}

/* Keep brand text visible when header switches to active state on scroll */
.md-header__title .md-header__topic + .md-header__topic {
  display: none;
}

.md-header__title--active .md-header__topic:first-child {
  opacity: 1;
  pointer-events: auto;
  transform: none;
  z-index: 1;
}

body.ct-hide-about-title .md-content__inner > h1:first-of-type {
  display: none;
}

body.ct-hide-about-title .md-content__inner > h1:first-of-type + * {
  margin-top: -0.35rem;
}

.md-tabs__item--active > .md-tabs__link {
  color: var(--md-primary-bg-color);
  font-weight: 500;
  opacity: 1;
}

@media screen and (max-width: 76.234375em) {
  .md-sidebar--primary {
    display: none !important;
  }

  .md-header__button[for="__drawer"] {
    display: none !important;
  }

  .md-tabs__item--active > .md-tabs__link {
    box-shadow: none;
  }
}

@media screen and (min-width: 60em) and (max-width: 76.234375em) {
  .md-tabs {
    display: block;
  }
}

@media screen and (min-width: 37.5001em) and (max-width: 59.984375em) {
  .md-tabs {
    display: block;
  }

  .md-header__inner {
    position: relative;
  }

  .md-tabs.md-tabs--in-header {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    z-index: 1;
  }

  .md-header .md-search {
    position: relative;
    z-index: 5;
  }

  .md-tabs.md-tabs--in-header .md-grid {
    max-width: none;
    margin: 0;
    padding: 0;
    height: 2.4rem;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 0.68rem;
    white-space: nowrap;
  }

  .md-tabs.md-tabs--in-header .md-tabs__list {
    gap: 1.2rem;
    overflow: visible;
  }

  .md-tabs.md-tabs--in-header .md-tabs__item {
    height: auto;
  }

  .md-tabs.md-tabs--in-header .md-tabs__link {
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 400;
    line-height: 1;
    color: var(--md-primary-bg-color);
    opacity: 0.82;
    text-decoration: none;
    margin-top: 0;
  }

  .md-tabs.md-tabs--in-header .md-tabs__item--active > .md-tabs__link {
    opacity: 1;
    font-weight: 500;
    text-decoration: none;
    box-shadow: none;
  }

  #__search:checked ~ .md-header .md-tabs.md-tabs--in-header {
    z-index: 0;
  }
}

@media screen and (max-width: 37.5em) {
  .md-header {
    z-index: 15;
  }

  .md-header__button[for="__drawer"] {
    display: inline-flex !important;
    margin-inline-end: 0.2rem;
    position: relative;
    width: 1.4rem;
    height: 1.4rem;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--md-primary-bg-color);
  }

  .md-header__button[for="__drawer"] svg {
    display: none;
  }

  .md-header__button[for="__drawer"]::before,
  .md-header__button[for="__drawer"]::after {
    content: "";
    position: absolute;
    width: 1rem;
    height: 0.12rem;
    background: currentColor;
    border-radius: 2px;
    transition: transform 180ms ease, top 180ms ease, opacity 180ms ease;
  }

  .md-header__button[for="__drawer"]::before {
    top: 0.45rem;
    box-shadow: 0 0.3rem 0 currentColor;
  }

  .md-header__button[for="__drawer"]::after {
    top: 1.05rem;
  }

  #__drawer:checked ~ .md-header .md-header__button[for="__drawer"]::before {
    top: 0.74rem;
    transform: rotate(45deg);
    box-shadow: none;
  }

  #__drawer:checked ~ .md-header .md-header__button[for="__drawer"]::after {
    top: 0.74rem;
    transform: rotate(-45deg);
  }

  .md-tabs,
  .md-tabs.md-tabs--in-header {
    display: none !important;
  }

  .md-header .md-search {
    position: relative;
    z-index: 20;
  }

  .ct-mobile-drawer {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--md-primary-fg-color);
    box-shadow: none;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition:
      max-height 300ms cubic-bezier(0.22, 1, 0.36, 1),
      opacity 240ms ease;
    z-index: 16;
    will-change: max-height, opacity;
  }

  .ct-mobile-drawer__link {
    display: block;
    padding: 0.7rem 1rem;
    color: var(--md-primary-bg-color);
    text-decoration: none;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 400;
  }

  .ct-mobile-drawer__link--active {
    font-weight: 500;
  }

  #__drawer:checked ~ .md-header .ct-mobile-drawer {
    max-height: 8rem;
    opacity: 1;
    pointer-events: auto;
  }

  #__search:checked ~ .md-header .ct-mobile-drawer {
    opacity: 0;
    pointer-events: none;
    z-index: 0;
  }
}

.site-name-code {
  color: #0F3328 !important;
  font-style: italic !important;
}

.site-name-tango {
  color: #E0F2F1 !important;
}

.site-name-link {
  text-decoration: none !important;
  cursor: pointer;
}

.site-name-link:hover {
  text-decoration: none !important;
}

.ct-post-synopsis {
  color: rgba(0, 0, 0, 0.56);
}

[data-md-color-scheme="slate"] .ct-post-synopsis {
  color: rgba(236, 239, 241, 0.82);
}

.ct-post-synopsis--page {
  margin-top: -1.5rem;
  margin-bottom: 1.4rem;
  font-size: 0.87em;
  font-style: italic;
}

pre.mermaid.mermaid-pending {
  opacity: 0;
  min-height: 9rem;
}

pre.mermaid.mermaid-ready {
  display: flex;
  justify-content: center;
  opacity: 1;
  transition: opacity 120ms linear;
}

pre.mermaid.mermaid-ready svg {
  margin: 0 auto;
}

.md-typeset .mermaid {
  text-align: center;
}

.md-typeset .mermaid svg {
  display: block;
  margin: 0 auto;
}

.ct-search-ghost {
  position: fixed;
  z-index: 9999;
  padding: 0 0.8rem;
  display: flex;
  align-items: center;
  border-radius: 0.1rem;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.8rem;
  line-height: 1;
  pointer-events: none;
  transform-origin: right center;
  transition: transform 180ms ease, opacity 180ms ease;
}

/* Sidebar header: empty green bar matching navbar height (48px) */
.md-nav--primary > .md-nav__title {
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  padding: 0 !important;
  background-color: var(--md-primary-fg-color);
  font-size: 0 !important;
}

.md-nav--primary > .md-nav__title * {
  display: none !important;
}
