/* Blog Archive & Single Post Styles */

/*
 * Scope note: this file is enqueued only on blog contexts
 * (is_home / single post / category / tag / author / date), so it never
 * reaches WooCommerce templates. Selectors stay under .blog-* wrappers.
 */

.blog-archive,
.blog-single {
	/* Readable measure for long-form blog surfaces. Resolves to the shared
	   --fc-reading-measure token so the blog single column and the standard
	   inner page / legal surface stay on one width; the local alias keeps the
	   blog rules readable and gives the package a single override point. */
	--fc-blog-measure: var(--fc-reading-measure, 54rem);
}

/* ---------------------------------------------------------------------
 * Shared inner-page head: breadcrumb -> H1 -> supporting copy.
 * Mirrors the shop archive head scale, using neutral/copper tokens only.
 * ------------------------------------------------------------------- */

.blog-archive .fcsu-page-breadcrumb,
.blog-single .fcsu-page-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	gap: var(--fc-space-1);
	align-items: center;
	margin: 0 0 var(--fc-space-2);
	color: var(--fc-text-muted);
	font-size: 0.86rem;
	line-height: 1.4;
	overflow-wrap: anywhere;
}

.blog-archive .fcsu-page-breadcrumb a,
.blog-single .fcsu-page-breadcrumb a {
	color: var(--fc-text);
	font-weight: 700;
	text-decoration: none;
}

.blog-breadcrumb__separator {
	color: var(--fc-brand-accent);
}

.blog-archive__header,
.blog-single__header {
	margin: 0 0 var(--fc-space-4);
	text-align: left;
}

/*
 * The archive head sits in the full-width container, so its copy is capped
 * at the content measure. The single post head already lives inside the
 * centred reading column and spans it, keeping one shared left edge with
 * the media and the content card.
 */
.blog-archive__header {
	max-width: var(--fc-container-content, 800px);
}

.blog-archive {
	padding-block: 0 var(--fc-space-4);
}

/*
 * Global inner-page H1 standard, shared with the shop archive title:
 * brand primary colour, 3rem desktop, 1.05 line-height, left aligned.
 * Copper stays an accent for meta, breadcrumb separators and eyebrows.
 */
.blog-archive__title,
.blog-single__title {
	margin: 0;
	color: var(--fc-brand-primary);
	font-size: 3rem;
	line-height: 1.05;
	overflow-wrap: anywhere;
	text-wrap: balance;
}

.blog-archive__description {
	margin-top: var(--fc-space-2);
	color: var(--fc-text-muted);
	font-size: 1.0625rem;
	line-height: 1.7;
	overflow-wrap: break-word;
}

.blog-archive__description > :first-child {
	margin-top: 0;
}

.blog-archive__description > :last-child {
	margin-bottom: 0;
}

.blog-archive__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: var(--fc-space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Blog Card (Inspired by home-blog-card but without green) */
.blog-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	border: 1px solid var(--fc-border, #ded8ce);
	border-radius: var(--fc-radius-lg, 22px);
	background: var(--fc-surface, #fff);
	transition: transform 160ms ease, box-shadow 160ms ease;
}

.blog-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.blog-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	color: inherit;
	text-decoration: none;
}

.blog-card__media {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--fc-background, #f7f2ea);
	flex-shrink: 0;
}

.blog-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 240ms ease;
}

.blog-card:hover .blog-card__image {
	transform: scale(1.035);
}

.blog-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, rgba(0,0,0,0.08), rgba(193,118,88,0.12));
}

.blog-card__content {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: var(--fc-space-2);
}

.blog-card__meta {
	margin: 0 0 0.5rem;
	color: var(--fc-brand-accent, #c17658);
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
}

.blog-card__title {
	margin: 0;
	color: var(--fc-text, #20231f);
	font-size: 1.15rem;
	line-height: 1.35;
	overflow-wrap: break-word;
}

.blog-card__excerpt {
	margin: 0.75rem 0 0;
	color: var(--fc-text-muted, #686e68);
	font-size: 0.9rem;
	line-height: 1.55;
	overflow-wrap: break-word;
}

.blog-card__more {
	margin-top: auto;
	padding-top: 1rem;
	color: var(--fc-text, #20231f);
	font-size: 0.86rem;
	font-weight: 700;
}

/* Empty State */
.blog-empty {
	text-align: center;
	padding-block: var(--fc-space-5);
	color: var(--fc-text-muted);
}

/* Pagination (reusing WooCommerce style structure) */
.blog-pagination {
	margin-top: var(--fc-space-5);
	text-align: center;
}

.blog-pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: var(--fc-space-1);
	justify-content: center;
}

.blog-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.75rem;
	min-height: 2.75rem;
	padding: var(--fc-space-1);
	border: 1px solid var(--fc-border);
	border-radius: var(--fc-radius-pill);
	color: var(--fc-text);
	background: var(--fc-surface);
	text-decoration: none;
	transition: all 160ms ease;
}

.blog-pagination .page-numbers.current {
	border-color: var(--fc-brand-accent);
	color: var(--fc-surface);
	background: var(--fc-brand-accent);
}

.blog-pagination a.page-numbers:hover {
	border-color: var(--fc-text);
	color: var(--fc-text);
	background: var(--fc-background);
}

/* ---------------------------------------------------------------------
 * Single post
 * ------------------------------------------------------------------- */

/*
 * The reading column is centred in the container; the text inside it stays
 * left aligned. Breadcrumb, H1, meta, media and the content card all share
 * this column, so they line up on the same left edge.
 */
.blog-single {
	width: min(100%, var(--fc-blog-measure));
	margin-inline: auto;
	padding-block: 0 var(--fc-space-4);
}

.blog-single__header {
	margin-bottom: var(--fc-space-3);
}

.blog-single__breadcrumb {
	margin-bottom: var(--fc-space-2);
}

.blog-single__meta {
	margin: var(--fc-space-2) 0 0;
	color: var(--fc-brand-accent);
	font-size: 0.86rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	overflow-wrap: break-word;
}

.blog-single__meta a {
	color: inherit;
	text-decoration: none;
}

.blog-single__meta a:hover {
	text-decoration: underline;
}

.blog-single__media {
	margin: 0 0 var(--fc-space-3);
	overflow: hidden;
	border: 1px solid var(--fc-border);
	border-radius: var(--fc-radius-lg, 22px);
	background: var(--fc-background);
}

.blog-single__image {
	display: block;
	width: 100%;
	height: auto;
}

/* Content surface: white card on the cream page background. */
.blog-single__content {
	padding: var(--fc-space-4);
	border: 1px solid var(--fc-border);
	border-radius: var(--fc-radius-lg, 22px);
	color: var(--fc-text);
	background: var(--fc-surface);
	font-size: 1.0625rem;
	line-height: 1.75;
	/* break-word keeps prose natural while still splitting long URLs. */
	overflow-wrap: break-word;
}

.blog-single__content > :first-child {
	margin-top: 0;
}

.blog-single__content > :last-child {
	margin-bottom: 0;
}

.blog-single__content p {
	margin: 0 0 1.5em;
}

.blog-single__content a {
	color: var(--fc-text);
	text-decoration-color: var(--fc-brand-accent);
	text-underline-offset: 0.15em;
}

.blog-single__content h2,
.blog-single__content h3,
.blog-single__content h4 {
	color: var(--fc-text);
	margin: 1.75em 0 0.75em;
	line-height: 1.25;
	overflow-wrap: break-word;
	text-wrap: balance;
}

.blog-single__content h2 {
	font-size: 1.6rem;
}

.blog-single__content h3 {
	font-size: 1.3rem;
}

.blog-single__content h4 {
	font-size: 1.1rem;
}

.blog-single__content ul,
.blog-single__content ol {
	margin: 0 0 1.5em;
	padding-inline-start: 1.35em;
}

.blog-single__content li {
	margin-bottom: 0.5em;
}

.blog-single__content blockquote {
	margin: 1.75em 0;
	padding: var(--fc-space-2) var(--fc-space-3);
	border: 1px solid var(--fc-border);
	border-inline-start: 3px solid var(--fc-brand-accent);
	border-radius: var(--fc-radius-sm);
	background: var(--fc-background);
	font-style: italic;
}

.blog-single__content blockquote > :last-child {
	margin-bottom: 0;
}

/* Keep every embedded surface inside the card. */
.blog-single__content img,
.blog-single__content video,
.blog-single__content iframe,
.blog-single__content object,
.blog-single__content embed {
	max-width: 100%;
	height: auto;
}

.blog-single__content img {
	border-radius: var(--fc-radius-sm);
}

.blog-single__content figure,
.blog-single__content .wp-block-image {
	margin-inline: 0;
	max-width: 100%;
}

.blog-single__content figcaption {
	margin-top: 0.5rem;
	color: var(--fc-text-muted);
	font-size: 0.86rem;
}

.blog-single__content .alignwide,
.blog-single__content .alignfull {
	width: 100%;
	max-width: 100%;
	margin-inline: 0;
}

.blog-single__content pre,
.blog-single__content .wp-block-code {
	max-width: 100%;
	overflow-x: auto;
	padding: var(--fc-space-2);
	border: 1px solid var(--fc-border);
	border-radius: var(--fc-radius-sm);
	background: var(--fc-background);
	font-size: 0.9rem;
	line-height: 1.6;
	white-space: pre;
	word-break: normal;
	overflow-wrap: normal;
}

.blog-single__content code {
	overflow-wrap: anywhere;
}

.blog-single__content .wp-block-table,
.blog-single__content .wp-block-embed,
.blog-single__content .wp-block-embed__wrapper {
	max-width: 100%;
	overflow-x: auto;
}

.blog-single__content table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
}

.blog-single__content th,
.blog-single__content td {
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--fc-border);
	text-align: start;
	overflow-wrap: anywhere;
}

/* Post Navigation */
.blog-navigation {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--fc-space-2);
	margin-top: var(--fc-space-5);
	padding-top: var(--fc-space-4);
	border-top: 1px solid var(--fc-border);
}

.blog-nav-link {
	display: flex;
	flex-direction: column;
	min-width: 0;
	text-decoration: none;
	color: inherit;
	padding: var(--fc-space-2);
	border: 1px solid var(--fc-border);
	border-radius: var(--fc-radius-md);
	background: var(--fc-surface);
	transition: border-color 160ms ease, background-color 160ms ease;
}

.blog-nav-link:hover {
	border-color: var(--fc-brand-accent);
	background: var(--fc-background);
}

.blog-nav-link__label {
	color: var(--fc-text-muted);
	font-size: 0.8rem;
	text-transform: uppercase;
	margin-bottom: 0.25rem;
}

.blog-nav-link__title {
	color: var(--fc-text);
	font-size: 1rem;
	font-weight: 700;
	margin: 0;
	overflow-wrap: anywhere;
}

.blog-nav-link--prev { text-align: left; }
.blog-nav-link--next { text-align: right; }

/* Related Posts */
.blog-related {
	margin-top: var(--fc-space-5);
	padding-top: var(--fc-space-4);
	border-top: 1px solid var(--fc-border);
}

.blog-related__title {
	margin: 0 0 var(--fc-space-3);
	color: var(--fc-text);
	font-size: 1.5rem;
}

/*
 * Related posts sit inside the narrower reading column, so the shared
 * auto-fill track would leave a stray card on its own row.
 */
@media (min-width: 769px) {
	.blog-related .blog-archive__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* Focus visibility (copper, matching the storefront accent). */
.blog-archive a:focus-visible,
.blog-single a:focus-visible,
.blog-pagination a:focus-visible {
	outline: 2px solid var(--fc-brand-accent);
	outline-offset: 3px;
}

/*
 * Desktop editorial canvas.
 *
 * The single post shares the archive's outer canvas from 769px up instead of
 * sitting in its own centred 54rem column, so moving between the archive and
 * a post no longer shifts the page. The reading measure is not lost: it moves
 * inward onto the prose blocks, which keep the shared --fc-reading-measure.
 */
@media (min-width: 769px) {
	.blog-single {
		--fc-blog-measure: 100%;
		width: 100%;
		margin-inline: 0;
	}

	.blog-single__content > :where(p, h2, h3, h4, ul, ol, blockquote) {
		max-width: var(--fc-reading-measure, 54rem);
	}
}

/* Adjustments for smaller screens */
@media (max-width: 860px) {
	.blog-archive__title,
	.blog-single__title {
		font-size: 2.25rem;
	}
}

@media (max-width: 768px) {
	.blog-navigation {
		grid-template-columns: 1fr;
	}
	.blog-nav-link--next {
		text-align: left;
	}
	.blog-card__image {
		transition: none; /* Disable hover transform on mobile */
	}
	.blog-single__content {
		padding: var(--fc-space-3);
		font-size: 1rem;
	}
}

@media (max-width: 480px) {
	.blog-archive__grid {
		grid-template-columns: minmax(0, 1fr);
	}
	.blog-single__content {
		padding: var(--fc-space-2);
	}
	.blog-single__content blockquote {
		padding: var(--fc-space-2);
	}
}

@media (max-width: 359px) {
	.blog-archive__title,
	.blog-single__title {
		font-size: 1.85rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.blog-card,
	.blog-card__image,
	.blog-nav-link {
		transition: none;
	}
	.blog-card:hover {
		transform: none;
	}
	.blog-card:hover .blog-card__image {
		transform: none;
	}
}
