/* CSS Variables */
:root {
	--font-sans:
		"IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
		"Noto Sans", Helvetica, Arial, sans-serif;
	--font-mono:
		"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	--font-serif: "IBM Plex Serif", Georgia, serif;
	--font-family: var(--font-sans);
	--font-size: 16px;
	--line-height: 1.7;

	/* Layout */
	--sidebar-width: 320px;
	--content-max-width: 936px;
	--layout-max-width: 1500px;
	--spacing: 1.5rem;
	--spacing-lg: 2.5rem;
	--content-padding: 3rem;

	/* Light theme — zed.dev cream */
	--bg-base: #f5f4f3;
	--bg-elevated: #fafaf9;
	--bg-primary: var(--bg-elevated);
	--bg-sidebar: var(--bg-base);
	--text: #1a1a1a;
	--text-primary: var(--text);
	--text-secondary: #5c574a;
	--text-muted: #8a8678;
	--border: #dadde2;
	--border-color: var(--border);
	--accent: oklch(48% 0.23 264);
	--accent-color: var(--accent);
	--accent-hover: oklch(40% 0.23 264);
}

[data-theme="dark"] {
	/* Dark theme — zed.dev offgray */
	--bg-base: hsl(218 13% 7.5%);
	--bg-elevated: #121316;
	--bg-primary: var(--bg-elevated);
	--bg-sidebar: var(--bg-base);
	--text: #e5e7eb;
	--text-primary: var(--text);
	--text-secondary: #b3b8c2;
	--text-muted: #9ca3af;
	--border: color-mix(in oklab, #6a7282 22%, transparent);
	--border-color: var(--border);
	--accent: color-mix(in oklch, oklch(48% 0.23 264) 60%, white);
	--accent-color: var(--accent);
	--accent-hover: color-mix(in oklch, oklch(48% 0.23 264) 40%, white);
}

/* Reset Pico defaults */
:root {
	--pico-font-family: var(--font-family);
	--pico-font-size: var(--font-size);
	--pico-line-height: var(--line-height);
	--pico-border-radius: 0;
	--pico-box-shadow: none;
}

/* Reset article/section box styling from Pico */
article,
section {
	background: transparent;
	box-shadow: none;
	border: none;
	border-radius: 0;
	padding: 0;
	margin-bottom: var(--spacing);
}

* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	font-family: var(--font-family);
	font-size: var(--font-size);
	line-height: var(--line-height);
	background: var(--bg-elevated);
	color: var(--text-primary);
	margin: 0;
	padding: 0;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Full-page noise texture — zed-style fractal noise */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
	background-size: 240px 240px;
	background-repeat: repeat;
	opacity: 0.06;
	mix-blend-mode: multiply;
}

[data-theme="dark"] body::before {
	opacity: 0.04;
	mix-blend-mode: screen;
}

/* Page wrapper - centered layout with split background */
.page-wrapper {
	max-width: var(--layout-max-width);
	margin: 0 auto;
	min-height: 100vh;
	position: relative;
	border-left: 1px solid var(--border-color);
	border-right: 1px solid var(--border-color);
}

/* Decorative ruler ticks along the page-wrapper edges */
.page-wrapper::before,
.page-wrapper::after {
	content: "";
	position: absolute;
	top: 80px;
	bottom: 80px;
	width: 6px;
	pointer-events: none;
	background-image:
		repeating-linear-gradient(
			to bottom,
			var(--border-color) 0,
			var(--border-color) 1px,
			transparent 1px,
			transparent 40px
		),
		repeating-linear-gradient(
			to bottom,
			var(--border-color) 0,
			var(--border-color) 1px,
			transparent 1px,
			transparent 8px
		);
	background-size:
		6px 100%,
		3px 100%;
	background-repeat: no-repeat;
	background-position:
		left top,
		left top;
	opacity: 0.6;
	-webkit-mask-image: linear-gradient(
		to bottom,
		transparent 0,
		black 60px,
		black calc(100% - 60px),
		transparent 100%
	);
	mask-image: linear-gradient(
		to bottom,
		transparent 0,
		black 60px,
		black calc(100% - 60px),
		transparent 100%
	);
}

.page-wrapper::before {
	left: -7px;
}

.page-wrapper::after {
	right: -7px;
	background-position:
		right top,
		right top;
}

/* Cross Divider - horizontal line within page-wrapper, with intersection rings */
.cross-divider {
	position: relative;
	height: 1px;
	background: var(--border-color);
}

/* Open ring markers at left/right page-wrapper border intersections */
.cross-divider::before,
.cross-divider::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 7px;
	height: 7px;
	border: 1px solid var(--border-color);
	border-radius: 50%;
	background: var(--bg-elevated);
	transform: translate(-50%, -50%);
}

.cross-divider::before {
	left: 0;
}

.cross-divider::after {
	left: 100%;
}

/* Ring at sidebar border × cross-divider intersection */
.top-left {
	position: relative;
}

.top-left::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	width: 7px;
	height: 7px;
	border: 1px solid var(--border-color);
	border-radius: 50%;
	background: var(--bg-base);
	transform: translate(50%, 50%);
	z-index: 1;
}

/* Top Row */
.top-row {
	display: flex;
	background: var(--bg-primary);
}

.top-left {
	width: var(--sidebar-width);
	flex-shrink: 0;
	background: var(--bg-sidebar);
	padding: var(--content-padding) var(--spacing);
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	border-right: 1px solid var(--border-color);
}

.top-left h1 {
	font-size: 1.375rem;
	font-weight: 600;
	margin: 0 0 0.5rem 0;
	color: var(--text-primary);
	letter-spacing: -0.02em;
}

.top-left .title {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-muted);
	margin: 0;
	line-height: 1.5;
	letter-spacing: 0.02em;
}

.top-right {
	flex: 1;
	min-width: 0;
	background: var(--bg-primary);
	padding: var(--content-padding);
	display: flex;
	justify-content: flex-end;
	align-items: flex-start;
}

/* Avatar - 200px, centered */
.avatar {
	width: 200px;
	height: 200px;
	border-radius: 50%;
	object-fit: cover;
	margin-bottom: var(--spacing);
	border: 3px solid var(--border-color);
}

/* Controls */
.content-controls {
	display: flex;
	gap: 1rem;
}

.control-btn {
	background: transparent;
	border: none;
	padding: 0.25rem;
	cursor: pointer;
	font-size: 1.25rem;
	color: var(--text-muted);
	transition: color 0.2s ease;
	line-height: 1;
	outline: none;
}

.control-btn:hover {
	color: var(--accent-color);
}

.control-btn:focus {
	outline: none;
}

/* Theme toggle icons */
#theme-toggle .icon-light,
#theme-toggle .icon-dark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

#theme-toggle .icon-dark {
	display: none;
}

[data-theme="dark"] #theme-toggle .icon-light {
	display: none;
}

[data-theme="dark"] #theme-toggle .icon-dark {
	display: inline-flex;
}

/* Bottom Row */
.bottom-row {
	display: flex;
	flex: 1;
	background: var(--bg-primary);
}

.bottom-left {
	width: var(--sidebar-width);
	flex-shrink: 0;
	background: var(--bg-sidebar);
	padding: var(--content-padding) var(--spacing);
	border-right: 1px solid var(--border-color);
}

.tagline {
	font-size: 0.875rem;
	color: var(--text-muted);
	margin: 0 0 var(--spacing-lg) 0;
	font-style: italic;
	line-height: 1.6;
	text-align: center;
}

/* Sidebar Links */
.sidebar-links {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.sidebar-links a {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-muted);
	text-decoration: none;
	transition: color 0.2s ease;
	letter-spacing: 0.01em;
}

.sidebar-links a:hover {
	color: var(--accent-color);
}

.sidebar-links svg {
	flex-shrink: 0;
}

/* Main Content - reset Pico styles */
.content {
	flex: 1;
	min-width: 0;
	max-width: var(--content-max-width);
	padding: var(--content-padding);
	background: var(--bg-primary);
	box-shadow: none;
	border: none;
	border-radius: 0;
}

/* Reset article styles from Pico */
.resume {
	max-width: 100%;
	background: transparent;
	box-shadow: none;
	border: none;
	border-radius: 0;
	padding: 0;
	margin: 0;
}

.resume[hidden] {
	display: none;
}

/* Typography */
h1,
h2,
h3 {
	font-family: var(--font-sans);
	color: var(--text-primary);
	letter-spacing: -0.015em;
}

h2 {
	font-size: 1.0625rem;
	font-weight: 600;
	margin: 0 0 1.25rem 0;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	font-family: var(--font-mono);
	color: var(--text-secondary);
}

h2::before {
	content: "# ";
	color: var(--text-muted);
	font-weight: 400;
	opacity: 0.7;
}

h3 {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 0.25rem 0;
}

p {
	margin: 0 0 1rem 0;
	color: var(--text-primary);
}

.summary-subtitle {
	font-family: var(--font-serif);
	font-style: italic;
	font-size: 1.0625rem;
	color: var(--text-secondary);
}

.job-meta,
.edu-year {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	letter-spacing: 0.02em;
}

/* Sections */
section {
	margin-bottom: var(--spacing);
}

/* Horizontal Rules — with corner plus-node markers */
hr {
	position: relative;
	border: none;
	border-top: 1px solid var(--border-color);
	margin: var(--spacing-lg) 0;
	overflow: visible;
	color: var(--text-muted);
}

hr::before,
hr::after {
	content: "";
	position: absolute;
	top: 0;
	width: 9px;
	height: 9px;
	background:
		linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat,
		linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat;
	opacity: 0.55;
	transform: translate(-50%, -50%);
}

hr::before {
	left: 0;
}

hr::after {
	left: 100%;
}

/* Job entries */
.job {
	margin-bottom: var(--spacing-lg);
}

.job:last-child {
	margin-bottom: 0;
}

.job-header {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
}

.job-header-left {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.job-header h3 {
	margin: 0;
}

.job-title {
	font-size: 0.9375rem;
	color: var(--text-secondary);
}

.job-meta {
	font-size: 0.8125rem;
	color: var(--text-muted);
	white-space: nowrap;
}

/* Lists */
ul {
	margin: 0;
	padding-left: 1.25rem;
}

li {
	margin-bottom: 0.5rem;
	color: var(--text-primary);
}

li:last-child {
	margin-bottom: 0;
}

/* Education entries */
.edu {
	margin-bottom: 1rem;
}

.edu:last-child {
	margin-bottom: 0;
}

.edu-header {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.edu-header-left {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.edu-header h3 {
	margin: 0;
}

.edu-degree {
	font-size: 0.9375rem;
	color: var(--text-secondary);
}

.edu-year {
	font-size: 0.8125rem;
	color: var(--text-muted);
	white-space: nowrap;
}

/* Links */
a {
	color: var(--accent-color);
	text-decoration: none;
	transition: color 0.2s ease;
}

a:hover {
	color: var(--accent-hover);
}

.patent-link {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	margin-left: 0.25rem;
	color: var(--text-primary);
}

.patent-link:hover {
	color: var(--accent-color);
}

.patent-link svg {
	vertical-align: middle;
}

/* Footer */
.footer {
	margin-top: var(--spacing-lg);
	padding-top: var(--spacing);
	border-top: 1px solid var(--border-color);
}

.footer p {
	font-size: 0.8125rem;
	color: var(--text-muted);
	margin: 0;
}

/* ============================================================
   Cover page (lizheng.me)
   ============================================================ */
.cover-body {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	background: var(--bg-base);
}

.cover-wrapper {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	max-width: 640px;
	width: 100%;
	margin: 0 auto;
	padding: 4rem var(--spacing) 2rem;
	position: relative;
}

.cover-controls {
	position: fixed;
	top: 1.25rem;
	right: 1.25rem;
	display: flex;
	gap: 0.25rem;
	z-index: 10;
}

.cover-controls .control-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	color: var(--text-muted);
	border-radius: 6px;
	transition:
		color 0.2s ease,
		background-color 0.2s ease;
}

.cover-controls .control-btn:hover {
	color: var(--text-primary);
	background: color-mix(in oklab, var(--border-color) 60%, transparent);
}

.cover-main {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.cover-avatar {
	width: 88px;
	height: 88px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid var(--border-color);
	margin-bottom: 1.5rem;
}

.cover-name {
	font-family: var(--font-serif);
	font-size: clamp(2rem, 5vw, 2.75rem);
	font-weight: 600;
	letter-spacing: -0.02em;
	color: var(--text-primary);
	margin: 0 0 0.5rem 0;
	line-height: 1.1;
}

.cover-role {
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	letter-spacing: 0.02em;
	color: var(--text-muted);
	margin: 0 0 1.25rem 0;
}

.cover-tagline {
	font-family: var(--font-serif);
	font-style: italic;
	font-size: 1.125rem;
	line-height: 1.55;
	color: var(--text-secondary);
	margin: 0;
	max-width: 32rem;
}

.cover-hr {
	width: 100%;
	margin: 2.5rem 0 1.5rem;
}

.cover-links-title {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-muted);
	letter-spacing: 0.05em;
	margin: 0 0 0.75rem 0;
	opacity: 0.8;
	align-self: center;
	width: 100%;
	max-width: 22rem;
}

.cover-links {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 22rem;
}

.cover-links a {
	display: flex;
	align-items: center;
	gap: 0.875rem;
	padding: 0.875rem 0.25rem;
	color: var(--text-primary);
	border-bottom: 1px solid
		color-mix(in oklab, var(--border-color) 70%, transparent);
	font-family: var(--font-sans);
	font-size: 0.9375rem;
	font-weight: 500;
	transition:
		color 0.15s ease,
		padding-left 0.15s ease;
}

.cover-links a:hover {
	color: var(--accent);
	padding-left: 0.5rem;
}

.cover-links a:last-child {
	border-bottom: none;
}

.cover-links a > svg:first-child {
	color: var(--text-muted);
	flex-shrink: 0;
	transition: color 0.15s ease;
}

.cover-links a:hover > svg:first-child {
	color: var(--accent);
}

.cover-links a > span {
	flex: 1;
}

.cover-link-arrow {
	color: var(--text-muted);
	opacity: 0;
	transform: translateX(-4px);
	transition:
		opacity 0.15s ease,
		transform 0.15s ease,
		color 0.15s ease;
}

.cover-links a:hover .cover-link-arrow {
	opacity: 1;
	transform: translateX(0);
	color: var(--accent);
}

.cover-footer {
	padding-top: 2rem;
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-muted);
	opacity: 0.7;
	text-align: center;
}

.cover-footer p {
	margin: 0;
}

@media (max-width: 480px) {
	.cover-wrapper {
		padding: 3.5rem 1.25rem 1.5rem;
	}

	.cover-tagline {
		font-size: 1rem;
	}
}

/* Responsive Design */
@media (max-width: 768px) {
	:root {
		--content-padding: 1.5rem;
	}

	.page-wrapper {
		background: var(--bg-primary);
		border-left: none;
		border-right: none;
	}

	.page-wrapper::before,
	.page-wrapper::after {
		display: none;
	}

	.top-row {
		flex-direction: column;
	}

	/* Mobile: controls bar at top */
	.top-right {
		order: -1;
		width: 100%;
		padding: 0.75rem var(--spacing);
		justify-content: flex-end;
		background: var(--bg-sidebar);
		border-bottom: 1px solid var(--border-color);
	}

	.top-left {
		width: 100%;
		border-right: none;
		border-bottom: none;
		padding-top: var(--spacing);
	}

	.avatar {
		width: 140px;
		height: 140px;
	}

	.cross-divider {
		display: none;
	}

	.bottom-row {
		flex-direction: column;
	}

	.bottom-left {
		width: 100%;
		border-right: none;
		text-align: center;
		padding: var(--spacing);
	}

	.tagline {
		margin-bottom: var(--spacing);
	}

	.sidebar-links {
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: center;
		gap: 1rem;
	}

	.content {
		width: 100%;
		padding: var(--spacing);
		max-width: 100%;
	}

	.job-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.25rem;
	}

	.edu-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.25rem;
	}
}

/* Print styles */
@media print {
	body::before {
		display: none;
	}

	hr::before,
	hr::after {
		display: none;
	}

	.cross-divider::before,
	.cross-divider::after,
	.top-left::after {
		display: none;
	}

	.page-wrapper::before,
	.page-wrapper::after {
		display: none;
	}

	h2::before {
		content: "";
	}

	.top-left,
	.bottom-left,
	.top-right {
		display: none;
	}

	.cross-divider {
		display: none;
	}

	.content {
		padding: 0;
		max-width: 100%;
	}

	hr {
		border-top-color: #ccc;
	}

	a {
		color: inherit;
		text-decoration: underline;
	}
}
