88 display : flex ;
99 justify-content : space-between ;
1010 align-items : stretch ;
11+ position : relative ;
1112 }
1213}
1314
3839 }
3940}
4041
42+ .mobile-menu-toggle {
43+ display : none ;
44+ flex-direction : column ;
45+ justify-content : center ;
46+ align-items : center ;
47+ background : none ;
48+ border : none ;
49+ cursor : pointer ;
50+ padding : 10px ;
51+ z-index : 1001 ;
52+
53+ span {
54+ display : block ;
55+ width : 25px ;
56+ height : 3px ;
57+ background-color : $text-black ;
58+ margin : 3px 0 ;
59+ transition : 0.3s ;
60+ transform-origin : center ;
61+ }
62+
63+ & .active span :nth-child (1 ) {
64+ transform : rotate (45deg ) translate (6px , 6px );
65+ }
66+
67+ & .active span :nth-child (2 ) {
68+ opacity : 0 ;
69+ }
70+
71+ & .active span :nth-child (3 ) {
72+ transform : rotate (-45deg ) translate (6px , -6px );
73+ }
74+ }
75+
4176#main-nav {
4277
4378 ul {
5893 color : $text-hover-color ;
5994 background : $tertiary-color ;
6095
61- .submenu {
62- display : block ;
96+
97+ @media (min-width : 769px ) {
98+ .submenu {
99+ display : block ;
100+ }
63101 }
64102 }
65103 }
73111 text-align : right ;
74112 }
75113
76- span {}
77-
78114 .submenu {
79115 display : none ;
80116 position : absolute ;
98134 padding : 0.5em 1em ;
99135 }
100136 }
137+ }
138+
139+ // Mobile styles
140+ @media (max-width : 768px ) {
141+ .mobile-menu-toggle {
142+ display : flex ;
143+ }
144+
145+ #main-nav {
146+ position : absolute ;
147+ top : 100% ;
148+ left : 0 ;
149+ right : 0 ;
150+ background-color : $background-color ;
151+ box-shadow : 0 2px 4px rgba (0 , 0 , 0 , 0.1 );
152+ transform : translateY (-100% );
153+ opacity : 0 ;
154+ visibility : hidden ;
155+ transition : all 0.3s ease ;
156+ z-index : 1000 ;
157+
158+ & .mobile-open {
159+ transform : translateY (0 );
160+ opacity : 1 ;
161+ visibility : visible ;
162+ }
163+
164+ ul {
165+ flex-direction : column ;
166+ align-items : stretch ;
167+ height : auto ;
168+ padding : 0 ;
169+ }
170+
171+ li {
172+ height : auto ;
173+ border-bottom : 1px solid rgba (0 , 0 , 0 , 0.1 );
174+
175+ & :hover {
176+ background : none ;
177+ }
178+
179+ & .has-submenu >a ::after {
180+ content : ' ▼' ;
181+ margin-left : auto ;
182+ transition : transform 0.3s ease ;
183+ }
184+
185+ & .submenu-open >a ::after {
186+ transform : rotate (180deg );
187+ }
188+ }
189+
190+ a {
191+ padding : 1rem ;
192+ height : auto ;
193+ justify-content : space-between ;
194+ border : none ;
195+ }
196+
197+ .submenu {
198+ position : static ;
199+ display : none ;
200+ background : rgba (0 , 0 , 0 , 0.05 );
201+ border : none ;
202+ box-shadow : none ;
203+
204+ ul {
205+ padding-left : 1rem ;
206+ }
207+
208+ li {
209+ border-bottom : none ;
210+
211+ & :hover {
212+ background : rgba (0 , 0 , 0 , 0.05 );
213+ }
214+ }
215+
216+ a {
217+ padding : 0.75rem 1rem ;
218+ align-items : flex-start ;
219+ }
220+ }
221+
222+ .submenu-open .submenu {
223+ display : block ;
224+ }
225+ }
226+
227+ .hide-mobile {
228+ display : none !important ;
229+ }
101230}
0 commit comments