/* Shared RU/EN control. The ID intentionally outranks legacy page navigation
   rules, including narrow-screen rules; geometry has one source of truth. */
#yc-language-switch {
  --yc-progress: 0;
  --yc-stretch: 1;
  --yc-squash: 1;
  position: relative;
  isolation: isolate;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 1fr;
  align-items: stretch;
  flex: 0 0 auto;
  width: 124px;
  min-width: 124px;
  height: 48px;
  min-height: 48px;
  gap: 0;
  margin: 0;
  padding: 4px;
  box-sizing: border-box;
  border: 0;
  border-radius: 999px;
  background: #efeeec;
  box-shadow: inset 0 0 0 1px #d6d5d1;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  font: 500 13px/1 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: .025em;
  transform: none;
  transition: transform 280ms cubic-bezier(.22,.8,.25,1);
  -webkit-tap-highlight-color: transparent;
}

#yc-language-switch:has(a[hreflang="en"][aria-current="page"]) { --yc-progress: 1; }
#yc-language-switch:active { transform: scale(.97); transition-duration: 110ms; }

#yc-language-switch > .yc-language-thumb {
  display: block;
  position: absolute;
  z-index: 0;
  left: 4px;
  top: 4px;
  bottom: 4px;
  width: calc(50% - 4px);
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #6e2639;
  box-shadow: none;
  transform: translateX(calc(var(--yc-progress) * 100%)) scaleX(var(--yc-stretch)) scaleY(var(--yc-squash));
  pointer-events: none;
}

#yc-language-switch > a,
#yc-language-switch > a:visited,
#yc-language-switch > a:hover {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: #67686e;
  font: inherit;
  letter-spacing: inherit;
  text-decoration: none;
  opacity: 1;
  transform: none;
  touch-action: manipulation;
  transition: color 100ms ease;
}
#yc-language-switch > a[aria-current="page"],
#yc-language-switch > a[aria-current="page"]:visited,
#yc-language-switch > a[aria-current="page"]:hover { color: #fff; }
#yc-language-switch > a:focus-visible { outline: 2px solid #6e2639; outline-offset: 6px; }

/* Both languages remain available alongside the existing back/avatar actions. */
@media (max-width: 600px) {
  .course-page > nav .nav-container,
  .chat-page > nav .nav-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding-block: 8px;
  }
  .course-page > nav .nav-links,
  .chat-page > nav .nav-links {
    position: static;
    display: flex;
    flex-direction: row;
    flex: 0 0 auto;
    width: auto;
    margin: 0 0 0 auto;
    padding: 0;
    gap: 10px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .course-page > nav .course-nav-back { margin-right: auto; }
  .course-page > nav .nav-user-avatar-link { flex-shrink: 0; }
  .chat-page > nav .nav-brand img { width: 100px; }
  .chat-page > nav .chat-nav-back { margin-right: auto; }
  .legal-page > nav .nav-container {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding-block: 8px;
  }
  .legal-page > nav .nav-brand { flex-shrink: 0; }
  .legal-page > nav .nav-links { margin-left: auto; gap: 12px; }
}
@media (pointer: coarse) {
  #yc-language-switch { height: 52px; min-height: 52px; }
}
@media (max-width: 380px) {
  .header .header-actions { gap: 4px; }
  .header .menu-button { padding-inline: 0; min-width: 44px; font-size: 14px; }
  .header .logo-link { flex: 0 0 100px; }
  .header .logo-link img { width: 100px; }
  .profile-page > nav .nav-container {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding-block: 8px;
  }
  .profile-page > nav .nav-links { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  #yc-language-switch,
  #yc-language-switch > a { transition: none; }
  #yc-language-switch:active { transform: none; }
}
.motion-off #yc-language-switch,
.motion-off #yc-language-switch > a { transition: none; }
.motion-off #yc-language-switch:active { transform: none; }
