/* Header Sentinel */
[data-header-sentinel] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  pointer-events: none;
  z-index: -1;
}

/* Header Bar */
.header-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  background-color: transparent;
  border-bottom: 1px solid transparent;
  visibility: visible;
  opacity: 1;
  isolation: isolate;
}

.header-bar.is-stuck {
  background-color: var(--bg-main);
  border-bottom-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  z-index: 10000;
}

.header[data-bg-color="pink"] {
  background-color: var(--accent-pink);
}

.header[data-bg-color="transparent"] {
  background-color: transparent;
}

/* Header Left Vectors */
.header__left-vectors,
.header__left-vectors img {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  max-height: clamp(114px, 35%, 140px);
}

/* Header Right Vectors */
.header__right-vectors,
.header__right-vectors img {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 0;
  max-height: clamp(114px, 35%, 140px);
  pointer-events: none; /* Позволяет кликать сквозь декоративные элементы */
}

/* Header Menu */
.header__menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px 0px;
  position: sticky;
  top: 0;
}

.header__menu-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.header__menu-list-topbar {
  display: none;
}

.header__menu-link {
  font-size: 22px;
  font-weight: 700;
  line-height: 100%;
  color: var(--text-main);
  transition: color 0.2s;
  position: relative;
}

.header__menu-link-parent {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.header__menu-link:hover {
  color: var(--accent-red);
}

.header__menu-burger {
  width: 32px;
  height: 32px;
  padding: 16px;
  border: 1px solid var(--text-main);
  border-radius: 50%;
  background-image: url("../images/header/burger-menu.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: initial;
  opacity: 0;
  display: none;
}

.header__social-btn,
.header__socials {
  display: none;
}

/* Social button icons */
.header__social-btn.instagram {
  background-image: url("../images/common/instagram.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 60%;
}

.header__socials-link.instagram {
  background-image: url("../images/common/instagram.svg");
}

.header__socials-link.facebook {
  background-image: url("../images/common/facebook.svg");
}

.header__socials-link.linkedin {
  background-image: url("../images/common/linkedin.svg");
}

.header__menu-close-btn {
  width: 32px;
  height: 32px;
  background: var(--accent-red);
  border-radius: 50%;
  border: none;
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  line-height: 100%;
  cursor: pointer;
}

/* Header Logo */
.header__logo {
  max-width: 160px;
  /* Fix for Safari screenshot issue - force GPU rendering */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Ensure proper rendering */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  /* Force repaint */
  opacity: 0.999;
}

.header__logo--mobile {
  display: none;
}

/* Header Submenu */
.header__submenu span {
  font-size: 24px;
  font-weight: 700;
  line-height: 100%;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: color 0.2s;
}

.header__submenu span:hover svg {
  fill: var(--accent-red);
  color: var(--accent-red);
}

.header__submenu-list {
  position: absolute;
  display: none;
  opacity: 0;
  top: 0px;
  width: 100%;
  left: 0px;
  padding-bottom: 38px;
  border-top: 1px solid var(--text-main);
  z-index: 10001;
  background-color: var(--bg-main);
  transition: 0.3s;
  padding-left: 40px;
  padding-right: 40px;
}

.header__submenu-list.open {
  display: block;
  opacity: 1;
  top: 125px;
}

.header__submenu-link {
  font-size: 32px;
  font-weight: 700;
  line-height: 100%;
  color: var(--text-main);
  position: relative;
  width: 100%;
  display: inline-block;
  padding: 24px 0;
  border-bottom: 1px solid var(--text-main);
  transition: color 0.2s;
}

.header__submenu-link:hover {
  color: var(--accent-red);
}

.header__submenu-link::after {
  content: url("../images/header/arrow-right.svg");
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 24px;
}

/* Header Buttons */
.header__btns {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Header Search Button */
.header__search-btn {
  border: none;
  background-color: transparent;
  width: 32px;
  height: 32px;
  background-image: url("../images/header/search.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  cursor: pointer;
}

.header__search-btn--mobile {
  display: none;
}

/* Header Language Selector */
.header__lng {
  position: relative;
}

.header__lng-btn {
  font-size: 18px;
  font-weight: 500;
  line-height: 100%;
  border: 1px solid var(--text-main);
  background-color: transparent;
  padding: 6px 3px;
  border-radius: 50%;
  color: var(--text-main);
  cursor: pointer;
}

.header__lng-btn:focus-visible {
  color: var(--text-main);
}

.header__lng-selector {
  position: absolute;
  top: 32px;
  left: -8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 500;
  line-height: 100%;
  border: 1px solid var(--text-main);
  color: var(--text-main);
  border-radius: 24px;
  background-color: var(--bg-main);
  padding: 12px;
  opacity: 0;
  transition: 0.3s;
}

.header__lng-selector span {
  position: relative;
  cursor: pointer;
  padding-left: 8px;
}

.header__lng-selector span:hover {
  color: var(--accent-red);
}

.header__lng-selector span.is-selected::after {
  content: "✓";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  line-height: 1;
}

.header__lng-selector.open {
  opacity: 1;
  top: 0px;
}

/* Search Panel */
.searchpanel {
  position: absolute;
  top: -20px;
  left: 0;
  width: 100%;
  background: var(--bg-main);
  padding: 20px 40px;
  z-index: 999;
  flex-direction: column;
  gap: 24px;
  display: none;
}

.searchpanel__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.searchpanel__close-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent-red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  line-height: 100%;
  cursor: pointer;
}

.searchpanel__wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
}

.searchpanel__input {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 12px;
  font-size: 24px;
  font-weight: 600;
  line-height: 110%;
  color: var(--text-main);
  position: relative;
  resize: none;
}

.searchpanel__input::placeholder {
  color: var(--text-main);
  font-size: 18px;
  font-weight: 500;
  line-height: 110%;
  text-transform: uppercase;
  transition: 0.3s;
}

.searchpanel__input:hover::placeholder {
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
  line-height: 110%;
  text-transform: uppercase;
  position: absolute;
  top: 8px;
  left: 24px;
}

.searchpanel__btn {
  padding: 10px 28px;
  border-radius: 30px;
  border: none;
  background: var(--accent-red);
  display: flex;
  align-items: center;
  justify-content: center;
}

.searchpanel__result {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
  gap: 24px;
}

.searchpanel__result .btn {
  font-size: 18px;
  font-weight: 700;
  line-height: 100%;
}

.searchpanel__result-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  padding: 10px 0;
  border-bottom: 1px solid var(--text-main);
  border-top: 1px solid var(--text-main);
  width: 100%;
  position: relative;
}

.searchpanel__result-item::after {
  content: url("../images/header/arrow-right.svg");
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 24px;
}

.searchpanel__result-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 100%;
  color: var(--text-main);
  flex: 1;
}

.searchpanel__loading,
.searchpanel__no-results,
.searchpanel__error {
  font-size: 24px;
  font-weight: 600;
  line-height: 100%;
  color: var(--text-main);
  text-align: center;
  padding: 40px 20px;
}

.searchpanel__error {
  color: var(--accent-red);
}

.searchpanel.open {
  display: flex;
}

/* Mobile Styles */
@media (max-width: 768px) {
  .header__left-vectors img:first-child {
    width: 80px;
    aspect-ratio: auto;
  }

  .header__left-vectors img:last-child {
    width: 52px;
    aspect-ratio: auto;
  }

  .header__right-vectors img:first-child {
    width: 80px;
    aspect-ratio: auto;
    z-index: -2;
  }

  .header__right-vectors img:last-child {
    width: 52px;
    aspect-ratio: auto;
    z-index: -2;
  }

  .header__logo {
    width: 94px;
  }

  .header__btns {
    gap: 8px;
  }

  .header__social-btn {
    width: 34px;
    height: 34px;
    border: 1px solid #5a3d32;
    border-radius: 50%;
    display: block;
    position: relative;
  }

  .header__search-btn {
    width: 34px;
    height: 34px;
  }

  .header__socials {
    position: absolute;
    top: -1px;
    left: -1px;
    display: none;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
    padding-bottom: 8px;
    background-color: var(--bg-main);
    border: 1px solid var(--text-main);
    border-radius: 24px;
    opacity: 0;
    transition: 0.3s;
  }

  .header__socials-link {
    width: 32px;
    height: 32px;
    display: block;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 80%;
  }

  .header__socials.open {
    opacity: 1;
    display: flex;
  }

  .header__menu {
    padding: 30px;
    padding-bottom: 16px;
    justify-content: space-between;
    padding-left: 50px;
    padding-right: 50px;
  }

  .header-bar .container {
    padding-left: 0;
    padding-right: 0;
    width: 100%;
    max-width: 100%;
  }

  .header__menu-burger {
    display: block;
    opacity: 1;
    height: 100%;
    z-index: 100;
  }

  .header__menu-list {
    display: none;
    padding: 16px 24px;
    top: 0;
  }

  .header__menu-list-topbar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .header__menu-list.menu-open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-main);
    padding-top: 20px;
    z-index: 10000;
  }

  .header__menu-list.menu-open > .page__header > * {
    z-index: -1;
  }

  .header__right-vectors {
    transition: opacity 0.3s, visibility 0.3s;
  }

  .header-bar:has(.header__menu-list.menu-open) .header__right-vectors,
  body:has(.header__menu-list.menu-open) .header__right-vectors {
    display: none;
    visibility: hidden;
    opacity: 0;
  }

  .header__menu-link-parent {
    justify-content: flex-start;
  }

  .header__menu-item {
    width: 100%;
  }

  .header__menu-close-btn.show {
    display: flex;
  }

  .header__menu-burger.show,
  .header__menu-logo--desktop {
    display: none;
  }

  .header__submenu-list {
    position: static;
    width: 100%;
    margin-top: 10px;
    padding-bottom: 0;
    border-top: none;
  }

  .header__submenu-link {
    border-bottom: none;
    padding: 10px 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 100%;
    margin-left: 16px;
  }

  .header__submenu-link::after {
    content: "";
  }

  .header__search-btn--desktop {
    display: none;
  }

  .header__search-btn--mobile {
    display: block;
  }

  .header__logo--mobile {
    display: block;
  }

  .searchpanel {
    padding: 20px 28px;
    gap: 10px;
    height: 100vh;
    top: 0;
  }

  .searchpanel__top img {
    max-width: 108px;
  }

  .searchpanel__close-btn {
    width: 36px;
    height: 36px;
    font-size: 20px;
    font-weight: 700;
    line-height: 100%;
  }

  .searchpanel .searchpanel__wrap {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
  }

  .searchpanel__input {
    padding: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 100%;
  }

  .searchpanel__input::placeholder {
    font-size: 12px;
  }

  .searchpanel__input:hover::placeholder {
    font-size: 8px;
    left: 8px;
  }

  .searchpanel__btn {
    padding: 6px 18px;
    border-radius: 24px;
  }

  .searchpanel__result {
    gap: 12px;
    height: 100%;
  }

  .searchpanel__result .btn {
    font-size: 12px;
    font-weight: 700;
    line-height: 100%;
    width: fit-content;
    padding: 6px 10px;
  }

  .searchpanel__result-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 6px 0;
  }

  .searchpanel__result-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 100%;
  }
}

/* Tablet and Mobile Styles */
@media (max-width: 1024px) {
  .header__logo--mobile {
    display: block;
  }

  .header__menu-logo--desktop {
    display: none;
  }

  .header__menu-list:not(.menu-open) {
    display: none;
  }

  .header__menu-burger {
    display: block;
    opacity: 1;
  }

  .header__social-btn {
    display: block;
    width: 34px;
    height: 34px;
    border: 1px solid #5a3d32;
    border-radius: 50%;
    position: relative;
  }

  .header__search-btn {
    display: block;
  }
}
