/* ===== ESTRUCTURA BASE DEL HEADER ===== */
.header-navbar {
  position: fixed;
  top: 0;
  left: 0;
  padding: 20px 0 3rem 0;
  width: 100%;
  height: 15vh;
  background-color: transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 5px 10px -5px rgba(0, 0, 0, 0.05);
  mask-image: linear-gradient(to bottom, black calc(100% - 25px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 25px), transparent 100%);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* ===== LOGO ===== */
.header-logo img {
  height: auto;
  max-height: 100px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  transition: transform 0.3s ease-out;
}

.header-logo img:hover {
  animation: bounce-logo 0.3s ease-out forwards;
}

@keyframes bounce-logo {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  70% { transform: scale(1.03); }
  100% { transform: scale(1.06); }
}

/* ===== NAVEGACIÓN DESKTOP ===== */
.header-nav-desktop {
  display: flex;
}

/* Enlaces principales */
.header-nav-desktop a,
.header-dropdown > a {
  color: var(--white);
  text-decoration: none;
  font-size: 1.8rem;
  font-weight: 400;
  margin-left: 2rem;
  transition: transform 0.3s ease, color 0.3s ease;
  display: inline-block;
}

.header-nav-desktop a:hover,
.header-dropdown > a:hover {
  color: var(--mid-grey);
}

/* Dropdown y submenú */
.header-dropdown {
  position: relative;
}

.header-submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: none;
  padding: 0.5rem 0;
  min-width: 200px;
  z-index: 1001;
  flex-direction: column;
}

.header-submenu a {
  display: inline-block;
  padding: 0.5rem 1rem;
  color: var(--white);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-10px);
  animation: dropdownFade 0.3s ease forwards;
  transition: transform 0.3s ease, color 0.3s ease;
}

.header-submenu a:hover {
  transform: translateY(-10px);
  color: var(--mid-grey);
}

.header-dropdown:hover > .header-submenu {
  display: flex;
}

/* Animaciones del dropdown */
@keyframes dropdownFade {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-dropdown:hover .header-submenu a:nth-child(1) { animation-delay: 0.05s; }
.header-dropdown:hover .header-submenu a:nth-child(2) { animation-delay: 0.1s; }
.header-dropdown:hover .header-submenu a:nth-child(3) { animation-delay: 0.15s; }

/* ===== NAVEGACIÓN MÓVIL ===== */
.header-nav-mobile {
  position: fixed;
  top: 15vh;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  padding: 1rem 2rem;
  z-index: 99999;
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s ease, opacity 0.3s ease;
  overflow-y: auto;
}

.header-nav-mobile.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.header-nav-mobile a {
  padding: 1rem 0;
  border-bottom: 1px solid var(--dark-grey);
  color: var(--white);
  text-decoration: none;
  font-size: 1.8rem;
}

.header-nav-mobile a:last-child {
  border-bottom: none;
}

/* Dropdown móvil */
.header-mobile-dropdown {
  display: flex;
  border-bottom: 1px solid #333;
  flex-direction: column;
  width: 100%;
}

.header-mobile-parent {
  font-family: var(--font1);
  font-size: 1.8rem;
  font-weight: 500;
  background: none;
  color: var(--light-grey);
  border: none;
  text-align: left;
  padding: 1rem 0;
  cursor: pointer;
  position: relative;
}

.header-mobile-parent::after {
  content: '◂';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  transition: transform 0.3s ease;
  font-size: 1.2rem;
}

.header-mobile-parent.open::after {
  transform: translateY(-50%) rotate(-90deg);
}

.header-mobile-submenu {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  padding-left: 1rem;
}

.header-mobile-submenu a {
  padding: 0.5rem 0;
  border: none;
}

.header-mobile-submenu.show {
  max-height: 500px;
  opacity: 1;
}

/* ===== BOTÓN BURGER (MÓVIL) ===== */
.burger-toggler {
  display: none;
}

.burger-animated-icon {
  width: 30px;
  height: 20px;
  position: relative;
  transition: 0.5s ease-in-out;
}

.burger-animated-icon span {
  position: absolute;
  height: 3px;
  width: 100%;
  border-radius: 9px;
  background: white;
  left: 0;
  transition: 0.25s ease-in-out;
}

.burger-animated-icon span:nth-child(1) { top: 0; }
.burger-animated-icon span:nth-child(2) { top: 10px; }
.burger-animated-icon span:nth-child(3) { top: 20px; }

.burger-animated-icon.open span:nth-child(1) {
  top: 11px;
  transform: rotate(135deg);
}

.burger-animated-icon.open span:nth-child(2) {
  opacity: 0;
  left: -60px;
}

.burger-animated-icon.open span:nth-child(3) {
  top: 11px;
  transform: rotate(-135deg);
}

/* ===== SAFARI ===== */
@supports (-webkit-backdrop-filter: blur(0)) {
  .header-navbar {
      height: auto !important;
  }
  html {
    font-size: 75% !important;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1680px) {
  .header-logo img {
    max-height: 70px;
  }
  .header-nav-desktop a,
  .header-dropdown > a {
    font-size: 1.6rem;
    margin-left: 1.5rem;
  }
  .header-submenu {
    top: 90%;
  }
}

@media (max-width: 768px) {
  .header-nav-desktop {
    display: none;
  }

  .header-logo img {
    height: auto;
    max-height: 70px;
  }

  .burger-toggler {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
  }
}

@media screen and (orientation: landscape) and (max-height: 500px) {
  
  .header-navbar {
    height: auto;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .header-logo img {
    max-height: 70px;
  }
  .header-nav-desktop {
    display: none;
  }

  .burger-toggler {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
  }
}
