22const base = import .meta .env .BASE_URL .replace (/ \/ $ / , " " );
33---
44
5- <header class =" fixed top-0 left-0 right-0 z-50 h-14 border-b border-[var(--border-subtle)] bg-[var(--bg-primary)]/80 backdrop-blur-md" >
6- <div class =" h-full flex items-center justify-between px-4 lg:px-6" >
7- <!-- Left: logo + mobile menu -->
8- <div class =" flex items-center gap-3" >
5+ <header class =" fixed top-0 left-0 right-0 z-50 h-12 bg-[var(--bg-primary)]/90 backdrop-blur-lg" >
6+ <!-- Reading progress bar -->
7+ <div id =" reading-progress" class =" absolute bottom-0 left-0 h-[1px] bg-[var(--text-tertiary)] w-full scale-x-0 origin-left" ></div >
8+ <div class =" absolute bottom-0 left-0 right-0 h-px bg-[var(--border-subtle)]" ></div >
9+
10+ <div class =" h-full flex items-center justify-between px-4 lg:px-5" >
11+ <!-- Left -->
12+ <div class =" flex items-center gap-2.5" >
913 <button
1014 id =" sidebar-toggle"
11- class =" lg:hidden p-1.5 rounded-md hover:bg-[var(--bg-hover)] transition-colors"
15+ class =" lg:hidden p-1 rounded hover:bg-[var(--bg-hover)] transition-colors"
1216 aria-label =" Toggle navigation"
1317 >
14- <svg width =" 18" height =" 18" viewBox =" 0 0 24 24" fill =" none" stroke =" currentColor" stroke-width =" 2" stroke-linecap =" round" >
15- <line x1 =" 3" y1 =" 6" x2 =" 21" y2 =" 6" />
16- <line x1 =" 3" y1 =" 12" x2 =" 21" y2 =" 12" />
17- <line x1 =" 3" y1 =" 18" x2 =" 21" y2 =" 18" />
18+ <svg width =" 16" height =" 16" viewBox =" 0 0 24 24" fill =" none" stroke =" currentColor" stroke-width =" 1.5" stroke-linecap =" round" >
19+ <line x1 =" 4" y1 =" 7" x2 =" 20" y2 =" 7" /><line x1 =" 4" y1 =" 12" x2 =" 20" y2 =" 12" /><line x1 =" 4" y1 =" 17" x2 =" 20" y2 =" 17" />
1820 </svg >
1921 </button >
20- <a href ={ ` ${base }/ ` } class =" flex items-center gap-2 text-sm font-medium hover:text-[var(--text-secondary)] transition-colors" >
21- <span class =" font-[var(--font-mono)] text-xs tracking-wider text-[var(--text-tertiary)]" >/</span >
22- <span >The Agentic Engineering Guide</span >
22+ <a href ={ ` ${base }/ ` } class =" text-[13px] font-medium text-[var(--text-primary)] hover:text-[var(--text-secondary)] transition-colors truncate" >
23+ The Agentic Engineering Guide
2324 </a >
2425 </div >
2526
26- <!-- Right: actions -->
27- <div class =" flex items-center gap-1" >
28- <!-- Search -->
27+ <!-- Right -->
28+ <div class =" flex items-center gap-0.5" >
2929 <button
3030 id =" search-trigger"
31- class =" flex items-center gap-2 px-3 py-1 .5 text-xs text-[var(--text-tertiary)] border border-[var(--border)] rounded-md hover:border-[var(--text-tertiary)] transition-colors"
31+ class =" flex items-center gap-1.5 h-7 px-2 .5 text-[12px] text-[var(--text-tertiary)] border border-[var(--border)] rounded-md hover:border-[var(--text-tertiary)] transition-colors cursor-pointer "
3232 >
33- <svg width =" 14" height =" 14" viewBox =" 0 0 24 24" fill =" none" stroke =" currentColor" stroke-width =" 2" stroke-linecap =" round" >
34- <circle cx =" 11" cy =" 11" r =" 8" />
35- <line x1 =" 21" y1 =" 21" x2 =" 16.65" y2 =" 16.65" />
33+ <svg width =" 13" height =" 13" viewBox =" 0 0 24 24" fill =" none" stroke =" currentColor" stroke-width =" 2" stroke-linecap =" round" >
34+ <circle cx =" 11" cy =" 11" r =" 8" /><line x1 =" 21" y1 =" 21" x2 =" 16.65" y2 =" 16.65" />
3635 </svg >
3736 <span class =" hidden sm:inline" >Search</span >
38- <kbd class =" hidden sm:inline font-[var(--font-mono)] text-[10px] px -1 py-0.5 rounded bg-[var(--bg-tertiary)] border border-[var(--border)] " >⌘K</kbd >
37+ <kbd class =" hidden sm:inline font-[var(--font-mono)] text-[10px] ml -1 opacity-50 " >⌘K</kbd >
3938 </button >
4039
41- <!-- GitHub -->
4240 <a
4341 href =" https://github.com/Siddhant-K-code/agentic-engineering-guide"
4442 target =" _blank"
4543 rel =" noopener noreferrer"
46- class =" p-2 rounded-md hover:bg-[var(--bg-hover)] transition-colors text-[var(--text-secondary )]"
44+ class =" p-1.5 rounded hover:bg-[var(--bg-hover)] transition-colors text-[var(--text-tertiary)] hover:text-[var(--text-primary )]"
4745 aria-label =" GitHub"
4846 >
49- <svg width =" 18 " height =" 18 " viewBox =" 0 0 24 24" fill =" currentColor" >
47+ <svg width =" 16 " height =" 16 " viewBox =" 0 0 24 24" fill =" currentColor" >
5048 <path d =" M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
5149 </svg >
5250 </a >
5351
54- <!-- Theme toggle -->
5552 <button
5653 id =" theme-toggle"
57- class =" p-2 rounded-md hover:bg-[var(--bg-hover)] transition-colors text-[var(--text-secondary)] "
54+ class =" p-1.5 rounded hover:bg-[var(--bg-hover)] transition-colors text-[var(--text-tertiary)] hover:text-[var(--text-primary)] cursor-pointer "
5855 aria-label =" Toggle theme"
5956 >
60- <!-- Sun (shown in dark mode) -->
61- <svg class =" dark:block hidden" width =" 18" height =" 18" viewBox =" 0 0 24 24" fill =" none" stroke =" currentColor" stroke-width =" 2" stroke-linecap =" round" >
62- <circle cx =" 12" cy =" 12" r =" 5" />
63- <line x1 =" 12" y1 =" 1" x2 =" 12" y2 =" 3" />
64- <line x1 =" 12" y1 =" 21" x2 =" 12" y2 =" 23" />
65- <line x1 =" 4.22" y1 =" 4.22" x2 =" 5.64" y2 =" 5.64" />
66- <line x1 =" 18.36" y1 =" 18.36" x2 =" 19.78" y2 =" 19.78" />
67- <line x1 =" 1" y1 =" 12" x2 =" 3" y2 =" 12" />
68- <line x1 =" 21" y1 =" 12" x2 =" 23" y2 =" 12" />
69- <line x1 =" 4.22" y1 =" 19.78" x2 =" 5.64" y2 =" 18.36" />
70- <line x1 =" 18.36" y1 =" 5.64" x2 =" 19.78" y2 =" 4.22" />
57+ <svg class =" dark:block hidden" width =" 16" height =" 16" viewBox =" 0 0 24 24" fill =" none" stroke =" currentColor" stroke-width =" 1.5" stroke-linecap =" round" >
58+ <circle cx =" 12" cy =" 12" r =" 5" /><line x1 =" 12" y1 =" 1" x2 =" 12" y2 =" 3" /><line x1 =" 12" y1 =" 21" x2 =" 12" y2 =" 23" /><line x1 =" 4.22" y1 =" 4.22" x2 =" 5.64" y2 =" 5.64" /><line x1 =" 18.36" y1 =" 18.36" x2 =" 19.78" y2 =" 19.78" /><line x1 =" 1" y1 =" 12" x2 =" 3" y2 =" 12" /><line x1 =" 21" y1 =" 12" x2 =" 23" y2 =" 12" /><line x1 =" 4.22" y1 =" 19.78" x2 =" 5.64" y2 =" 18.36" /><line x1 =" 18.36" y1 =" 5.64" x2 =" 19.78" y2 =" 4.22" />
7159 </svg >
72- <!-- Moon (shown in light mode) -->
73- <svg class =" dark:hidden block" width =" 18" height =" 18" viewBox =" 0 0 24 24" fill =" none" stroke =" currentColor" stroke-width =" 2" stroke-linecap =" round" >
60+ <svg class =" dark:hidden block" width =" 16" height =" 16" viewBox =" 0 0 24 24" fill =" none" stroke =" currentColor" stroke-width =" 1.5" stroke-linecap =" round" >
7461 <path d =" M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
7562 </svg >
7663 </button >
@@ -80,24 +67,23 @@ const base = import.meta.env.BASE_URL.replace(/\/$/, "");
8067
8168<!-- Search dialog -->
8269<div id =" search-dialog" class =" fixed inset-0 z-[100] hidden" >
83- <div class =" absolute inset-0 bg-black/50 backdrop-blur-sm" id =" search-backdrop" ></div >
84- <div class =" relative max-w-xl mx-auto mt-[15vh] bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg shadow-2xl overflow-hidden" >
85- <div class =" flex items-center border-b border-[var(--border)] px-4" >
86- <svg width =" 16" height =" 16" viewBox =" 0 0 24 24" fill =" none" stroke =" var(--text-tertiary)" stroke-width =" 2" stroke-linecap =" round" class =" shrink-0" >
87- <circle cx =" 11" cy =" 11" r =" 8" />
88- <line x1 =" 21" y1 =" 21" x2 =" 16.65" y2 =" 16.65" />
70+ <div class =" absolute inset-0 bg-black/40 backdrop-blur-sm" id =" search-backdrop" ></div >
71+ <div class =" relative max-w-lg mx-auto mt-[12vh] bg-[var(--bg-primary)] border border-[var(--border)] rounded-xl shadow-2xl overflow-hidden" >
72+ <div class =" flex items-center gap-2 border-b border-[var(--border-subtle)] px-4" >
73+ <svg width =" 14" height =" 14" viewBox =" 0 0 24 24" fill =" none" stroke =" var(--text-tertiary)" stroke-width =" 2" stroke-linecap =" round" class =" shrink-0" >
74+ <circle cx =" 11" cy =" 11" r =" 8" /><line x1 =" 21" y1 =" 21" x2 =" 16.65" y2 =" 16.65" />
8975 </svg >
9076 <input
9177 id =" search-input"
9278 type =" text"
9379 placeholder =" Search chapters..."
9480 autocomplete =" off"
95- class =" w-full bg-transparent px-3 py-3 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-tertiary)] outline-none"
81+ class =" w-full bg-transparent py-3 text-[14px] text-[var(--text-primary)] placeholder:text-[var(--text-tertiary)] outline-none"
9682 />
97- <kbd class =" font-[var(--font-mono)] text-[10px] px-1.5 py-0.5 rounded bg-[var(--bg-tertiary)] border border-[var(--border)] text-[var(--text-tertiary)] shrink-0" >ESC </kbd >
83+ <kbd class =" font-[var(--font-mono)] text-[10px] px-1.5 py-0.5 rounded bg-[var(--bg-tertiary)] text-[var(--text-tertiary)] shrink-0" >esc </kbd >
9884 </div >
99- <div id =" search-results" class =" max-h-[60vh ] overflow-y-auto p-2 " >
100- <p id =" search-placeholder" class =" text-sm text-[var(--text-tertiary)] px-2 py-4 text-center" >Type to search across all chapters</p >
85+ <div id =" search-results" class =" max-h-[50vh ] overflow-y-auto p-1.5 " >
86+ <p id =" search-placeholder" class =" text-[13px] text-[var(--text-tertiary)] px-3 py-6 text-center" >Type to search across all chapters</p >
10187 </div >
10288 </div >
10389</div >
@@ -119,6 +105,17 @@ const base = import.meta.env.BASE_URL.replace(/\/$/, "");
119105 overlay?.classList.toggle('hidden');
120106 });
121107
108+ // Reading progress
109+ var progressBar = document.getElementById('reading-progress');
110+ if (progressBar) {
111+ window.addEventListener('scroll', function() {
112+ var scrollTop = window.scrollY;
113+ var docHeight = document.documentElement.scrollHeight - window.innerHeight;
114+ var progress = docHeight > 0 ? Math.min(scrollTop / docHeight, 1) : 0;
115+ progressBar.style.transform = 'scaleX(' + progress + ')';
116+ }, { passive: true });
117+ }
118+
122119 // Search
123120 var searchTrigger = document.getElementById('search-trigger');
124121 var searchDialog = document.getElementById('search-dialog');
@@ -183,24 +180,24 @@ const base = import.meta.env.BASE_URL.replace(/\/$/, "");
183180 }
184181
185182 if (!pagefind) {
186- searchResults.innerHTML = '<p class="text-sm text-[var(--text-tertiary)] px-2 py-4 text-center">Search index not available.</p>';
183+ searchResults.innerHTML = '<p class="text-[13px] text-[var(--text-tertiary)] px-3 py-6 text-center">Search index not available.</p>';
187184 return;
188185 }
189186
190187 var search = await pagefind.search(query);
191- var results = await Promise.all(search.results.slice(0, 10 ).map(function(r) { return r.data(); }));
188+ var results = await Promise.all(search.results.slice(0, 8 ).map(function(r) { return r.data(); }));
192189
193190 if (results.length === 0) {
194- searchResults.innerHTML = '<p class="text-sm text-[var(--text-tertiary)] px-2 py-4 text-center">No results found</p>';
191+ searchResults.innerHTML = '<p class="text-[13px] text-[var(--text-tertiary)] px-3 py-6 text-center">No results found</p>';
195192 return;
196193 }
197194
198195 searchResults.innerHTML = results.map(function(r) {
199- return '<a href="' + r.url + '" class="block px-3 py-2.5 rounded-md hover:bg-[var(--bg-hover)] transition-colors">' +
200- '<span class="block text-sm font-medium text-[var(--text-primary)] leading-snug">' + (r.meta?.title || 'Untitled') + '</span>' +
201- '<span class="block text-xs text-[var(--text-tertiary)] mt-1 leading-relaxed line-clamp-2">' + (r.excerpt || '') + '</span>' +
196+ return '<a href="' + r.url + '" class="block px-3 py-2 rounded-lg hover:bg-[var(--bg-hover)] transition-colors">' +
197+ '<span class="block text-[13px] font-medium text-[var(--text-primary)] leading-snug">' + (r.meta?.title || 'Untitled') + '</span>' +
198+ '<span class="block text-[12px] text-[var(--text-tertiary)] mt-0.5 leading-relaxed line-clamp-2">' + (r.excerpt || '') + '</span>' +
202199 '</a>';
203200 }).join('');
204- }, 200 );
201+ }, 150 );
205202 });
206203</script >
0 commit comments