/*
Theme Name: Custom Theme
Theme URI: https://theregoesdat.com
Author: Dat Vo
Author URI: https://theregoesdat.com
Description: A clean, minimal blog theme for personal writing and storytelling.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: custom-theme
Tags: blog, personal, minimal, clean, responsive
*/

/* ===== RESET & BASE ===== */
*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root {
	/* Palette */
	--color-bg:       #EFF5F8;
	--color-surface:  #ffffff;
	--color-white:    #ffffff;
	--color-text:     #1C2B30;
	--color-muted:    #7a8f96;
	--color-accent:   #4A8FA8;
	--color-border:   #ccdde6;

	/* Category tile colours */
	--color-tile-1:   #FFCC53;   /* golden sun */
	--color-tile-2:   #4A8FA8;   /* ocean blue */
	--color-tile-3:   #0D3B4F;   /* deep ocean */

	/* Footer */
	--color-footer-bg: #1E3D58;

	/* Typography */
	--font-display: 'Playfair Display', Georgia, serif;
	--font-body:    'Manrope', system-ui, -apple-system, sans-serif;

	/* Sizes */
	--text-xs:   0.75rem;
	--text-sm:   0.875rem;
	--text-base: 1rem;
	--text-lg:   1.125rem;
	--text-xl:   1.25rem;
	--text-2xl:  1.5rem;
	--text-3xl:  2rem;
	--text-4xl:  2.75rem;
	--text-5xl:  3.5rem;
	--text-hero: clamp(3rem, 8vw, 6rem);

	/* Spacing */
	--sp-2: 0.5rem;
	--sp-3: 0.75rem;
	--sp-4: 1rem;
	--sp-6: 1.5rem;
	--sp-8: 2rem;
	--sp-12: 3rem;
	--sp-16: 4rem;
	--sp-20: 5rem;
	--sp-24: 6rem;

	/* Layout */
	--container:      1200px;
	--content-width:  720px;
	--header-height:  68px;

	--radius-sm: 3px;
	--radius-md: 6px;
}

html {
	scroll-padding-top: calc(var(--header-height) + 1.5rem);
	font-size: 16px;
	scroll-behavior: smooth;
}

body {
	background-color: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: var(--text-base);
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

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

a {
	color: inherit;
	text-decoration: none;
	transition: opacity 0.2s ease;
}

a:hover {
	opacity: 0.7;
}

/* ===== SITE SHELL ===== */
.site {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.container {
	width: 100%;
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 var(--sp-6);
}

/* ===== HEADER ===== */
.admin-bar .site-header { top: 32px; }
@media screen and (max-width: 782px) {
	.admin-bar .site-header { top: 46px; }
}

.site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 200;
	height: var(--header-height);
	background: transparent;
	transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
	border-bottom: 1px solid transparent;
}

.site-header.scrolled {
	background: var(--color-bg);
	border-bottom-color: transparent;
	box-shadow: none;
}

/* Non-homepage: always solid */
body:not(.home) .site-header {
	background: var(--color-bg);
	border-bottom-color: transparent;
	box-shadow: none;
	position: sticky;
}

.site-header .container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 100%;
}

.site-branding .site-title {
	font-family: var(--font-display);
	font-size: var(--text-2xl);
	font-weight: 400;
	letter-spacing: 0.01em;
	line-height: 1;
}

.site-branding .site-title a {
	color: var(--color-text);
}

.home .site-header:not(.scrolled) .site-branding .site-title a {
	color: var(--color-white);
}

.site-description {
	display: none;
}

/* ===== NAVIGATION ===== */
.main-navigation {
	display: flex;
	align-items: center;
}

.main-navigation ul {
	list-style: none;
	display: flex;
	align-items: center;
	gap: var(--sp-8);
}

.main-navigation a {
	font-size: var(--text-xs);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--color-text);
	opacity: 0.85;
}

.main-navigation a:hover {
	opacity: 1;
}

.home .site-header:not(.scrolled) .main-navigation a {
	color: var(--color-white);
}

.menu-toggle {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	padding: var(--sp-2);
	color: var(--color-text);
}

.home .site-header:not(.scrolled) .menu-toggle {
	color: var(--color-white);
}

.menu-toggle .bar {
	display: block;
	width: 22px;
	height: 1.5px;
	background-color: currentColor;
	margin: 5px 0;
	transition: all 0.2s ease;
}

/* ===== HEADER SOCIAL ICONS ===== */
.header-social {
	display: flex;
	align-items: center;
	gap: var(--sp-4);
	margin-left: var(--sp-6);
}

.header-social-link {
	display: flex;
	align-items: center;
	color: var(--color-text);
	opacity: 0.7;
	transition: opacity 0.15s ease;
}

.header-social-link:hover {
	opacity: 1;
}

.header-social-link svg {
	width: 18px;
	height: 18px;
}

.home .site-header:not(.scrolled) .header-social-link {
	color: var(--color-white);
}

/* ===== HERO (homepage only) ===== */
.home-hero {
	position: relative;
	height: 100vh;
	min-height: 500px;
	background-color: #8a7a6a;
	background-size: cover;
	background-position: center;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}

.hero-content {
	transform: translateY(-60px);
}

.home-hero::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to bottom,
		rgba(0,0,0,0.18) 0%,
		rgba(0,0,0,0.05) 40%,
		rgba(0,0,0,0.25) 100%
	);
}

.hero-content {
	position: relative;
	z-index: 1;
	padding: 0 var(--sp-6);
}

.hero-site-title {
	font-family: var(--font-display);
	font-size: var(--text-hero);
	font-weight: 300;
	letter-spacing: 0.04em;
	color: var(--color-white);
	line-height: 1.1;
}

.hero-site-title a {
	color: inherit;
}

.hero-tagline {
	margin-top: var(--sp-4);
	font-size: var(--text-sm);
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: rgba(255,255,255,0.8);
}


/* ===== INTRO SECTION ===== */
.home-intro {
	padding: var(--sp-20) var(--sp-6);
	text-align: center;
	background: #ffffff;
}

.intro-inner {
	max-width: 660px;
	margin: 0 auto;
}

.intro-hey {
	font-family: var(--font-display);
	font-size: clamp(1.5rem, 3vw, 2rem);
	font-weight: 500;
	line-height: 1.3;
	color: var(--color-text);
	margin-bottom: var(--sp-4);
}

.intro-text {
	font-family: var(--font-body);
	font-size: clamp(1.1rem, 2vw, 1.35rem);
	font-weight: 400;
	line-height: 1.75;
	color: var(--color-muted);
	text-wrap: pretty;
}

.intro-tagline {
	margin-top: var(--sp-4);
	font-family: var(--font-display);
	font-size: var(--text-lg);
	font-style: italic;
	color: var(--color-muted);
}

/* ===== CATEGORY TILES ===== */
.home-categories {
	background: #ffffff;
	padding: var(--sp-20) 0;
}

.home-categories-inner {
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 var(--sp-6);
}

.categories-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}

.category-tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: var(--sp-16) var(--sp-6);
	min-height: 400px;
	text-decoration: none;
	position: relative;
	overflow: hidden;
	cursor: pointer;
	transition: filter 0.3s ease;
}

.category-tile:hover {
	filter: brightness(0.92);
	opacity: 1;
}

.cat-tile-1 { background-color: var(--color-tile-1); }
.cat-tile-2 { background-color: var(--color-tile-2); }
.cat-tile-3 { background-color: var(--color-tile-3); }

.tile-name {
	font-family: var(--font-display);
	font-size: var(--text-4xl);
	font-weight: 400;
	color: #ffffff;
	letter-spacing: 0.02em;
	line-height: 1;
	position: relative;
	z-index: 1;
}

.tile-browse {
	margin-top: var(--sp-3);
	font-size: var(--text-xs);
	font-weight: 500;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: #FFCC53;
	position: relative;
	z-index: 1;
}

/* ===== HOME POSTS GRID ===== */
.home-posts {
	padding: var(--sp-20) 0;
	background: var(--color-bg);
}

.home-posts-inner {
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 var(--sp-6);
}

.section-title {
	font-family: var(--font-display);
	font-size: var(--text-3xl);
	font-weight: 400;
	letter-spacing: 0.02em;
	margin-bottom: var(--sp-12);
	color: var(--color-text);
}

.posts-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--sp-6);
	align-items: stretch;
}

.post-card {
	display: flex;
	flex-direction: column;
}

.post-card-image {
	display: block;
	overflow: hidden;
	width: 100%;
	aspect-ratio: 4 / 3;
	margin-bottom: var(--sp-4);
}

.post-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	transition: transform 0.5s ease;
}

.post-card:hover .post-card-image img {
	transform: scale(1.04);
}

.post-card-body {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.post-card-cat {
	display: block;
	font-size: var(--text-xs);
	font-weight: 500;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	color: var(--color-muted);
	margin-bottom: var(--sp-2);
}

.post-card-title {
	font-family: var(--font-display);
	font-size: var(--text-2xl);
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: 0.01em;
	margin-bottom: var(--sp-3);
}

.post-card-title a {
	color: var(--color-text);
	text-decoration: none;
}

.post-card-excerpt {
	font-size: var(--text-sm);
	color: var(--color-muted);
	line-height: 1.6;
	margin-bottom: var(--sp-3);
}

.post-card-read {
	font-size: var(--text-sm);
	font-weight: 500;
	letter-spacing: 0.03em;
	color: var(--color-text);
	display: inline-flex;
	align-items: center;
	gap: 4px;
	transition: gap 0.2s ease;
	margin-top: auto;
}

.post-card:hover .post-card-read {
	gap: 8px;
	opacity: 1;
}

/* ===== SITE CONTENT (non-homepage) ===== */
.site-content {
	flex: 1;
	padding: var(--sp-16) 0;
}

/* Homepage hero starts at top-of-viewport under fixed transparent header */
.home .site-content {
	padding: 0;
}

.content-area {
	display: grid;
	grid-template-columns: 1fr 260px;
	gap: var(--sp-12);
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 var(--sp-6);
}

.content-area.no-sidebar {
	grid-template-columns: 1fr;
	max-width: var(--content-width);
}

/* ===== BLOG POST CARDS (archive/index) ===== */
.post {
	margin-bottom: var(--sp-12);
	padding-bottom: var(--sp-12);
	border-bottom: 1px solid var(--color-border);
}

.post:last-of-type {
	border-bottom: none;
}

.post-header {
	margin-bottom: var(--sp-4);
}

.post-title {
	font-family: var(--font-display);
	font-size: var(--text-5xl);
	font-weight: 400;
	line-height: 1.15;
	letter-spacing: 0.01em;
	margin-bottom: var(--sp-3);
}

.post-title a {
	color: var(--color-text);
}

.post-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--sp-3);
	font-size: var(--text-xs);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-muted);
}

.post-meta a { color: var(--color-muted); }
.post-meta .sep { color: var(--color-border); }

.post-thumbnail {
	margin-bottom: var(--sp-6);
	overflow: hidden;
}

.post-thumbnail img {
	width: 100%;
	height: 280px;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.post-thumbnail img:hover {
	transform: scale(1.02);
}

.post-content {
	font-family: var(--font-body);
	font-size: var(--text-base);
	line-height: 1.85;
}

.post-content p { margin-bottom: var(--sp-4); }

.post-content img,
.post-content figure,
.post-content .wp-block-image {
	margin-bottom: var(--sp-4);
}

/* Remove bottom margin from img when it's inside a figure — the figure carries the spacing */
.post-content figure img,
.post-content .wp-block-image img {
	margin-bottom: 0;
}

/* Suppress empty paragraphs the block editor inserts between list items */
.post-content p:empty { display: none; margin: 0; }
.post-content li > p:only-child { margin-bottom: 0; }

/* Consistent list item spacing */
.post-content li { margin-bottom: var(--sp-2); }

/* Hide empty nested lists that TOC plugins insert (causes uneven gaps) */
.post-content li > ul:empty,
.post-content li > ol:empty { display: none; }

/* Rank Math TOC block — hide heading */
.wp-block-rank-math-toc-block h2,
.wp-block-rank-math-toc-block h3,
.rank-math-toc h2,
.rank-math-toc h3,
.rank-math-toc .title {
	display: none !important;
}

/* Rank Math TOC block — normalize spacing */
.wp-block-rank-math-toc-block li,
.rank-math-toc li,
[class*="toc"] li {
	margin-bottom: var(--sp-2) !important;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

.wp-block-rank-math-toc-block p,
.wp-block-rank-math-toc-block br,
.rank-math-toc p,
.rank-math-toc br {
	display: none !important;
	margin: 0 !important;
}

.wp-block-rank-math-toc-block,
.rank-math-toc {
	border: none !important;
	padding-bottom: 0 !important;
	margin-bottom: 0 !important;
}

.wp-block-rank-math-toc-block *,
.rank-math-toc * {
	border: none !important;
}

.wp-block-rank-math-toc-block + hr,
.rank-math-toc + hr {
	display: none !important;
}

.post-content hr {
	display: none;
}

.post-content .wp-block-table,
.post-content figure.wp-block-table {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: none !important;
}

.post-content .wp-block-table table *,
.post-content table * {
	border-color: var(--color-text) !important;
}

.post-content .wp-block-table tbody,
.post-content .wp-block-table thead,
.post-content .wp-block-table tfoot,
.post-content .wp-block-table tr,
.post-content tbody,
.post-content thead,
.post-content tfoot,
.post-content tr {
	border: none !important;
}

.post-content table,
.post-content .wp-block-table table {
	width: 100%;
	min-width: 480px;
	border-collapse: collapse;
	background: transparent;
	border-bottom: 2px solid var(--color-text) !important;
}

.post-content td,
.post-content th,
.post-content .wp-block-table td,
.post-content .wp-block-table th {
	border: none !important;
	padding: var(--sp-3) var(--sp-4);
	text-align: left;
	vertical-align: top;
	font-size: var(--text-sm);
}

.post-content td:first-child,
.post-content th:first-child,
.post-content .wp-block-table td:first-child,
.post-content .wp-block-table th:first-child {
	white-space: nowrap !important;
	min-width: 60px;
}

.post-content tbody tr:nth-child(odd) td,
.post-content tbody tr:nth-child(odd) th,
.post-content .wp-block-table tbody tr:nth-child(odd) td,
.post-content .wp-block-table tbody tr:nth-child(odd) th {
	background: #ffffff !important;
}

.post-content tbody tr:nth-child(even) td,
.post-content tbody tr:nth-child(even) th,
.post-content .wp-block-table tbody tr:nth-child(even) td,
.post-content .wp-block-table tbody tr:nth-child(even) th {
	background: var(--color-bg) !important;
}

.post-content thead th,
.post-content thead td,
.post-content .wp-block-table thead th,
.post-content .wp-block-table thead td {
	border-bottom: 2px solid var(--color-text) !important;
}

.post-content .wp-block-table {
	margin-bottom: var(--sp-6);
}


.post-content h2:not(.wp-block-post-title),
.post-content h3,
.post-content h4,
.post-content h5 {
	font-family: var(--font-display);
	font-weight: 500;
	line-height: 1.3;
	margin: var(--sp-8) 0 var(--sp-4);
	letter-spacing: 0.01em;
}

.post-content h2:not(.wp-block-post-title) {
	font-family: var(--font-display);
	font-size: var(--text-2xl);
	font-weight: 400;
	letter-spacing: 0.01em;
}
.post-content h3 {
	font-family: var(--font-body);
	font-size: var(--text-base);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}
.post-content h4 { font-size: var(--text-base); }

.post-content ul, .post-content ol {
	padding-left: var(--sp-6);
	margin-bottom: var(--sp-4);
}

.post-content li { margin-bottom: var(--sp-2); }

.post-content blockquote {
	border-left: 2px solid var(--color-tile-1);
	padding-left: var(--sp-6);
	margin: var(--sp-8) 0;
	color: var(--color-muted);
	font-style: italic;
	font-size: var(--text-xl);
}

.post-content pre {
	background: #1c1c1a;
	color: #e8e4de;
	padding: var(--sp-6);
	border-radius: var(--radius-md);
	overflow-x: auto;
	font-size: var(--text-sm);
	margin-bottom: var(--sp-4);
	font-family: 'Fira Code', 'Consolas', monospace;
}

.post-content code {
	background: rgba(0,0,0,0.07);
	padding: 2px 6px;
	border-radius: 3px;
	font-size: 0.9em;
	font-family: 'Fira Code', 'Consolas', monospace;
}

.post-content pre code { background: none; padding: 0; }
.post-content a { text-decoration: underline; text-underline-offset: 3px; }

.post-content figcaption,
.post-content .wp-element-caption {
	text-align: center;
	font-size: var(--text-sm);
	color: var(--color-muted);
	margin-top: 4px;
}

.post-footer {
	margin-top: 0;
	padding-top: 0;
	border-top: none;
}

.post-tags {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-2);
}

.post-tags .tag {
	position: relative;
	display: inline-block;
	font-size: var(--text-xs);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--color-muted);
	padding: 4px 12px;
	white-space: nowrap;
	transition: color 0.15s ease;
}

.post-tags .tag::after {
	content: '';
	position: absolute;
	inset: 0 0;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 32' preserveAspectRatio='none'%3E%3Cellipse cx='50' cy='16' rx='48' ry='14' fill='none' stroke='%23a0b4bc' stroke-width='1.5'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
	pointer-events: none;
}

.post-tags .tag:hover {
	color: var(--color-text);
	opacity: 1;
}

.post-tags .tag:hover::after {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 32' preserveAspectRatio='none'%3E%3Cellipse cx='50' cy='16' rx='48' ry='14' fill='none' stroke='%231C2B30' stroke-width='1.5'/%3E%3C/svg%3E");
}

.read-more {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-top: var(--sp-4);
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--color-text);
	transition: gap 0.2s ease;
}

.read-more:hover { gap: 8px; opacity: 1; }

/* ===== SINGLE POST ===== */
.single .post {
	max-width: var(--content-width);
	margin: 0 auto;
	border-bottom: none;
	padding-bottom: 0;
}

.single .post-thumbnail img {
	height: 420px;
}

/* ===== PAGINATION ===== */
.pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: var(--sp-2);
	margin-top: var(--sp-12);
}

.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	font-size: var(--text-sm);
	color: var(--color-muted);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	transition: all 0.2s ease;
}

.pagination .page-numbers.current,
.pagination .page-numbers:hover {
	background: var(--color-text);
	border-color: var(--color-text);
	color: var(--color-white);
	opacity: 1;
}

.pagination .page-numbers.dots {
	border: none;
}

/* ===== SIDEBAR ===== */
.widget-area {
	position: sticky;
	top: calc(var(--header-height) + var(--sp-6));
	align-self: start;
}

.widget {
	margin-bottom: var(--sp-8);
}

.widget-title {
	font-size: var(--text-xs);
	font-weight: 600;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	color: var(--color-muted);
	margin-bottom: var(--sp-4);
	padding-bottom: var(--sp-3);
	border-bottom: 1px solid var(--color-border);
}

.widget ul { list-style: none; }

.widget ul li {
	padding: var(--sp-2) 0;
	border-bottom: 1px solid var(--color-border);
	font-size: var(--text-sm);
}

.widget ul li:last-child { border-bottom: none; }

/* ===== SEARCH ===== */
.search-form {
	display: flex;
	gap: var(--sp-2);
}

.search-field {
	flex: 1;
	padding: var(--sp-2) var(--sp-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	font-family: var(--font-body);
	background: var(--color-white);
	color: var(--color-text);
	transition: border-color 0.2s ease;
}

.search-field:focus {
	outline: none;
	border-color: var(--color-text);
}

.search-submit {
	padding: var(--sp-2) var(--sp-4);
	background: var(--color-text);
	color: var(--color-white);
	border: none;
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	font-family: var(--font-body);
	font-weight: 500;
	cursor: pointer;
}

/* ===== AUTHOR BOX ===== */
/* ===== RELATED POSTS ===== */
.related-posts {
	margin-top: var(--sp-8);
	padding-top: var(--sp-8);
	border-top: 1px solid var(--color-border);
}

.related-posts-title {
	font-family: var(--font-display);
	font-size: var(--text-3xl);
	font-weight: 400;
	margin-bottom: var(--sp-4);
}

.related-carousel {
	position: relative;
}

.carousel-track-wrap {
	overflow-x: scroll;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-ms-overflow-style: none;
	container-type: inline-size;
}

.carousel-track-wrap::-webkit-scrollbar {
	display: none;
}

.carousel-track {
	display: flex;
	gap: var(--sp-6);
}

.carousel-card {
	flex: 0 0 calc((100cqi - 2 * var(--sp-6)) / 3);
	min-width: 0;
}

.carousel-card .post-card-title {
	font-size: var(--text-base);
	font-weight: 400;
}

.carousel-card .post-card-image {
	aspect-ratio: 4 / 3;
}

.carousel-btn {
	position: absolute;
	top: 0; /* overridden by JS */
	width: 26px;
	height: 26px;
	border-radius: 50%;
	border: none;
	background: var(--color-text);
	color: var(--color-white);
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.15s ease;
	padding-bottom: 1px;
	z-index: 1;
}

.carousel-prev { left: -13px; }
.carousel-next { right: -13px; }

.carousel-btn:hover { opacity: 0.75; }

.author-box {
	display: flex;
	gap: var(--sp-6);
	padding: var(--sp-8) 0;
	border-top: 1px solid var(--color-border);
	border-bottom: 1px solid var(--color-border);
	margin: var(--sp-8) 0;
}

.author-box img { border-radius: 50%; flex-shrink: 0; }

.author-box-content .author-name {
	font-family: var(--font-display);
	font-size: var(--text-xl);
	font-weight: 500;
	margin-bottom: var(--sp-2);
}

.author-box-content .author-bio {
	font-size: var(--text-sm);
	color: var(--color-muted);
	line-height: 1.6;
}

/* ===== POST NAVIGATION ===== */
.post-navigation {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--sp-4);
	margin-top: var(--sp-8);
}

.post-navigation a {
	display: block;
	padding: var(--sp-4) 0;
	border-top: 1px solid var(--color-border);
}

.post-navigation a:hover { opacity: 0.6; }

.post-navigation .nav-subtitle {
	display: block;
	font-size: var(--text-xs);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--color-muted);
	margin-bottom: var(--sp-2);
}

.post-navigation .nav-title {
	font-family: var(--font-display);
	font-size: var(--text-xl);
	color: var(--color-text);
	line-height: 1.3;
}

.nav-previous { text-align: left; }
.nav-next { text-align: right; }

/* ===== COMMENTS ===== */
.comments-area {
	margin-top: var(--sp-12);
	padding-top: var(--sp-8);
	border-top: 1px solid var(--color-border);
}

.comments-title {
	font-family: var(--font-display);
	font-size: var(--text-2xl);
	font-weight: 500;
	margin-bottom: var(--sp-8);
}

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

.comment {
	padding: var(--sp-6) 0;
	border-bottom: 1px solid var(--color-border);
}

.comment-author {
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	margin-bottom: var(--sp-3);
}

.comment-author img { border-radius: 50%; }

.comment-author .fn {
	font-weight: 600;
	font-size: var(--text-sm);
}

.comment-metadata {
	font-size: var(--text-xs);
	color: var(--color-muted);
}

.comment-content { font-size: var(--text-base); line-height: 1.7; }

.comment-reply-link {
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--color-muted);
	margin-top: var(--sp-2);
	display: inline-block;
}

.comment-respond { margin-top: var(--sp-8); }

.comment-reply-title {
	font-family: var(--font-display);
	font-size: var(--text-2xl);
	font-weight: 500;
	margin-bottom: var(--sp-6);
}

.comment-form label {
	display: block;
	font-size: var(--text-xs);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	margin-bottom: var(--sp-2);
	color: var(--color-muted);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%;
	padding: var(--sp-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	font-family: var(--font-body);
	background: var(--color-white);
	color: var(--color-text);
	margin-bottom: var(--sp-4);
}

.comment-form input:focus,
.comment-form textarea:focus {
	outline: none;
	border-color: var(--color-text);
}

.comment-form textarea { min-height: 130px; resize: vertical; }

.comment-form .submit {
	padding: var(--sp-3) var(--sp-8);
	background: var(--color-text);
	color: var(--color-white);
	border: none;
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	font-family: var(--font-body);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.comment-form .submit:hover { opacity: 0.8; }

/* ===== 404 ===== */
.error-404 {
	text-align: center;
	padding: var(--sp-24) 0;
}

.error-404 .error-code {
	font-family: var(--font-display);
	font-size: 8rem;
	font-weight: 300;
	color: var(--color-border);
	line-height: 1;
}

.error-404 h1 {
	font-family: var(--font-display);
	font-size: var(--text-3xl);
	font-weight: 500;
	margin-bottom: var(--sp-4);
}

.error-404 p { color: var(--color-muted); margin-bottom: var(--sp-8); }

/* ===== SINGLE POST LAYOUT ===== */
.single-post-wrap {
	padding: var(--sp-16) var(--sp-6);
	overflow-x: clip;
}

.single-post-layout {
	display: grid;
	grid-template-columns: 220px minmax(0, 720px);
	gap: var(--sp-16);
	max-width: 1020px;
	margin: 0 auto;
	align-items: start;
}

body:not(.has-side-toc) .single-post-layout {
	grid-template-columns: minmax(0, 720px);
	max-width: 720px;
}

/* ===== SIDE TOC ===== */
.side-toc {
	position: sticky;
	top: calc(var(--header-height) + var(--sp-12));
	max-height: calc(100vh - var(--header-height) - var(--sp-20));
	overflow-y: auto;
	scrollbar-width: none;
}

.side-toc::-webkit-scrollbar { display: none; }

.side-toc-title {
	font-size: var(--text-xs);
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--color-muted);
	padding-top: 0.55rem; /* optical offset to align with h1 cap height */
	margin-bottom: var(--sp-4);
}

#side-toc-nav ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

#side-toc-nav li {
	margin: 0;
}

.toc-link {
	display: block;
	font-size: 0.8rem;
	line-height: 1.4;
	color: var(--color-muted);
	padding: 5px var(--sp-3);
	border-left: 2px solid var(--color-border);
	transition: color 0.2s ease, border-color 0.2s ease;
	text-decoration: none;
}

.toc-link:hover {
	color: var(--color-text);
	border-left-color: var(--color-muted);
	opacity: 1;
}

.toc-link.active {
	color: var(--color-text);
	border-left-color: var(--color-tile-1);
	font-weight: 500;
	opacity: 1;
}

/* Hide the inline Rank Math TOC on desktop — side TOC handles it there */
@media (min-width: 861px) {
	.has-side-toc .wp-block-rank-math-toc-block,
	.has-side-toc .rank-math-toc {
		display: none;
	}
}

/* Style the inline Rank Math TOC on mobile to match the side TOC */
@media (max-width: 860px) {
	.wp-block-rank-math-toc-block,
	.rank-math-toc {
		background: var(--color-surface);
		border-radius: var(--radius-md);
		padding: var(--sp-4) var(--sp-6);
		margin-bottom: var(--sp-8);
	}

	.wp-block-rank-math-toc-block::before,
	.rank-math-toc::before {
		content: 'Contents';
		display: block;
		font-size: var(--text-xs);
		font-weight: 600;
		letter-spacing: 0.14em;
		text-transform: uppercase;
		color: var(--color-muted);
		margin-bottom: var(--sp-4);
	}

	.wp-block-rank-math-toc-block ul,
	.wp-block-rank-math-toc-block ol,
	.rank-math-toc ul,
	.rank-math-toc ol {
		list-style: none;
		padding: 0 0 var(--sp-2) 0;
		margin: 0;
	}

	.wp-block-rank-math-toc-block li,
	.rank-math-toc li {
		margin: 0 0 6px 0 !important;
		padding: 0 !important;
	}

	.wp-block-rank-math-toc-block a,
	.rank-math-toc a {
		display: block;
		font-size: 0.8rem;
		line-height: 1.4;
		color: var(--color-muted) !important;
		padding: 5px var(--sp-3);
		border-left: 2px solid var(--color-border) !important;
		text-decoration: none !important;
		transition: color 0.2s ease;
	}

	.wp-block-rank-math-toc-block a:hover,
	.rank-math-toc a:hover {
		color: var(--color-text) !important;
		opacity: 1;
	}
}

/* Collapse to single column on smaller screens — side TOC disappears */
@media (max-width: 860px) {
	.single-post-layout {
		grid-template-columns: minmax(0, 1fr);
	}
	.side-toc {
		display: none;
	}
	.single-post-wrap {
		padding: var(--sp-12) var(--sp-6);
	}
}

/* Mobile TOC — shown inline before post content on small screens */
.mobile-toc {
	display: none;
}
.has-side-toc .mobile-toc {
	display: block;
	background: var(--color-surface);
	border-radius: var(--radius-md);
	padding: var(--sp-4) var(--sp-6);
	margin-bottom: var(--sp-8);
}
@media (min-width: 861px) {
	.mobile-toc {
		display: none !important;
	}
}

/* ===== GUTENBERG QUERY LOOP ===== */
.wp-block-post-template {
	row-gap: var(--sp-8) !important;
	column-gap: var(--sp-6) !important;
}

.wp-block-post {
	margin: 0 !important;
	padding: 0 !important;
}

/* Ensure the last post in a query loop also gets the bottom border */
[class*="wp-container-"] > .wp-block-post:last-child,
[class*="wp-container-"] > li:last-child {
	border-bottom: 1px solid var(--color-border) !important;
	padding-block-end: 0 !important;
}

.wp-block-post hr,
.wp-block-post .wp-block-separator {
	display: none !important;
}

.wp-block-post-title {
	margin-top: var(--sp-2) !important;
	margin-bottom: 0 !important;
	padding-bottom: 0 !important;
	border: none !important;
	font-family: var(--font-display) !important;
	font-size: var(--text-base) !important;
	font-weight: 400 !important;
	line-height: 1.3 !important;
}

.wp-block-post-title a,
.post-content .wp-block-post-title a {
	text-decoration: none !important;
	border-bottom: none !important;
	color: var(--color-text) !important;
	font-family: var(--font-display) !important;
}



.wp-block-post-featured-image,
.wp-block-post-featured-image a {
	display: block;
	overflow: hidden;
	aspect-ratio: 4 / 3 !important;
	height: auto !important;
	margin-bottom: 0 !important;
	border: none !important;
}

.wp-block-post-featured-image img,
.wp-block-post-featured-image a img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	object-position: center !important;
	display: block !important;
}

/* ===== ARCHIVE PAGE ===== */
.archive-wrap {
	max-width: var(--container);
	margin: 0 auto;
	padding: var(--sp-16) var(--sp-6);
}

.archive-header {
	margin-bottom: var(--sp-12);
}

.archive-title {
	font-family: var(--font-body) !important;
	font-size: var(--text-lg) !important;
	font-weight: 500 !important;
	letter-spacing: 0.12em !important;
	text-transform: uppercase !important;
	color: var(--color-text);
	margin-bottom: var(--sp-2);
}

.archive-description {
	font-size: var(--text-sm);
	color: var(--color-muted);
}

/* ===== ABOUT PAGE ===== */
.about-page-wrap {
	max-width: 1000px;
	margin: 0 auto;
	padding: var(--sp-16) var(--sp-6);
}

.about-title {
	font-family: var(--font-display);
	font-size: var(--text-4xl);
	font-weight: 500;
	letter-spacing: -0.01em;
	line-height: 1.15;
	margin-bottom: var(--sp-8);
	color: var(--color-text);
}

.about-content {
	font-family: var(--font-body);
	font-size: var(--text-base);
	line-height: 1.8;
	color: var(--color-text);
}

.about-content p {
	margin-bottom: var(--sp-6);
}

/* Allow Gutenberg columns to use full width */
.about-content .wp-block-columns {
	gap: var(--sp-8);
	align-items: start;
}

.about-content .wp-block-column {
	flex-basis: auto;
}

/* Staggered image effect: nudge second image down */
.about-content .wp-block-column:last-child .wp-block-image:last-child img,
.about-content .wp-block-column:last-child .wp-block-image:nth-child(2) {
	margin-top: var(--sp-8);
}

.about-content img {
	border-radius: var(--radius-sm);
	width: 100%;
	height: auto;
	display: block;
}

/* ===== GUTENBERG CALLOUT BLOCKS ===== */
.wp-block-group.has-background,
.wp-block-group[style*="background-color"],
[class*="has-"][class*="background-color"] {
	background-color: #f0ece6 !important;
	border-radius: 8px;
}

/* ===== FOOTER ===== */
.site-footer {
	background-color: var(--color-footer-bg);
	padding: var(--sp-16) 0;
}

.footer-inner {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: var(--sp-6);
}


.footer-copyright {
	font-size: var(--text-sm);
	color: rgba(255,255,255,0.7);
}

.footer-copyright a {
	color: rgba(255,255,255,0.7);
}



.footer-nav ul {
	list-style: none;
	display: flex;
	gap: var(--sp-6);
}

.footer-nav a {
	font-size: var(--text-xs);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(255,255,255,0.7);
}

.footer-nav a:hover { color: var(--color-white); opacity: 1; }

.footer-social {
	display: flex;
	align-items: center;
	gap: var(--sp-4);
	justify-self: end;
}

.footer-social-link {
	display: flex;
	align-items: center;
	color: rgba(255,255,255,0.7);
	transition: color 0.15s ease;
}

.footer-social-link:hover {
	color: var(--color-white);
}

.footer-social-link svg {
	width: 18px;
	height: 18px;
}

/* ===== UTILITIES ===== */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0,0,0,0);
	white-space: nowrap;
	border: 0;
}

.no-posts {
	text-align: center;
	padding: var(--sp-16) 0;
	color: var(--color-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
	.content-area {
		grid-template-columns: 1fr;
	}
	.widget-area { position: static; }

	.categories-grid {
		grid-template-columns: 1fr;
		gap: 6px;
	}
	.category-tile { min-height: 220px; }

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

@media (max-width: 600px) {
	:root {
		--sp-6: 1.25rem;
		--sp-12: 2.5rem;
		--sp-16: 3rem;
		--sp-20: 3.5rem;
		--header-height: 56px;
	}

	.site-header .container { height: 56px; }

	.main-navigation ul {
		display: none;
		position: absolute;
		top: 56px;
		left: 0;
		right: 0;
		background: var(--color-surface);
		border-bottom: 1px solid var(--color-border);
		flex-direction: column;
		padding: var(--sp-4) var(--sp-6);
		gap: var(--sp-4);
	}

	.main-navigation.toggled ul { display: flex; }
	.menu-toggle { display: block; }
	.header-social { display: none; }

	/* 1. Post grid → single column */
	.posts-grid { grid-template-columns: 1fr; }

	.post-navigation { grid-template-columns: 1fr; }
	.author-box { flex-direction: column; }
	.footer-inner { grid-template-columns: 1fr; text-align: center; }
	.footer-nav ul { justify-content: center; }
	.footer-social { justify-content: center; }

	/* 3. About page columns → stack */
	.about-content .wp-block-columns {
		flex-direction: column;
	}
	.about-content .wp-block-column {
		width: 100% !important;
		flex-basis: 100% !important;
	}
	.about-content .wp-block-column:last-child .wp-block-image:last-child img,
	.about-content .wp-block-column:last-child .wp-block-image:nth-child(2) {
		margin-top: 0;
	}
}
