/* Single Post Template */

.single-post-template {
	background: var(--wp--preset--color--base-100);
	color: var(--wp--preset--color--base-content);
}


/* Entry Wrapper */

.entry-wrapper .post-thumbnail {
	width: 100%;
	margin: 32px 0;
	border-radius: 16px;
	overflow: hidden;
	
	img {
		width: 100%;
		height: auto;
		max-height: 500px;
		object-fit: cover;
	}
}

.entry-wrapper {
	max-width: var(--wp--style--global--content-size);
	margin-inline: auto;
	padding-block-start: 32px;
}

/* Entry Header */

.entry-header {
	margin-bottom: 32px;
	
	.entry-categories {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		margin-bottom: 16px;
	}
	
	.category-badge {
		display: inline-block;
		padding: 6px 12px;
		border-radius: 6px;
		background: var(--wp--preset--color--primary);
		color: var(--wp--preset--color--primary-content);
		font-size: 14px;
		font-weight: 600;
		text-decoration: none;
		transition: opacity 0.2s ease;
		
		&:hover {
			opacity: 0.8;
		}
	}
	
	.entry-title {
		margin-bottom: 16px;
		font-size: clamp(32px, 5vw, 48px);
		font-weight: 700;
		line-height: 1.2;
		color: var(--wp--preset--color--base-content);
	}
	
	.entry-meta {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 16px;
		color: color-mix(
			in oklab,
			var(--wp--preset--color--base-content),
			var(--wp--preset--color--base-100) 40%
		);
		font-size: 14px;
		
		.entry-date,
		.reading-time,
		.entry-author {
			display: flex;
			align-items: center;
			gap: 6px;
		}
		
		svg {
			width: 16px;
			height: 16px;
			flex-shrink: 0;
		}
		
		a {
			color: inherit;
			text-decoration: none;
			transition: color 0.2s ease;
			
			&:hover {
				color: var(--wp--preset--color--primary);
			}
		}
	}
}

/* Entry Content */

.entry-content {
	margin-bottom: 48px;
	font-size: 18px;
	line-height: 1.8;
	color: var(--wp--preset--color--base-content);
	
	> * + * {
		margin-top: 1.5em;
	}
	
	h2 {
		margin-top: 2em;
		font-size: 32px;
		font-weight: 700;
		line-height: 1.3;
	}
	
	h3 {
		margin-top: 1.8em;
		font-size: 24px;
		font-weight: 700;
		line-height: 1.4;
	}
	
	h4 {
		margin-top: 1.5em;
		font-size: 20px;
		font-weight: 600;
		line-height: 1.4;
	}
	
	p {
		margin-bottom: 1.5em;
	}
	
	a {
		color: var(--wp--preset--color--primary);
		text-decoration: underline;
		text-underline-offset: 3px;
		transition: opacity 0.2s ease;
		
		&:hover {
			opacity: 0.8;
		}
	}
	
	ul, ol {
		padding-left: 1.5em;
		
		li {
			margin-bottom: 0.5em;
		}
	}
	
	ul {
		list-style-type: disc;
	}
	
	ol {
		list-style-type: decimal;
	}
	
	blockquote {
		margin: 2em 0;
		padding: 24px;
		border-left: 4px solid var(--wp--preset--color--primary);
		border-radius: 8px;
		background: color-mix(
			in oklab,
			var(--wp--preset--color--base-200),
			transparent 50%
		);
		font-style: italic;
		
		p:last-child {
			margin-bottom: 0;
		}
	}
	
	img {
		max-width: 100%;
		height: auto;
		border-radius: 12px;
	}
	
	figure {
		margin: 2em 0;
		
		figcaption {
			margin-top: 12px;
			color: color-mix(
				in oklab,
				var(--wp--preset--color--base-content),
				var(--wp--preset--color--base-100) 40%
			);
			font-size: 14px;
			text-align: center;
		}
	}
	
	pre {
		padding: 20px;
		border-radius: 8px;
		background: var(--wp--preset--color--base-200);
		overflow-x: auto;
		
		code {
			font-family: 'Courier New', monospace;
			font-size: 14px;
		}
	}
	
	code {
		padding: 2px 6px;
		border-radius: 4px;
		background: var(--wp--preset--color--base-200);
		font-family: 'Courier New', monospace;
		font-size: 0.9em;
	}
	
	table {
		width: 100%;
		border-collapse: collapse;
		
		th, td {
			padding: 12px;
			border: 1px solid color-mix(
				in oklab,
				var(--wp--preset--color--base-200),
				var(--wp--preset--color--base-content) 30%
			);
		}
		
		th {
			background: var(--wp--preset--color--base-200);
			font-weight: 600;
			text-align: left;
		}
	}
	
	.wp-block-embed {
		margin: 2em 0;
		
		iframe {
			max-width: 100%;
			border-radius: 12px;
		}
	}
	
	/* WordPress Gallery */
	.wp-block-gallery {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
		gap: 16px;
		padding: 0;
		list-style: none;
	}
}

/* Page Links */

.page-links {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin-top: 3em;
	padding: 24px;
	border-radius: 12px;
	background: var(--wp--preset--color--base-200);
	
	.page-number,
	> span,
	> a {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 40px;
		height: 40px;
		padding: 8px 12px;
		border-radius: 8px;
		background: var(--wp--preset--color--base-100);
		color: var(--wp--preset--color--base-content);
		font-weight: 600;
		text-decoration: none;
		transition: all 0.2s ease;
		
		&:hover {
			background: var(--wp--preset--color--primary);
			color: var(--wp--preset--color--primary-content);
		}
	}
	
	> span {
		background: var(--wp--preset--color--primary);
		color: var(--wp--preset--color--primary-content);
	}
}

/* Entry Tags */

.entry-tags {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	padding: 24px;
	border-radius: 12px;
	background: var(--wp--preset--color--base-200);
	margin-bottom: 32px;
	
	.tags-label {
		display: flex;
		align-items: center;
		gap: 6px;
		font-weight: 600;
		color: var(--wp--preset--color--base-content);
		
		svg {
			width: 16px;
			height: 16px;
		}
	}
	
	.tags-list {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
	}
	
	.tag-link {
		padding: 6px 12px;
		border-radius: 6px;
		background: var(--wp--preset--color--base-100);
		color: var(--wp--preset--color--base-content);
		font-size: 14px;
		text-decoration: none;
		transition: all 0.2s ease;
		
		&:hover {
			background: var(--wp--preset--color--primary);
			color: var(--wp--preset--color--primary-content);
		}
	}
}

/* Entry Footer */

.entry-footer {
	margin-top: 48px;
}

/* Post Navigation */

.post-navigation {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
	gap: 24px;
	margin: 64px 0;
	
	.nav-previous,
	.nav-next {
		a {
			display: flex;
			flex-direction: column;
			gap: 8px;
			padding: 24px;
			border-radius: 12px;
			background: var(--wp--preset--color--base-200);
			text-decoration: none;
			transition: all 0.3s ease;
			
			&:hover {
				background: var(--wp--preset--color--primary);
				color: var(--wp--preset--color--primary-content);
				transform: translateY(-2px);
				box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
			}
		}
		
		.nav-label {
			font-size: 14px;
			font-weight: 600;
			text-transform: uppercase;
			letter-spacing: 0.5px;
			color: color-mix(
				in oklab,
				var(--wp--preset--color--base-content),
				var(--wp--preset--color--base-100) 40%
			);
		}
		
		.nav-title {
			font-size: 18px;
			font-weight: 600;
			line-height: 1.4;
			color: var(--wp--preset--color--base-content);
		}
		
		a:hover .nav-label,
		a:hover .nav-title {
			color: inherit;
		}
	}
	
	.nav-previous {
		text-align: right;
	}
}

/* Comments Wrapper */

.comments-wrapper {
	max-width: var(--wp--style--global--content-size);
	margin: 64px auto;
	padding: 32px;
	border-radius: 16px;
	background: var(--wp--preset--color--base-200);
}

/* Responsive adjustments */

@media (width < 960px) {
	.entry-wrapper {
		padding-inline: 24px;
	}
	
	.entry-content {
		font-size: 16px;
		
		h2 {
			font-size: 28px;
		}
		
		h3 {
			font-size: 22px;
		}
	}
}

@media (width < 640px) {
	.entry-wrapper .post-thumbnail img {
		max-height: 350px;
	}
	.entry-header .entry-title {
		font-size: 28px;
	}
	
	.entry-meta {
		font-size: 13px;
		gap: 12px;
	}
	
	.related-posts-section .section-title {
		font-size: 24px;
	}
}

/* Author Bio */

.author-bio {
	display: flex;
	gap: 24px;
	padding: 32px;
	border-radius: 16px;
	background: var(--wp--preset--color--base-200);
	
	@media (width < 640px) {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}
}

.author-bio-avatar {
	flex-shrink: 0;
	
	a {
		display: block;
		border-radius: 50%;
		overflow: hidden;
		transition: transform 0.3s ease, box-shadow 0.3s ease;
		
		&:hover {
			transform: scale(1.05);
			box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
		}
	}
	
	img {
		display: block;
		width: 80px;
		height: 80px;
		border-radius: 50%;
	}
}

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

.author-bio-header {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 12px;
	
	@media (width < 640px) {
		justify-content: center;
	}
}

.author-bio-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
	
	a {
		color: var(--wp--preset--color--base-content);
		text-decoration: none;
		transition: color 0.2s ease;
		
		&:hover {
			color: var(--wp--preset--color--primary);
		}
	}
}

.author-bio-posts-count {
	padding: 4px 10px;
	border-radius: 6px;
	background: color-mix(
		in oklab,
		var(--wp--preset--color--base-100),
		transparent 20%
	);
	color: color-mix(
		in oklab,
		var(--wp--preset--color--base-content),
		var(--wp--preset--color--base-100) 30%
	);
	font-size: 13px;
	font-weight: 600;
}

.author-bio-description {
	margin-bottom: 16px;
	color: color-mix(
		in oklab,
		var(--wp--preset--color--base-content),
		var(--wp--preset--color--base-100) 20%
	);
	font-size: 15px;
	line-height: 1.6;
	
	p {
		margin: 0;
	}
	
	p + p {
		margin-top: 0.75em;
	}
}

.author-bio-footer {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 16px;
	
	@media (width < 640px) {
		justify-content: center;
	}
}

.author-bio-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	border-radius: 8px;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary-content);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.2s ease;
	
	&:hover {
		opacity: 0.9;
		transform: translateX(2px);
	}
	
	svg {
		width: 16px;
		height: 16px;
		transition: transform 0.2s ease;
	}
	
	&:hover svg {
		transform: translateX(2px);
	}
}

.author-bio-social {
	display: flex;
	align-items: center;
	gap: 12px;
	
	a {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 36px;
		height: 36px;
		border-radius: 50%;
		background: var(--wp--preset--color--base-100);
		color: var(--wp--preset--color--base-content);
		transition: all 0.2s ease;
		
		&:hover {
			background: var(--wp--preset--color--primary);
			color: var(--wp--preset--color--primary-content);
			transform: translateY(-2px);
		}
		
		svg {
			width: 18px;
			height: 18px;
		}
	}
}

/* Category, tag and author pages */

.category-template,
.tag-template,
.author-template {
	padding-block: 64px;

	.category-header,
	.archive-header {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 16px;
		margin-bottom: 64px;
		text-align: center;

		.category-icon-wrapper,
		.archive-icon-wrapper {
			display: flex;
			align-items: center;
			justify-content: center;
			width: 80px;
			height: 80px;
			padding: 16px;
			border-radius: 50%;
			background: var(--wp--preset--color--primary);
			color: var(--wp--preset--color--primary-content);

			svg {
				width: 100%;
				height: 100%;
			}
		}

		.archive-avatar {
			img {
				display: block;
				width: 120px;
				height: 120px;
				border-radius: 50%;
				border: 4px solid var(--wp--preset--color--primary);
			}
		}

		.category-title,
		.archive-title {
			margin: 0;
			font-size: clamp(32px, 5vw, 48px);
			font-weight: 700;
			line-height: 1.2;
			color: var(--wp--preset--color--base-content);
		}

		.category-description,
		.archive-description {
			max-width: 700px;
			color: color-mix(
				in oklab,
				var(--wp--preset--color--base-content),
				var(--wp--preset--color--base-100) 30%
			);
			font-size: 18px;
			line-height: 1.6;

			p {
				margin: 0;
			}

			p + p {
				margin-top: 0.75em;
			}
		}

		.archive-meta {
			.archive-count {
				padding: 6px 12px;
				border-radius: 6px;
				background: var(--wp--preset--color--base-200);
				color: color-mix(
					in oklab,
					var(--wp--preset--color--base-content),
					var(--wp--preset--color--base-100) 30%
				);
				font-size: 14px;
				font-weight: 600;
			}
		}

		.archive-social {
			display: flex;
			align-items: center;
			gap: 12px;

			a {
				display: inline-flex;
				align-items: center;
				justify-content: center;
				width: 40px;
				height: 40px;
				border-radius: 50%;
				background: var(--wp--preset--color--base-200);
				color: var(--wp--preset--color--base-content);
				transition: all 0.2s ease;

				&:hover {
					background: var(--wp--preset--color--primary);
					color: var(--wp--preset--color--primary-content);
					transform: translateY(-2px);
				}

				svg {
					width: 20px;
					height: 20px;
				}
			}
		}
	}

	.pagination {
		margin-top: 64px;

		ul {
			display: flex;
			justify-content: center;
			align-items: center;
			flex-wrap: wrap;
			gap: 8px;
			padding: 0;
			list-style: none;

			li {
				a,
				span {
					display: inline-flex;
					align-items: center;
					justify-content: center;
					gap: 6px;
					min-width: 44px;
					height: 44px;
					padding: 8px 12px;
					border-radius: 8px;
					background: var(--wp--preset--color--base-200);
					color: var(--wp--preset--color--base-content);
					font-weight: 600;
					text-decoration: none;
					transition: all 0.2s ease;

					svg {
						width: 16px;
						height: 16px;
					}

					&:hover {
						background: var(--wp--preset--color--primary);
						color: var(--wp--preset--color--primary-content);
					}
				}

				&.current span {
					background: var(--wp--preset--color--primary);
					color: var(--wp--preset--color--primary-content);
				}

				&.dots span {
					background: transparent;
					cursor: default;

					&:hover {
						background: transparent;
						color: var(--wp--preset--color--base-content);
					}
				}
			}
		}
	}

	.no-posts {
		padding: 64px 32px;
		border-radius: 16px;
		background: var(--wp--preset--color--base-200);
		text-align: center;

		p {
			margin: 0;
			font-size: 18px;
			color: color-mix(
				in oklab,
				var(--wp--preset--color--base-content),
				var(--wp--preset--color--base-100) 30%
			);
		}
	}
}

.category-template {
	.category-posts {
		display: flex;
		flex-direction: column;
		gap: 64px;
	}

	.category-grid {
		.category-grid-posts {
			display: grid;
			grid-template-columns: repeat(4, minmax(0, 1fr));
			gap: 8px;
			@media (width < 1280px) {
				grid-template-columns: repeat(3, minmax(0, 1fr));
			}
			@media (width < 960px) {
				grid-template-columns: repeat(2, minmax(0, 1fr));
			}
			@media (width < 640px) {
				grid-template-columns: 1fr;
			}
		}
	}
}

.tag-template,
.author-template {
	.archive-posts {
		display: grid;
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 24px;

		@media (width < 1280px) {
			grid-template-columns: repeat(3, minmax(0, 1fr));
		}

		@media (width < 960px) {
			grid-template-columns: repeat(2, minmax(0, 1fr));
		}

		@media (width < 640px) {
			grid-template-columns: 1fr;
		}
	}
}

/* all category template */
.all-categories-template {
	padding-block: 64px;

	.page-header {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 16px;
		margin-bottom: 48px;
		text-align: center;

		.page-title {
			margin: 0;
			font-size: clamp(32px, 5vw, 48px);
			font-weight: 700;
			line-height: 1.2;
			color: var(--wp--preset--color--base-content);
		}

		.page-description {
			max-width: 700px;
			color: color-mix(
				in oklab,
				var(--wp--preset--color--base-content),
				var(--wp--preset--color--base-100) 30%
			);
			font-size: 18px;
			line-height: 1.6;

			p {
				margin: 0;
			}
		}
	}

	.all-categories-posts {
		display: flex;
		flex-direction: column;
		gap: 64px;
	}

	.category-row {
		.category-row-header {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			align-items: center;
			gap: 16px;
			margin-bottom: 24px;
			padding-bottom: 16px;
			border-bottom: 2px solid
				color-mix(
					in oklab,
					var(--wp--preset--color--base-200),
					var(--wp--preset--color--base-content) 20%
				);

			.category-row-info {
				display: flex;
				align-items: center;
				gap: 16px;

				svg {
					width: 40px;
					height: 40px;
					flex-shrink: 0;
					color: var(--wp--preset--color--primary);
				}

				.category-row-title {
					margin: 0;
					font-size: 28px;
					font-weight: 700;
					line-height: 1.2;

					a {
						color: var(--wp--preset--color--base-content);
						text-decoration: none;
						transition: color 0.2s ease;

						&:hover {
							color: var(--wp--preset--color--primary);
						}
					}
				}

				.category-row-count {
					padding: 6px 12px;
					border-radius: 6px;
					background: var(--wp--preset--color--base-200);
					color: color-mix(
						in oklab,
						var(--wp--preset--color--base-content),
						var(--wp--preset--color--base-100) 30%
					);
					font-size: 14px;
					font-weight: 600;
					white-space: nowrap;
				}
			}

			.category-row-link {
				display: inline-flex;
				align-items: center;
				gap: 6px;
				padding: 8px 16px;
				border-radius: 8px;
				background: var(--wp--preset--color--primary);
				color: var(--wp--preset--color--primary-content);
				font-size: 14px;
				font-weight: 600;
				text-decoration: none;
				white-space: nowrap;
				transition: all 0.2s ease;

				&:hover {
					opacity: 0.9;
					transform: translateX(2px);
				}

				svg {
					width: 16px;
					height: 16px;
					transition: transform 0.2s ease;
				}

				&:hover svg {
					transform: translateX(2px);
				}
			}
		}

		.category-row-posts {
			display: grid;
			grid-template-columns: repeat(4, minmax(0, 1fr));
			gap: 8px;

			@media (width < 1280px) {
				grid-template-columns: repeat(3, minmax(0, 1fr));
			}

			@media (width < 960px) {
				grid-template-columns: repeat(2, minmax(0, 1fr));
			}

			@media (width < 640px) {
				grid-template-columns: 1fr;
			}
		}
	}
}

.faq-template {
	.page-header {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 16px;
		margin-top: 32px;
		text-align: center;

		.page-title {
			margin: 0;
			font-size: clamp(32px, 5vw, 48px);
			font-weight: 700;
			line-height: 1.2;
			color: var(--wp--preset--color--base-content);
		}
	}

	.faq-list {
		display: flex;
		flex-direction: column;
		gap: 16px;
		width: 100%;
		margin-block: 48px;

		> details {
			width: 100%;
			height: fit-content;
			border-radius: 16px;
			border: 2px solid
				color-mix(
					in oklab,
					var(--wp--preset--color--base-200),
					var(--wp--preset--color--base-content) 30%
				);
			background: var(--wp--preset--color--base-200);
			color: var(--wp--preset--color--base-content);

			&:is([open], :popover-open, :open) {
				.only-close {
					display: none;
				}
				.only-open {
					display: initial;
				}

				> summary {
					padding-bottom: 16px;
				}
			}

			.only-open {
				display: none;
			}

			> summary {
				display: flex;
				justify-content: space-between;
				gap: 16px;
				padding: 24px 32px;
				font-size: 18px;
				font-weight: 600;
				cursor: pointer;
			}

			> p {
				padding: 0 32px 24px 32px;
			}
		}
	}
}


.page-latest-article-template {
	.tool-section {
		margin-bottom: 32px;

		.section-cta {
			display: block;
			max-width: fit-content;
			margin-top: 32px;
			margin-inline: auto;
		}
	}

	.posts-section {
		margin-bottom: 32px;

		.section-title {
			font-size: 28px;
			font-weight: 700;
			margin-bottom: 32px;
		}
		.section-cta {
			display: block;
			max-width: fit-content;
			margin-top: 32px;
			margin-inline: auto;
		}
		.list {
			display: grid;
			grid-template-columns: repeat(4, minmax(0, 1fr));
			gap: 8px;

			@media (width < 640px) {
				grid-template-columns: repeat(2, minmax(0, 1fr));
			}

			.post {
				flex: 1;
			}
		}
	}
}
