* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	font-family: "Roboto", sans-serif;
}

html,
body {
	width: 100%;
	max-width: 100%;
	overflow-x: hidden;
	min-height: 100vh;
}

body {
	display: flex;
	flex-direction: column;
}

main {
	flex: 1;
	display: flex;
	justify-content: flex-start;
	align-items: center;
	overflow-y: auto;
	overflow-x: hidden;
	flex-direction: column;
	padding-top: 5vh;
}

.hidden {
	display: none !important;
}

header > button {
	margin: 0;
}

/* ─── Footer ──────────────────────────────────────────────── */

footer {
	padding: 12px 0;
	background-color: #0a0a0a;
	color: #aaa;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.8rem;
	width: 100%;
	margin-top: auto;
}

/* ─── Login notification ──────────────────────────────────── */

#login-notification {
	position: fixed;
	top: 20px;
	left: 50%;
	transform: translateX(-50%);
	background: linear-gradient(135deg, #be0000, #c44800);
	color: #fff;
	padding: 16px 32px;
	border-radius: 12px;
	font-size: 1.1rem;
	font-weight: 500;
	box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
	z-index: 1000;
	backdrop-filter: blur(4px);
	animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(-20px);
	}
	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

/* ─── Home / Category / Search Layout ─────────────────────── */

.home-layout,
.category-layout {
	display: flex;
	flex-direction: row;
	gap: 30px;
	width: 85%;
	max-width: 1200px;
	margin: 20px auto;
	align-items: flex-start;
}

.content-area {
	flex: 1;
	min-width: 0;
}

.sidebar {
	width: 260px;
	flex-shrink: 0;
}

.sidebar h3 {
	margin-bottom: 8px;
	padding-bottom: 6px;
	border-bottom: 2px solid #e8e8e8;
	font-size: 1rem;
	color: #333;
}

.sidebar h3:first-of-type {
	border-bottom: none;
	padding-bottom: 0;
}

.sidebar > * + * {
	margin-top: 18px;
}

.sidebar-mascot {
	width: 100%;
	max-width: 180px;
	display: block;
	margin: 18px auto 0;
	border-radius: 10px;
	image-rendering: auto;
}

.search-form {
	display: flex;
	gap: 6px;
	margin-bottom: 20px;
}

.search-form input {
	flex: 1;
	padding: 6px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 0.9rem;
}

.search-form button {
	padding: 6px 14px;
	background: #1a73e8;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.9rem;
}

.category-list {
	list-style: none;
	padding: 0;
}

.category-list li {
	margin-bottom: 4px;
}

.category-list a {
	text-decoration: none;
	color: #1a73e8;
	font-size: 0.9rem;
}

.category-list a:hover {
	text-decoration: underline;
}

/* ─── Intro Section ───────────────────────────────────────── */

#intro-section {
	margin-bottom: 30px;
	padding: 32px 0 24px;
	border-bottom: 1px solid #eee;
}

#intro-section p {
	font-size: 1.15rem;
	line-height: 1.7;
	color: #333;
	max-width: 700px;
}

#intro-section h1,
#intro-section h2,
#intro-section h3 {
	color: #111;
	margin-bottom: 10px;
}

/* ─── Post Cards ──────────────────────────────────────────── */

.post-card {
	display: flex;
	gap: 20px;
	border: 1px solid #e0e0e0;
	border-radius: 10px;
	padding: 20px;
	margin-bottom: 20px;
	background: #fff;
	transition:
		box-shadow 0.15s,
		border-color 0.15s;
}

.post-card:hover {
	box-shadow: 0 3px 16px rgba(0, 0, 0, 0.1);
	border-color: #ccc;
}

.post-card-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transform-origin: center;
}

/* Whole image visible inside the frame, no cropping */
.post-card-image.fit-zoom,
.post-list-image.fit-zoom {
	object-fit: contain;
	transform: none;
	background: #f0f0f0;
}

/* Fixed-size frame: always the same size, image zooms inside */
.post-card-image-zoom {
	display: inline-block;
	width: 140px;
	height: 100px;
	overflow: hidden;
	border-radius: 4px;
	flex-shrink: 0;
}

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

.post-card-body h2 {
	font-size: 1.2rem;
	margin-bottom: 6px;
}

.post-card-body h2 a {
	text-decoration: none;
	color: #111;
}

.post-card-body h2 a:hover {
	color: #1a73e8;
	text-decoration: underline;
}

.post-card-body .read-more {
	display: inline-block;
	margin-top: 6px;
	color: #1a73e8;
	font-size: 0.85rem;
	font-weight: 500;
	text-decoration: none;
}

.post-card-body .read-more:hover {
	text-decoration: underline;
}

.post-card-body p {
	color: #555;
	font-size: 0.9rem;
	line-height: 1.5;
	margin-top: 6px;
}

.post-card-meta {
	font-size: 0.8rem;
	color: #888;
	display: flex;
	gap: 14px;
	margin-bottom: 6px;
}

.post-card-categories {
	margin-bottom: 4px;
}

#latest-posts h2 {
	margin-bottom: 16px;
	font-size: 1.3rem;
}

/* ─── Category Badges ─────────────────────────────────────── */

.category-badge {
	display: inline-block;
	padding: 1px 8px;
	border-radius: 10px;
	font-size: 0.75rem;
	font-weight: 600;
	margin-right: 4px;
	text-transform: capitalize;
}

/* Category badge colors are generated dynamically in head.ejs */

/* ─── Single Post ─────────────────────────────────────────── */

.post-layout {
	display: flex;
	flex-direction: row;
	gap: 30px;
	width: 95%;
	max-width: 1600px;
	margin: 20px auto;
	align-items: flex-start;
}

.post-container {
	flex: 1;
	min-width: 0;
	padding: 20px 0;
}

.post-container h1 {
	font-size: 2rem;
	margin-bottom: 8px;
}

.post-meta {
	font-size: 0.85rem;
	color: #777;
	display: flex;
	gap: 16px;
	margin-bottom: 8px;
}

.post-categories {
	margin-bottom: 20px;
}

.post-list-image {
	width: 100%;
	max-width: 100%;
	height: auto;
	display: block;
	transform-origin: center;
}

/* Full-width frame under post title: fixed natural height, image zooms inside */
.post-list-image-zoom {
	display: block;
	overflow: hidden;
	border-radius: 8px;
	margin-bottom: 20px;
}

.post-body {
	font-size: 1.05rem;
	line-height: 1.8;
	color: #222;
}

.post-body img {
	max-width: 100%;
	border-radius: 6px;
}

/* Matches TinyMCE content_style so editor and final post look identical */
.post-body blockquote {
	border-left: 4px solid #1a73e8;
	margin: 1em 0;
	padding: 0.5em 1em;
	background: #f5f7fa;
	font-style: italic;
}

.post-body pre {
	background: #f5f5f5;
	padding: 12px;
	border-radius: 6px;
	overflow-x: auto;
}

.post-body code {
	background: #f0f0f0;
	padding: 2px 4px;
	border-radius: 3px;
	font-family: "SF Mono", "Cascadia Code", ui-monospace, monospace;
	font-size: 0.9em;
}

.post-body pre code {
	background: none;
	padding: 0;
}

.post-body ul,
.post-body ol {
	margin: 0.8em 0;
	padding-left: 2em;
}

.post-body li {
	margin-bottom: 0.25em;
}

.post-body hr {
	border: none;
	border-top: 2px solid #ddd;
	margin: 1.5em 0;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
	margin: 1.2em 0 0.5em;
	color: #111;
	line-height: 1.3;
}

.post-body a {
	color: #1a73e8;
	text-decoration: none;
}

.post-body a:hover {
	text-decoration: underline;
}

.post-body table {
	border-collapse: collapse;
	margin: 1em 0;
	width: 100%;
}

.post-body table td,
.post-body table th {
	border: 1px solid #ddd;
	padding: 6px 10px;
}

.post-body table th {
	background: #f5f5f5;
}

.post-body img[style*="float"] {
	margin: 0.5em 1em 0.5em 0;
}

/* ─── Comments ────────────────────────────────────────────── */

#comments-section {
	margin-top: 50px;
	padding-top: 24px;
	border-top: 1px solid #ddd;
}

#comments-section h2,
#comments-section h3 {
	margin-bottom: 12px;
}

.comment {
	border-bottom: 1px solid #eee;
	padding: 14px 0;
}

.comment-header {
	display: flex;
	gap: 12px;
	align-items: center;
	margin-bottom: 4px;
	font-size: 0.85rem;
}

.comment-header span {
	color: #999;
}

.author-badge {
	display: inline-block;
	padding: 1px 8px;
	border-radius: 10px;
	font-size: 0.7rem;
	font-weight: 700;
	background: #1a73e8;
	color: #fff !important;
	margin-left: 4px;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}

.comment p {
	font-size: 0.95rem;
	color: #333;
	line-height: 1.5;
}

#comment-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 16px;
}

#comment-form input,
#comment-form textarea {
	padding: 8px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 0.9rem;
}

#comment-form textarea {
	min-height: 80px;
	resize: vertical;
}

#comment-form button {
	align-self: flex-start;
	padding: 8px 20px;
	background: #1a73e8;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.9rem;
}

/* ─── Load More Button ────────────────────────────────────── */

.btn-load-more {
	display: block;
	margin: 20px auto;
	padding: 8px 24px;
	background: transparent;
	color: #1a73e8;
	border: 1px solid #1a73e8;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.95rem;
}

.btn-load-more:hover {
	background: #1a73e8;
	color: #fff;
}

/* ─── Mobile Responsive ───────────────────────────────────── */

@media (max-width: 768px) {
	html,
	body {
		width: 100%;
		overflow-x: hidden;
	}
	main {
		padding-top: 0;
	}

	/* Two-column layouts stack */
	.home-layout,
	.category-layout,
	.post-layout {
		flex-direction: column;
		width: 95%;
		gap: 16px;
		margin: 12px auto;
	}

	.content-area {
		width: 100%;
	}
	.post-container {
		width: 100%;
		padding: 10px 0;
	}
	.post-container h1 {
		font-size: 1.5rem;
	}

	/* Sidebar goes full width below content */
	.sidebar {
		width: 100%;
		margin-top: 24px;
		padding: 16px;
		border-top: 1px solid #eee;
	}
	.sidebar h3 {
		font-size: 0.95rem;
	}

	/* Post cards stack image above text */
	.post-card {
		flex-direction: column;
	}
	.post-card-image {
		width: 100%;
		height: 200px;
	}
	.post-card-image-zoom {
		width: 100%;
		height: 200px;
	}

	/* Intro section tighter */
	#intro-section {
		padding: 16px 0 12px;
	}
	#intro-section p {
		font-size: 1rem;
	}

	/* Comments form full width */
	#comment-form input[type="text"],
	#comment-form input[type="number"],
	#comment-form textarea {
		width: 100%;
		box-sizing: border-box;
	}
	#comment-name-row {
		flex-direction: column;
		gap: 6px;
	}

	/* Admin tables scrollable */
	.posts-table,
	.users-table,
	.cat-table {
		display: block;
		overflow-x: auto;
		white-space: nowrap;
	}

	/* Admin dashboard */
	.admin-layout {
		width: 96%;
		padding: 12px 0;
	}
	.admin-topbar {
		flex-direction: column;
		align-items: flex-start;
	}
	.stats-row {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px;
	}
	.stat-card {
		padding: 12px 14px;
	}
	.stat-card .stat-value {
		font-size: 1.3rem;
	}
	.nav-pills {
		gap: 4px;
		flex-wrap: wrap;
	}
	.nav-pills a,
	.nav-pills button {
		padding: 5px 10px;
		font-size: 0.8rem;
	}

	/* Editor */
	.editor-layout {
		width: 95%;
	}
	.editor-meta-row {
		flex-direction: column;
		gap: 0;
	}

	/* Categories page */
	.cat-layout {
		width: 95%;
	}
	.perm-grid {
		grid-template-columns: 1fr;
	}
	.form-row {
		flex-direction: column;
	}
	.create-cat-form .form-row input,
	.create-cat-form .form-row select {
		width: 100%;
	}

	/* Users page */
	.users-layout {
		width: 95%;
	}
	.create-user-form .form-row {
		flex-direction: column;
	}
	.create-user-form .form-row input,
	.create-user-form .form-row select {
		width: 100%;
	}

	/* Gallery */
	.gallery-layout {
		width: 95%;
	}
	.gallery-grid {
		grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
	}

	/* Load more button */
	.btn-load-more {
		width: 90%;
	}

	/* Category list 2 per row on mobile */
	.category-list {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 6px 12px;
	}
}
