// --------------------------------------------------------- // Site navigation mobile layout // // The main layout for the website navigation, for the mobile // version only. // ----------------------------------------------------------- $nav-toggle-color: #333; $nav-toggle-active-color: #fff; $hamburger-padding-x: 1.5rem; $hamburger-padding-y: 5rem; $hamburger-layer-width: 4rem; $hamburger-layer-height: .2rem; $hamburger-layer-spacing: .6rem; $hamburger-layer-color: $nav-toggle-color; $hamburger-layer-border-radius: 0; $hamburger-hover-opacity: .8; $hamburger-hover-transition-duration: .15s; $hamburger-hover-transition-timing-function: linear; @charset 'utf-8'; @import 'hamburgers/_sass/hamburgers/hamburgers'; // Choose hamburger animation here // Choices: https://jonsuh.com/hamburgers/ .hamburger { @extend .hamburger--spin; } // Mobile styles @media screen and (max-width: $responsivenav - 1px) { // Users that don't have Javascript enabled .no-js .site-header { position: static; // Use the same color than navigation background: $color-almostblack; } // Disable scroll on html body when menu is opened. .disable-scroll { overflow: hidden; } // Ensure nav stays in the same position when activated .js { &.js-nav-active { overflow: hidden; nav { visibility: visible; max-height: 100%; height: 100vh; overflow: auto; } } } .js nav { // Hide mobile navigation by default while enabling use of animations visibility: hidden; max-height: 0; height: 0; clip: auto; position: fixed; top: 0; left: 0; right: 0; .menu-items { padding: 15% 0; } } nav { background: $color-almostblack; transition: all .55s; margin: 0; overflow: hidden; display: block; width: 100%; .menu-items { margin: 0; width: 100%; float: none; padding: 2rem 0; a { padding-top: 1rem; padding-bottom: 1rem; padding-left: 5%; padding-right: 5.8rem; // Make room for the toggle button (sub indicator) color: #fff; font-size: 1.6rem; font-weight: 400; line-height: 1.7rem; text-decoration: none; position: relative; z-index: 0; display: block; // We have color here, so it's okay to remove outline outline: none; &:focus { outline: none; } // Prevent nav item overlapping with dropdown opening toggle &.has-submenu { width: 80%; position: static; } &:hover, &:focus, &:active { color: $color-links; } &.current { color: #d23600; } &.disabled { color: #bbb; } &.highlighted .sub-arrow:before { display: block; content: '-'; } } // Dropdown toggle .dropdown-toggle { position: absolute; top: 0; margin-top: 0; left: auto; right: 2rem; width: 3.7rem; height: 3.7rem; overflow: hidden; font: bold 18px/37px monospace; text-align: center; background: #202020; color: #fff; padding: 0; z-index: 9999; border: 0; &:focus { z-index: 10000; } &:before { content: '+'; } &:hover { background-color: #3e4853; color: #fff; } &.toggled-on:before { display: block; content: '-'; } } // Dropdowns ul { background: rgba(#666, .1); margin-left: 0; padding: 0; // Slight margins to improve readability of sub-navs // Second level > li { padding-left: 1.5rem; // Third level ul { margin-left: -1.5rem; li { padding-left: 3rem; } // Fourth level ul { margin-left: -3rem; li { padding-left: 4.5rem; } } } } a { font-size: 1.4rem; } } } } } // Hamburger menu icon .nav-toggle { list-style: none; z-index: 100000; -webkit-tap-highlight-color: rgba(#000, 0); border: 0; overflow: visible; color: #fff; font-weight: 700; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-touch-callout: none; user-select: none; text-decoration: none; padding: 0; margin: 0; background: transparent; cursor: pointer; position: relative; // Hide from desktops display: none; span { color: $nav-toggle-color; font-size: 1.2em; } // Alternative focus for mobile nav &:focus { outline: none; span { span { background-color: $nav-toggle-color; } &:before, &:after { background-color: $nav-toggle-color; } } } &:hover, &:active { color: $nav-toggle-color; span { color: $nav-toggle-color; } } @media (max-width: $responsivenav - 1px) { display: block; } // Separate active colors for opened state &.is-active { color: $nav-toggle-active-color; &:focus, &.focus { .hamburger-box { .hamburger-inner { background-color: $nav-toggle-active-color; &:after { background-color: $nav-toggle-active-color; } } } } .hamburger-box { .hamburger-inner { background-color: $nav-toggle-active-color; &:after { background-color: $nav-toggle-active-color; } } } &:focus, &:hover, &:active { color: $nav-toggle-active-color; span { color: $nav-toggle-active-color; } } span { color: $nav-toggle-active-color; } } }