summaryrefslogtreecommitdiff
path: root/website.templ
blob: bec14530c3043278b8ee1d12a380ce66cfbff801 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
package main

import "flag"

templ HeadComponent(title string, description string) {
	<head>
		<meta charset="UTF-8"/>
		<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
		<meta name="color-scheme" content="dark"/>
		<link rel="icon" type="image/svg+xml" href="/public/favicon.svg"/>
		<meta name="darkreader-lock"/>
		<meta name="robots" content="index, follow, noarchive"/>
		<meta name="keywords" content="Kyren223, Krypton, Compiler, Minecraft, Developer, Language, Langdev, Gamedev, Game, Software, Software Engineer, Game developer"/>
		<meta name="author" content="Kyren223"/>
		<meta name="description" content={ description }/>
		<title>{ title }</title>
		<meta property="og:title" content={ title }/>
		<meta property="og:description" content={ description }/>
		<meta property="og:type" content="website"/>
		<meta property="og:url" content="https://kyren.codes/"/>
		<meta property="og:image" content="https://kyren.codes/public/image.png"/>
		<meta property="og:image:alt" content="a cyan sphere with a dark background"/>
		<meta property="og:site_name" content="Kyren's Website"/>
		<script src="/public/copy.js" defer></script>
		<script src="/public/theme.js" defer></script>
		<script src="/public/scrollbar.js" defer></script>
		<script src="/public/my_uptime.js" defer></script>
		<link rel="stylesheet" href="/public/style.css"/>
		{ children... }
	</head>
}

func Choose(chooseA bool, a string, b string) string {
	if chooseA {
		return a
	} else {
		return b
	}
}

templ BlogItem(header string, blog Blog, extra string) {
	@TerminalBorderForBlog(header, blog.Date.Format("January 2, 2006"), Choose(header == "", "bg-black/20 hover:bg-white/5 transition-colors duration-150", "")+" "+extra, header == "") {
		<span class="cursor-pointer group block">
			<a href={ templ.SafeURL("/blogs/" + blog.Slug) } class="no-underline hover:no-underline">
				<h1 class="text-[130%] font-bold text-(--accent) group-hover:underline">
					{ blog.Title }
				</h1>
				<p class="text-(--secondary)">{ blog.Desc }</p>
			</a>
		</span>
	}
}

templ Link(href string, newTab bool) {
	<a
		href={ templ.SafeURL(href) }
		if newTab {
			target="_blank"
			rel="noopener noreferrer"
		}
	>
		{ children... }
	</a>
}

templ TerminalStack(joined bool, extra string) {
	<div class={ "flex flex-col min-h-0", templ.KV("[&>*+*]:mt-[-0.1rem]", joined), templ.KV("gap-4", !joined), extra }>
		{ children... }
	</div>
}

templ TerminalBorderForBlog(header string, footer string, extra string, enable bool) {
	if enable {
		<div class={ "relative flex px-3.5 py-(--ypad) pt-[calc(var(--ypad)+0.0625rem)] [--ypad:var(--border-py,0.875rem)] border-[0.1rem] border-solid border-[color:var(--alt)]", extra }>
			<span class="absolute px-[0.625rem] text-[1rem] left-[0.625rem] top-[-0.75rem] bg-[var(--text)] text-[color:var(--alt)]">{ header }</span>
			<span class="absolute px-[0.625rem] text-[0.6rem] left-[0.625rem] bottom-[-0.55rem] bg-[var(--background)] border-[0.05rem] text-(--alt)">{ footer }</span>
			{ children... }
		</div>
	} else {
		@TerminalBorder(header, footer, extra) {
			{ children... }
		}
	}
}

templ TerminalBorder(header string, footer string, extra string) {
	// <div class={ "relative flex px-3.5 py-(--ypad) pt-[calc(var(--ypad)+0.0625rem)] [--ypad:var(--border-py,0.875rem)] border-[0.1rem] border-solid border-[color:var(--alt)]", extra }>
	// 	<span class="absolute px-[0.625rem] text-[1rem] left-[0.625rem] top-[-0.75rem] text-[color:var(--alt)] bg-[linear-gradient(to_bottom,var(--background),var(--cmp-bg,transparent))]">{ header }</span>
	// 	<span class="absolute px-[0.625rem] text-[1rem] left-[0.625rem] bottom-[-0.75rem] text-[color:var(--alt)] bg-[linear-gradient(to_bottom,#181825,var(--background))]">{ footer }</span>
	// 	{ children... }
	// </div>
	<div class={ "relative flex px-3.5 py-(--ypad) pt-[calc(var(--ypad)+0.0625rem)] [--ypad:var(--border-py,0.875rem)] border-[0.1rem] border-solid border-(--alt)", extra }>
		<span class="absolute px-[0.625rem] text-[1rem] left-[0.625rem] top-[-0.75rem] bg-[var(--background)] text-[color:var(--alt)]">{ header }</span>
		<span class="absolute px-[0.625rem] text-[1rem] left-[0.625rem] bottom-[-0.75rem] bg-[var(--background)] text-[color:var(--alt)]">{ footer }</span>
		{ children... }
	</div>
}

templ CopyIcon() {
	<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy preview-icon"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></svg>
}

templ TerminalBorderWithCopy(header string, footer string, extra string, text string, href string, showLabel bool) {
	@TerminalBorder(header, footer, extra) {
		<div data-copy-scope class="group/copy flex w-full items-center justify-between gap-4">
			if href != "" {
				<a href={ templ.SafeURL(href) } class="wrap-anywhere">
					{ children... }
				</a>
			} else {
				<span data-copy={ text } class="cursor-pointer wrap-anywhere">
					{ children... }
				</span>
			}
			<span class="relative shrink-0">
				if showLabel {
					<span class="hidden group-data-copied/copy:block absolute right-full top-1/2 -translate-y-1/2 mr-2 px-[0.4rem] whitespace-nowrap bg-(--background) text-(--primary)">copied</span>
				}
				<button type="button" data-copy={ text } aria-label="copy" class="block p-[0.4rem] rounded-[0.4rem] cursor-pointer transition-colors hover:bg-(--alt)/25 group-data-copied/copy:bg-(--primary)/25!">
					@CopyIcon()
				</button>
			</span>
		</div>
	}
}

templ CopyPre(text string, preClass string) {
	<button type="button" data-copy={ text } class="group relative shrink-0 cursor-pointer text-left rounded-[0.4rem] p-[0.4rem] -m-[0.4rem] transition-colors hover:bg-(--alt)/25 data-copied:bg-(--primary)/25! data-copied:animate-[bump_0.25s]">
		<pre class={ preClass }>
			{ children... }
		</pre>
		<span class="hidden group-data-copied:block absolute right-[0.6rem] top-[0.6rem] px-[0.4rem] bg-(--background) text-(--primary) text-[0.8rem]">copied</span>
	</button>
}

templ NavLink(href string, label string) {
	<a href={ templ.SafeURL(href) } class="text-(--primary) hover:text-(--accent)">{ label }</a>
}

templ Nav(path string) {
	<nav class="flex justify-between gap-10 p-4 mb-6 border-[0.125rem] border-(--alt) text-[1.375rem]">
		<span>{ path }</span>
		<span class="flex gap-[1ch]">
			@NavLink("/", "home")
			for _, dir := range []string{"skills", "projects", "blogs"} {
				@NavLink("/"+dir, dir)
			}
			@NavLink("/shell", "shell")
		</span>
	</nav>
}

templ TerminalLayout(style Style, path string) {
	<!DOCTYPE html>
	<html lang="en" style={ styleToCss(style) }>
		@HeadComponent(path, "My personal website") {
			<link rel="stylesheet" href="/public/styles/terminal.css"/>
		}
		<body>
			<main class="flex flex-col w-[75rem] h-[40rem] p-8 border-[0.2rem] border-(--text) overflow-hidden text-[1.125rem]">
				@Nav(path)
				{ children... }
			</main>
		</body>
	</html>
}

const fingerprint = `+--[ED25519 256]--+
|       +. ..  +.B|
|      + o..o . BB|
|     ..o oo.o =+E|
|     ... oo. + o.|
|      . S .   =  |
|  .  .   +   o   |
| o    o o .      |
|  oo .o+ +       |
|  ++ooo+=        |
+----[SHA256]-----+`
const sshKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO7P9K9D5RkBk+JCRRS6AtHuTAc6cRpXfRfRMg/Kyren"

templ HomePage(style Style, latestBlog *Blog) {
	@TerminalLayout(style, "/home/kyren/") {
		<div class={ "grid grid-cols-[29%_1fr] gap-x-8 flex-1 min-h-0", templ.KV("gap-y-4", !false) }>
			<div class="flex flex-col min-h-0 [--border-py:0.75rem]">
				@TerminalStack(true, "") {
					@TerminalBorder("Profile", "", "[--border-py:0.875rem]") {
						<div class="flex items-center gap-4 h-38">
							<img src="/public/favicon.svg" alt="picture" class="h-full object-cover"/>
							@CopyPre(sshKey, "shrink-0 text-[0.675rem] leading-[normal]") {
								{ fingerprint }
							}
						</div>
					}
					@TerminalBorderWithCopy("Email", "", "", "contact@kyren.codes", "mailto:contact@kyren.codes", false) {
						contact@kyren.codes
					}
					@TerminalBorder("Git Repos (main)", "", "") {
						@Link("https://git.kyren.codes", true) {
							git.kyren.codes
						}
					}
					@TerminalBorder("GitHub (secondary)", "", "") {
						@Link("https://github.com/kyren223", true) {
							github.com/Kyren223
						}
					}
					@TerminalBorder("Discord", "", "") {
						@Link("https://discord.com/users/481884415090229258", true) {
							Kyren223
						}
					}
				}
			</div>
			<div class="flex flex-col gap-10 min-h-0 select-text">
				@TerminalBorder("Status", "", "") {
					<div class="flex gap-[1ch] text-[1rem]">
						<span>Working on</span>
						<span>
							@Link("/projects/krypton", false) {
								Krypton
							}
						</span>
						<span>|</span>
						<span>Learning Langdev & Compiler Design</span>
						<span>|</span>
						<span>Available for hire</span>
					</div>
				}
				@TerminalBorder("About Me", "", "") {
					Hi! I'm Kyren, a softwarea engineer and game developer.
					I love working with low level languages and learning things deeply.
					I am also a terminal nerd and Linux enthusiast who uses NVIM btw.
					And when I am not coding, I am most likely playing video games,
					watching Anime, or solving Rubik's cubes fast.
				}
				@BlogItem("Latest Blog Post", *latestBlog, "")
			</div>
			@TerminalBorderWithCopy("SSH Key", "", footerClass(false), sshKey, "", true) {
				{ sshKey }
			}
		</div>
	}
}

func footerClass(connected bool) string {
	style := "col-span-2 select-text [--border-py:0.5rem]"
	if connected {
		style += " mb-[0.30rem]"
	}
	return style
}

templ SkillsPage(style Style) {
	@TerminalLayout(style, "/home/kyren/skills.md") {
		@TerminalStack(false, "") {
			@TerminalBorder("Info", "", "") {
				<span>
					$ fastfetch
					@Fastfetch(fetchRows)
				</span>
			}
		}
	}
}

type Project struct {
	Slug      string       // e.g. "my-game"
	Title     string       // e.g. "MyGame"
	Category  string       // e.g. "Game written in Zig"
	Desc      string       // 1-2 line description/pitch
	Tags      []ProjectTag // ["Zig", "OpenGL", "Linux"]
	Status    string
	Icon      templ.Component
	CgitURL   string // e.g. "https://cgit.yourdomain.com/my-game"
	GithubURL string // Fallback mirror link
}

type ProjectTag struct {
	Name  string
	Color string
}

type ProjectLink struct {
	URL  string
	Icon templ.Component
}

type FlagshipInfo struct {
	Downloads []Download
	Version   string
	Stats     []Stat
	Snippet   string
}

type Download struct {
	Label string // "Linux", "Windows"
	URL   string
	Size  string // "42 MB"
}

type Stat struct {
	Label string
	Value string
}

var p Project = Project{
	Slug:     "krypton",
	Title:    "Krypton",
	Category: "Programming Language Compiler",
	Desc:     "A modern Minecraft creator event. As a developer, I helped with minor improvements to the cosmetics system. ",
	Icon:     IconCpu("text-[#F5A670] self-center"),
	// Icon:   IconKrypton(),
	Status: "ON",
	Tags: []ProjectTag{
		// {"Programming Language", Color("--extra")},
		// {"Compiler", Color("--extra")},
		{"C", Color("text-[#5874FF]")},
		{"LLVM", Color("text-[#FFFFFF]")},
		// {"Java", Color("#F5A670")},
	},
	CgitURL:   "https://whatever",
	GithubURL: "",
}

var flagship FlagshipInfo = FlagshipInfo{
	Version: "Sprout.0 2026-08-13",
	Downloads: []Download{
		{"linux-amd64", "https://foobar", "23 MB"},
		// {"linux-arm64", "https://foobar", "52 MB"},
		// {"macos-arm64", "https://fooshit", "47 MB"},
		{"windows-amd64", "https://fooshit", "65.7 MB"},
	},
	// Stats:   []Stat{{"lines of code", "18.7k"}},
	Snippet: `
io :: import "core/io";

main :: proc() {
  io.printf("Hello, %s", "world");
}
`,
}

var versionBeforeDownloads = false

const flagshipClasses = "[--border-py:1.25rem] border-(--accent)! bg-white/[0.03] shadow-[0_0_1.5rem_color-mix(in_srgb,var(--accent)_25%,transparent)]"

templ FlagshipProject(project Project, extra string) {
	@TerminalBorder("", "", flagshipClasses+" "+extra) {
		<div class="flex gap-8 w-full">
			<div class="flex flex-col gap-4 flex-1 min-w-0">
				<div class="flex flex-wrap items-baseline gap-x-[1ch] gap-y-[0.4rem]">
					@project.Icon
					<a href={ templ.SafeURL("/projects/" + project.Slug) } class="text-[170%] font-bold text-(--accent) hover:underline">{ project.Title }</a>
					<span class="text-[85%] text-(--primary)">{ project.Category }</span>
					for _, tag := range project.Tags {
						<code class={ "text-[75%] px-[0.4rem] inline-block rounded-[0.3rem] border-[0.01rem] bg-(--alt)/25" + " " + tag.Color }>{ tag.Name }</code>
					}
					<span class="ml-auto flex items-center self-center">
						@IconLink("https://git.example.com/foo", "git", "") {
							@IconGit("text-(--primary)")
						}
						@IconLink("https://github.com/foo", "github", "") {
							@IconGithub("text-(--secondary)")
						}
						@IconLink("https://example.com", "website", "") {
							@IconExternal("text-(--accent)")
						}
					</span>
				</div>
				<p class="leading-relaxed max-w-3xl">{ project.Desc }</p>
				if len(flagship.Downloads) > 0 || flagship.Version != "" {
					<div class="flex flex-wrap items-center gap-x-4 gap-y-2">
						if versionBeforeDownloads {
							@VersionTag(project)
						}
						for _, d := range flagship.Downloads {
							@DownloadButton(d)
						}
						if !versionBeforeDownloads {
							@VersionTag(project)
						}
					</div>
				}
				if len(flagship.Stats) > 0 {
					<div class="flex flex-wrap gap-x-[2rem] gap-y-[0.4rem] text-[85%]">
						for _, stat := range flagship.Stats {
							<span class="flex gap-[1ch]">
								<span class="font-bold text-(--primary)">{ stat.Value }</span>
								<span class="text-(--alt)">{ stat.Label }</span>
							</span>
						}
					</div>
				}
			</div>
			if flagship.Snippet != "" {
				<div class="shrink-0 self-start flex flex-col gap-[0.5rem] p-[1rem] rounded-[0.4rem] bg-black/30">
					<span class="text-[75%] text-(--alt)">example</span>
					@CopyPre(flagship.Snippet, "text-[80%] leading-[normal]") {
						{ flagship.Snippet }
					}
				</div>
			}
		</div>
	}
}

templ VersionTag(project Project) {
	if flagship.Version != "" {
		<span class="flex items-baseline gap-[1ch] text-[85%]">
			<code class="text-[#46d46c]">{ flagship.Version }</code>
			// <a href={ templ.SafeURL("/projects/" + project.Slug + "#changelog") } class="text-(--alt) hover:underline">changelog</a>
		</span>
	}
}

templ DownloadButton(d Download) {
	<a href={ templ.SafeURL(d.URL) } class="no-underline inline-flex items-center gap-[1ch] px-[0.6rem] py-[0.1rem] rounded-[0.4rem] border-[0.1rem] border-solid border-(--secondary)/60 text-[85%] text-(--secondary) transition-colors hover:bg-(--secondary)/15">
		@IconArchive("text-(--secondary)")
		<span>{ d.Label }</span>
		if d.Size != "" {
			<span class="text-(--alt)">{ d.Size }</span>
		}
	</a>
}

templ IconArchive(color string) {
	@Icon(color) {
		<rect width="20" height="5" x="2" y="3" rx="1"></rect>
		<path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"></path>
		<path d="M10 12h4"></path>
	}
}

const flagshipClassesV4 = "[--border-py:1.25rem] border-(--accent)! bg-white/[0.03] shadow-[0_0_1.5rem_color-mix(in_srgb,var(--accent)_25%,transparent)]"

templ FlagshipProjectV4(project Project, extra string) {
	@TerminalBorder("", "", flagshipClasses+" "+extra) {
		<div class="flex gap-[2rem] w-full">
			<div class="flex flex-col gap-[1rem] flex-1 min-w-0">
				<div class="flex flex-wrap items-baseline gap-x-[1ch] gap-y-[0.4rem]">
					@project.Icon
					<a href={ templ.SafeURL("/projects/" + project.Slug) } class="text-[170%] font-bold text-(--accent) hover:underline">{ project.Title }</a>
					<span class="text-[85%] text-(--primary)">{ project.Category }</span>
					for _, tag := range project.Tags {
						<code class={ "text-[75%] px-[0.4rem] inline-block rounded-[0.3rem] border-[0.01rem] bg-(--alt)/25" + " " + tag.Color }>{ tag.Name }</code>
					}
					<span class="ml-auto flex items-center self-center">
						@IconLink("https://git.example.com/foo", "git", "") {
							@IconGit("text-(--primary)")
						}
						@IconLink("https://github.com/foo", "github", "") {
							@IconGithub("text-(--secondary)")
						}
						@IconLink("https://example.com", "website", "") {
							@IconExternal("text-(--accent)")
						}
					</span>
				</div>
				<p class="leading-relaxed max-w-3xl">{ project.Desc }</p>
				if len(project.Downloads) > 0 || project.Version != "" {
					<div class="flex flex-wrap items-center gap-x-[1rem] gap-y-[0.5rem]">
						for _, d := range project.Downloads {
							@DownloadButton(d)
						}
						if project.Version != "" {
							<code class="text-[85%] text-(--alt)">{ project.Version }</code>
						}
					</div>
				}
				if len(project.Stats) > 0 {
					<div class="flex flex-wrap gap-x-[2rem] gap-y-[0.4rem] text-[85%]">
						for _, stat := range project.Stats {
							<span class="flex gap-[1ch]">
								<span class="font-bold text-(--primary)">{ stat.Value }</span>
								<span class="text-(--alt)">{ stat.Label }</span>
							</span>
						}
					</div>
				}
			</div>
			if project.Snippet != "" {
				<div class="shrink-0 self-start flex flex-col gap-[0.5rem] p-[1rem] rounded-[0.4rem] bg-black/30">
					<span class="text-[75%] text-(--alt)">example</span>
					@CopyPre(project.Snippet, "text-[80%] leading-[normal]") {
						{ project.Snippet }
					}
				</div>
			}
		</div>
	}
}

templ DownloadButtonV4(d Download) {
	<a href={ templ.SafeURL(d.URL) } class="inline-flex items-center gap-[1ch] px-[0.8rem] py-[0.3rem] rounded-[0.4rem] border-[0.1rem] border-solid border-(--alt) text-(--primary) transition-colors hover:bg-(--alt)/25">
		@IconDownload("text-(--primary)")
		{ d.Label }
	</a>
}

templ IconDownload(color string) {
	@Icon(color) {
		<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
		<polyline points="7 10 12 15 17 10"></polyline>
		<line x1="12" x2="12" y1="15" y2="3"></line>
	}
}

const flagshipClassesV3 = "[--border-py:1.25rem] border-(--primary)! bg-white/[0.03] shadow-[0_0_1.5rem_color-mix(in_srgb,var(--primary)_25%,transparent)]"

templ FlagshipProjectV3(project Project, extra string) {
	@TerminalBorder("", "", flagshipClasses+" "+extra) {
		<div class="flex gap-[2rem] w-full">
			<div class="flex flex-col gap-[1rem] flex-1 min-w-0">
				<div class="flex flex-wrap items-baseline gap-x-[1ch] gap-y-[0.4rem]">
					@project.Icon
					<a href={ templ.SafeURL("/projects/" + project.Slug) } class="text-[170%] font-bold text-(--accent) hover:underline">{ project.Title }</a>
					<code class="px-[0.5rem] rounded-[0.3rem] border-[0.1rem] border-(--accent)/50 text-[85%] text-(--accent)">{ project.Version }</code>
					<span class="text-[85%] text-(--primary)">{ project.Category }</span>
					for _, tag := range project.Tags {
						<code class={ "text-[75%] px-[0.4rem] inline-block rounded-[0.3rem] border-[0.01rem] bg-(--alt)/25" + " " + tag.Color }>{ tag.Name }</code>
					}
					<span class="ml-auto flex items-center self-center">
						@IconLink("https://git.example.com/foo", "git", "") {
							@IconGit("text-(--primary)")
						}
						@IconLink("https://github.com/foo", "github", "") {
							@IconGithub("text-(--secondary)")
						}
						@IconLink("https://example.com", "website", "") {
							@IconExternal("text-(--accent)")
						}
					</span>
				</div>
				<p class="leading-relaxed max-w-3xl">{ project.Desc }</p>
				if project.Install != "" {
					@CopyPre(project.Install, "text-[85%] leading-[normal]") {
						{ "$ " + project.Install }
					}
				}
				if project.Devlog != nil {
					<a href={ templ.SafeURL("/blogs/" + project.Devlog.Slug) } class="text-[85%] text-(--secondary) hover:underline">
						{ "latest devlog: " + project.Devlog.Title }
					</a>
				}
			</div>
			if project.Snippet != "" {
				<div class="shrink-0 self-start flex flex-col gap-[0.5rem] p-[1rem] rounded-[0.4rem] bg-black/30">
					<span class="text-[75%] text-(--alt)">example</span>
					@CopyPre(project.Snippet, "text-[80%] leading-[normal]") {
						{ project.Snippet }
					}
				</div>
			}
		</div>
	}
}

templ FlagshipProjectV2(project Project, extra string) {
	@TerminalBorder(project.Version, "", flagshipClasses+" "+extra) {
		<div class="flex gap-[2rem] w-full">
			<div class="flex flex-col gap-[1rem] flex-1 min-w-0">
				<div class="flex flex-wrap items-baseline gap-x-[1ch] gap-y-[0.4rem]">
					@project.Icon
					<a href={ templ.SafeURL("/projects/" + project.Slug) } class="text-[170%] font-bold text-(--primary) hover:underline">{ project.Title }</a>
					<span class="text-[85%] text-(--secondary)">{ project.Category }</span>
					for _, tag := range project.Tags {
						<code class={ "text-[75%] px-[0.4rem] inline-block rounded-[0.3rem] border-[0.01rem] bg-(--alt)/25" + " " + tag.Color }>{ tag.Name }</code>
					}
					<span class="ml-auto flex items-center self-center">
						@IconLink("https://git.example.com/foo", "git", "") {
							@IconGit("text-(--primary)")
						}
						@IconLink("https://github.com/foo", "github", "") {
							@IconGithub("text-(--secondary)")
						}
						@IconLink("https://example.com", "website", "") {
							@IconExternal("text-(--accent)")
						}
					</span>
				</div>
				<p class="leading-relaxed max-w-3xl">{ project.Desc }</p>
				<div class="flex flex-wrap items-center gap-[0.5ch] pt-[1rem] border-t border-white/10 text-[85%]">
					for i, stage := range project.Pipeline {
						if i > 0 {
							<span class="text-(--alt)">→</span>
						}
						<code class="px-[0.4rem] rounded-[0.3rem] bg-(--alt)/25 text-(--accent)">{ stage }</code>
					}
				</div>
				<div class="flex flex-wrap gap-x-[2.5rem] gap-y-[0.75rem]">
					for _, stat := range project.Stats {
						<div class="flex flex-col">
							<span class="text-[150%] font-bold text-(--primary)">{ stat.Value }</span>
							<span class="text-[75%] text-(--alt)">{ stat.Label }</span>
						</div>
					}
				</div>
			</div>
			if project.Snippet != "" {
				<div class="shrink-0 self-start flex flex-col gap-[0.5rem] p-[1rem] rounded-[0.4rem] bg-black/30">
					<span class="text-[75%] text-(--alt)">example</span>
					@CopyPre(project.Snippet, "text-[80%] leading-[normal]") {
						{ project.Snippet }
					}
				</div>
			}
		</div>
	}
}

templ FlagshipProjectV1(project Project) {
	<div class="relative border border-[var(--primary)]/40 rounded bg-white/[0.03] p-6 mb-10 shadow-[0_0_15px_rgba(0,0,0,0.3)]">
		<!-- Header Bar -->
		<div class="flex items-center justify-between pb-3 mb-4 border-b border-white/10 font-mono text-xs">
			<div class="flex items-center gap-2">
				<span class="w-2 h-2 rounded-full bg-emerald-400 animate-pulse"></span>
				<span class="text-[var(--accent)] font-bold">FLAGSHIP BUILD</span>
				<span class="text-zinc-500">|</span>
				<span class="text-zinc-400">{ project.Status }</span>
			</div>
			<div class="flex gap-3 text-zinc-400">
				if project.CgitURL != "" {
					<a href={ templ.URL(project.CgitURL) } target="_blank" class="hover:text-[var(--primary)] transition-colors">[cgit]</a>
				}
				if project.GithubURL != "" {
					<a href={ templ.URL(project.GithubURL) } target="_blank" class="hover:text-[var(--primary)] transition-colors">[github]</a>
				}
			</div>
		</div>
		<!-- Title & Category Line -->
		<div class="flex items-baseline gap-3 mb-2">
			<h2 class="text-2xl font-bold text-[var(--primary)]">
				<a href={ templ.URL("/projects/" + project.Slug) } class="hover:underline">{ project.Title }</a>
			</h2>
			<span class="text-sm text-zinc-400 font-mono">{ project.Category }</span>
		</div>
		<!-- 1-2 Line Pitch -->
		<p class="text-zinc-300 text-sm leading-relaxed mb-6 max-w-3xl">{ project.Desc }</p>
		<!-- Tech Tags & Detail Link -->
		<div class="flex flex-wrap items-center justify-between gap-4 pt-4 border-t border-white/5 font-mono text-xs">
			<div class="flex flex-wrap gap-2">
				for _, tag := range project.Tags {
					<span class="px-2 py-0.5 rounded bg-white/5 border border-white/10 text-zinc-300">{ tag.Name }</span>
				}
			</div>
			<a href={ templ.URL("/projects/" + project.Slug) } class="text-[var(--primary)] hover:translate-x-1 transition-transform inline-flex items-center gap-1">
				View Project Details &rarr;
			</a>
		</div>
	</div>
}

templ PinnedGrid(projects []Project) {
	<div class="mb-12">
		<div class="text-xs font-mono text-zinc-500 uppercase tracking-wider mb-4">
			// Notable Projects</div>
			<div class="grid grid-cols-1 md:grid-cols-6 gap-4">
				for i, project := range projects {
					<!-- Top 2 items take col-span-3 (50%), Bottom 3 items take col-span-2 (33%) -->
					<div
						class={ "group border border-white/10 rounded bg-white/[0.02] hover:bg-white/[0.05] hover:border-white/20 transition-all p-5 flex flex-col justify-between",
                            templ.KV("md:col-span-3", i < 2), 
                            templ.KV("md:col-span-2", i >= 2) }
					>
						<div>
							<!-- Title + Description/Type Line -->
							<div class="flex items-baseline justify-between gap-2 mb-2">
								<h3 class="font-bold text-[var(--primary)] group-hover:text-[var(--accent)] transition-colors">
									<a href={ templ.URL("/projects/" + project.Slug) } class="hover:underline">{ project.Title }</a>
								</h3>
								<span class="text-xs text-zinc-400 font-mono shrink-0">{ project.Category }</span>
							</div>
							<!-- Pitch -->
							<p class="text-xs text-zinc-300 mb-4 line-clamp-2 leading-relaxed">{ project.Desc }</p>
						</div>
						<!-- Footer: Tags & Outbound Links -->
						<div class="flex items-center justify-between pt-3 border-t border-white/5 text-[11px] font-mono">
							<div class="flex flex-wrap gap-1">
								for _, tag := range project.Tags {
									<span class="text-zinc-400 bg-white/5 px-1.5 py-0.5 rounded border border-white/5">{ tag.Name }</span>
								}
							</div>
							<div class="flex gap-2 text-zinc-400">
								if project.CgitURL != "" {
									<a href={ templ.URL(project.CgitURL) } target="_blank" class="hover:text-white">[cgit]</a>
								}
								if project.GithubURL != "" {
									<a href={ templ.URL(project.GithubURL) } target="_blank" class="hover:text-white">[gh]</a>
								}
							</div>
						</div>
					</div>
				}
			</div>
		</div>
	</div>
}

templ IconLink(href string, label string, extra string) {
	<a href={ templ.SafeURL(href) } target="_blank" rel="noopener noreferrer" aria-label={ label } title={ label } class={ "text-[90%] block p-[0.2rem] rounded-[0.4rem] transition-colors hover:bg-(--alt)/25" + " " + extra }>
		{ children... }
	</a>
}

templ IconGit(color string) {
	@Icon(color) {
		<line x1="6" x2="6" y1="3" y2="15"></line>
		<circle cx="18" cy="6" r="3"></circle>
		<circle cx="6" cy="18" r="3"></circle>
		<path d="M18 9a9 9 0 0 1-9 9"></path>
	}
}

templ IconGithub(color string) {
	@Icon(color) {
		<path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"></path>
		<path d="M9 18c-4.51 2-5-2-7-2"></path>
	}
}

templ IconExternal(color string) {
	@Icon(color) {
		<path d="M15 3h6v6"></path>
		<path d="M10 14 21 3"></path>
		<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
	}
}

templ IconKrypton() {
	@Icon("text-[#00f1ff]") {
		<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-dot preview-icon"><circle cx="12" cy="12" r="1"></circle><circle cx="12" cy="12" r="10"></circle></svg>
	}
	// { "\uf192" }
}

templ ProjectItem(project Project, extra string) {
	<div>
		@TerminalBorder("", "", "[--border-py:0.25rem] py-2 text-[80%] bg-black/20 hover:bg-white/5 transition-colors duration-150"+" "+extra) {
			<div class="flex flex-col gap-[0.0625rem] w-full">
				<div class="flex flex-wrap items-baseline gap-x-[1ch] gap-y-[0.4rem]">
					@project.Icon
					<a href={ templ.SafeURL("/projects/" + project.Slug) } class="text-[130%] font-bold text-(--accent)">{ project.Title }</a>
					<span class="text-[80%] text-(--primary)">{ project.Category }</span>
					for _, tag := range project.Tags {
						<code class={ "text-[75%] px-[0.4rem] inline-block rounded-[0.3rem] border-[0.01rem] bg-(--alt)/25" + " " + tag.Color }>{ tag.Name }</code>
					}
					// for _, tag := range project.Tags {
					// 	<code class="text-[75%] px-[0.4rem] inline-block rounded-[0.3rem] bg-(--extra)/70 text-(--background)">{ tag }</code>
					// }
					<span class="ml-auto flex items-center self-center">
						@IconLink("https://git.example.com/foo", "git", "") {
							@IconGit("text-(--primary)")
						}
						@IconLink("https://github.com/foo", "github", "") {
							@IconGithub("text-(--secondary)")
						}
						@IconLink("https://example.com", "website", "") {
							@IconExternal("text-(--accent)")
						}
					</span>
				</div>
				<p class="text-[95%]">{ project.Desc }</p>
			</div>
		}
	</div>
}

func DoubleProject(project Project) Project {
	project.Desc += project.Desc
	return project
}

templ ProjectsPage(style Style, projects []Project, pinned int) {
	@TerminalLayout(style, "/home/kyren/projects") {
		@FlagshipProject(projects[0], "mb-[1.5rem]")
		@ScrollBox("") {
			@TerminalStack(false, "mt-[0.5rem]") {
				for i := 0; i < 1; i++ {
					for i, project := range projects[1:] {
						if i < pinned {
							@ProjectItem(project, "my-[-0.15rem] border-(--text)")
						} else {
							@ProjectItem(project, "my-[-0.15rem]")
						}
					}
				}
			}
		}
	}
}

templ NotFoundPage(style Style, path string) {
	@TerminalLayout(style, "404") {
		@TerminalStack(true, "") {
			@TerminalBorder("Shell", "", "") {
				<span>
					<p>$ cd ~{ path }</p>
					<p class="pt-3">"{ path[1:] }": No such file or directory (os error 2) </p>
				</span>
			}
			@TerminalBorder("", "", "") {
				<span>
					<div class="gap-[1ch]">
						<span>{ ">" }</span>
						<span class="text-(--secondary)">
							@Link("javascript:history.back()", false) {
								{ "cd -" }
							}
						</span>
						<span class="text-(--alt)">
							# Previous page
						</span>
					</div>
					<div class="gap-[1ch]">
						<span>{ ">" }</span>
						<span class="text-(--secondary)">
							@Link("/", false) {
								{ "cd $HOME" }
							}
						</span>
					</div>
				</span>
			}
		}
	}
}

templ ScrollBox(extra string) {
	<div data-scrollbox class={ "flex flex-1 min-h-0", extra }>
		<div data-scroll-area class="flex-1 min-w-0 overflow-y-auto border-[0.1rem] border-solid border-(--alt) p-[1rem] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
			{ children... }
		</div>
		<div data-scroll-track class="relative w-8 -ml-[0.1rem] border-[0.1rem] border-solid border-(--alt)">
			<div data-scroll-thumb class="absolute inset-x-[0.3rem] bg-(--secondary) cursor-grab touch-none"></div>
		</div>
	</div>
}

templ BlogsPage(style Style, blogs []Blog) {
	@TerminalLayout(style, "blogs") {
		@TerminalBorder("Shell", "", "mb-[1rem]") {
			$ ls -lh ~/blogs
		}
		@ScrollBox("") {
			@TerminalStack(false, "mt-[0.5rem]") {
				for i := 0; i < 1; i++ {
					for _, blog := range blogs {
						@BlogItem("", blog, "mb-[1rem]")
					}
				}
			}
		}
	}
}

type FetchRow struct {
	Icon  templ.Component
	Color string // tailwind text color class, used for the icon and label
	Label string
	Value string
}

templ IconMonitor(color string) {
	@Icon(color) {
		<rect width="20" height="14" x="2" y="3" rx="2"></rect>
		<line x1="8" x2="16" y1="21" y2="21"></line>
		<line x1="12" x2="12" y1="17" y2="21"></line>
	}
}

templ IconTerminal(color string) {
	@Icon(color) {
		<polyline points="4 17 10 11 4 5"></polyline>
		<line x1="12" x2="20" y1="19" y2="19"></line>
	}
}

templ IconCode(color string) {
	@Icon(color) {
		<polyline points="16 18 22 12 16 6"></polyline>
		<polyline points="8 6 2 12 8 18"></polyline>
	}
}

templ IconCpu(color string) {
	@Icon(color) {
		<rect width="16" height="16" x="4" y="4" rx="2"></rect>
		<rect width="6" height="6" x="9" y="9" rx="1"></rect>
		<path d="M15 2v2M15 20v2M2 15h2M2 9h2M20 15h2M20 9h2M9 2v2M9 20v2"></path>
	}
}

templ IconScriptLang(color string) {
	@Icon(color) {
		<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-terminal preview-icon"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"></path><path d="M14 2v5a1 1 0 0 0 1 1h5"></path><path d="m8 16 2-2-2-2"></path><path d="M12 18h4"></path></svg>
	}
}

templ IconEditor(color string) {
	@Icon(color) {
		<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-pen preview-icon"><path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"></path></svg>
	}
}

templ IconDebugger(color string) {
	@Icon(color) {
		<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-bug-off preview-icon"><path d="M12 20v-8"></path><path d="M12.656 7H14a4 4 0 0 1 4 4v1.344"></path><path d="M14.12 3.88 16 2"></path><path d="M17.123 17.123A6 6 0 0 1 6 14v-3a4 4 0 0 1 1.72-3.287"></path><path d="m2 2 20 20"></path><path d="M21 5a4 4 0 0 1-3.55 3.97"></path><path d="M22 13h-3.344"></path><path d="M3 21a4 4 0 0 1 3.81-4"></path><path d="M3 5a4 4 0 0 0 3.55 3.97"></path><path d="M6 13H2"></path><path d="m8 2 1.88 1.88"></path><path d="M9.712 4.06A3 3 0 0 1 15 6v1.13"></path></svg>
	}
}

templ IconKeyboard(color string) {
	@Icon(color) {
		<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-keyboard preview-icon"><path d="M10 8h.01"></path><path d="M12 12h.01"></path><path d="M14 8h.01"></path><path d="M16 12h.01"></path><path d="M18 8h.01"></path><path d="M6 8h.01"></path><path d="M7 16h10"></path><path d="M8 12h.01"></path><rect width="20" height="16" x="2" y="4" rx="2"></rect></svg>
	}
}

templ IconUptime(color string) {
	@Icon(color) {
		<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clock preview-icon"><circle cx="12" cy="12" r="10"></circle><path d="M12 6v6l4 2"></path></svg>
	}
}

func row(icon func(color string) templ.Component, color, label, value string) FetchRow {
	return FetchRow{Icon: icon(color), Color: color, Label: label, Value: value}
}

var fetchRows = []FetchRow{
	// row(IconTerminal, "text-(--secondary)", "Terminal", "Ghostty & Zsh"),
	row(IconCode, "--accent", "Main Language", "C"),
	row(IconScriptLang, "--accent", "Scripting Langs", "Go and Python"),
	row(IconDebugger, "#F16265", "Debugger", "Raddebugger"),
	row(IconMonitor, "#54D7A9", "Operating System", "Fedora KDE Linux"),
	row(IconEditor, "#54D7A9", "Text Editor", "Neovim"),
	row(IconUptime, "#D8C44B", "Uptime", "Asleep"),
	// row(IconCpu, "--extra", "Hardware", "..."),
}

func branch(i, n int) string {
	switch {
	case n == 1:
		return "─"
	case i == 0:
		return "┌"
	case i == n-1:
		return "└"
	default:
		return "├"
	}
}

templ Fastfetch(rows []FetchRow) {
	<div
		style="
		display: grid;
		grid-template-columns: auto auto auto 1fr;
		align-items: center;
		column-gap: 1ch;
		line-height: normal;
	"
	>
		for i, row := range rows {
			<span class="text-(--alt)">{ branch(i, len(rows)) }</span>
			@row.Icon
			<span class={ row.Color, "font-bold" }>{ row.Label }</span>
			<span id={ row.Label }>{ row.Value }</span>
		}
	</div>
}

templ Icon(color string) {
	<svg width="1.1em" height="1.1em" class={ "shrink-0", Color(color) } viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
		{ children... }
	</svg>
}