/* ============ fonts ============ */
@font-face {
	font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap;
	src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
}
@font-face {
	font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap;
	src: url("../fonts/jetbrains-mono-700.woff2") format("woff2");
}
@font-face {
	font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
	src: url("../fonts/inter-400.woff2") format("woff2");
}
@font-face {
	font-family: "Inter"; font-style: italic; font-weight: 400; font-display: swap;
	src: url("../fonts/inter-400i.woff2") format("woff2");
}
@font-face {
	font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
	src: url("../fonts/inter-600.woff2") format("woff2");
}
@font-face {
	font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap;
	src: url("../fonts/inter-700.woff2") format("woff2");
}

/* ============ tokens ============ */
:root {
	--bg: #0B0F14;
	--surface: #111721;
	--text: #D6DEE7;
	--text-2: #8B98A5;
	--green: #3DDC97;
	--amber: #FFB454;
	--border: #1E2733;
	--mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
	--sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--wrap: 780px;
}

/* ============ base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	background-color: var(--bg);
	background-image:
		linear-gradient(var(--border) 1px, transparent 1px),
		linear-gradient(90deg, var(--border) 1px, transparent 1px);
	background-size: 48px 48px;
	background-attachment: fixed;
	color: var(--text);
	font-family: var(--sans);
	font-size: 17px;
	line-height: 1.7;
}
body::before { /* dims the grid to ~5% visibility */
	content: "";
	position: fixed;
	inset: 0;
	background: var(--bg);
	opacity: 0.94;
	z-index: -1;
	pointer-events: none;
}
::selection { background: var(--green); color: var(--bg); }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, h5, h6 { font-family: var(--mono); line-height: 1.3; color: var(--text); }
img { max-width: 100%; height: auto; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.amber { color: var(--amber); }
.skip-link {
	position: absolute; left: -9999px; top: 0;
	background: var(--surface); color: var(--green);
	padding: 8px 16px; font-family: var(--mono); z-index: 100;
}
.skip-link:focus { left: 0; }

/* cursor block */
.cursor { color: var(--green); font-style: normal; }
@keyframes mk-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.cursor--blink { animation: mk-blink 1.06s steps(1) infinite; }

/* ============ header ============ */
.site-header {
	position: sticky; top: 0; z-index: 50;
	background: rgba(11, 15, 20, 0.8);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid transparent;
	transition: border-color 0.2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.site-header__inner {
	display: flex; align-items: center; justify-content: space-between;
	height: 56px;
}
.site-logo {
	font-family: var(--mono); font-size: 15px; color: var(--text);
}
.site-logo:hover { text-decoration: none; }
.site-logo__user { color: var(--green); }
.site-logo__at { color: var(--text-2); }
.site-logo:hover .cursor { animation: mk-blink 1.06s steps(1) infinite; }
.site-nav__list {
	display: flex; gap: 20px; margin: 0; padding: 0; list-style: none;
	font-family: var(--mono); font-size: 14px;
}
.site-nav__list a { color: var(--text-2); }
.site-nav__list a:hover { color: var(--green); text-decoration: none; }

/* ============ footer ============ */
.site-footer {
	margin-top: 96px; padding: 32px 0 48px;
	border-top: 1px solid var(--border);
	font-family: var(--mono); font-size: 13px; color: var(--text-2);
}
.site-footer__comment { color: var(--border); }
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--green); }

/* ============ motion sanity ============ */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
	html { scroll-behavior: auto; }
}

/* ============ post lines / listings ============ */
.post-line__link {
	display: flex; align-items: baseline; gap: 14px;
	padding: 10px 12px; margin: 0 -12px;
	border-radius: 6px; color: var(--text);
	transition: background-color 0.15s ease;
}
.post-line__link:hover { background: var(--surface); text-decoration: none; }
.post-line__arrow {
	color: var(--green); font-family: var(--mono);
	opacity: 0; transform: translateX(-6px);
	transition: opacity 0.15s ease, transform 0.15s ease;
}
.post-line__link:hover .post-line__arrow { opacity: 1; transform: translateX(0); }
.post-line__date {
	font-family: var(--mono); font-size: 13px; color: var(--text-2);
	flex-shrink: 0; transition: color 0.15s ease;
}
.post-line__link:hover .post-line__date { color: var(--green); }
.post-line__title { font-weight: 600; }
.post-line__cat {
	font-family: var(--mono); font-size: 12px; color: var(--amber);
	margin-left: auto; flex-shrink: 0;
}
.year-heading {
	font-size: 20px; margin: 48px 0 12px; color: var(--text);
}
.year-heading::before { content: "# "; color: var(--green); }
.year-group { display: flex; flex-direction: column; }

/* ============ terminal window ============ */
.term-window {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}
.term-bar {
	display: flex; align-items: center; gap: 8px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--border);
}
.term-dot { width: 12px; height: 12px; border-radius: 50%; position: relative; }
.term-dot--r { background: #FF5F57; }
.term-dot--y { background: #FEBC2E; }
.term-dot--g { background: #28C840; }
.term-dot::after {
	content: attr(data-tip);
	position: absolute; top: 20px; left: 0;
	background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
	padding: 2px 8px; font-family: var(--mono); font-size: 11px; color: var(--text-2);
	white-space: nowrap; opacity: 0; transform: translateY(-4px);
	transition: opacity 0.15s ease, transform 0.15s ease;
	pointer-events: none; z-index: 5;
}
.term-dot:hover::after { opacity: 1; transform: translateY(0); }
.term-title {
	margin-left: 8px; font-family: var(--mono); font-size: 12px; color: var(--text-2);
}
.term-body {
	padding: 20px 22px; font-family: var(--mono); font-size: 15px; line-height: 1.9;
}
.term-line { margin: 0; }
.term-line[data-type="cmd"]::before { content: "$ "; color: var(--green); }
.term-line[data-type="out"] { color: var(--text-2); }
.term-line[data-type="out"] strong { color: var(--text); }
.term-line[data-type="prompt"]::before { content: "$ "; color: var(--green); }
.term-line--skills { display: flex; flex-wrap: wrap; gap: 2px 22px; padding: 4px 0; }

/* ============ hero + recent ============ */
.hero { padding: 64px 20px 16px; }
.recent { padding-top: 48px; }
.recent__heading { font-size: 16px; color: var(--text); margin-bottom: 16px; }
.recent__prompt { color: var(--green); }
.recent__all { font-family: var(--mono); margin-top: 20px; }

/* ============ page head ============ */
.page-head { padding: 56px 0 8px; }
.page-head__title { font-size: 22px; margin: 0; }
.page-head__meta { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.none-found { color: var(--text-2); font-family: var(--mono); }

/* ============ single post ============ */
.post-single__head { padding: 56px 0 8px; }
.post-single__cmd { font-family: var(--mono); font-size: 13px; color: var(--text-2); margin: 0 0 12px; }
.post-single__cmd::first-letter { color: var(--green); }
.post-single__title { font-size: clamp(26px, 5vw, 38px); margin: 0 0 12px; }
.post-single__meta { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.post-single__meta a { color: var(--amber); }
.post-single__sep { color: var(--border); margin: 0 4px; }

.entry-content { max-width: 68ch; }
.entry-content h2, .entry-content h3 { margin-top: 2.2em; }
.entry-content h2::before, .entry-content h3::before { color: var(--green); }
.entry-content h2::before { content: "# "; }
.entry-content h3::before { content: "## "; }
.entry-content p { margin: 1.2em 0; }
.entry-content a { text-decoration: none; background-image: linear-gradient(var(--green), var(--green)); background-repeat: no-repeat; background-size: 0% 1px; background-position: 0 100%; transition: background-size 0.25s ease; }
.entry-content a:hover { background-size: 100% 1px; text-decoration: none; }
.entry-content blockquote { margin: 1.4em 0; padding: 4px 20px; border-left: 2px solid var(--green); color: var(--text-2); font-style: italic; }
.entry-content code { font-family: var(--mono); font-size: 0.88em; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; color: var(--amber); }
.entry-content pre code { background: none; border: 0; padding: 0; color: inherit; }
.entry-content table { border-collapse: collapse; width: 100%; font-size: 15px; }
.entry-content th, .entry-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.entry-content img { border-radius: 8px; }

/* code window (JS wraps every pre) */
.code-window { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: 1.6em 0; }
.code-window__bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.code-window__dots { display: flex; gap: 6px; }
.code-window__dots span { width: 10px; height: 10px; border-radius: 50%; }
.code-window pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.7; color: var(--text); }
.code-window__copy { margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 4px; color: var(--text-2); font-family: var(--mono); font-size: 11px; padding: 2px 10px; cursor: pointer; transition: color 0.15s ease, border-color 0.15s ease; }
.code-window__copy:hover { color: var(--green); border-color: var(--green); }

/* post nav */
.post-nav { display: flex; justify-content: space-between; gap: 16px; margin: 56px 0 0; font-family: var(--mono); font-size: 13px; }
.post-nav__next { margin-left: auto; }

/* reading progress */
.reading-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; }
#reading-progress-bar { display: block; height: 100%; background: var(--green); transform: scaleX(0); transform-origin: 0 0; }

/* comments */
.comments { margin-top: 64px; border-top: 1px solid var(--border); padding-top: 32px; max-width: 68ch; }
.comments__title { font-size: 18px; }
.comments__title::first-letter { color: var(--green); }
.comments__list { list-style: none; padding: 0; }
.comments__list .comment { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin: 14px 0; background: var(--surface); }
.comments__list .comment .avatar { border-radius: 50%; vertical-align: middle; margin-right: 8px; }
.comments__list .children { list-style: none; padding-left: 24px; }
.comment-form label { display: block; font-family: var(--mono); font-size: 13px; color: var(--text-2); margin-top: 12px; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: var(--mono); font-size: 14px; padding: 8px 10px; }
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--green); }
.comment-form .submit { background: var(--green); color: var(--bg); border: 0; border-radius: 6px; font-family: var(--mono); font-weight: 700; padding: 10px 20px; cursor: pointer; margin-top: 14px; }

/* ============ search + 404 ============ */
.search-form { display: flex; gap: 8px; align-items: center; font-family: var(--mono); margin: 24px 0; }
.search-form__label { color: var(--green); font-size: 14px; }
.search-form__input { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: var(--mono); font-size: 14px; padding: 8px 12px; }
.search-form__input:focus { outline: none; border-color: var(--green); }
.search-form__submit { background: var(--green); color: var(--bg); border: 0; border-radius: 6px; font-family: var(--mono); font-weight: 700; padding: 8px 16px; cursor: pointer; }
.term-line--error { color: #FF5F57 !important; }

/* ============ scroll reveal ============ */
.reveal-armed .post-line, .reveal-armed .recent__heading, .reveal-armed .recent__all {
	opacity: 0; transform: translateY(8px);
	transition: opacity 0.4s ease, transform 0.4s ease;
}
.reveal-armed .is-revealed { opacity: 1; transform: translateY(0); }

/* ============ command palette ============ */
.palette {
	position: fixed; inset: 0; z-index: 80;
	background: rgba(11, 15, 20, 0.7);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	display: flex; align-items: flex-start; justify-content: center; padding-top: 18vh;
}
.palette[hidden] { display: none; }
.palette__window {
	width: min(560px, 90vw);
	background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
	font-family: var(--mono);
}
.palette__row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; }
.palette__prompt { color: var(--green); }
.palette__input {
	flex: 1; background: none; border: 0; outline: none;
	color: var(--text); font-family: var(--mono); font-size: 15px;
}
.palette__out { padding: 0 16px 14px; font-size: 13px; color: var(--text-2); min-height: 0; }
.palette__out:empty { display: none; }

/* ============ matrix ============ */
.matrix-canvas { position: fixed; inset: 0; z-index: 90; pointer-events: none; }

/* ============ view transitions ============ */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.15s; }
@media (prefers-reduced-motion: reduce) {
	@view-transition { navigation: none; }
}

/* ============ responsive ============ */
@media (max-width: 640px) {
	body { font-size: 16px; }
	.hero { padding-top: 32px; }
	.term-body { padding: 16px 14px; font-size: 13px; }
	.post-line__link { flex-wrap: wrap; gap: 6px 10px; padding: 12px; }
	.post-line__arrow { display: none; }
	.post-line__cat { margin-left: 0; }
	.post-single__title { font-size: 24px; }
	.site-nav__list { gap: 12px; font-size: 13px; }
	.post-nav { flex-direction: column; }
	.post-nav__next { margin-left: 0; }
}
