:root {
	--font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--bg-body: #f9fafb;
	--bg-surface: #ffffff;
	--text-main: #1f2937;
	--text-muted: #6b7280;
	--primary: #2563eb;
	--primary-hover: #1d4ed8;
	--border: #e5e7eb;
	--header-height: 72px;
	--container-width: 1200px;
}

[data-theme="dark"] {
	--bg-body: #111827;
	--bg-surface: #1f2937;
	--text-main: #f3f4f6;
	--text-muted: #9ca3af;
	--primary: #60a5fa;
	--primary-hover: #93c5fd;
	--border: #374151;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-main); background: var(--bg-body); color: var(--text-main); line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: var(--container-width); margin: 0 auto; padding: 0 1.5rem; }
.screen-reader-text { clip: rect(1px, 1px, 1px, 1px); height: 1px; width: 1px; overflow: hidden; position: absolute; }

/* -------------------------------------------
   HEADER & NAVIGATION
------------------------------------------- */
.site-header {
	background: var(--bg-surface);
	border-bottom: 1px solid var(--border);
	height: var(--header-height);
	position: sticky;
	top: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
}
.header-inner { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.site-title { font-size: 1.25rem; font-weight: 800; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { display: flex; align-items: center; gap: 2rem; }

/* Menus & Dropdowns */
.main-navigation ul { list-style: none; display: flex; gap: 1.5rem; margin: 0; padding: 0; }
.main-navigation li { position: relative; }
.main-navigation a { font-weight: 500; font-size: 0.95rem; display: block; padding: 0.5rem 0; }
.main-navigation a:hover { color: var(--primary); }

/* Dropdown Sub-menus */
.main-navigation ul ul {
	display: none; /* Hidden by default */
	position: absolute;
	top: 100%;
	left: 0;
	background: var(--bg-surface);
	border: 1px solid var(--border);
	min-width: 200px;
	flex-direction: column;
	gap: 0;
	box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
	border-radius: 8px;
	padding: 0.5rem 0;
	z-index: 999;
}
.main-navigation li:hover > ul,
.main-navigation li:focus-within > ul {
	display: flex; /* Show on hover/focus */
}
.main-navigation ul ul a { padding: 0.5rem 1rem; width: 100%; }
.main-navigation ul ul a:hover { background: var(--bg-body); }

/* Header Tools (Search + Theme) */
.header-tools { display: flex; align-items: center; gap: 1rem; }

/* Search Bar styling */
.search-form .search-group { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 99px; padding: 0.25rem 0.5rem 0.25rem 1rem; background: var(--bg-body); transition: border-color 0.2s; }
.search-form .search-group:focus-within { border-color: var(--primary); }
.search-field { border: none; background: transparent; color: var(--text-main); outline: none; font-size: 0.9rem; width: 140px; }
.search-submit { background: none; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; }
.search-submit:hover { color: var(--primary); }

/* Theme Toggle Icons */
.theme-toggle { background: none; border: none; color: var(--text-main); cursor: pointer; padding: 0.5rem; display: flex; align-items: center; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }

/* Mobile Menu Toggle */
.menu-toggle { display: none; background: none; border: none; color: var(--text-main); cursor: pointer; }

/* -------------------------------------------
   HERO SECTION
------------------------------------------- */
.hero-section {
	background: var(--bg-surface);
	border-bottom: 1px solid var(--border);
	padding: 5rem 0;
	text-align: center;
	margin-bottom: 3rem;
}
.hero-title { font-size: clamp(2rem, 5vw, 3.5rem); margin-bottom: 1rem; line-height: 1.1; }
.hero-desc { font-size: 1.25rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 2rem; }
.hero-section .search-form { max-width: 400px; margin: 0 auto; }
.hero-section .search-group { background: var(--bg-surface); border-color: var(--border); height: 50px; }
.hero-section .search-field { width: 100%; }

/* -------------------------------------------
   POST GRID (OVERLAY STYLE)
------------------------------------------- */
.post-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 2rem;
	margin-bottom: 3rem;
}

.post-grid article {
	position: relative;
	border-radius: 12px;
	overflow: hidden;
	aspect-ratio: 3/4; /* Standard Portrait Card */
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	background: #000;
	box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
	transition: transform 0.3s ease;
}
.post-grid article:hover { transform: translateY(-5px); }

/* --- New Click Overlay --- */
.card-overlay-link {
	position: absolute;
	inset: 0;
	z-index: 10; /* Sits on top of everything */
	cursor: pointer;
}

/* Thumbnail */
.post-grid .post-thumbnail { 
	position: absolute; 
	inset: 0; 
	z-index: 1; 
	height: 100%; 
	width: 100%; 
	margin: 0; 
}
.post-grid .post-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.post-grid article:hover .post-thumbnail img { transform: scale(1.05); }

/* Gradient Overlay */
.post-grid .post-thumbnail::after {
	content: ""; position: absolute; inset: 0; z-index: 2;
	background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0) 100%);
}

/* Card Content */
.card-content { 
	position: relative; 
	z-index: 5; /* Above background, but below overlay link (z-index 10) if you want whole card click. */
	/* Note: If content is z-index 5 and overlay is 10, overlay wins. 
	   You can't select text, but click works 100%. */
	padding: 1.5rem; 
	width: 100%; 
	pointer-events: none; /* Passes clicks through to the link if z-index order is different */
}

.post-grid .entry-title {
	color: #fff; font-size: 1.5rem; line-height: 1.3; margin-bottom: 0.5rem;
	text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.post-grid .entry-meta { display: none; }

/* -------------------------------------------
   SINGLE POST & CONTENT
------------------------------------------- */
.site-content { padding: 3rem 0; }
.single .entry-header { text-align: center; max-width: 800px; margin: 0 auto 3rem; }
.single .entry-title { line-height: 1.2; margin-bottom: 1rem; }

/* Content Links Styling */
.entry-content { max-width: 740px; margin: 0 auto; font-size: 1.15rem; }
.entry-content a {
	color: var(--text-main);
	border-bottom: 2px solid var(--primary); /* Thick underline */
	transition: background 0.2s;
}
.entry-content a:hover { background: rgba(37, 99, 235, 0.1); }
.entry-content > * + * { margin-top: 1.75rem; }

/* Author Box Responsive */
.author-box {
	background: var(--bg-surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 2rem;
	margin-top: 4rem;
	display: flex;
	gap: 1.5rem;
	align-items: center;
}
@media (max-width: 600px) {
	.author-box { flex-direction: column; text-align: center; }
}
.author-avatar img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }

/* -------------------------------------------
   PAGINATION
------------------------------------------- */
.pagination { display: flex; justify-content: center; gap: 0.5rem; margin-top: 4rem; }
.pagination .page-numbers {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px; /* Fixed square size */
	height: 44px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--bg-surface);
	color: var(--text-main);
	font-weight: 600;
	font-size: 1rem;
	transition: all 0.2s;
}
.pagination .current, .pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* -------------------------------------------
   RELATED POSTS
------------------------------------------- */
.related-posts-section { margin-top: 4rem; padding-top: 3rem; border-top: 1px solid var(--border); }
.related-title { font-size: 1.5rem; margin-bottom: 2rem; }

/* -------------------------------------------
   FOOTER
------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); margin-top: auto; padding: 3rem 0; background: var(--bg-surface); }
.footer-navigation ul {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	list-style: none; /* No bullets */
	gap: 2rem;
	padding: 0;
	margin-bottom: 2rem;
}
.footer-navigation a {
	color: var(--text-muted);
	font-weight: 500;
}
.footer-navigation a:hover { color: var(--primary); }
.site-info { text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* -------------------------------------------
   MOBILE RESPONSIVE
------------------------------------------- */
@media (max-width: 900px) {
	.menu-toggle { display: block; }
	.main-navigation {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: var(--bg-surface);
		padding: 1rem;
		border-bottom: 1px solid var(--border);
		box-shadow: 0 10px 15px rgba(0,0,0,0.1);
	}
	.main-navigation.toggled { display: block; }
	.main-navigation ul { flex-direction: column; gap: 0; }
	.main-navigation a { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
	
	.header-right { gap: 1rem; }
	.search-field { width: 100px; } /* Smaller search on mobile */
	.post-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
	.container { padding: 0 1rem; } /* Tighter padding for small screens */
	.hero-section { padding: 3rem 0; } /* Reduce hero padding */
	.header-right { gap: 0.5rem; } /* Reduce header gap */
	.search-field { width: 70px; } /* Shrink search further */
	.post-grid { grid-template-columns: 1fr; } /* 1 Column for Mobile */
	.site-title { font-size: 1.1rem; }
}