:root {
  --site-shell-max: 1100px;
}

.site-toolbar {
  position: sticky;
  top: 14px;
  z-index: 100;
  width: min(var(--site-shell-max), calc(100% - 32px));
  min-height: 76px;
  margin: 14px auto 0;
  padding: 12px 14px 12px 20px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  overflow: visible;
  isolation: isolate;
  border: none;
  border-radius: 21px;
  background: rgb(32 37 40 / 60%);
  box-shadow:
    0 14px 42px rgba(0, 0, 0, 0.25),
    inset 0 1px rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(20px) saturate(145%);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
  animation: none;
}

.site-toolbar::before {
  content: none;
}

.site-toolbar--subpage + main,
.site-toolbar--subpage + section {
  margin-top: 18px;
}

.site-toolbar .header-logo {
  min-width: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  direction: ltr;
  unicode-bidi: isolate;
  flex: 0 1 auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  white-space: nowrap;
}

.site-toolbar .header-logo img {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 0;
  object-fit: contain;
}

.site-toolbar .header-logo h1 {
  margin: 0;
  color: #f4faf5;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.site-toolbar #backHomeContainer {
  display: none;
  margin: 0;
  flex: 0 1 auto;
  animation: none;
}

.site-toolbar #backHome {
  min-height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(240, 250, 243, 0.78);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.site-toolbar #backHome:hover {
  color: #c7f5d5;
  background: rgba(132, 231, 168, 0.08);
  border-color: rgba(132, 231, 168, 0.34);
}

.site-toolbar #subtitle {
  min-width: 0;
  margin: 0;
  padding: 0;
  color: rgba(240, 250, 243, 0.66);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: start;
  animation: none;
}

.site-toolbar-nav {
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  direction: ltr;
}

html[dir="rtl"] .site-toolbar-nav {
  margin-right: auto;
  margin-left: 0;
}

.site-toolbar-nav-link {
  min-height: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(240, 250, 243, 0.72);
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  direction: auto;
  unicode-bidi: isolate;
  transition: color 180ms ease, background 180ms ease;
}

.site-toolbar-nav-link:hover {
  color: #c7f5d5;
  background: rgba(132, 231, 168, 0.08);
}

.site-toolbar-nav-link.is-active,
.site-toolbar-nav-link[aria-current="page"] {
  color: #f4faf5;
  background: rgba(132, 231, 168, 0.13);
  cursor: default;
  pointer-events: none;
}

.site-toolbar .lang-dropdown {
  position: relative !important;
  inset: auto !important;
  z-index: 110;
  margin: 0;
  flex: 0 0 auto;
  direction: ltr;
}

html[dir="rtl"] .site-toolbar .lang-dropdown {
  margin: 0;
}

.site-toolbar--compact {
  flex-wrap: wrap;
}

.site-toolbar--compact .site-toolbar-nav {
  order: 3;
  flex: 1 0 100%;
  margin: 0;
}

.site-toolbar .lang-toggle {
  width: 44px;
  height: 36px;
  min-width: 44px;
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #e8f2ea;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  transform: none;
}

.site-toolbar .lang-toggle::after {
  content: "";
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.3 4.2 6 7.8l3.7-3.6' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.3 4.2 6 7.8l3.7-3.6' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: none;
  transition: transform 180ms ease;
}

.site-toolbar .lang-dropdown:has(.lang-menu.open) .lang-toggle::after {
  transform: rotate(180deg);
}

.site-toolbar .lang-toggle:hover {
  color: #84e7a8;
  background: rgba(132, 231, 168, 0.1);
  border-color: rgba(132, 231, 168, 0.34);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.07);
  transform: none;
}

.site-toolbar .lang-menu {
  top: calc(100% + 8px) !important;
  right: 0 !important;
  bottom: auto !important;
  left: auto !important;
  width: max-content;
  min-width: 160px;
  max-height: none;
  margin: 0;
  overflow: hidden;
  direction: ltr;
  border: 0;
  border-radius: 14px;
  background: rgba(18, 24, 27, 0.94);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(20px) saturate(135%);
  -webkit-backdrop-filter: blur(20px) saturate(135%);
  scrollbar-width: none;
}

html[dir="rtl"] .site-toolbar .lang-menu {
  right: auto !important;
  left: 0 !important;
}

.site-toolbar .lang-menu::-webkit-scrollbar {
  display: none;
}

.site-toolbar .lang-menu::-webkit-scrollbar-track {
  background: transparent;
}

.site-toolbar .lang-menu::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(217, 229, 220, 0.34);
}

.site-toolbar .lang-option {
  width: 100%;
  height: 2.5rem;
  min-height: 2.5rem;
  padding: 0 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d9e5dc;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.site-toolbar .lang-option:hover,
.site-toolbar .lang-option.active {
  color: #f4faf5;
  background: rgba(132, 231, 168, 0.12);
}

@media (max-width: 600px) {
  .site-toolbar {
    top: 8px;
    width: calc(100% - 32px);
    min-height: 66px;
    margin-top: 8px;
    padding: 10px 11px 10px 14px;
    gap: 9px;
    border-radius: 17px;
  }

  .site-toolbar .header-logo {
    gap: 8px;
  }

  .site-toolbar .header-logo img {
    width: 29px;
    height: 29px;
  }

  .site-toolbar .header-logo h1 {
    font-size: 1.25rem;
    line-height: 1.2;
    letter-spacing: -0.035em;
  }

  .site-toolbar #subtitle {
    display: none;
  }

  .site-toolbar-nav {
    display: none;
  }

  .site-toolbar #backHomeContainer {
    display: flex;
    align-items: center;
    height: 36px;
    line-height: 0;
    flex: 0 0 auto;
  }

  .site-toolbar .lang-dropdown {
    display: flex;
    align-items: center;
    height: 36px;
    line-height: 0;
  }

  .site-toolbar--subpage #backHomeContainer {
    margin-left: auto;
  }

  html[dir="rtl"] .site-toolbar--subpage #backHomeContainer {
    margin-right: auto;
    margin-left: 0;
  }

  .site-toolbar--subpage .lang-dropdown,
  html[dir="rtl"] .site-toolbar--subpage .lang-dropdown {
    margin: 0;
  }

  .site-toolbar:not(.site-toolbar--subpage) .lang-dropdown {
    margin-left: auto;
  }

  html[dir="rtl"] .site-toolbar:not(.site-toolbar--subpage) .lang-dropdown {
    margin-right: auto;
    margin-left: 0;
  }

  .site-toolbar--compact {
    flex-wrap: nowrap;
  }

  .site-toolbar #backHome {
    width: 36px;
    height: 36px;
    min-height: 36px;
    max-width: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    border-radius: 12px;
    font-size: 0;
  }

  .site-toolbar #backHome::before {
    content: "←";
    font-size: 1rem;
    line-height: 1;
  }

  html[dir="rtl"] .site-toolbar #backHome::before {
    content: "→";
  }

  .site-toolbar--subpage + main,
  .site-toolbar--subpage + section {
    margin-top: 12px;
  }

  .site-toolbar .lang-toggle {
    width: 44px;
    height: 36px;
    min-width: 44px;
    min-height: 36px;
    padding: 0;
    font-size: 0.76rem;
  }
}

@media (max-width: 360px) {
  .site-toolbar--subpage .header-logo h1 {
    display: none;
  }

  .site-toolbar #backHome {
    width: 36px;
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-toolbar *,
  .site-toolbar *::before,
  .site-toolbar *::after {
    transition-duration: 0.01ms !important;
  }
}
