/* Header */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  pointer-events: none;
}

.site-header__shell,
.mobile-header {
  pointer-events: auto;
}

.site-header__shell {
  display: block;
}

.site-header__top {
  position: relative;
  z-index: 40;
  max-height: var(--header-top-h);
  overflow: visible;
  opacity: 1;
  transform: translateY(0);
  transition:
    max-height var(--transition),
    opacity var(--transition),
    transform var(--transition);
  border-bottom: 1px solid var(--border-soft);
}

.site-header__top-inner {
  min-height: var(--header-top-h);
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.top-nav {
  justify-self: center;
  grid-column: 3;
}

.top-nav__list {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.top-nav__list a {
  font-size: calc(var(--fs-topnav) + 1px);
  font-weight: var(--fw-topnav);
  color: var(--text-primary);
  transition: opacity var(--transition-base), color var(--transition-base);
}

.top-nav__list a:hover {
  opacity: 0.82;
}

.top-contacts {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 24px;
  position: relative;
  z-index: 700;
}

.top-contacts__phone {
  font-size: var(--fs-phone);
  font-weight: var(--fw-phone);
  white-space: nowrap;
}

.header-search {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  --search-max-width: 420px;
  z-index: 710;
}

.header-search__toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color var(--transition-base), background-color var(--transition-base);
  position: relative;
  z-index: 530;
}

.header-search__toggle:hover,
.header-search.is-open .header-search__toggle {
  border-color: var(--accent);
  background: rgba(255, 96, 0, 0.08);
}

.header-search__toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.header-search__icon {
  width: 15px;
  height: 15px;
  border: 1.8px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.header-search__icon::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 6px;
  height: 1.8px;
  background: currentColor;
  transform: rotate(45deg);
  border-radius: 2px;
}

.header-search__panel {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  width: max(260px, var(--search-max-width));
  min-width: 260px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-base), visibility var(--transition-base);
  z-index: 720;
}

.header-search.is-open .header-search__panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.header-search__input {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #11161d;
  color: var(--text-primary);
  padding: 0 16px;
}

.header-search__input:focus-visible,
.mobile-header-search__input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.header-search__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  margin-top: 0;
  max-height: min(320px, calc(100vh - 140px));
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  background: #11161d;
  border-radius: 14px;
  box-shadow: var(--shadow-modal);
  overflow-x: hidden;
  z-index: 730;
}

.mobile-header-search__dropdown {
  margin-top: 8px;
  max-height: min(320px, calc(100vh - 140px));
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  background: var(--bg-mega);
  border-radius: 14px;
  box-shadow: var(--shadow-modal);
  overflow-x: hidden;
}

.header-search__result {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
}

.header-search__result:first-child {
  border-top: 0;
}

.header-search__result:hover {
  background: var(--hover-bg);
}

.header-search__result-title {
  font-size: 14px;
  line-height: 1.35;
  color: var(--text-primary);
}

.header-search__result-meta {
  font-size: 12px;
  line-height: 1.25;
  color: var(--text-muted);
}

.header-search__empty {
  margin: 0;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text-muted);
}

html[data-theme="light"] .header-search__input,
html[data-theme="light"] .header-search__dropdown {
  background: #ffffff;
}

.social-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
}

.social-icon--wa {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12c0 1.85.5 3.59 1.37 5.09L2.05 22l5.08-1.32A9.96 9.96 0 0012 22c5.52 0 10-4.48 10-10S17.52 2 12 2zm4.64 14.23c-.2.56-1.16 1.08-1.61 1.15-.41.06-.95.09-1.54-.1-.35-.1-.8-.24-1.38-.47-2.43-1.05-4-3.5-4.12-3.66-.12-.16-.98-1.3-.98-2.48 0-1.18.62-1.76.84-2 .2-.23.45-.29.6-.32.15-.03.29-.02.42-.01.14 0 .32-.02.5.38.2.43.66 1.48.72 1.59.06.1.1.22.02.36-.08.14-.12.22-.24.34-.12.12-.25.27-.36.36-.12.1-.25.22-.11.43.14.22.62 1.02 1.33 1.65.91.81 1.68 1.06 1.92 1.18.24.12.38.1.52-.06.14-.16.6-.7.76-.94.16-.24.32-.2.54-.12.22.08 1.4.66 1.64.78.24.12.4.18.46.28.06.1.06.58-.14 1.14z'/%3E%3C/svg%3E");
}

.social-icon--tg {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M21.94 3.66L2.07 11.26c-1.55.62-1.54 1.48-.28 1.87l5.26 1.64 2.1 6.38c.26.72.13 1.01.83 1.01.34 0 .49-.16.68-.35l2.91-2.83 6.06 4.44c1.11.61 1.9.29 2.17-1.03l3.99-18.8c.38-1.53-.58-2.23-1.61-1.79zM17.68 7.9l-11.3 7.1c-1.1.68-1.1.65-.2 1.05l12.35 4.5c.47.17.47.12.87-.28l-13.5-12.6c-.2-.2-.36-.29-.72-.17z'/%3E%3C/svg%3E");
}

html[data-theme="light"] .social-icon {
  background-color: rgba(255, 255, 255, 0.78);
  border-color: rgba(17, 17, 17, 0.2);
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    background-image 0.2s ease;
}

html[data-theme="light"] .social-icon--wa {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23111111'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12c0 1.85.5 3.59 1.37 5.09L2.05 22l5.08-1.32A9.96 9.96 0 0012 22c5.52 0 10-4.48 10-10S17.52 2 12 2zm4.64 14.23c-.2.56-1.16 1.08-1.61 1.15-.41.06-.95.09-1.54-.1-.35-.1-.8-.24-1.38-.47-2.43-1.05-4-3.5-4.12-3.66-.12-.16-.98-1.3-.98-2.48 0-1.18.62-1.76.84-2 .2-.23.45-.29.6-.32.15-.03.29-.02.42-.01.14 0 .32-.02.5.38.2.43.66 1.48.72 1.59.06.1.1.22.02.36-.08.14-.12.22-.24.34-.12.12-.25.27-.36.36-.12.1-.25.22-.11.43.14.22.62 1.02 1.33 1.65.91.81 1.68 1.06 1.92 1.18.24.12.38.1.52-.06.14-.16.6-.7.76-.94.16-.24.32-.2.54-.12.22.08 1.4.66 1.64.78.24.12.4.18.46.28.06.1.06.58-.14 1.14z'/%3E%3C/svg%3E");
}

html[data-theme="light"] .social-icon--wa:hover {
  background-color: rgba(255, 96, 0, 0.12);
  border-color: rgba(255, 96, 0, 0.45);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23FF6000'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12c0 1.85.5 3.59 1.37 5.09L2.05 22l5.08-1.32A9.96 9.96 0 0012 22c5.52 0 10-4.48 10-10S17.52 2 12 2zm4.64 14.23c-.2.56-1.16 1.08-1.61 1.15-.41.06-.95.09-1.54-.1-.35-.1-.8-.24-1.38-.47-2.43-1.05-4-3.5-4.12-3.66-.12-.16-.98-1.3-.98-2.48 0-1.18.62-1.76.84-2 .2-.23.45-.29.6-.32.15-.03.29-.02.42-.01.14 0 .32-.02.5.38.2.43.66 1.48.72 1.59.06.1.1.22.02.36-.08.14-.12.22-.24.34-.12.12-.25.27-.36.36-.12.1-.25.22-.11.43.14.22.62 1.02 1.33 1.65.91.81 1.68 1.06 1.92 1.18.24.12.38.1.52-.06.14-.16.6-.7.76-.94.16-.24.32-.2.54-.12.22.08 1.4.66 1.64.78.24.12.4.18.46.28.06.1.06.58-.14 1.14z'/%3E%3C/svg%3E");
}

html[data-theme="light"] .social-icon--tg {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23111111'%3E%3Cpath d='M21.94 3.66L2.07 11.26c-1.55.62-1.54 1.48-.28 1.87l5.26 1.64 2.1 6.38c.26.72.13 1.01.83 1.01.34 0 .49-.16.68-.35l2.91-2.83 6.06 4.44c1.11.61 1.9.29 2.17-1.03l3.99-18.8c.38-1.53-.58-2.23-1.61-1.79zM17.68 7.9l-11.3 7.1c-1.1.68-1.1.65-.2 1.05l12.35 4.5c.47.17.47.12.87-.28l-13.5-12.6c-.2-.2-.36-.29-.72-.17z'/%3E%3C/svg%3E");
}

html[data-theme="light"] .social-icon--tg:hover {
  background-color: rgba(255, 96, 0, 0.12);
  border-color: rgba(255, 96, 0, 0.45);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23FF6000'%3E%3Cpath d='M21.94 3.66L2.07 11.26c-1.55.62-1.54 1.48-.28 1.87l5.26 1.64 2.1 6.38c.26.72.13 1.01.83 1.01.34 0 .49-.16.68-.35l2.91-2.83 6.06 4.44c1.11.61 1.9.29 2.17-1.03l3.99-18.8c.38-1.53-.58-2.23-1.61-1.79zM17.68 7.9l-11.3 7.1c-1.1.68-1.1.65-.2 1.05l12.35 4.5c.47.17.47.12.87-.28l-13.5-12.6c-.2-.2-.36-.29-.72-.17z'/%3E%3C/svg%3E");
}

.city-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  padding: 4px 8px;
  font-size: var(--fs-topnav);
  font-weight: var(--fw-topnav);
  justify-self: start;
}

.city-trigger__caret {
  width: 9px;
  height: 9px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.site-header__bottom {
  position: relative;
  z-index: 20;
  transition: min-height var(--transition), background var(--transition);
}

.site-header__bottom-inner {
  min-height: var(--header-bottom-h);
  display: grid;
  grid-template-columns: 207px 1fr 207px;
  align-items: center;
  gap: 28px;
}

.site-header.is-scrolled .site-header__shell {
  background: var(--bg-header-scrolled);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.site-header.is-scrolled .site-header__top {
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  overflow: hidden;
  border-bottom-color: transparent;
}

.site-header.is-scrolled .site-header__bottom-inner {
  min-height: var(--header-sticky-bottom-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  padding: 10px;
  margin: -10px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
}

.theme-switcher__label {
  font-size: 13px;
  line-height: 1.2;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

.theme-switcher-wrap--desktop {
  justify-self: start;
}

.theme-switch {
  border: none;
  background: transparent;
  color: var(--text-primary);
  border-radius: 999px;
  padding: 0;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  transition:
    background-color var(--transition-base),
    border-color var(--transition-base),
    box-shadow var(--transition-base);
}

.theme-switch__track {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #2a2d33;
  position: relative;
  transition: background-color var(--transition-base), box-shadow var(--transition-base);
}

.theme-switch__icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  line-height: 1;
  transition: opacity var(--transition-base), transform var(--transition-base);
  user-select: none;
}

.theme-switch__icon--dark {
  left: 7px;
  opacity: 1;
}

.theme-switch__icon--light {
  right: 8px;
  opacity: 0;
}

.theme-switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26);
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base);
}

.theme-switch.is-light .theme-switch__track {
  background: var(--accent);
  box-shadow: 0 8px 16px rgba(255, 96, 0, 0.26);
}

.theme-switch.is-light .theme-switch__thumb {
  transform: translateX(20px);
}

.theme-switch.is-light .theme-switch__icon--dark {
  opacity: 0;
  transform: translate(-2px, -50%);
}

.theme-switch.is-light .theme-switch__icon--light {
  opacity: 1;
  transform: translate(0, -50%);
}

.theme-switch:hover {
  filter: brightness(1.04);
}

.theme-switch:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.theme-switcher.is-theme-hint-active {
  position: relative;
  z-index: 130;
}

.theme-hint-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.36);
}

.theme-hint {
  position: fixed;
  z-index: 131;
  max-width: 280px;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-modal);
}

.theme-hint__title {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.25;
  color: var(--text-primary);
  font-weight: 600;
}

.theme-hint__text {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-primary);
}

.theme-hint__button {
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.theme-hint__button:hover {
  filter: brightness(1.05);
}

/* Mobile header */
.mobile-header {
  display: none;
  pointer-events: auto;
  background: transparent;
  transition: background var(--transition);
}

.mobile-header__inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.icon-burger {
  position: relative;
  width: 20px;
  height: 14px;
}

.icon-burger::before,
.icon-burger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.icon-burger::before {
  top: 1px;
}

.icon-burger::after {
  bottom: 1px;
}

.icon-phone {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 4px;
  position: relative;
}

.icon-phone::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  height: 6px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 4px 4px;
}

.brand--mobile {
  font-size: 20px;
  padding: 0;
  margin: 0;
}

.mobile-header-search {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}

.mobile-header-search__toggle {
  width: 40px;
  height: 40px;
}

.mobile-header-search__icon {
  width: 15px;
  height: 15px;
  border: 1.8px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.mobile-header-search__icon::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 6px;
  height: 1.8px;
  background: currentColor;
  transform: rotate(45deg);
}

.mobile-header-search__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 14px;
  right: 14px;
  z-index: 9;
}

.mobile-header-search__row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.mobile-header-search__input {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-header-scrolled);
  color: var(--text-primary);
  padding: 0 14px;
}

.mobile-header-search__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text-primary);
  font-size: 28px;
  line-height: 1;
  padding: 0;
}

@media (max-width: 1199px) {
  .site-header__shell {
    display: none;
  }

  .mobile-header {
    display: block;
  }

  .site-header.is-scrolled .mobile-header {
    background: var(--bg-header-scrolled);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .theme-switcher-wrap--mobile .theme-switch {
    min-height: 26px;
  }

  .theme-switcher-wrap--mobile {
    width: 100%;
    justify-content: space-between;
    margin-top: 8px;
  }

  .theme-switcher-wrap--mobile .theme-switcher {
    width: 100%;
  }

  .theme-switcher-wrap--mobile .theme-switcher__label {
    font-size: 14px;
  }

  .theme-switcher-wrap--mobile .theme-switch__track {
    width: 44px;
    height: 26px;
  }

  .theme-switcher-wrap--mobile .theme-switch__thumb {
    width: 20px;
    height: 20px;
  }

  .theme-switcher-wrap--mobile .theme-switch.is-light .theme-switch__thumb {
    transform: translateX(18px);
  }
}

@media (max-width: 767px) {
  .mobile-header__inner {
    min-height: 68px;
  }
}

/* Light theme: первый экран — читаемый хедер поверх hero */
html[data-theme="light"] .site-header:not(.is-scrolled) .site-header__shell {
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.6),
    rgba(255, 255, 255, 0)
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html[data-theme="light"] .site-header:not(.is-scrolled) .mobile-header {
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.6),
    rgba(255, 255, 255, 0)
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html[data-theme="light"] .site-header .brand,
html[data-theme="light"] .site-header .city-trigger,
html[data-theme="light"] .site-header .top-contacts__phone,
html[data-theme="light"] .site-header .top-nav__list a,
html[data-theme="light"] .site-header .main-nav__item,
html[data-theme="light"] .site-header .theme-switch,
html[data-theme="light"] .site-header .mobile-header .icon-btn,
html[data-theme="light"] .site-header .mobile-header .brand--mobile {
  color: #111111;
}

html[data-theme="light"] .site-header .top-nav__list a:hover {
  opacity: 1;
  color: #ff6000;
}

html[data-theme="light"] .site-header .main-nav__item:hover,
html[data-theme="light"] .site-header .main-nav__item.is-active {
  color: #ff6000;
}
