/* Estructura general del header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background-color: white;
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid #ccc;
}

.header-superior {
  display: flex;
  width: 100%;
  max-width: 1440px;
  height: 70px;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
}

.header-superior img {
  width: 100%;
  max-width: 170px;
  z-index: 999;
}

.header-superior .logo-link {
  display: inline-block; /* o inline-flex si quieres */
  width: auto; /* evita que tome 100% */
  padding: 0;
  margin: 0;
}


/* Enlaces del menú */
.header-superior nav a {
  display: flex;
  position: relative;
  text-decoration: none;
  color: black;
  transition: color 150ms;
  overflow: hidden;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  padding: 5px 0;
}

/* Línea decorativa inferior */
.header-superior nav a::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--main);
  transform: translateX(-50%);
  transition: width 150ms ease;
}

/* Hover */
.header-superior nav a:hover {
  color: var(--main);
}

.header-superior nav a:hover::before {
  width: 100%;
}

/* Activo (se mantiene marcado) */
.header-superior nav a.active {
  color: var(--main);
}

.header-superior nav a.active::before {
  width: 100%;
}

.header-superior nav {
  display: flex;
  gap: 30px;
}

.header-superior i {
  display: none;
}

/* Ícono hamburguesa */
.menu-icon {
  display: none;
  width: 30px;
  height: 24px;
  position: relative;
  cursor: pointer;
  z-index: 1001;
}

.menu-icon span {
  position: absolute;
  height: 3px;
  width: 100%;
  background-color: black;
  border-radius: 2px;
  transition: all 0.3s ease;
  left: 0;
}

.menu-icon span:nth-child(1) {
  top: 0;
}
.menu-icon span:nth-child(2) {
  top: 10px;
}
.menu-icon span:nth-child(3) {
  top: 20px;
}

/* Animación hamburguesa a X */
#menu-toggle:checked ~ .menu-icon span:nth-child(1) {
  transform: rotate(45deg);
  top: 10px;
}
#menu-toggle:checked ~ .menu-icon span:nth-child(2) {
  opacity: 0;
}
#menu-toggle:checked ~ .menu-icon span:nth-child(3) {
  transform: rotate(-45deg);
  top: 10px;
}

/* Overlay para fondo oscuro */
.menu-overlay {
  display: none;
}

@media (max-width: 768px) {
  .menu-icon {
    display: block;
  }

  .header-superior nav {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    position: fixed;
    top: 71px;
    right: 0;
    width: 280px;
    height: 100vh;
    background-color: white;
    padding: 30px 2rem 2rem;
    gap: 2rem;
    z-index: 998;
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }

  .header-superior i {
    display: block;
  }

  .header-superior a {
    width: 100%;
    padding: 10px 0;
  }

  #menu-toggle:checked ~ .menu-icon + nav {
    transform: translateX(0);
  }

  .menu-overlay {
    display: block;
    position: fixed;
    top: 71px;
    left: 0;
    width: 100%;
    height: calc(100vh - 71px);
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 997;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  #menu-toggle:checked ~ .menu-icon ~ nav + .menu-overlay {
    opacity: 1;
    pointer-events: auto;
  }
}
