*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: sans-serif;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  font-size: 16px;
}

body {
  font-family: "Montserrat", sans-serif;
  font-size: 1rem;
  color: #000;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body {
  height: 100%;
  padding: 0 !important;
  margin: 0 !important;
}

:root {
  --header-height: 8rem;
  --header-bg: transparent;
  --header-bg-scrolled: #ffffff;
  --transition-speed: .5s;
}

/**************************************
HEADER GENERAL
**************************************/
header {
  display: flex;
  align-items: center;
  background-color: var(--header-bg);
  height: var(--header-height);
  position: fixed;
  z-index: 9999;
  width: 100%;
  transition: background-color var(--transition-speed) ease;
}

header.scrolled {
  background-color: var(--header-bg-scrolled);
}

/**************************************
LOGOS
**************************************/
#logo_color {
  display: none;
  transition: opacity var(--transition-speed) ease;
}
#logo_white {
  display: block;
  transition: opacity var(--transition-speed) ease;
}
.logo-svg {
  display: block;
  transition: opacity 0.3s ease;
}

/* Scroll sin menú activo → logo color */
header.scrolled:not(.fullscreen-active) #logo_color {
  display: block;
}
header.scrolled:not(.fullscreen-active) #logo_white {
  display: none;
}

/* Menú fullscreen activo → siempre logo blanco */
header.fullscreen-active #logo_color {
  display: none !important;
}
header.fullscreen-active #logo_white {
  display: block !important;
}

/**************************************
LOGO CONTENEDOR
**************************************/
header .primero {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 0;
  position: relative;
  z-index: 10000;
}

.logo-inicio {
  height: 100%;
  display: flex;
  align-items: start;
  justify-content: start;
  padding: 1.5rem;
}

.logo-inicio img {
  height: 100%;
  object-fit: contain;
}

/**************************************
BLOQUE CENTRAL (NAVEGACIÓN)
**************************************/
header .segundo {
  display: flex;
  justify-content: end;
  align-items: center;
  width: 80%;
}

header .segundo nav {
  position: relative;
}

.nav-ul {
  display: inline-flex;
  align-items: center;
  flex-direction: row;
  list-style: none;
  white-space: nowrap;
  margin: 0 !important;
  padding: 0;
  width: max-content;
}

.nav-li {
  position: relative;
}
.nav-li i.bi {
  font-size: 0.8rem;
  margin-left: .3rem;
}

.nav-li > a {
  color: white;
  padding: 1rem;
  display: flex;
  align-items: center;
  text-transform: uppercase;
  font-family: "Montserrat", sans-serif;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.1rem;
  text-decoration: none;
}

header.scrolled .nav-li > a {
  color: black;
}

.nav-ul li > a {
  position: relative;
}

.nav-ul li > a::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #c00;
  transition: width 0.3s ease;
}

@media (hover: hover) {
  .nav-ul li > a:hover::after {
    width: 100%;
  }
}

.nav-ul li.has-megamenu.open > a::after {
  width: 100%;
}


/**************************************
MEGAMENÚS
**************************************/
.nav-li.has-megamenu {
  position: static;
}

.dropdown-menu.megamenu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 192px;
  display: none; /* mobile: oculto por defecto */
  background: white;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 15px rgba(0,0,0,0.1);
  overflow: hidden;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border: none !important;
  margin-top: 4px;
}

.megamenu-row {
  display: flex;
  width: 100%;
  height: 192px;
  align-items: stretch;
}

/**************************************
COLUMNA LINKS
**************************************/
.megamenu-col.links {
  flex: 1;
  display: flex;
}

.megamenu-col.links ul {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
  list-style: none;
  justify-content: center;
}

.megamenu-col.links ul li {
  width: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.megamenu-col.links ul li a {
  width: 100%;
  padding: 1rem;
  text-decoration: none;
  text-transform: capitalize;
  color: black;
  font-family: "Montserrat", sans-serif;
  font-size: 1rem;
  font-weight: 500;
}

.submenu.carreras {
  flex-direction: column;
  width: 100%;
}

.megamenu-col.links ul.submenu.carreras li {
  width: 100%;
  
}

/**************************************
COLUMNA IMAGEN
**************************************/
.megamenu-col.image {
  flex: 1;
  align-self: stretch;
  background-size: cover;
  background-position: top center; /* en lugar de center */
  background-repeat: no-repeat;
}

.bg-img-menu-info {
  background-image: url("../img/megamenuimg/bg-img-menu-info.webp");
}

.bg-img-menu-carreras {
  background-image: url("../img/megamenuimg/bg-img-menu-carreras.webp");
}
.nav-icon {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    max-width: 22px;
    max-height: 22px;
    vertical-align: middle;
    margin-right: 0.5rem;
    object-fit: contain;
    display: inline-block;
    flex-shrink: 0;
    filter: invert(16%) sepia(85%) saturate(700%) hue-rotate(325deg) brightness(80%);
}



/**************************************
SELECTOR IDIOMA — DESKTOP
**************************************/
.language-switcher {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  margin: 0 5rem;
  z-index: 10000;
}

.lang-current {
  color: white;
  padding: 1rem;
  text-transform: uppercase;
  font-family: "Montserrat", sans-serif;
  font-size: 1.35rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

/* Scroll sin fullscreen → texto negro */
header.scrolled:not(.fullscreen-active) .lang-current {
  color: black;
}

/* Fullscreen activo → texto blanco */
header.fullscreen-active .lang-current {
  color: #fff !important;
}

.lang-menu {
  position: absolute;
  top: 100%;
  right: 0;
  display: none;
  background: white;
  border: 1px solid #ddd;
  flex-direction: column;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 120px;
  z-index: 10001;
}

.language-switcher:hover .lang-menu {
  display: flex;
}

/* Dropdown: siempre fondo blanco, texto negro — sin excepciones */
.lang-menu li a {
  height: 54px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
  text-decoration: none;
  color: #000 !important;
  background: #fff;
  font-family: "Montserrat", sans-serif;
  font-size: 1.25rem;
  font-weight: 500;
}

.lang-menu li a:hover {
  background: #f7f7f7;
  color: #000 !important;
}

/**************************************
HAMBURGUESA
**************************************/
.burguer-button {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 30px;
  position: relative;
  margin-right: 0.5rem;
  z-index: 10000;
}

.burguer-icon,
.burguer-icon::before,
.burguer-icon::after {
  width: 30px;
  height: 3px;
  background: #fff;
  display: block;
  position: absolute;
  left: 0;
  transition: background 0.3s;
}

.burguer-icon {
  top: 50%;
  transform: translateY(-50%);
}

.burguer-icon::before {
  content: "";
  top: -10px;
}

.burguer-icon::after {
  content: "";
  top: 10px;
}

/* Scroll sin fullscreen → burger negro */
header.scrolled:not(.fullscreen-active) .burguer-icon,
header.scrolled:not(.fullscreen-active) .burguer-icon::before,
header.scrolled:not(.fullscreen-active) .burguer-icon::after {
  background: #000;
}

/* Fullscreen activo → burger siempre blanco */
header.fullscreen-active .burguer-icon,
header.fullscreen-active .burguer-icon::before,
header.fullscreen-active .burguer-icon::after {
  background: #fff !important;
}

/**************************************
MEGAMENU — DESKTOP (click + transición)
**************************************/
@media (min-width: 993px) {
  .nav-li.has-megamenu .dropdown-menu.megamenu {
    display: flex;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
  }
  .nav-li.has-megamenu.open > .dropdown-menu.megamenu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.22s ease, transform 0.22s ease;
  }
}

/**************************************
RESPONSIVE — MÓVIL / TABLET
**************************************/
@media (max-width: 992px) {

  header {
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 2000;
  }

  .primero {
    flex: 0 0 auto;
    z-index: 2001;
  }

  .logo-inicio {
    padding: 0;
    height: auto;
    display: flex;
    align-items: center;
  }

  .logo-inicio img {
    height: 50px;
  }

  .menu-right {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .burguer-button {
    display: block;
  }

  /* Language switcher: permanece en su posición natural del flujo */
  .language-switcher {
    margin: 0;
    position: relative;
    z-index: 10001;
  }

  /* lang-current blanco por defecto en móvil */
  .lang-current {
    color: #fff;
    padding: 0.5rem;
  }

  /* Scroll sin fullscreen → negro */
  header.scrolled:not(.fullscreen-active) .lang-current {
    color: #000;
  }

  /* Fullscreen activo → blanco */
  header.fullscreen-active .lang-current {
    color: #fff !important;
  }

  /* Dropdown: fondo blanco, texto negro — siempre */
  .lang-menu {
    z-index: 10002 !important;
    background: #fff !important;
    border: 1px solid #ddd;
  }

  .lang-menu li a {
    color: #000 !important;
    background: #fff;
  }

  .lang-menu li a:hover {
    background: #f7f7f7;
    color: #000 !important;
  }

  /* Menú nav oculto por defecto */
  .nav-ul {
    display: none;
    position: absolute;
    top: calc(110% + 10px);
    right: 0;
    background: white;
    flex-direction: column;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
    width: 175px;
    z-index: 1000;
  }

  .nav-ul.active {
    display: flex;
  }

  .nav-li > a {
    color: black;
    font-size: 1.1rem;
    padding: 10px 0;
  }

  .dropdown-menu.megamenu {
    position: static;
    height: auto;
    box-shadow: none;
  }

  .megamenu-row {
    flex-direction: column;
  }

  .megamenu-col.image {
    min-height: 180px;
  }

  .nav-li.has-megamenu .dropdown-menu.megamenu {
    display: none;
    flex-direction: column;
    width: 100%;
    position: static;
    background: transparent !important;
    box-shadow: none;
    height: auto;
  }

  .nav-li.has-megamenu.open .dropdown-menu.megamenu {
    display: flex;
  }

  .burguer-button,
  .language-switcher {
    position: relative;
    z-index: 10001;
  }
}

/**************************************
FULLSCREEN MENU NEGRO — MÓVIL
**************************************/
@media (max-width: 992px) {

  .nav-ul.fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    display: flex !important;
    flex-direction: column;
    justify-content: flex-start !important;
    align-items: center;
    padding-top: 8rem;
    overflow-y: auto;
    z-index: 1000;
  }

  .nav-ul.fullscreen .nav-li {
    width: 100%;
    position: relative;
    text-align: center;
  }

  .nav-ul.fullscreen .nav-li > a {
    width: 100%;
    display: flex;
    justify-content: center;
    color: #fff !important;
    padding: 0.8rem 0;
    font-size: 1.2rem;
  }

  .nav-ul.fullscreen .dropdown-menu.megamenu {
    display: none !important;
    position: relative !important;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0 auto;
    background: transparent !important;
    box-shadow: none;
    height: auto;
  }

  .nav-ul.fullscreen .nav-li.has-megamenu.open > .dropdown-menu.megamenu {
    display: block !important;
  }

  .nav-ul.fullscreen .nav-li.has-megamenu.open > a {
    margin-bottom: 0.5rem;
  }

  .nav-ul.fullscreen .megamenu-row,
  .nav-ul.fullscreen .megamenu-col,
  .nav-ul.fullscreen .megamenu-col.links,
  .nav-ul.fullscreen .megamenu-col.links ul {
    display: block !important;
    width: 100%;
  }

  .nav-ul.fullscreen .megamenu-col.image {
    display: none !important;
  }

  .nav-ul.fullscreen .megamenu-col.links ul {
    padding: 0;
    margin: 0;
  }

  .nav-ul.fullscreen .megamenu-col.links ul li {
    width: 100%;
    justify-content: center;
    padding-right: 1rem;
  }

  .nav-ul.fullscreen .megamenu-col.links ul li a {
    display: block;
    width: 100%;
    padding: 0.45rem 0;
    font-size: 0.95rem;
    color: #fff !important;
    text-align: center;
  }

  .nav-ul.fullscreen .megamenu-col.links ul.submenu.info {
    flex-direction: column;
    width: 100%;
    align-items: center;
  }

  .nav-ul.fullscreen .megamenu-col.links ul.submenu.info li {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .nav-ul.fullscreen .megamenu-col.links ul.submenu.info li a {
    text-align: center;
    width: 100%;
    display: block;
  }

  .nav-ul.fullscreen .nav-li.has-megamenu.open .dropdown-menu.megamenu {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    position: relative;
    background: none;
    box-shadow: none;
    height: auto;
  }

  .nav-ul.fullscreen .nav-li.has-megamenu.open .megamenu-row {
    flex-direction: column;
  }

  .nav-ul.fullscreen .nav-li.has-megamenu.open .megamenu-col.links ul.submenu li {
    width: 100%;
  }

  .nav-ul.fullscreen .megamenu-row {
    flex-direction: column;
  }
}

/* FIX: resetea la altura fija del megamenu-row (192px) en fullscreen móvil
   para que el menú de carreras no deje hueco vacío con solo 2 items */
.nav-ul.fullscreen .nav-li.has-megamenu.open .megamenu-col.links {
    height: auto !important;
    min-height: unset !important;
}

.nav-ul.fullscreen .nav-li.has-megamenu.open .megamenu-col.links ul.submenu.carreras {
    height: auto !important;
    min-height: unset !important;
}

.nav-ul.fullscreen .nav-li.has-megamenu.open .megamenu-row {
    height: auto !important;
    min-height: unset !important;
}

.dropdown-menu.megamenu * {
    color: #000 !important;
}

.dropdown-menu.megamenu a:hover {
    color: #a31e33 !important;
}

