@import url('https://fonts.googleapis.com/css?family=Varela+Round');

* {
  box-sizing: border-box;
}

:root {
  --GAP: 15px;
  --WHITE: #FBFBFB;
  --COLOR1: #FDA085;
  --COLOR1g: #F6D365;
  --COLOR2: #BFF098;
  --COLOR2g: #6FD6FF;
  --COLOR3: #EA8D8D;
  --COLOR3g: #A890FE;
  --COLOR4: #D8B5FF;
  --COLOR4g: #1EAE98;
  --COLOR5: #C6EA8D;
  --COLOR5g: #FE90AF;
}


/* ===================== MENU ===================== */
.fijar-menu{
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 9999;
}

.menu {
}

.menu > ol {
  list-style: none;
  padding: 0;
  text-transform: uppercase;
}

.menu > ol > li {
  background: #233e87; /* equivalente a darken(#FBFBFB,75%) */
  border-left: 5px solid var(--WHITE);
  margin-bottom: 1px;
  position: relative;
  transition: 0.5s;
}

/* Colores por posición */
.menu > ol > li:nth-child(1) {
  --accent-color: var(--COLOR1);
  --gradient-color: var(--COLOR1g);
}
.menu > ol > li:nth-child(2) {
  --accent-color: var(--COLOR2);
  --gradient-color: var(--COLOR2g);
}
.menu > ol > li:nth-child(3) {
  --accent-color: var(--COLOR3);
  --gradient-color: var(--COLOR3g);
}
.menu > ol > li:nth-child(4) {
  --accent-color: var(--COLOR4);
  --gradient-color: var(--COLOR4g);
}
.menu > ol > li:nth-child(5) {
  --accent-color: var(--COLOR5);
  --gradient-color: var(--COLOR5g);
}

.menu > ol > li > a {
  color: var(--WHITE);
  display: block;
  padding: var(--GAP);
  position: relative;
  text-decoration: none;
  z-index: 1;
  font-family:  "Raleway", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
}

/* Icono del submenú */
.menu > ol > li > a:not(:last-child)::before {
  content: "\f078";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 0.75em;
  line-height: 50px;
  position: absolute;
  right: 25px;
  top: 0;
  bottom: 0;
  margin: auto;
  transition: 0.5s;
}

/* Hover principal */
.menu > ol > li:hover,
.menu > ol > li:focus-within {
  z-index: 100;
}

.menu > ol > li:hover::after,
.menu > ol > li:focus-within::after {
  background: linear-gradient(to left, var(--accent-color), var(--gradient-color));
  max-width: 800px;
}

.menu > ol > li::after {
  background: #2b2f33;
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  transition: 0.5s;
  max-width: 0;
  overflow: hidden;
}

/* ===================== SUBMENÚ (Corregido + animado) ===================== */

.menu .sub-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 5px);
  list-style: none;
  margin: 0;
  padding: 0;
  background: linear-gradient(to bottom, var(--accent-color), var(--gradient-color));
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: max-height 0.5s ease, opacity 0.4s ease, transform 0.4s ease;
  z-index: 10;
}

.menu > ol > li:hover .sub-menu,
.menu > ol > li:focus-within .sub-menu {
  max-height: 400px;
  opacity: 1;
  transform: translateY(0);
}

.menu .sub-menu li {
  font-size: 0.9em;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.menu .sub-menu li:last-child {
  border-bottom: none;
}

.menu .sub-menu a {
  display: block;
  padding: 10px;
  color: var(--WHITE);
  text-decoration: none;
  position: relative;
  transition: background 0.3s, color 0.3s;
}

.menu .sub-menu a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.menu .sub-menu a::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  height: 1px;
  width: 0;
  margin: auto;
  background: var(--WHITE);
  transition: width 0.3s ease;
}

.menu .sub-menu a:hover::after {
  width: 20px;
}

/* ===================== LINKS ===================== */

a:focus {
  outline: none;
}

.menu-item a::after, .nav-pills a::after{
  content: "";
  background: var(--WHITE);
  position: absolute;
  bottom: 5px;
  left: var(--GAP);
  height: 3px;
  width: 0;
  transition: 0.5s;
  transition-delay: 0.2s;
}

a:hover::after,
a:focus::after {
  width: 50px;
}

/* ===================== RESPONSIVE ===================== */

@media (min-width: 600px) {
  .menu {
    margin: 0;
  }

  .menu > ol {
    display: block;
    text-align: right;
  }

  .menu > ol > li {
    border-top: 5px solid var(--accent-color);
    border-left: 0;
    display: inline-block;
    margin-left: -5px;
    vertical-align: top;
    width: 120px;
  }

  .menu > ol > li:hover::after {
    background: linear-gradient(to bottom, var(--accent-color), var(--gradient-color));
    border-radius: 3px;
    top: calc(-1 * var(--GAP));
    bottom: calc(-1 * var(--GAP));
    left: calc(-1 * var(--GAP));
    right: calc(-1 * var(--GAP));
  }

  .menu > ol > li:hover .sub-menu {
    max-height: 750px;
  }

  .menu > ol > li > a:not(:last-child)::before {
    right: 12.5px;
  }

  .menu .sub-menu {
    border-left: 0;
    margin: var(--GAP) calc(-1 * var(--GAP)) calc(-1 * var(--GAP));
    padding-left: 0;
  }
}

@media (min-width: 775px) {
  .menu > ol > li {
    width: 150px;
  }

  .menu > ol > li > a:not(:last-child)::before {
    right: 25px;
  }
}
