/*
 * Blog listing (home.php) + Blog single (single.php) styles.
 * Loaded together (see inc/enqueue.php: is_home() || is_singular('post'))
 * so both templates share one set of card/badge/media classes.
 */

.blog-single {
	overflow-x: clip;
}

/* ---------- Shared: media placeholder ---------- */

.media-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	min-height: 120px;
	background: var(--light-bg);
	color: var(--text-color-light);
}

/* ---------- Shared: category badge ---------- */

.category-badge {
	display: inline-flex;
	align-items: center;
	background: #ffffff;
	color: var(--primary-color-dark);
	font-family: var(--font-primary);
	font-weight: var(--font-weight-extrabold);
	font-size: 0.8125rem;
	letter-spacing: 0.045em;
	text-transform: uppercase;
	padding: 0.5rem 0.9rem;
	border-radius: var(--radius-full);
	box-shadow: var(--shadow-sm);
}

.category-badge--sm {
	font-size: 0.75rem;
	padding: 0.45rem 0.85rem;
}

.category-badge--gyprock {
	color: var(--secondary-color);
}

.category-badge--plastering {
	color: var(--accent-color);
}

.category-badge--default {
	color: var(--primary-color-dark);
}

/* ---------- Blog hero (Blog listing) ---------- */

.blog-hero {
	position: relative;
	overflow: hidden;
	padding: 2.75rem 0 6.75rem;
	min-height: clamp(340px, 28vw, 460px);
	display: flex;
	align-items: flex-end;
}

.blog-hero__media {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.blog-hero__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.blog-hero__img-placeholder {
	background: var(--heading-color);
	min-height: 100%;
}

.blog-hero__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, rgba(0, 0, 0, 0.78) 20%, rgba(0, 0, 0, 0.3) 58%), linear-gradient(90deg, rgba(29, 31, 101, 0.2), rgba(29, 31, 101, 0.2));
}

.blog-hero__inner {
	position: relative;
	z-index: 1;
}

.blog-hero__breadcrumb {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 2.5rem;
	font-family: var(--font-primary);
	font-weight: var(--font-weight-medium);
	font-size: 1.125rem;
}

.blog-hero__breadcrumb a {
	color: #ffffff;
}

.blog-hero__breadcrumb span {
	color: rgba(255, 255, 255, 0.6);
}

.blog-hero__breadcrumb-current {
	color: var(--primary-color) !important;
}

.blog-hero__content {
	max-width: 40rem;
}

.blog-hero__title {
	margin: 1.4rem 0 1.25rem;
}

.blog-hero__title-accent {
	color: var(--primary-color);
}

.blog-hero__text {
	color: rgba(255, 255, 255, 0.92);
	font-size: clamp(1.0625rem, 1.6vw, 1.3125rem);
	max-width: 36rem;
	margin: 0;
}

/* ---------- Featured post ---------- */

.featured-post-section {
	padding: var(--section-spacing) 0 4rem;
	background: #ffffff;
}

.featured-post {
	display: grid;
	grid-template-columns: 1.1fr 0.9fr;
	background: #ffffff;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-xl);
	box-shadow: var(--shadow-lg);
	overflow: hidden;
}

.featured-post__media {
	position: relative;
	min-height: clamp(320px, 27vw, 420px);
}

.featured-post__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.featured-post__media .category-badge {
	position: absolute;
	top: 1.375rem;
	left: 1.375rem;
}

.featured-post__body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 1rem;
	padding: 3rem 3.375rem;
}

.featured-post__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	font-family: var(--font-primary);
	font-weight: var(--font-weight-bold);
	font-size: 1rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--primary-color-dark);
}

.featured-post__eyebrow-rule {
	display: inline-block;
	width: 26px;
	height: 2px;
	border-radius: 2px;
	background: var(--primary-color);
}

.featured-post__title {
	font-size: clamp(1.625rem, 2.4vw, 2.125rem);
	font-weight: var(--font-weight-extrabold);
	letter-spacing: -0.02em;
	margin: 0;
}

.featured-post__title a {
	color: var(--heading-color);
}

.featured-post__title a:hover {
	color: var(--primary-color);
}

.featured-post__excerpt {
	color: var(--text-color-light);
	font-size: 1.0625rem;
	margin: 0;
}

.featured-post__meta {
	display: flex;
	align-items: center;
	gap: 0.875rem;
	margin-top: 0.25rem;
}

.featured-post__avatar {
	border-radius: 50%;
	width: 42px;
	height: 42px;
}

.featured-post__meta-text {
	display: flex;
	flex-direction: column;
}

.featured-post__author {
	font-family: var(--font-primary);
	font-weight: var(--font-weight-bold);
	font-size: 0.9375rem;
	color: var(--heading-color);
}

.featured-post__date {
	font-size: 0.875rem;
	color: var(--text-color-light);
}

.featured-post__link {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-family: var(--font-primary);
	font-weight: var(--font-weight-bold);
	color: var(--primary-color-dark);
	margin-top: 0.25rem;
}

.featured-post__link:hover {
	color: var(--primary-color);
}

/* ---------- Blog grid + card (also reused by Related Posts) ---------- */

.blog-grid-section {
	padding: 2rem 0 var(--section-spacing);
	background: #fbf8f3;
}

.blog-grid-section__empty {
	text-align: center;
	color: var(--text-color-light);
}

.blog-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.875rem;
}

.blog-card {
	background: #ffffff;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-xl);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.blog-card:hover,
.blog-card:focus-within {
	transform: translateY(-6px);
	border-color: #e8dcc8;
	box-shadow: var(--shadow-lg);
}

.blog-card__media {
	position: relative;
	aspect-ratio: 16 / 11;
}

.blog-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--transition-slow);
}

.blog-card:hover .blog-card__img,
.blog-card:focus-within .blog-card__img {
	transform: scale(1.045);
}

.blog-card__media .category-badge {
	position: absolute;
	top: 1.125rem;
	left: 1.125rem;
}

.blog-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	padding: 1.7rem 1.625rem 1.875rem;
	flex-grow: 1;
}

.blog-card__title {
	font-size: 1.3125rem;
	letter-spacing: -0.02em;
	margin: 0;
}

.blog-card__title a {
	color: var(--heading-color);
}

.blog-card__title a:hover {
	color: var(--primary-color);
}

.blog-card__excerpt {
	color: var(--text-color-light);
	font-size: 0.9375rem;
	margin: 0;
	flex-grow: 1;
}

.blog-card__meta {
	display: flex;
	align-items: center;
	gap: 0.875rem;
	padding-top: 0.625rem;
}

.blog-card__avatar {
	border-radius: 50%;
	width: 36px;
	height: 36px;
}

.blog-card__meta-text {
	display: flex;
	flex-direction: column;
}

.blog-card__author {
	font-family: var(--font-primary);
	font-weight: var(--font-weight-bold);
	font-size: 0.875rem;
	color: var(--heading-color);
}

.blog-card__date {
	font-size: 0.8125rem;
	color: var(--text-color-light);
}

/* ---------- Pagination ---------- */

.blog-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.625rem;
	margin-top: 3.5rem;
}

.blog-pagination__btn,
.blog-pagination__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	height: 46px;
	min-width: 46px;
	padding: 0 1rem;
	border-radius: var(--radius-md);
	border: 1px solid var(--border-color);
	background: #ffffff;
	font-family: var(--font-primary);
	font-weight: var(--font-weight-bold);
	font-size: 0.9375rem;
	color: var(--text-color-light);
}

.blog-pagination__num {
	padding: 0;
}

.blog-pagination__num--current {
	background: var(--primary-color-dark);
	border-color: var(--primary-color-dark);
	color: #ffffff;
}

.blog-pagination__btn--disabled {
	opacity: 0.45;
	pointer-events: none;
}

.blog-pagination__btn:hover,
.blog-pagination__num:hover {
	border-color: var(--primary-color);
	color: var(--primary-color);
}

/* ---------- Blog single: breadcrumb ---------- */

.blog-breadcrumb {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 1.75rem 0;
	font-family: var(--font-secondary);
	font-weight: var(--font-weight-semibold);
	font-size: 0.9375rem;
}

.blog-breadcrumb a {
	color: var(--text-color-light);
}

.blog-breadcrumb a:hover {
	color: var(--primary-color);
}

.blog-breadcrumb__sep {
	color: var(--text-color-light);
	flex-shrink: 0;
}

.blog-breadcrumb__current {
	color: var(--heading-color);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ---------- Article header ---------- */

.article-header {
	position: relative;
	overflow: hidden;
	padding: 0.5rem 0 2.75rem;
}

.article-header__gradient {
	position: absolute;
	top: -160px;
	right: -160px;
	width: 480px;
	height: 480px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(217, 138, 61, 0.14), rgba(217, 138, 61, 0) 68%);
	pointer-events: none;
	z-index: 0;
}

.article-header__inner {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1.3rem;
	max-width: 56rem;
}

.article-header__title {
	font-size: clamp(2rem, 3.4vw, 3rem);
	margin: 0;
}

.article-header__meta {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1.25rem;
	border-top: 1px solid var(--border-color);
	border-bottom: 1px solid var(--border-color);
	padding: 1.6rem 0;
}

.article-header__author {
	display: flex;
	align-items: center;
	gap: 0.875rem;
}

.article-header__avatar {
	border-radius: 50%;
	width: 48px;
	height: 48px;
}

.article-header__author-info {
	display: flex;
	flex-direction: column;
}

.article-header__author-name {
	font-family: var(--font-primary);
	font-weight: var(--font-weight-bold);
	font-size: 1rem;
	color: var(--heading-color);
}

.article-header__author-date {
	font-size: 0.875rem;
	color: var(--text-color-light);
}

.article-header__share {
	display: flex;
	align-items: center;
	gap: 0.625rem;
}

.article-header__share-label {
	font-family: var(--font-primary);
	font-weight: var(--font-weight-bold);
	font-size: 0.875rem;
	color: var(--text-color-light);
	margin-right: 0.25rem;
}

.article-share-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: var(--radius-md);
	background: #ffffff;
	border: 1px solid var(--border-color);
	color: var(--heading-color);
}

.article-share-btn:hover {
	color: var(--primary-color);
	border-color: var(--primary-color);
}

/* ---------- Hero image ---------- */

.blog-hero-image {
	margin: 0 0 3.5rem;
	border-radius: var(--radius-xl);
	overflow: hidden;
	box-shadow: var(--shadow-lg);
}

.blog-hero-image__img {
	display: block;
	width: 100%;
	max-height: 34rem;
	object-fit: cover;
}

.blog-hero-image__img-placeholder {
	min-height: 22rem;
}

/* ---------- Article layout: content + aside ---------- */

.article-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	gap: 4.5rem;
	padding-bottom: var(--section-spacing);
	align-items: start;
}

.article-body {
	min-width: 0;
}

/* ---------- Article content typography ---------- */

.article-content {
	color: var(--text-color);
	font-size: 1.125rem;
}

.article-content > *:first-child {
	margin-top: 0;
}

.article-content p {
	margin: 0 0 1.75rem;
}

.article-content .article-lead {
	font-family: var(--font-primary);
	font-weight: var(--font-weight-semibold);
	font-size: 1.25rem;
	color: var(--heading-color);
	margin-bottom: 2rem;
}

.article-content h2 {
	font-size: 1.8125rem;
	margin: 2.75rem 0 1.25rem;
	scroll-margin-top: 6.5rem;
}

.article-content ul {
	list-style: none;
	margin: 0 0 1.75rem;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.875rem;
}

.article-content .article-checklist li {
	position: relative;
	padding-left: 2.5rem;
	font-size: 1.0625rem;
}

.article-content .article-checklist li::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0.15rem;
	width: 26px;
	height: 26px;
	border-radius: 8px;
	background: var(--eyebrow-bg);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c2742a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 13px;
}

.article-content .article-checklist strong {
	color: var(--heading-color);
}

.article-content blockquote.article-callout {
	background: var(--light-bg);
	border-left: 4px solid var(--primary-color);
	border-radius: 0 var(--radius-md) var(--radius-md) 0;
	padding: 1.75rem 2rem;
	margin: 0 0 1.75rem;
}

.article-content blockquote.article-callout p {
	margin: 0;
	font-family: var(--font-primary);
	font-weight: var(--font-weight-bold);
	font-size: 1.3125rem;
	color: var(--heading-color);
}

.article-figure {
	margin: 0 0 1.75rem;
}

.article-figure__img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
}

.article-figure figcaption {
	text-align: center;
	font-style: italic;
	color: var(--text-color-light);
	font-size: 1.0625rem;
	padding-top: 0.9rem;
}

/* ---------- Tags row ---------- */

.article-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.625rem;
	border-top: 1px solid var(--border-color);
	padding-top: 2rem;
	margin-top: 0.5rem;
}

.article-tag {
	background: var(--light-bg);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-full);
	padding: 0.55rem 1.1rem;
	font-family: var(--font-primary);
	font-weight: var(--font-weight-bold);
	font-size: 0.875rem;
	color: var(--text-color-light);
}

.article-tag:hover {
	color: var(--primary-color);
	border-color: var(--primary-color);
}

/* ---------- Author bio box ---------- */

.article-author-bio {
	display: flex;
	gap: 1.375rem;
	background: var(--light-bg);
	border-radius: var(--radius-xl);
	padding: 2rem;
	margin-top: 2rem;
}

.article-author-bio__avatar {
	border-radius: 50%;
	width: 76px;
	height: 76px;
	flex-shrink: 0;
}

.article-author-bio__name {
	font-size: 1.1875rem;
	margin: 0 0 0.25rem;
}

.article-author-bio__role {
	font-family: var(--font-primary);
	font-weight: var(--font-weight-bold);
	font-size: 0.875rem;
	color: var(--primary-color-dark);
	margin: 0 0 0.5rem;
}

.article-author-bio__text {
	color: var(--text-color-light);
	margin: 0;
}

/* ---------- Aside ---------- */

.article-aside {
	display: flex;
	flex-direction: column;
	gap: 1.75rem;
	position: sticky;
	top: 6rem;
}

.aside-card {
	background: #ffffff;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-xl);
	padding: 1.75rem;
}

.aside-card__title {
	font-size: 1.125rem;
	letter-spacing: -0.02em;
	margin: 0 0 1.125rem;
}

.toc-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.toc-item a {
	display: flex;
	align-items: baseline;
	gap: 0.625rem;
	color: var(--text-color-light);
	font-family: var(--font-secondary);
	font-weight: var(--font-weight-semibold);
	font-size: 0.9375rem;
}

.toc-item a:hover {
	color: var(--primary-color);
}

.toc-item__num {
	font-family: var(--font-primary);
	font-weight: var(--font-weight-extrabold);
	color: var(--primary-color-dark);
	font-size: 0.9375rem;
	flex-shrink: 0;
}

.related-reading-list {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.related-reading-item {
	display: flex;
	gap: 0.875rem;
}

.related-reading-item__media {
	flex-shrink: 0;
	width: 68px;
	height: 68px;
	border-radius: var(--radius-md);
	overflow: hidden;
	display: block;
}

.related-reading-item__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.related-reading-item__body {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	justify-content: center;
}

.related-reading-item__title {
	font-family: var(--font-primary);
	font-weight: var(--font-weight-bold);
	font-size: 0.875rem;
	color: var(--heading-color);
	line-height: 1.35;
}

.related-reading-item__title:hover {
	color: var(--primary-color);
}

.related-reading-item__meta {
	font-size: 0.8125rem;
	color: var(--text-color-light);
}

.painter-cta {
	background: linear-gradient(155deg, var(--primary-color), #c9a875);
	border-radius: var(--radius-xl);
	padding: 1.75rem;
	color: #ffffff;
}

.painter-cta__title {
	color: #ffffff;
	font-size: 1.125rem;
	margin: 0 0 0.875rem;
}

.painter-cta__text {
	color: rgba(255, 255, 255, 0.92);
	font-size: 0.9375rem;
	margin: 0 0 1.375rem;
}

.painter-cta__button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	background: #ffffff;
	color: var(--primary-color-dark);
	font-family: var(--font-primary);
	font-weight: var(--font-weight-bold);
	font-size: 1.0625rem;
	padding: 0.95rem 1.5rem;
	border-radius: var(--radius-full);
}

.painter-cta__button:hover {
	color: var(--primary-color);
}

/* ---------- Related posts ---------- */

.related-posts-section {
	padding: var(--section-spacing) 0;
	background: #faf7f2;
}

/* ---------- Newsletter CTA background alternation ---------- */

/*
 * newsletter-cta-section (template-parts/sections/newsletter-cta) is shared
 * with the rest of the site and only carries padding centrally — it has no
 * background of its own, so it inherits the page's white background.
 *
 * On the Blog listing, the section right before it is blog-grid-section
 * (#ffffff), so the newsletter band needs the light tint to keep the
 * white/light-bg alternation going.
 *
 * On a single post, the section right before it is related-posts-section,
 * which is already var(--light-bg) — so the newsletter band should stay
 * white (its default) rather than repeat the light tint back-to-back.
 */
body.blog .newsletter-cta-section {
	background: #ffffff;
}

/* ---------- Related-post carousel ---------- */

.related-posts-slider {
	position: relative;
}

.related-posts-slider__track {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.related-posts-slider__track::-webkit-scrollbar {
	display: none;
}

.related-posts-slider__track .blog-card {
	flex: 0 0 calc((100% - 3.75rem) / 3);
	scroll-snap-align: start;
}

.related-posts-slider__nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border: 1px solid var(--border-color);
	border-radius: 50%;
	background: #ffffff;
	color: var(--primary-color-dark);
	box-shadow: var(--shadow-md);
	transform: translateY(-50%);
}

.related-posts-slider__nav--prev {
	left: -23px;
}

.related-posts-slider__nav--next {
	right: -23px;
}

/* ---------- Responsive ---------- */

@media (max-width: 991.98px) {
	.featured-post {
		grid-template-columns: 1fr;
	}

	.featured-post__media {
		min-height: 320px;
	}

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

	.related-posts-slider__track .blog-card {
		flex-basis: calc((100% - 1.875rem) / 2);
	}

	.article-layout {
		grid-template-columns: 1fr;
	}

	.article-aside {
		position: static;
	}
}

@media (max-width: 767.98px) {
	.blog-hero {
		padding-bottom: 4rem;
	}

	.blog-grid {
		grid-template-columns: 1fr;
	}

	.related-posts-slider__track .blog-card {
		flex-basis: 100%;
	}

	.related-posts-slider__nav--prev {
		left: 0.5rem;
	}

	.related-posts-slider__nav--next {
		right: 0.5rem;
	}

	.article-header__meta {
		flex-direction: column;
		align-items: flex-start;
	}

	.article-author-bio {
		flex-direction: column;
	}
}

@media (max-width: 575.98px) {
	.blog-pagination {
		flex-wrap: wrap;
	}
}
