@import url(https://fonts.googleapis.com/css?family=Roboto:400,500);
@import url(https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css);

/*
  Hamburger Menu Toggle and Slide-In Navigation Styles
  Inspired by "Marie" on CodePen: https://codepen.io/Tiffy_Dingens/pen/QWbQXoV
*/

/* Toggle container for the hamburger menu */
#menuToggle {
  display: block;
  position: relative;
  top: 1em;
  left: 1em;
  z-index: 1000;
  -webkit-user-select: none;
  user-select: none;
}

/* Link styles inside the menu */
#menuToggle a {
  text-decoration: none;
  color: #232323;
  transition: color 0.3s ease;
}

#menuToggle a:hover {
  color: tomato;
}

/* The actual checkbox input that triggers the menu */
#menuToggle input {
  display: block;
  width: 40px;
  height: 32px;
  position: absolute;
  top: -7px;
  left: -5px;
  cursor: pointer;
  opacity: 0; /* Hide input */
  z-index: 2; /* Place above the hamburger spans */
  -webkit-touch-callout: none;
}

/* Hamburger lines */
#menuToggle span {
  display: block;
  width: 33px;
  height: 4px;
  margin-bottom: 5px;
  position: relative;
  background: #cdcdcd;
  border-radius: 3px;
  z-index: 1;
  transform-origin: 4px 0px;
  transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0),
              background 0.5s cubic-bezier(0.77,0.2,0.05,1.0),
              opacity 0.55s ease;
}

#menuToggle span:first-child {
  transform-origin: 0% 0%;
}

#menuToggle span:nth-last-child(2) {
  transform-origin: 0% 100%;
}

/* Transform hamburger into X on check */
#menuToggle input:checked ~ span {
  opacity: 1;
  transform: rotate(45deg) translate(-2px, -1px);
  background: #232323;
}

/* Hide middle line */
#menuToggle input:checked ~ span:nth-last-child(3) {
  opacity: 0;
  transform: rotate(0deg) scale(0.2, 0.2);
}

/* Rotate last line the other way */
#menuToggle input:checked ~ span:nth-last-child(2) {
  transform: rotate(-45deg) translate(0, -1px);
}

/* Slide-out menu container */
#menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 1em;
  padding-bottom: 2em;
  background: #ededed;
  display: grid;
  grid-template-rows: 1fr 1fr;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1em;
  list-style-type: none;
  -webkit-font-smoothing: antialiased; /* Improves font rendering on macOS */
  transform-origin: 0% 0%;
  transform: translate(-100%, 0);
  transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0);
}

/* First menu item spans full width and height */
#menu li:nth-child(1) {
  grid-column: 1 / span 3;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 1em;
  padding: 2em;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
}

/* Menu links stretch to fill grid cells */
#menu li a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Image inside menu item */
#menu li img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

/* Heading in menu item */
#menu li h2 {
  text-transform: uppercase;
  margin-bottom: 1em;
}

/* Other menu items aligned to second row */
#menu li:nth-child(2),
#menu li:nth-child(3),
#menu li:nth-child(4) {
  grid-row: 2;
}

/* Slide menu in when checkbox is checked */
#menuToggle input:checked ~ ul {
  transform: translate(0, 0);
}

/* Mobile-first default image styles */
ul#menu img.contact {
  width: 100%;
  height: auto;
}

/* Medium screen adjustments */
@media only screen and (min-width: 500px) {
  ul#menu img.contact {
    width: 40%;
    height: auto;
  }

  #menu li:nth-child(1) {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    text-align: left;
    gap: 2em;
  }

  #menu li:nth-child(1) h2 {
    margin: 0;
  }

  #menu li:nth-child(1) img.contact {
    display: block;
    max-width: 100%;
    height: auto;
  }
}

/* Large screen adjustments */
@media only screen and (min-width: 800px) {
  #menu li:nth-child(1) {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  #menu li:nth-child(1) img.contact {
    display: block;
    width: 30%;
    height: auto;
    margin: 0 auto;
  }
}

/* Dark mode styles */
@media (prefers-color-scheme: dark) {
  #menu {
    color: #ccc;
    background-color: rgba(30, 30, 30, 1);
  }

  /* Hamburger bars turn white in dark mode */
  #menuToggle input:checked ~ span {
    background: white;
  }

  #menu li {
    background-color: #333;
  }
}

/* Light mode fallback */
@media (prefers-color-scheme: light) {
  #menu li {
    background-color: #fff;
  }
}
