/* Раскрывающийся переключатель темы в шапке (components/theme_menu.html). */

.theme-menu {
  position: relative;
  flex-shrink: 0;
  align-self: center;
  margin-left: 0.35rem;
  z-index: 130;
}

.theme-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 2.35rem;
  padding: 0 0.5rem 0 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(5, 184, 125, 0.28);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.theme-menu__trigger::-webkit-details-marker {
  display: none;
}

.theme-menu__trigger:hover,
.theme-menu[open] .theme-menu__trigger {
  border-color: var(--accent-border-strong, rgba(5, 184, 125, 0.55));
}

.theme-menu__trigger:focus-visible {
  outline: 2px solid var(--green, #05b87d);
  outline-offset: 2px;
}

[data-theme="light"] .theme-menu__trigger {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 2px 10px rgba(26, 36, 48, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* На кнопке виден только кружок текущей темы (атрибуты ставит theme.js). */
.theme-menu__dot {
  display: none;
}

html[data-theme="dark"]:not([data-palette]) .theme-menu__dot--dark,
html[data-theme="light"]:not([data-palette]) .theme-menu__dot--light,
html[data-palette="pink"] .theme-menu__dot--pink,
html[data-palette="mono"] .theme-menu__dot--mono {
  display: block;
}

.theme-menu__chevron {
  width: 0.4rem;
  height: 0.4rem;
  margin-top: -0.2rem;
  border-right: 1.5px solid var(--text-muted, rgba(255, 255, 255, 0.6));
  border-bottom: 1.5px solid var(--text-muted, rgba(255, 255, 255, 0.6));
  transform: rotate(45deg);
  transition: transform 0.18s ease, margin 0.18s ease;
}

.theme-menu[open] .theme-menu__chevron {
  margin-top: 0.2rem;
  transform: rotate(225deg);
}

.theme-menu__panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  padding: 0.65rem 0.7rem 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--surface-elevated, #1e2630);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  animation: theme-menu-in 0.18s ease-out;
}

[data-theme="light"] .theme-menu__panel {
  border-color: rgba(15, 23, 42, 0.08);
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(26, 36, 48, 0.14);
}

.theme-menu__title {
  margin: 0 0 0.5rem 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted, rgba(255, 255, 255, 0.6));
}

@keyframes theme-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-menu__panel {
    animation: none;
  }
}
