11---
2- import HeaderLink from ' ./HeaderLink.astro' ;
3- import { SITE_TITLE } from ' ../consts' ;
2+ import HeaderLink from " ./HeaderLink.astro" ;
3+ import { SITE_TITLE } from " ../consts" ;
44---
55
66<header class =" navbar" >
77 <nav >
8+ <div class =" logo" >
9+ <a href =" /" >Madhu Sudhan Subedi</a >
10+ </div >
11+
12+ <button class =" mobile-menu-toggle" aria-label =" Toggle menu" >
13+ <span class =" hamburger-box" >
14+ <span class =" hamburger-inner" ></span >
15+ </span >
16+ </button >
17+
818 <div class =" nav-links" >
919 <ol >
1020 <li ><a href =" /" ><span >01.</span > Home</a ></li >
@@ -13,15 +23,39 @@ import { SITE_TITLE } from '../consts';
1323 <li ><a href =" /notes" ><span >04.</span > Notes</a ></li >
1424 </ol >
1525 </div >
26+
27+ <div class =" mobile-menu" >
28+ <nav class =" mobile-nav" >
29+ <ol >
30+ <li ><a href =" /" ><span >01.</span > Home</a ></li >
31+ <li ><a href =" /blog" ><span >02.</span > Blog</a ></li >
32+ <li ><a href =" /weekly" ><span >03.</span > Weekly</a ></li >
33+ <li ><a href =" /notes" ><span >04.</span > Notes</a ></li >
34+ </ol >
35+ </nav >
36+ </div >
1637 </nav >
17-
38+
1839 <div class =" home-subnav" >
1940 <a href =" #about" >About</a >
2041 <a href =" #experience" >Experience</a >
2142 <a href =" #projects" >Projects</a >
2243 <a href =" #skills" >Skills</a >
2344 </div >
2445</header >
46+ <script >
47+ const menuToggle = document.querySelector(".mobile-menu-toggle");
48+ const mobileMenu = document.querySelector(".mobile-menu");
49+ const body = document.querySelector("body");
50+
51+ if (menuToggle && mobileMenu) {
52+ menuToggle.addEventListener("click", () => {
53+ menuToggle.classList.toggle("active");
54+ mobileMenu.classList.toggle("active");
55+ if (body) body.classList.toggle("blur");
56+ });
57+ }
58+ </script >
2559
2660<style >
2761 .navbar {
@@ -31,11 +65,13 @@ import { SITE_TITLE } from '../consts';
3165 width: 100%;
3266 height: 70px;
3367 padding: 0px 50px;
34- background-color: rgba(10, 25, 47, 0.85 );
68+ background-color: var(--navy );
3569 backdrop-filter: blur(10px);
3670 transition: var(--transition);
71+ box-sizing: border-box;
72+ border-bottom: 1px solid var(--lightest-navy);
3773 }
38-
74+
3975 nav {
4076 display: flex;
4177 justify-content: space-between;
@@ -48,33 +84,20 @@ import { SITE_TITLE } from '../consts';
4884 counter-reset: item 0;
4985 z-index: 12;
5086 }
51-
52- .logo-link {
53- display: flex;
54- justify-content: center;
55- align-items: center;
87+
88+ .logo a {
5689 color: var(--green);
57- width: 42px;
58- height: 42px;
59- font-size: 20px;
90+ font-size: var(--fz-md);
6091 font-weight: 700;
92+ text-decoration: none;
93+ font-family: var(--font-mono);
6194 }
62-
63- .logo-container {
64- display: flex;
65- justify-content: center;
66- align-items: center;
67- width: 42px;
68- height: 42px;
69- border: 2px solid var(--green);
70- border-radius: var(--border-radius);
71- }
72-
95+
7396 .nav-links {
7497 display: flex;
7598 align-items: center;
7699 }
77-
100+
78101 .nav-links ol {
79102 display: flex;
80103 justify-content: space-between;
@@ -83,64 +106,207 @@ import { SITE_TITLE } from '../consts';
83106 margin: 0;
84107 list-style: none;
85108 }
86-
109+
87110 .nav-links ol li {
88- margin: 0 5px ;
111+ margin: 0 15px ;
89112 position: relative;
90113 counter-increment: item 1;
91114 font-size: var(--fz-xs);
92115 }
93-
116+
94117 .nav-links ol li a {
95118 padding: 10px;
96119 color: var(--lightest-slate);
97120 }
98-
121+
99122 .nav-links ol li a:hover {
100123 color: var(--green);
101124 }
102-
125+
103126 .nav-links ol li a span {
104127 color: var(--green);
105128 font-size: var(--fz-xxs);
106129 margin-right: 5px;
107130 }
108-
109- .social-links {
131+
132+ /* Mobile Menu Styles */
133+ .mobile-menu-toggle {
134+ display: none;
135+ position: relative;
136+ z-index: 15;
137+ cursor: pointer;
138+ background: transparent;
139+ border: none;
140+ padding: 15px;
141+ margin-right: -15px;
142+ }
143+
144+ .hamburger-box {
145+ width: 30px;
146+ height: 24px;
147+ display: inline-block;
148+ position: relative;
149+ }
150+
151+ .hamburger-inner {
152+ display: block;
153+ top: 50%;
154+ margin-top: -2px;
155+ }
156+
157+ .hamburger-inner,
158+ .hamburger-inner::before,
159+ .hamburger-inner::after {
160+ width: 30px;
161+ height: 2px;
162+ background-color: var(--green);
163+ border-radius: 4px;
164+ position: absolute;
165+ transition: transform 0.15s ease;
166+ }
167+
168+ .hamburger-inner::before,
169+ .hamburger-inner::after {
170+ content: "";
171+ display: block;
172+ }
173+
174+ .hamburger-inner::before {
175+ top: -10px;
176+ }
177+
178+ .hamburger-inner::after {
179+ bottom: -10px;
180+ }
181+
182+ .mobile-menu-toggle.active .hamburger-inner {
183+ transform: rotate(225deg);
184+ transition-delay: 0.12s;
185+ transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
186+ }
187+
188+ .mobile-menu-toggle.active .hamburger-inner::before {
189+ top: 0;
190+ opacity: 0;
191+ transition:
192+ top 0.12s cubic-bezier(0.33333, 0, 0.66667, 0.33333),
193+ opacity 0.1s linear;
194+ }
195+
196+ .mobile-menu-toggle.active .hamburger-inner::after {
197+ top: 0;
198+ transform: rotate(-90deg);
199+ transition:
200+ bottom 0.12s cubic-bezier(0.33333, 0, 0.66667, 0.33333),
201+ transform 0.22s cubic-bezier(0.215, 0.61, 0.355, 1) 0.12s;
202+ }
203+
204+ .mobile-menu {
205+ display: none;
206+ position: fixed;
207+ top: 0;
208+ bottom: 0;
209+ right: 0;
210+ width: min(75vw, 400px);
211+ height: 100vh;
212+ background-color: var(--light-navy);
213+ box-shadow: -10px 0px 30px -15px var(--navy-shadow);
214+ z-index: 10;
215+ transform: translateX(100%);
216+ transition: all 0.25s cubic-bezier(0.645, 0.045, 0.355, 1);
217+ visibility: hidden;
218+ }
219+
220+ .home-subnav {
110221 display: flex;
111222 align-items: center;
112- margin-left: 15px;
223+ gap: 1rem;
224+ padding: 10px 50px;
225+ background-color: var(--navy);
226+ border-top: 1px solid var(--lightest-navy);
113227 }
114-
115- .social-links a {
116- padding: 10px;
228+ .home-subnav a {
117229 color: var(--lightest-slate);
230+ text-decoration: none;
231+ font-family: var(--font-mono);
232+ font-size: var(--fz-xs);
118233 }
119-
120- .social-links a:hover {
234+ .home-subnav a:hover {
121235 color: var(--green);
122- transform: translateY(-3px);
123236 }
124-
125- .sr-only {
126- position: absolute;
127- width: 1px;
128- height: 1px;
237+
238+ .mobile-nav {
239+ display: flex;
240+ flex-direction: column;
241+ text-align: center;
242+ width: 100%;
243+ }
244+
245+ .mobile-nav ol {
246+ list-style: none;
129247 padding: 0;
130- margin: -1px;
131- overflow: hidden;
132- clip: rect(0, 0, 0, 0);
133- white-space: nowrap;
134- border-width: 0;
248+ margin: 0;
249+ width: 100%;
135250 }
136-
251+
252+ .mobile-nav li {
253+ margin: 0 auto 20px;
254+ counter-increment: item 1;
255+ font-size: var(--fz-lg);
256+ }
257+
258+ .mobile-nav a {
259+ display: inline-block;
260+ text-decoration: none;
261+ color: var(--lightest-slate);
262+ padding: 3px 20px 20px;
263+ width: 100%;
264+ }
265+
266+ .mobile-nav a span {
267+ display: block;
268+ margin-bottom: 5px;
269+ color: var(--green);
270+ font-size: var(--fz-sm);
271+ }
272+
273+ @media (min-width: 769px) {
274+ .mobile-menu {
275+ display: none !important;
276+ visibility: hidden !important;
277+ transform: translateX(100%) !important;
278+ }
279+ }
280+
137281 @media (max-width: 768px) {
138282 .navbar {
139283 padding: 0 25px;
140284 }
141-
142- .nav-links ol {
285+
286+ .nav-links {
143287 display: none;
144288 }
289+
290+ .mobile-menu-toggle {
291+ display: flex;
292+ align-items: center;
293+ justify-content: center;
294+ }
295+
296+ .mobile-menu {
297+ display: block; /* But hidden by transform */
298+ }
299+
300+ .mobile-menu.active {
301+ transform: translateX(0);
302+ visibility: visible;
303+ display: flex;
304+ justify-content: center;
305+ align-items: center;
306+ }
307+
308+ .home-subnav {
309+ padding: 10px 25px;
310+ }
145311 }
146312</style >
0 commit comments