/**
 * Blog — card-grid index, recent-posts sidebar, single post.
 * Loaded on the blog (wc_is_blog()) and on pages with [wc_latest_posts]. Header, eyebrow, lede,
 * title-link hover and the underline input come from editorial.css.
 *
 * @package GeneratePress_Child
 */

/*--------------------------------------------------------------
# Grid
--------------------------------------------------------------*/
/* Two columns beside the sidebar; GP's pagination lands after the wrapper. */
.blog-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-block) var(--editorial-gap);
	padding-block-end: var(--space-block);
}

.blog-grid .blog-card {
	margin: 0;
}

/*--------------------------------------------------------------
# Card
--------------------------------------------------------------*/
.blog-card {
	display: flex;
	flex-direction: column;
}

.blog-card__media {
	display: block;
	aspect-ratio: 4 / 3;
	margin-bottom: var(--space-content);
	overflow: hidden;
	background: var(--editorial-surface);
}

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

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

.blog-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--editorial-space-2xs);
}

.blog-card__eyebrow {
	align-self: flex-start;
	margin: 0;
	font-size: 0.75rem;
	letter-spacing: 0.1em;
	text-decoration: none;
}

.blog-card__eyebrow:is(:hover, :focus-visible) {
	text-decoration: underline;
}

.blog-card :is(h2, h3) {
	margin: 0;
	font-size: var(--editorial-font-size-h4);
}

.blog-card__date {
	color: var(--editorial-muted-text);
	font-size: 0.85rem;
}

.blog-card__excerpt {
	margin: var(--editorial-space-2xs) 0 0;
	font-size: 0.95rem;
	line-height: 1.6;
	color: color-mix(in srgb, currentColor 80%, var(--editorial-soft-bg));
}

/*--------------------------------------------------------------
# Sidebar
--------------------------------------------------------------*/
/* Sticky needs a tall parent: stretch GP's wrapper to the column. */
.wc-blog #right-sidebar .inside-right-sidebar {
	height: 100%;
}

.blog-sidebar {
	position: sticky;
	top: var(--space-content);
	display: flex;
	flex-direction: column;
	gap: var(--space-block);
}

.blog-sidebar__section h2 {
	margin: 0 0 var(--editorial-space-sm);
	padding-bottom: var(--editorial-space-2xs);
	border-bottom: 1px solid var(--editorial-border);
	font-weight: 700;
}

.blog-sidebar__search {
	position: relative;
}

input.blog-sidebar__search-input {
	padding: 0.5em 2.25em 0.5em 0;
	font-size: 1.05rem;
}

.blog-sidebar__search-submit {
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	padding: 0.25em;
	border: 0;
	background: none;
	color: inherit;
	cursor: pointer;
	opacity: 0.7;
}

.blog-sidebar__search-submit:is(:hover, :focus-visible) {
	opacity: 1;
}

.blog-sidebar__recent,
.blog-sidebar__categories {
	margin: 0;
	padding: 0;
	list-style: none;
}

.blog-sidebar__item + .blog-sidebar__item {
	margin-top: var(--editorial-space-sm);
}

/* Recent posts: thumb + title + date rows. */
.blog-sidebar__link {
	display: flex;
	gap: var(--editorial-space-sm);
	align-items: flex-start;
}

.blog-sidebar__thumb {
	flex: 0 0 64px;
	width: 64px;
	height: 64px;
	object-fit: cover;
	background: var(--editorial-surface);
}

.blog-sidebar__text {
	display: flex;
	flex-direction: column;
	gap: 0.2em;
	min-width: 0;
}

.blog-sidebar__item-title {
	font-family: var(--wc-font-serif);
	font-size: 1.05rem;
	line-height: 1.3;
}

.blog-sidebar__date {
	color: var(--editorial-muted-text);
	font-size: 0.8rem;
}

/* Categories: wp_list_categories() markup. */
.blog-sidebar__categories li {
	display: flex;
	justify-content: space-between;
	gap: var(--editorial-space-sm);
	padding: 0.4em 0;
	border-bottom: 1px solid var(--editorial-border);
	font-size: 0.95rem;
}

.blog-sidebar__categories li:last-child {
	border-bottom: 0;
}

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

.blog-sidebar__categories a:is(:hover, :focus-visible) {
	text-decoration: underline;
}

.blog-sidebar__categories li.current-cat > a {
	font-weight: 600;
}

/*--------------------------------------------------------------
# Single post
--------------------------------------------------------------*/
/* Beside a sidebar the column is narrow; align the title with the copy. */
.single-post .entry-header .entry-title {
	margin-left: 0;
	text-align: left;
}

.single-post .entry-meta {
	color: var(--editorial-muted-text);
	font-size: 0.85rem;
}

/* Footer under the post: category line, then previous/next as two cards. */
.single-post footer.entry-meta {
	margin-top: var(--editorial-space-lg);
	padding-top: var(--editorial-space-md);
	border-top: 1px solid var(--editorial-border);
}

/* Category and tags: a small label, then the terms as chips. The
   ", " between GP's tag links are bare text, so the row's font-size is 0
   and each piece sets its own size. */
.single-post footer.entry-meta :is(.cat-links, .tags-links) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin: 0 0 0.75rem;
	/* Wrapped chips line up with the first one, not under the label. */
	padding-left: 6rem;
	font-size: 0;
}

.single-post footer.entry-meta :is(.cat-links, .tags-links) .gp-icon {
	display: none;
}

/* Visible label; the "/ ''" alt text keeps screen readers on GP's own
   hidden "Categories"/"Tags" text instead of reading it twice. */
.single-post footer.entry-meta :is(.cat-links, .tags-links)::before {
	flex: 0 0 5.5rem;
	margin-left: -6rem; /* 5.5rem label + 0.5rem gap = the 6rem indent */
	color: var(--editorial-muted-text);
	font-family: var(--wc-font-sans);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.single-post footer.entry-meta .cat-links::before {
	content: "Category";
	content: "Category" / "";
}

.single-post footer.entry-meta .tags-links::before {
	content: "Tags";
	content: "Tags" / "";
}

.single-post footer.entry-meta :is(.cat-links, .tags-links) a {
	display: inline-flex;
	align-items: center;
	min-height: 2.25rem;
	padding: 0.35rem 0.85rem;
	border: 1px solid var(--editorial-border);
	border-radius: 999px;
	background: var(--editorial-page);
	color: var(--editorial-text);
	font-family: var(--wc-font-sans);
	font-size: 0.85rem;
	line-height: 1.2;
	text-decoration: none;
	transition: border-color 160ms ease, background-color 160ms ease;
}

.single-post footer.entry-meta .cat-links a {
	border-color: var(--editorial-accent-rule);
	color: var(--editorial-accent-text);
	font-weight: 600;
}

.single-post footer.entry-meta :is(.cat-links, .tags-links) a:is(:hover, :focus-visible) {
	border-color: var(--editorial-heading);
	background: var(--editorial-surface);
	color: var(--editorial-heading);
}

/* Phones: label on its own line, bigger tap targets. */
@media ( max-width: 600px ) {
	.single-post footer.entry-meta :is(.cat-links, .tags-links) {
		margin-bottom: 1rem;
		padding-left: 0;
	}

	.single-post footer.entry-meta :is(.cat-links, .tags-links)::before {
		flex-basis: 100%;
		margin: 0;
	}

	.single-post footer.entry-meta :is(.cat-links, .tags-links) a {
		min-height: 2.75rem;
		padding-inline: 1rem;
	}
}

.single-post .post-navigation {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--editorial-space-sm);
	margin-top: var(--editorial-space-md);
}

.single-post .post-navigation :is(.nav-previous, .nav-next) {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin: 0;
	padding: var(--editorial-space-sm) var(--editorial-space-md);
	transition: border-color 160ms ease, background-color 160ms ease;
}

/* "Next" always sits on the right, even when there is no "previous". */
.single-post .post-navigation .nav-next {
	grid-column: 2;
	text-align: right;
	align-items: flex-end;
}

.single-post .post-navigation :is(.nav-previous, .nav-next):is(:hover, :focus-within) {
	border-color: var(--editorial-heading);
	background: var(--editorial-surface);
}

/* Eyebrow (editorial.css), small and tracked. */
.single-post .post-navigation__label {
	margin: 0;
	font-size: 0.75rem;
	letter-spacing: 0.08em;
}

.single-post .post-navigation :is(.prev, .next) {
	display: block;
	padding: 0;
}

.single-post .post-navigation :is(.prev, .next) a {
	color: var(--editorial-heading);
	font-family: var(--wc-font-serif);
	font-size: 1.15rem;
	line-height: 1.3;
	text-decoration: none;
}

/* The link covers the whole card and its focus ring: Cover link in
   editorial.css. */

/* GP's arrow icons; the label carries the arrow now. */
.single-post .post-navigation .gp-icon {
	display: none;
}

@media ( max-width: 600px ) {
	.single-post .post-navigation {
		grid-template-columns: minmax(0, 1fr);
	}

	.single-post .post-navigation .nav-next {
		grid-column: auto;
		text-align: left;
		align-items: flex-start;
	}
}

@media ( max-width: 900px ) {
	.blog-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* GP stacks the sidebar under the content at 768; nothing to stick to then. */
@media ( max-width: 768px ) {
	.blog-sidebar {
		position: static;
		margin-top: var(--space-block);
	}
}
