/*
	Minimalist responsive theme V2
	- CSS variables for easy theming
	- Mobile-first design
	- Clean typography and generous spacing
	- Subtle animations
*/

:root {
	/* Light theme - ultra minimal */
	--bg: #fdfdfd;
	--bg-secondary: #f1f1f1;
	--surface: #ffffff;
	--card: #ffffff;
	--ink: #111111;
	--muted: #555555;
	--border: #eeeeee;
	--shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
	--shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);

	--primary: #007aff; /* Apple's blue */
	--primary-hover: #0056b3;
	--accent: #34c759; /* Apple's green */
	--success: #34c759;
	--warning: #ff9500;
	--danger: #ff3b30;

	--radius: 6px;
	--radius-lg: 10px;
	--transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark theme */
html[data-theme="dark"] {
	--bg: #000000;
	--bg-secondary: #1c1c1e;
	--surface: #1c1c1e;
	--card: #2c2c2e;
	--ink: #ffffff;
	--muted: #8e8e93;
	--border: #3a3a3c;
	--shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	--shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Base styles */
* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
	font-size: 17px;
	line-height: 1.7;
	color: var(--ink);
	background-color: var(--bg);
	margin: 0;
	padding: 0;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
	font-weight: 600;
	line-height: 1.3;
	margin: 0 0 0.75rem 0;
	color: var(--ink);
}

h1 {
	font-size: 2.5rem;
	font-weight: 700;
	letter-spacing: -0.5px;
}

h2 {
	font-size: 1.75rem;
}

h3 {
	font-size: 1.25rem;
}

p {
	margin: 0 0 1.25rem 0;
}

a {
	color: var(--primary);
	text-decoration: none;
	transition: var(--transition);
}

a:hover {
	color: var(--primary-hover);
	text-decoration: underline;
}

/* Layout */
.container {
	width: 100%;
	max-width: 960px;
	margin: 0 auto;
	padding: 0 1.5rem;
	text-align: center;
}

/* Header */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background-color: color-mix(in srgb, var(--surface) 80%, transparent);
	border-bottom: 1px solid var(--border);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	width: 100%;
}

.nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 0;
	min-height: 64px;
	width: 100%;
	max-width: 960px;
	margin: 0 auto;
}

.brand {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: var(--primary);
	color: white;
	border-radius: var(--radius);
	font-weight: 600;
	font-size: 1.2rem;
	transition: var(--transition);
}

.logo:hover {
	transform: scale(1.08);
	background: var(--primary-hover);
}

.nav-links {
	display: flex;
	align-items: center;
	gap: 2.5rem;
}

.nav-links a {
	font-weight: 500;
	color: var(--muted);
	padding: 0.5rem 0;
	transition: var(--transition);
	border-bottom: 2px solid transparent;
}

.nav-links a:hover {
	color: var(--ink);
	text-decoration: none;
}

.nav-links a.active {
	color: var(--ink);
	border-bottom-color: var(--primary);
}

.nav-actions {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background-color: transparent;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--muted);
	cursor: pointer;
	transition: var(--transition);
}

.theme-toggle:hover {
	background-color: var(--bg-secondary);
	color: var(--ink);
	transform: scale(1.08);
}

/* Main content */
main {
	min-height: calc(100vh - 128px);
	padding-top: 2rem;
}

/* Hero section */
.hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 4rem 1rem 4rem;
	max-width: 720px;
	margin: 0 auto;
}

.hero .avatar {
	width: 100px;
	height: 100px;
	border-radius: 50%;
	border: 3px solid var(--surface);
	box-shadow: 0 0 0 3px var(--primary), var(--shadow);
	margin-bottom: 2rem;
	transition: var(--transition);
}

.hero .avatar:hover {
	transform: scale(1.08);
	box-shadow: 0 0 0 4px var(--primary), var(--shadow-hover);
}

.hero h1 {
	margin-bottom: 0.75rem;
}

.hero .subtitle {
	color: var(--muted);
	font-size: 1.25rem;
	margin-bottom: 1.5rem;
	font-weight: 400;
}

.hero .lead {
	font-size: 1.1rem;
	line-height: 1.8;
	color: var(--muted);
	max-width: 640px;
}

/* Cards and grid */
.grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2rem;
	margin: 4rem auto;
	width: 100%;
	max-width: 800px;
	justify-items: center;
}

.card {
	background-color: var(--card);
	border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
	box-shadow: var(--shadow);
	transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
	padding: 2.5rem;
	width: 100%;
	text-align: left;
}

.card:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow-hover);
	border-color: color-mix(in srgb, var(--ink) 14%, transparent);
}

.card h2 {
	border-bottom: none !important;
	margin-bottom: 0.75rem !important;
	padding-bottom: 0.25rem !important;
	position: relative;
}

.card h2::after {
	content: "";
	display: block;
	width: 72px;
	height: 2px;
	margin: 0.65rem auto 0;
	background: color-mix(in srgb, var(--primary) 70%, transparent);
	border-radius: 2px;
}

.list {
	list-style: none;
	padding: 0;
	margin: 0;
	text-align: left;
	gap: 0.25rem;
}

.list li {
	padding: 0.6rem 0.5rem;
	border: 1px solid transparent;
	border-bottom: none;
	border-radius: var(--radius);
}

.list li + li {
	margin-top: 0.25rem;
}

.list li:nth-child(odd) {
	background: color-mix(in srgb, var(--ink) 5%, transparent);
}

.list a {
	display: inline-block;
	padding: 0.35rem 0.5rem;
	border-radius: var(--radius);
	transition: var(--transition);
}

.list a::after {
	content: "→";
	opacity: 0;
	margin-left: 0.25rem;
	transition: var(--transition);
}

.list a:hover {
	background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.list a:hover::after {
	opacity: 1;
	transform: translateX(2px);
}

/* Blog posts */
.posts {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2rem;
	margin: 4rem auto;
	width: 100%;
	max-width: 800px;
}

.post-card {
	background-color: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 2rem;
	box-shadow: var(--shadow);
	transition: var(--transition);
	text-decoration: none;
	color: inherit;
	display: block;
	width: 100%;
	text-align: left;
}

.post-card:hover {
	box-shadow: var(--shadow-hover);
	transform: translateY(-4px);
	text-decoration: none;
}

.post-header {
	margin-bottom: 0.5rem;
	text-align: center;
}

.post-card h3 {
	margin-bottom: 0.5rem;
	color: var(--ink);
	text-align: center;
	transition: var(--transition);
}

.post-card:hover h3 {
	color: var(--primary);
}

.meta {
	color: var(--muted);
	font-size: 0.875rem;
	text-align: center;
	opacity: 0.85;
}

.chip {
	display: inline-block;
	background-color: var(--bg-secondary);
	color: var(--primary);
	border-radius: 999px;
	padding: 0.25rem 0.75rem;
	font-size: 0.75rem;
	font-weight: 500;
	margin: 0.25rem 0.25rem 0 0;
}

/* Footer */
.site-footer {
	border-top: 1px solid var(--border);
	margin-top: 4rem;
	padding: 2rem 0;
	background-color: var(--bg-secondary);
}

.site-footer .container {
	text-align: center;
	color: var(--muted);
}

/* Animations */
.reveal {
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
	opacity: 1;
	transform: translateY(0);
}

.reveal-grid .card,
.reveal-grid .post-card {
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-grid.in-view .card,
.reveal-grid.in-view .post-card {
	opacity: 1;
	transform: translateY(0);
}

.reveal-grid.in-view .card:nth-child(1),
.reveal-grid.in-view .post-card:nth-child(1) {
	transition-delay: 0.1s;
}

.reveal-grid.in-view .card:nth-child(2),
.reveal-grid.in-view .post-card:nth-child(2) {
	transition-delay: 0.2s;
}

.reveal-grid.in-view .card:nth-child(3),
.reveal-grid.in-view .post-card:nth-child(3) {
	transition-delay: 0.3s;
}

/* Responsive design */
@media (min-width: 640px) {
	.grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.posts {
		grid-template-columns: repeat(2, 1fr);
	}

	.hero {
		padding: 5rem 1rem 4rem;
	}

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

	.hero h1 {
		font-size: 2.5rem;
	}

	.card {
		padding: 2.5rem;
	}

	.latest-posts .card { grid-column: 1 / -1; }
}

@media (min-width: 768px) {
	.container {
		padding: 0 2rem;
	}

	.nav-links {
		gap: 3rem;
	}

	.grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 2rem;
		max-width: 900px;
		justify-items: center;
	}

	.posts {
		grid-template-columns: repeat(2, 1fr);
		max-width: 900px;
		justify-items: center;
	}

	.hero {
		padding: 6rem 1rem 5rem;
	}

	.hero .avatar {
		width: 160px;
		height: 160px;
	}

	.hero h1 {
		font-size: 3rem;
	}

	.card {
		padding: 3rem;
	}
}

@media (min-width: 1024px) {
	.grid {
		grid-template-columns: repeat(2, 1fr);
		max-width: 1000px;
	}

	.posts {
		grid-template-columns: repeat(3, 1fr);
		max-width: 1000px;
	}

	.hero h1 {
		font-size: 3.25rem;
	}
}

/* Mobile menu */
.mobile-menu-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background-color: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--ink);
	cursor: pointer;
	transition: var(--transition);
}

.mobile-menu-toggle:hover {
	background-color: var(--bg-secondary);
	transform: scale(1.05);
}

.mobile-menu {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background-color: var(--surface);
	border-bottom: 1px solid var(--border);
	box-shadow: var(--shadow);
}

.mobile-menu.active {
	display: block;
}

.mobile-menu-content {
	padding: 1rem;
}

.mobile-menu-content a {
	display: block;
	padding: 0.75rem 0;
	color: var(--ink);
	font-weight: 500;
	border-bottom: 1px solid var(--border);
	transition: var(--transition);
}

.mobile-menu-content a:last-child {
	border-bottom: none;
}

.mobile-menu-content a:hover {
	color: var(--primary);
	padding-left: 0.5rem;
}

/* Mobile navigation */
@media (max-width: 768px) {
	.nav-links {
		display: none;
	}

	.mobile-menu-toggle {
		display: flex;
	}

	.nav {
		padding: 0.75rem 0;
	}

	.hero {
		padding: 3rem 1rem 2rem;
	}

	.hero .avatar {
		width: 100px;
		height: 100px;
	}

	.hero h1 {
		font-size: 2rem;
	}

	.hero .lead {
		font-size: 1rem;
	}

	.card {
		padding: 1.5rem;
	}

	.posts {
		grid-template-columns: 1fr;
	}
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
	}

	.reveal,
	.reveal-grid .card,
	.reveal-grid .post-card {
		opacity: 1 !important;
		transform: none !important;
	}
}

/* Focus styles */
button:focus-visible,
a:focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
}

/* Background canvas - subtle effect */
#bg-canvas {
	position: fixed;
	inset: 0;
	z-index: -1;
	opacity: 0.03;
	pointer-events: none;
}

/* Print styles */
@media print {
	.theme-toggle,
	#bg-canvas {
		display: none !important;
	}

	* {
		background: transparent !important;
		color: black !important;
		box-shadow: none !important;
		text-shadow: none !important;
	}

	a,
	a:visited {
		text-decoration: underline;
	}

	.card {
		border: 1px solid #ccc !important;
		box-shadow: none !important;
	}
}

/* --- Alignment & emphasis overrides (last wins) --- */
/* Center all grid-based sections regardless of earlier rules */
section.container.grid,
.container.grid,
.container .grid,
.grid,
.posts,
section.container.posts {
	margin-left: auto !important;
	margin-right: auto !important;
	justify-items: center !important;
}

/* Keep a generous max-width and ensure centering */
.grid, .posts { max-width: 1000px !important; width: 100%; }

/* Center content inside cards and lists for a cohesive look */
.card,
.card h2,
.list,
.list li,
.list a,
.post-card,
.post-header,
.meta { text-align: center !important; }

/* Stronger separation between list items */
.list li { padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }

/* Subtle highlight on hover to distinguish items */
.list a { display: inline-block; padding: 0.45rem 0.75rem; border-radius: var(--radius); }
.list a:hover { background-color: color-mix(in srgb, var(--primary) 10%, transparent); transform: translateY(-1px); }

/* Blog list cards centered as well */
.posts { row-gap: 2rem; }
.post-card { border: none; border-bottom: 1px solid var(--border); padding: 0 0 1.25rem 0; box-shadow: none; }
.post-card:last-child { border-bottom: none; }

/* --- Section aesthetics refinements --- */
/* Tighter vertical rhythm for all section grids */
.grid, .posts { margin-block: 2.5rem !important; }

/* Card polish: softer borders and hover lift */
.card {
	background-color: var(--card);
	border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
	box-shadow: var(--shadow);
	transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow-hover);
	border-color: color-mix(in srgb, var(--ink) 14%, transparent);
}

/* Headings with centered accent bar */
.card h2 {
	border-bottom: none !important;
	margin-bottom: 0.75rem !important;
	padding-bottom: 0.25rem !important;
	position: relative;
}
.card h2::after {
	content: "";
	display: block;
	width: 72px;
	height: 2px;
	margin: 0.65rem auto 0;
	background: color-mix(in srgb, var(--primary) 70%, transparent);
	border-radius: 2px;
}

/* Lists: clearer separation and gentle emphasis */
.list { gap: 0.25rem; }
.list li { 
	padding: 0.6rem 0.5rem;
	border: 1px solid transparent;
	border-bottom: none;
	border-radius: var(--radius);
}
.list li + li { margin-top: 0.25rem; }
.list li:nth-child(odd) { background: color-mix(in srgb, var(--ink) 5%, transparent); }

.list a {
	display: inline-block;
	padding: 0.35rem 0.5rem;
	border-radius: var(--radius);
}
.list a::after {
	content: "→";
	opacity: 0;
	margin-left: 0.25rem;
	transition: var(--transition);
}
.list a:hover {
	background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.list a:hover::after { opacity: 1; transform: translateX(2px); }

/* Blog items spacing */
.posts { row-gap: 2rem; }
.post-header { margin-bottom: 0.75rem !important; }
.meta { opacity: 0.85; }

/* --- Blog page centering --- */
.blog-page .posts { 
	margin-left: auto !important; 
	margin-right: auto !important; 
	justify-items: center !important; 
	max-width: 1000px; 
}

/* --- Rounded cards with subtle white shadow --- */
.card,
.post-card {
	border-radius: 12px !important;
	border: 1px solid color-mix(in srgb, #ffffff 12%, transparent);
	box-shadow: 0 6px 18px rgba(255,255,255,0.06), 0 1px 0 rgba(255,255,255,0.08) inset;
	background-color: color-mix(in srgb, var(--card) 92%, #ffffff 8%);
}

/* Slightly stronger on hover, but still subtle */
.card:hover,
.post-card:hover {
	box-shadow: 0 10px 26px rgba(255,255,255,0.09), 0 1px 0 rgba(255,255,255,0.1) inset;
}

/* Center the Latest blog posts section explicitly */
.latest-posts {
	max-width: 800px;
	margin-left: auto !important;
	margin-right: auto !important;
	justify-items: center !important;
}
.latest-posts .card { width: 100%; }

/* Make 'Latest blog posts' span two columns on wider screens */
@media (min-width: 640px) {
	.latest-posts .card { grid-column: 1 / -1; }
}

/* --- Avatar size overrides (bigger hero image) --- */
.hero .avatar { width: 140px; height: 140px; }
@media (max-width: 768px) {
	.hero .avatar { width: 120px; height: 120px; }
}
@media (min-width: 640px) {
	.hero .avatar { width: 180px; height: 180px; }
}
@media (min-width: 1024px) {
	.hero .avatar { width: 220px; height: 220px; }
}
