/* kaipatel.me: shared stylesheet */

@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap");

:root {
	--bg: #faf9f7;
	--surface: #f2f0ec;
	--text: #1c1b19;
	--muted: #67635b;
	--faint: #948f84;
	--border: #ddd8cf;
	--accent: #2f6b6b;
	--accent-text: #ffffff;
	--code-bg: #f0ede6;
	--green: #3f6b3f;
	--yellow: #8a6414;
	--red: #a3372a;
	--green-bg: #eaf0e6;
	--yellow-bg: #f7f0dc;
	--red-bg: #f6e6e1;
	--serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Source Serif Pro", serif;
	--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
	--mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #161513;
		--surface: #1d1c19;
		--text: #eae7e0;
		--muted: #a29d92;
		--faint: #736e64;
		--border: #34322c;
		--accent: #5fa8a8;
		--accent-text: #161513;
		--code-bg: #201f1b;
		--green: #82b07c;
		--yellow: #d3ad52;
		--red: #dd8571;
		--green-bg: #1e2a1c;
		--yellow-bg: #2b2416;
		--red-bg: #2c1e1a;
	}
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

.wrap {
	max-width: 720px;
	margin: 0 auto;
	padding: 0 24px;
}

/* ---- nav ---- */
.site-nav {
	border-bottom: 1px solid var(--border);
	padding: 22px 0;
	margin-bottom: 56px;
}
.site-nav .wrap {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	flex-wrap: wrap;
	row-gap: 8px;
}
.site-nav .brand {
	font-family: var(--mono);
	font-weight: 600;
	font-size: 15px;
	color: var(--text);
	text-decoration: none;
	letter-spacing: -0.01em;
}
.site-nav .brand:hover {
	color: var(--accent);
}
.site-nav .links {
	display: flex;
	gap: 22px;
	font-family: var(--mono);
	font-size: 13px;
}
.site-nav .links a {
	color: var(--muted);
	text-decoration: none;
	border-bottom: 1px solid transparent;
}
.site-nav .links a:hover,
.site-nav .links a[aria-current="page"] {
	color: var(--text);
	border-bottom-color: var(--accent);
}

/* ---- typography ---- */
h1, h2, h3 {
	font-family: var(--serif);
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: -0.01em;
	margin: 0 0 0.5em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; margin-top: 2.4em; }
h3 { font-size: 1.05rem; margin-top: 1.8em; }
p { margin: 0 0 1.1em; }
a { color: var(--accent); }
a.quiet { color: inherit; text-decoration-color: var(--border); }
.lede {
	font-size: 1.1rem;
	color: var(--muted);
	max-width: 56ch;
}
.meta {
	font-family: var(--mono);
	font-size: 12.5px;
	color: var(--faint);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
code, pre {
	font-family: var(--mono);
	font-size: 0.88em;
}
code {
	background: var(--code-bg);
	padding: 0.1em 0.4em;
	border-radius: 3px;
}
pre {
	background: var(--code-bg);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 16px 18px;
	overflow-x: auto;
	line-height: 1.5;
}
pre code { background: none; padding: 0; }
blockquote {
	margin: 1.4em 0;
	padding-left: 18px;
	border-left: 2px solid var(--accent);
	color: var(--muted);
}
ul, ol { padding-left: 1.3em; }
li { margin-bottom: 0.4em; }
hr {
	border: none;
	border-top: 1px solid var(--border);
	margin: 2.4em 0;
}
table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
}
th, td {
	text-align: left;
	padding: 8px 10px;
	border-bottom: 1px solid var(--border);
}
th { font-family: var(--mono); font-size: 12px; color: var(--muted); font-weight: 500; }

/* ---- sections / layout ---- */
main { padding-bottom: 80px; }
section { margin-bottom: 3.2em; }

/* ---- index hero ---- */
.hero {
	margin-bottom: 3.2em;
}
.hero h1 { font-size: 2.1rem; }
.title-line {
	font-family: var(--mono);
	font-size: 13.5px;
	color: var(--muted);
	margin: 6px 0 14px;
}
.hero-links {
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	margin-top: 20px;
	font-family: var(--mono);
	font-size: 13.5px;
}
.hero-links a {
	color: var(--text);
	text-decoration: none;
	border-bottom: 1px solid var(--border);
	padding-bottom: 2px;
}
.hero-links a:hover { border-bottom-color: var(--accent); }

/* ---- project list ---- */
.project-list { display: flex; flex-direction: column; }
.project-row {
	display: block;
	padding: 22px 0;
	border-top: 1px solid var(--border);
	text-decoration: none;
	color: inherit;
}
.project-list .project-row:last-child { border-bottom: 1px solid var(--border); }
.project-row:hover .project-title { color: var(--accent); }
.project-top {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}
.project-title {
	font-family: var(--serif);
	font-size: 1.15rem;
	font-weight: 600;
	color: var(--text);
}
.project-tags {
	font-family: var(--mono);
	font-size: 11.5px;
	color: var(--faint);
	white-space: nowrap;
}
.project-desc {
	margin: 6px 0 0;
	color: var(--muted);
	max-width: 62ch;
}
.badge {
	display: inline-block;
	font-family: var(--mono);
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 2px 7px;
	border-radius: 3px;
	border: 1px solid currentColor;
}
.badge-live { color: var(--green); }
.badge-writeup { color: var(--muted); }

/* ---- writing list ---- */
.post-row {
	display: block;
	padding: 18px 0;
	border-top: 1px solid var(--border);
	text-decoration: none;
	color: inherit;
}
.post-list .post-row:last-child { border-bottom: 1px solid var(--border); }
.post-row:hover .post-title { color: var(--accent); }
.post-title {
	font-family: var(--serif);
	font-size: 1.08rem;
	font-weight: 600;
	color: var(--text);
	margin-bottom: 4px;
}
.post-dek { color: var(--muted); font-size: 0.95rem; }

/* ---- buttons / form controls ---- */
.btn {
	font-family: var(--mono);
	font-size: 13.5px;
	background: var(--text);
	color: var(--bg);
	border: none;
	padding: 10px 18px;
	border-radius: 4px;
	cursor: pointer;
}
.btn:hover { background: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: 0.5; cursor: default; }
input[type="text"] {
	font-family: var(--mono);
	font-size: 14px;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: 4px;
	background: var(--surface);
	color: var(--text);
	width: 100%;
}
input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- demo panel (npm verifier) ---- */
.demo-panel {
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 24px;
	background: var(--surface);
}
.demo-form { display: flex; gap: 10px; }
.demo-form input { flex: 1; }
.demo-hint {
	margin-top: 10px;
	font-family: var(--mono);
	font-size: 12px;
	color: var(--faint);
}
.demo-examples { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.demo-examples button {
	font-family: var(--mono);
	font-size: 12px;
	background: none;
	border: 1px solid var(--border);
	color: var(--muted);
	padding: 4px 9px;
	border-radius: 4px;
	cursor: pointer;
}
.demo-examples button:hover { color: var(--text); border-color: var(--muted); }

.result { margin-top: 26px; }
.result-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--border);
}
.result-name { font-family: var(--mono); font-size: 1.05rem; }
.verdict {
	font-family: var(--mono);
	font-size: 12.5px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 4px 10px;
	border-radius: 4px;
}
.verdict-low { background: var(--green-bg); color: var(--green); }
.verdict-medium { background: var(--yellow-bg); color: var(--yellow); }
.verdict-high { background: var(--red-bg); color: var(--red); }

.score-rows { margin-top: 16px; }
.score-row {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 10px 0;
	border-top: 1px solid var(--border);
	font-size: 0.92rem;
}
.score-row .label { color: var(--text); }
.score-row .why { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.score-row .points {
	font-family: var(--mono);
	color: var(--muted);
	white-space: nowrap;
}
.score-row .points.hit { color: var(--red); }

.stat-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1px;
	background: var(--border);
	border: 1px solid var(--border);
	border-radius: 6px;
	overflow: hidden;
	margin-top: 18px;
}
.stat-cell {
	background: var(--surface);
	padding: 12px 14px;
}
.stat-cell .stat-label {
	font-family: var(--mono);
	font-size: 10.5px;
	text-transform: uppercase;
	color: var(--faint);
	letter-spacing: 0.04em;
}
.stat-cell .stat-value {
	font-family: var(--mono);
	font-size: 1rem;
	margin-top: 4px;
}

.error-box {
	margin-top: 20px;
	padding: 14px 16px;
	border: 1px solid var(--red);
	background: var(--red-bg);
	color: var(--red);
	border-radius: 6px;
	font-size: 0.92rem;
}
.loading {
	margin-top: 20px;
	font-family: var(--mono);
	font-size: 13px;
	color: var(--muted);
}

/* ---- diagram ---- */
.diagram {
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface);
	padding: 20px;
	margin: 1.6em 0;
}
.diagram svg { width: 100%; height: auto; display: block; }
.diagram-caption {
	font-family: var(--mono);
	font-size: 11.5px;
	color: var(--faint);
	margin-top: 10px;
	text-align: center;
}

/* ---- spyware dashboard ---- */
.dashboard {
	background: #14161b;
	border: 1px solid #262a33;
	border-radius: 8px;
	padding: 22px;
	color: #e7e9ee;
	font-family: var(--sans);
}
.dashboard-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin-bottom: 16px;
}
.dashboard-controls select {
	font-family: var(--mono);
	font-size: 12.5px;
	background: #1c1f26;
	color: #e7e9ee;
	border: 1px solid #333843;
	border-radius: 4px;
	padding: 7px 10px;
}
.dashboard-controls label.file-btn {
	font-family: var(--mono);
	font-size: 12.5px;
	background: #1c1f26;
	color: #e7e9ee;
	border: 1px solid #333843;
	border-radius: 4px;
	padding: 7px 10px;
	cursor: pointer;
}
.dashboard-controls input[type="file"] { display: none; }
.dashboard-status {
	font-family: var(--mono);
	font-size: 11.5px;
	color: #7c8494;
	margin-bottom: 16px;
}
.dashboard-grid {
	display: grid;
	grid-template-columns: 1.3fr 1fr;
	gap: 22px;
}
.dashboard-feed {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
	max-height: 480px;
	overflow-y: auto;
	padding-right: 4px;
	scrollbar-width: thin;
	scrollbar-color: #333843 transparent;
}
.dashboard-feed::-webkit-scrollbar { width: 8px; }
.dashboard-feed::-webkit-scrollbar-track { background: transparent; }
.dashboard-feed::-webkit-scrollbar-thumb { background: #333843; border-radius: 4px; }
.dashboard-feed::-webkit-scrollbar-thumb:hover { background: #454b59; }
.dashboard-feed .feed-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	font-size: 12.5px;
	border: 1px solid #333843;
	border-radius: 6px;
	background: #181b22;
	transition: background 0.12s ease;
}
.dashboard-feed .feed-item > span:last-child {
	flex: 1;
	line-height: 1.4;
}
.dashboard-feed .feed-item.inferred:hover { background: #1c212b; }
.dashboard-feed .feed-time {
	font-family: var(--mono);
	font-size: 11px;
	color: #9aa2b1;
	white-space: nowrap;
	flex-shrink: 0;
}
.dashboard-feed .feed-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex-shrink: 0;
}
.dashboard-charts { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dashboard-charts .chart-box { flex: 1; min-width: 0; position: relative; height: 200px; }
.dashboard-charts .chart-box.wide { height: 200px; }
@media (max-width: 760px) {
	.dashboard-grid { grid-template-columns: 1fr; }
}

/* ---- footer ---- */
.site-footer {
	border-top: 1px solid var(--border);
	padding: 24px 0 60px;
	font-family: var(--mono);
	font-size: 12px;
	color: var(--faint);
}

/* ---- responsive ---- */
@media (max-width: 480px) {
	.stat-grid { grid-template-columns: 1fr; }
	.demo-form { flex-direction: column; }
	h1 { font-size: 1.7rem; }
}
