/*
Theme Name: Personal Blog Theme
Theme URI:
Author:
Description: Minimal SEO-first personal blog. White, black, blue. No clutter.
Version: 1.0
License: GPL-2.0-or-later
Text Domain: personalblogtheme
*/

/* ── Variables ── */

:root {
	--reading:  640px;
	--accent:   rgb(0,0,238);
	--gray:     #767676;
	--dark:     #111;
	--bg:       #fff;
	--border:   rgba(0,0,0,.07);
	--sp:       1.4em;
	--sp-md:    2em;
	--sp-lg:    2.8em;
	--sp-xl:    3.4em;
	--sp-2xl:   4.8em;
}

/* ── Reset ── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */

html { font-size: 16px; }

body {
	background: var(--bg);
	color: var(--dark);
	font-family: sans-serif;
	font-size: 1rem;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

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

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5, h6 {
	font-family: inherit;
	font-weight: 600;
	line-height: 1.2;
	margin: 0;
}

/* ── Layout ── */

.container {
	width: calc(100% - 2rem);
	max-width: var(--reading);
	margin: 0 auto;
}

/* ── Header ── */

.site-header {
	border-bottom: 1px solid var(--border);
}

.site-header .container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	padding: 1em 0;
}

.site-identity { flex-shrink: 0; }

.site-title {
	font-size: 1.2em;
	font-weight: 600;
	line-height: 1.1;
	margin: 0;
}

.site-title a { color: inherit; text-decoration: none; }
.site-title a:hover { color: var(--accent); }

.site-tagline {
	display: block;
	font-size: 0.85em;
	color: var(--gray);
	line-height: 1.3;
	margin-top: 0.2em;
}

/* Desktop nav */
.nav-primary ul {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.5rem;
	margin: 0;
	padding: 0;
}
.nav-primary a {
	font-size: 0.9em;
	color: var(--dark);
}
.nav-primary a:hover { color: var(--accent); text-decoration: none; }

/* Hamburger button — visible on mobile only */
.nav-toggle {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.25rem;
	color: var(--dark);
	flex-shrink: 0;
}
.nav-toggle svg { display: block; }

/* Off-canvas overlay */
.nav-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 200;
	background: rgba(0,0,0,.35);
}
.nav-overlay.is-open { display: block; }

.nav-drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 201;
	width: min(320px, 85vw);
	background: var(--bg);
	padding: 1.5rem;
	overflow-y: auto;
	transform: translateX(100%);
	transition: transform .22s ease;
}
.nav-overlay.is-open .nav-drawer { transform: translateX(0); }

.nav-drawer-close {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 0.9rem;
	color: var(--gray);
	margin-bottom: 1.5rem;
	padding: 0;
}
.nav-drawer-close:hover { color: var(--dark); }

.nav-drawer ul {
	list-style: none;
	padding: 0;
	margin: 0;
}
.nav-drawer li { border-bottom: 1px solid var(--border); }
.nav-drawer a {
	display: block;
	padding: 0.75rem 0;
	font-size: 1rem;
	font-weight: 600;
	color: var(--dark);
	text-decoration: none;
}
.nav-drawer a:hover { color: var(--accent); }

/* ── Main ── */

.site-main { padding: var(--sp-xl) 0; }

/* ── Archive / Home post list ── */

.post-list { list-style: none; }

.post-list-item { display: flex; gap: 1.25rem; align-items: flex-start; }
.post-list-item + .post-list-item { margin-top: var(--sp-2xl); }

.post-list-body { flex: 1; min-width: 0; }

.post-list-title {
	font-size: 1.35rem;
	font-weight: 600;
	line-height: 1.25;
	margin-bottom: 0.4em;
	word-break: break-word;
}
.post-list-title a { color: inherit; text-decoration: none; }
.post-list-title a:hover { color: var(--accent); }

.post-list-excerpt {
	font-size: 1rem;
	color: var(--dark);
	line-height: 1.5;
	margin-bottom: 0.5em;
}

.post-list-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.2em 0.5em;
	font-size: 0.875rem;
	color: var(--gray);
}
.post-list-meta a { color: var(--gray); text-decoration: none; }
.post-list-meta a:hover { color: var(--accent); }
.post-list-meta .sep { color: var(--gray); }

.post-list-thumb {
	flex-shrink: 0;
	width: 100px;
	height: 100px;
	overflow: hidden;
	border-radius: 4px;
}
.post-list-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ── Archive heading ── */

.archive-header {
	margin-bottom: var(--sp-xl);
}
.archive-header h1 {
	font-size: 1.5rem;
	font-weight: 600;
}
.archive-header .archive-desc {
	margin-top: 0.4em;
	font-size: 0.9rem;
	color: var(--gray);
}

/* ── Pagination ── */

.pagination {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin-top: var(--sp-2xl);
	flex-wrap: wrap;
}
.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2rem;
	height: 2rem;
	padding: 0 0.5rem;
	font-size: 0.875rem;
	border: 1px solid var(--border);
	border-radius: 3px;
	color: var(--dark);
	text-decoration: none;
}
.pagination .page-numbers.current,
.pagination .page-numbers:hover { border-color: var(--accent); color: var(--accent); }

/* ── Single post ── */

.post-header {
	padding: var(--sp-lg) 0;
}

.post-title {
	font-size: clamp(1.6rem, 5vw, 2.2rem);
	font-weight: 600;
	line-height: 1.15;
	word-break: break-word;
	margin-bottom: 0.5em;
}

.post-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.2em 0.5em;
	font-size: 0.875rem;
	color: var(--gray);
}
.post-meta a { color: var(--gray); }
.post-meta a:hover { color: var(--accent); }

.post-featured-image {
	margin-bottom: var(--sp-md);
	border-radius: 4px;
	overflow: hidden;
}
.post-featured-image img { width: 100%; }

/* ── Post content ── */

.post-content { font-size: 1rem; line-height: 1.7; }

.post-content > * { margin-top: var(--sp); }
.post-content > *:first-child { margin-top: 0; }

.post-content h2 { font-size: 1.4rem; font-weight: 600; line-height: 1.2; }
.post-content h3 { font-size: 1.15rem; font-weight: 600; line-height: 1.2; }
.post-content h4 { font-size: 1rem; font-weight: 600; }

.post-content ul,
.post-content ol { padding-left: 1.5em; }
.post-content li + li { margin-top: 0.3em; }

.post-content blockquote {
	border-left: 3px solid var(--accent);
	padding-left: 1.25em;
	color: var(--gray);
	font-style: italic;
}

.post-content pre {
	background: #f5f5f5;
	border: 1px solid var(--border);
	border-radius: 3px;
	padding: 1em;
	overflow-x: auto;
	font-size: 0.875rem;
	line-height: 1.55;
}

.post-content code {
	background: #f5f5f5;
	border: 1px solid rgba(0,0,0,.1);
	border-radius: 2px;
	padding: 0.1em 0.35em;
	font-size: 0.875em;
}

.post-content pre code { background: none; border: none; padding: 0; font-size: inherit; }

.post-content img { border-radius: 3px; margin-left: auto; margin-right: auto; }

.post-content table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
	display: block;
	overflow-x: auto;
}
.post-content th,
.post-content td {
	text-align: left;
	padding: 0.5em 0.75em;
	border: 1px solid rgba(0,0,0,.1);
}
.post-content th { font-weight: 600; background: #f9f9f9; }

/* ── More articles ── */

.more-articles {
	margin-top: var(--sp-2xl);
	padding-top: var(--sp-lg);
	border-top: 1px solid var(--border);
}

.more-articles-heading {
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.09em;
	color: var(--gray);
	margin-bottom: var(--sp-md);
}

.more-articles-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--sp-md) var(--sp);
	list-style: none;
}

.more-article-thumb {
	aspect-ratio: 4/3;
	overflow: hidden;
	border-radius: 3px;
	margin-bottom: 0.5em;
	background: #f0f0f0;
	display: block;
}
.more-article-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.more-article-title {
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.3;
	margin-bottom: 0.2em;
}
.more-article-title a { color: var(--dark); text-decoration: none; }
.more-article-title a:hover { color: var(--accent); }

.more-article-meta { font-size: 0.75rem; color: var(--gray); }

/* ── Static page ── */

.page-header { padding: var(--sp-lg) 0 var(--sp-md); }
.page-title { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 600; line-height: 1.15; }

/* ── 404 ── */

.not-found { text-align: center; padding: var(--sp-2xl) 0; }
.not-found h1 { font-size: clamp(4rem, 15vw, 7rem); font-weight: 700; color: #ddd; line-height: 1; margin-bottom: 0.4em; }
.not-found p { color: var(--gray); margin-bottom: 1.25em; }

/* ── No results ── */

.no-results { color: var(--gray); font-size: 0.95rem; }

/* ── Footer ── */

.site-footer {
	border-top: 1px solid var(--border);
	margin-top: var(--sp-2xl);
}
.site-footer .container {
	padding-top: var(--sp-2xl);
	padding-bottom: var(--sp-2xl);
	text-align: center;
	font-size: 0.875rem;
	color: var(--gray);
}

/* ── Responsive ── */

@media (max-width: 680px) {
	/* show hamburger, hide inline nav */
	.nav-primary { display: none; }
	.nav-toggle  { display: flex; align-items: center; }

	.post-list-title { font-size: 1.15rem; }

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

@media (max-width: 440px) {
	.post-list-thumb { width: 72px; height: 72px; }

	.more-articles-grid { grid-template-columns: 1fr; }
}
