/* styles\header.css */

.header {
  z-index: 100;
  position: relative;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.header.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  column-gap: clamp(0.5rem, 2vw, 1rem);
  padding: 0 clamp(1rem, 4vw, var(--container-padding-x));
}

@media (width <= 63.99875rem) {
  .header-inner {
    justify-content: space-between;
    column-gap: clamp(0.3rem, 1.5vw, 0.5rem);
  }
}

/* Уменьшаем padding для tablet/mobile */
@media (width <= 768px) {
  .header-inner {
    justify-content: space-between;
    padding: clamp(1rem, 4vw, 1.5rem) clamp(1.5rem, 6vw, 2rem);
    position: relative;
    z-index: 1001;
    background-color: var(--color-dark);
  }
}

/* Еще меньше для совсем маленьких экранов */
@media (width <= 480px) {
  .header-inner {
    padding: clamp(0.8rem, 3vw, 1.2rem) clamp(1.2rem, 5vw, 1.5rem);
  }
}

.header__logo {
  width: clamp(70px, 12vw, 141px);
  height: auto;
  max-width: 141px;
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.5s ease-out 0.2s, transform 0.5s ease-out 0.2s;
}

.header.animate-in .header__logo {
  opacity: 1;
  transform: translateX(0);
}

@media (width <= 768px) {
  .header__logo {
    width: clamp(80px, 18vw, 120px);
  }
}

@media (width <= 480px) {
  .header__logo {
    width: clamp(70px, 15vw, 100px);
  }
}

/* Десктопное меню */
.header__menu--desktop .header__menu-list {
  display: flex;
  column-gap: clamp(0.5rem, 2vw, 1rem);
  position: relative;
  opacity: 0;
  transform: translateY(-15px);
  transition: opacity 0.5s ease-out 0.4s, transform 0.5s ease-out 0.4s;
}

.header.animate-in .header__menu--desktop .header__menu-list {
  opacity: 1;
  transform: translateY(0);
}

/* Центрирование меню на больших экранах */
@media (width > 768px) {
  .header-inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }
  
  .header__menu--desktop {
    justify-self: center;
  }
  
  .header__contacts--desktop {
    justify-self: end;
  }
}

@media (width <= 63.99875rem) and (width > 768px) {
  .header__menu--desktop .header__menu-list {
    column-gap: clamp(0.4rem, 1.5vw, 0.8rem);
  }
}

/* Скрываем десктопное меню на планшетах и мобильных */
@media (width <= 768px) {
  .header__menu--desktop,
  .header__contacts--desktop {
    display: none;
  }
}

.header__menu-item {
  font-size: clamp(0.7rem, 1.8vw, 0.9375rem);
  display: flex;
  background-color: var(--color-button);
  border-radius: 1.25rem;
  padding-inline: clamp(0.8rem, 2.5vw, 1.375rem);
  align-items: center;
  font-weight: 400;
  color: var(--color-light);
  height: clamp(1.5rem, 4vw, 1.875rem);
  white-space: nowrap;
  transition: 
    transform var(--transition-duration),
    background-color var(--transition-duration);
  cursor: pointer;
}

.header__menu-link {
  display: block;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
}

@media (width <= 63.99875rem) and (width > 768px) {
  .header__menu-item {
    font-size: clamp(0.65rem, 2vw, 0.85rem);
    padding-inline: clamp(0.6rem, 2vw, 1rem);
    height: clamp(1.4rem, 3.5vw, 1.7rem);
  }
}

.header__contacts--desktop {
  display: flex;
  column-gap: clamp(0.5rem, 2vw, 1rem);
  align-items: center;
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.5s ease-out 0.6s, transform 0.5s ease-out 0.6s;
}

.header.animate-in .header__contacts--desktop {
  opacity: 1;
  transform: translateX(0);
}

@media (width <= 63.99875rem) and (width > 768px) {
  .header__contacts--desktop {
    column-gap: clamp(0.4rem, 1.5vw, 0.8rem);
  }
}

.header__email {
  font-size: clamp(0.7rem, 1.8vw, 0.9375rem);
  font-weight: 400;
  color: var(--color-light);
}

@media (width <= 63.99875rem) and (width > 768px) {
  .header__email {
    font-size: clamp(0.65rem, 2vw, 0.85rem);
  }
}

/* МОБИЛЬНОЕ OVERLAY МЕНЮ */
.header__mobile-overlay {
  position: fixed;
  top: clamp(4rem, 12vw, 6rem); /* Учитываем высоту header */
  left: 0;
  width: 100%;
  height: calc(100vh - clamp(4rem, 12vw, 6rem)); /* Высота минус header */
  background-color: var(--color-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2.5rem, 8vw, 4rem);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(100%);
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@media (width <= 480px) {
  .header__mobile-overlay {
    top: clamp(3rem, 10vw, 4.5rem);
    height: calc(100vh - clamp(3rem, 10vw, 4.5rem));
    gap: clamp(2rem, 6vw, 3rem);
  }
}

.header__mobile-overlay.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.header__mobile-menu-list {
  display: flex;
  flex-direction: column;
  gap: clamp(1.2rem, 4vw, 1.5rem);
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

.header__mobile-menu-item {
  width: clamp(220px, 65vw, 320px);
  height: clamp(50px, 12vw, 60px);
  background-color: var(--color-button);
  border-radius: clamp(25px, 6vw, 30px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  transform: translateY(50px);
  opacity: 0;
}

.header__mobile-overlay.is-active .header__mobile-menu-item {
  transform: translateY(0);
  opacity: 1;
}

.header__mobile-overlay.is-active .header__mobile-menu-item:nth-child(1) {
  transition-delay: 0.1s;
}

.header__mobile-overlay.is-active .header__mobile-menu-item:nth-child(2) {
  transition-delay: 0.2s;
}

.header__mobile-overlay.is-active .header__mobile-menu-item:nth-child(3) {
  transition-delay: 0.3s;
}

.header__mobile-menu-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: var(--color-light);
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  font-weight: 500;
}

.header__mobile-contacts {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.5rem, 5vw, 2rem);
  transform: translateY(50px);
  opacity: 0;
  transition: all 0.3s ease 0.4s;
}

.header__mobile-overlay.is-active .header__mobile-contacts {
  transform: translateY(0);
  opacity: 1;
}

.header__mobile-email {
  font-size: clamp(1.1rem, 3.5vw, 1.3rem);
  font-weight: 400;
  color: var(--color-light);
  text-align: center;
}

.header__mobile-button {
  width: clamp(220px, 65vw, 320px);
  height: clamp(50px, 12vw, 60px);
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: clamp(25px, 6vw, 30px);
}

/* Скрываем мобильное меню на десктопе */
@media (width > 768px) {
  .header__mobile-overlay {
    display: none;
  }
}

.button {
  font-size: clamp(0.7rem, 1.8vw, 0.9375rem);
  font-family: var(--font-family);
  font-weight: 500;
  color: #060c1a;
  background: linear-gradient(90deg, #1461cc 0%, #04dbd6 100%);
  display: flex;
  align-items: center;
  padding: clamp(0.4rem, 1.5vw, 0.625rem) clamp(1rem, 3vw, 1.625rem);
  border-radius: 1.875rem;
  border: none;
  text-wrap: nowrap;
  transition: 
    transform 0.3s ease-out,
    box-shadow 0.3s ease-out,
    background 0.4s ease-in-out;
  position: relative;
  overflow: hidden;
  z-index: 1;
  cursor: pointer;
}

.button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #04dbd6 0%, #1461cc 100%);
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
  z-index: -1;
}

@media (width <= 63.99875rem) and (width > 768px) {
  .button {
    font-size: clamp(0.65rem, 2vw, 0.85rem);
    padding: clamp(0.35rem, 1.2vw, 0.5rem) clamp(0.8rem, 2.5vw, 1.2rem);
  }
}

.burger-button {
  width: clamp(1.8rem, 6vw, 2.2rem);
  height: clamp(1.8rem, 6vw, 2.2rem);
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(0.4rem, 1.5vw, 0.5rem) clamp(0.2rem, 0.8vw, 0.25rem);
  color: var(--color-light);
  background-color: transparent;
  border: none;
  position: relative;
  z-index: 1002;
  opacity: 0;
  transform: translateX(20px);
  transition: 
    opacity 0.5s ease-out 0.6s, 
    transform 0.5s ease-out 0.6s,
    color var(--transition-duration);
  cursor: pointer;
}

@media (width <= 768px) {
  .burger-button {
    display: inline-flex;
  }
}

@media (width <= 480px) {
  .burger-button {
    width: clamp(1.6rem, 5vw, 1.8rem);
    height: clamp(1.6rem, 5vw, 1.8rem);
  }
}

.header.animate-in .burger-button {
  opacity: 1;
  transform: translateX(0);
}

@media (any-hover: hover) {
  .burger-button:hover {
    color: #04dbd6;
  }
  
  .button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(4, 219, 214, 0.25);
  }
  
  .button:hover::before {
    opacity: 1;
  }
  
  .header__mobile-menu-item:hover {
    transform: translateY(-3px) scale(1.02);
    background-color: rgba(255, 255, 255, 0.15);
  }
}

@media (any-hover: none) {
  .burger-button:active {
    color: #04dbd6;
  }
  
  .button:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(4, 219, 214, 0.25);
  }
  
  .button:active::before {
    opacity: 1;
  }
  
  .header__mobile-menu-item:active {
    transform: translateY(-1px) scale(1.01);
    background-color: rgba(255, 255, 255, 0.15);
  }
}

.burger-button.is-active .burger-button__line:nth-child(1) {
  rotate: 45deg;
  transform-origin: 0;
  translate: clamp(0.15em, 0.6vw, 0.2em) clamp(-0.06em, -0.25vw, -0.08em);
}

.burger-button.is-active .burger-button__line:nth-child(2) {
  rotate: -45deg;
}

.burger-button.is-active .burger-button__line:nth-child(3) {
  width: 0;
}

.burger-button__line {
  background-color: currentColor;
  width: 100%;
  height: clamp(0.1rem, 0.4vw, 0.125rem);
  border-radius: 1rem;
  transition-duration: var(--transition-duration);
}

.burger-button__line:last-child {
  align-self: end;
  width: 55%;
}

@media (width >= 90rem) {
  .header-inner {
    padding: 0 clamp(3rem, 5vw, var(--container-padding-x));
  }
  
  .header__logo {
    width: clamp(100px, 8vw, 141px);
  }
  
  .header__menu--desktop .header__menu-list {
    column-gap: clamp(1rem, 1.5vw, 1.5rem);
  }
}

@media (width <= 320px) {
  .header-inner {
    padding: 0.8rem 1.2rem;
    column-gap: 0.8rem;
  }
  
  .header__logo {
    width: 65px;
  }
  
  .burger-button {
    width: 1.5rem;
    height: 1.5rem;
  }
  
  .header__mobile-menu-item {
    width: 200px;
    height: 45px;
  }
  
  .header__mobile-button {
    width: 200px;
    height: 45px;
    font-size: 0.95rem;
  }
  
  .header__mobile-email {
    font-size: 1rem;
  }
}

@media (width <= 64rem) and (width > 768px) {
  .header__menu--desktop .header__menu-list {
    column-gap: clamp(0.6rem, 1.8vw, 1rem);
  }
  
  .header__menu-item {
    font-size: clamp(0.7rem, 1.6vw, 0.9rem);
    padding-inline: clamp(0.8rem, 2.2vw, 1.2rem);
  }
}

@media (width <= 768px) {
  html.is-lock {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }
}

.header__menu-item {
  transition: 
    transform 0.25s ease-out,
    background-color 0.3s ease-out;
}

@media (any-hover: hover) {
  .header__menu-item:hover {
    transform: translateY(-2px) scale(1.03);
    background-color: rgba(255, 255, 255, 0.15);
  }
}

@media (any-hover: none) {
  .header__menu-item:active {
    transform: translateY(-1px) scale(1.01);
    background-color: rgba(255, 255, 255, 0.15);
  }
}

@media (prefers-reduced-motion: reduce) {
  .header,
  .header__logo,
  .header__menu--desktop .header__menu-list,
  .header__contacts--desktop,
  .burger-button,
  .header__mobile-overlay,
  .header__mobile-menu-item,
  .header__mobile-contacts {
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

@media (width <= 768px) {
  .header__menu--desktop,
  .header__contacts--desktop {
    display: none !important;
  }
}