/*
 * Hamburger menu toggle
 * NB NB NB!!! Must have template form-element--clean.html.twig in theme to work!
 * */

:root {
  --menu-width: 190px;
}

#ssmm_trigger {
  float: left;
  margin: 10px 12rem 0 10px;
}

#xblock-ssmmtriggermenu #ssmm_trigger {
  margin-right: calc(-0.8 * var(--menu-width));
}

/* 
 * The input placeholder 
 * Put it on top of the burger and hide it
*/
#ssmm_trigger input {
  display: block;
  width: 40px;
  height: 32px;
  position: absolute;
  margin-top: -7px;
  margin-left: -3px;
  cursor: pointer;
  opacity: 0; /* hide this */
  z-index: 2; /* and place it over the hamburger */
  -webkit-touch-callout: none;
}

/* Make the burger spans */
#ssmm_trigger span {
  display: block;
  width: 33px;
  height: 4px;
  margin-bottom: 5px;
  position: relative;
  background: #000;
  border-radius: 3px;
  border-bottom: 2px solid #ccc;
  z-index: 1;
  /* transform-origin: 4px 0px; */
  
  transition: transform 0.2s cubic-bezier(0.77,0.2,0.05,1.0),
              background 0.2s cubic-bezier(0.77,0.2,0.05,1.0),
              opacity 0.25s ease;
  
}


/* Transform all the slices of hamburger into a cross */
#ssmm_trigger input:checked ~ span.burger {
  opacity: 1;
  transform: translate(0px, -13px) rotate(45deg);
  transform-origin: 50% 50%;
}
/* The last goes in the other direction */
#ssmm_trigger input:checked ~ span.burger:nth-child(3) {
  transform: translate(0px, -1px) rotate(-45deg);
}
/* Hide the middle one */
#ssmm_trigger input:checked ~ span.burger:nth-child(2) {
  opacity: 0;
}

/* Make the menu absolute positioned */
#ssmm_trigger > ul {
  position: absolute;
  margin-left: calc(-1 * var(--menu-width));
  max-width: var(--menu-width);
  border-radius: 0 0 0 1rem;
  /* box-shadow: 3px 3px 6px 2px #ccc; */
  padding: 0.5rem;
  background-color: rgba(255, 255, 255, 0.9);
  list-style-type: none;
  -webkit-font-smoothing: antialiased; /* to stop flickering of text in safari */
  /* transition: transform 1s cubic-bezier(0.77,0.2,0.05,1.0) ease-in-out; */
  /* transition: opacity 1s ease-in-out; */
  /* transition: z-index 1.5s step-end, opacity 1s ease-in-out; */
  /* -webkit-transition: opacity 1s; /* Safari */
  z-index: -10;
  opacity: 0;
}

#ssmm_trigger ul ul {
  margin-left: 1rem;
}

#ssmm_trigger ul li  {
  list-style: none;
  display: block;
  margin-right: 20px;
  transition: all ease-in-out 0.5s;
}

#ssmm_trigger ul li a {
  border: 0;
  display: block;
  padding: 0.5rem;
  width: calc(var(--menu-width) - 30px);
  border-radius: 0 0 0 10px;
  transition: all ease-in-out 0.3s;
}

#ssmm_trigger ul li a:hover  {
  background-color: #ddd;
}

/* Show menu */
#ssmm_trigger input:checked ~ ul {
  opacity: 1;
  z-index: 1200;
  box-shadow: 0 0 4px #eee;
}

#ssmm_menu a.child {
  margin-left: 1rem;
}


@media all and (max-width: 700px) {
/* Make the menu absolute positioned */
/*
  #ssmm_trigger ul {
    position: absolute;
    right: 0;
  }
  */

}
