/*
 * Blog (Figma "Resources - Blog", "Resources - Blog_Post" and their mobile frames): the sidebar,
 * post cards, the article, page links (also used by the Videos section's episode list), the default
 * call-to-action band on blog pages and the 404 page.
 */

.blog-page {
	padding-block: 60px var(--space-m);
}

.blog-layout {
	display: grid;
	grid-template-columns: 368px minmax(0, 1fr);
	gap: 16px;
	align-items: start;
}

/* Sidebar: title, search, categories. */
.blog-side {
	display: grid;
	grid-template-areas: "title" "search" "cats";
	align-content: start;
	gap: 16px;
	padding-top: 16px;
}

/* On desktop the sidebar stays in view while the posts scroll. */
@media (min-width: 1024px) {
	.blog-side {
		position: sticky;
		top: 8px;
	}
}

.blog-side__title {
	grid-area: title;
	margin: 0;
	font-family: var(--f-display);
	font-size: var(--t-display);
	line-height: var(--lh-display);
	font-weight: 500;
}

.blog-side__search {
	grid-area: search;
}

.blog-side__cats {
	grid-area: cats;
	margin-top: 16px;
}

.blog-side__cats ul {
	display: grid;
	gap: 32px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.blog-side__cats a {
	font-family: var(--f-display);
	font-size: var(--t-title-s);
	line-height: var(--lh-title-s);
	font-weight: 500;
	color: var(--c-text-2);
	text-decoration: none;
	text-underline-offset: 4px;
}

.blog-side__cats a:hover,
.blog-side__cats a[aria-current] {
	color: var(--c-text);
	text-decoration: underline;
}

/* Category drop-down (under 1024px). */
.blog-side__menu {
	grid-area: menu;
	display: none;
	position: relative;
}

.blog-side__menu summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-height: 44px;
	padding: 10px 12px 10px 4px;
	border-bottom: 1px solid var(--c-text);
	list-style: none;
	cursor: pointer;
}

.blog-side__menu summary::-webkit-details-marker {
	display: none;
}

.blog-side__menu summary .icon {
	width: 24px;
	height: 24px;
	color: var(--c-accent);
	stroke-width: 2.5;
	transition: transform 0.2s;
}

.blog-side__menu[open] summary .icon {
	transform: rotate(180deg);
}

.blog-side__menu nav {
	position: absolute;
	z-index: 20;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	border: 1px solid var(--c-line);
	background: var(--c-light);
	box-shadow: 0 8px 24px rgb(0 0 0 / 0.08);
}

.blog-side__menu ul {
	margin: 0;
	padding: 8px 0;
	list-style: none;
}

.blog-side__menu a {
	display: block;
	padding: 10px 16px;
	text-decoration: none;
	text-underline-offset: 3px;
}

.blog-side__menu a:hover,
.blog-side__menu a[aria-current] {
	text-decoration: underline;
}

/* Search box (sidebar and 404). */
.blog-search {
	display: flex;
	align-items: center;
	width: 272px;
	max-width: 100%;
	height: 40px;
	border: 1px solid var(--c-line);
	background: var(--c-light);
}

.blog-search:focus-within {
	outline: 2px solid var(--c-text);
	outline-offset: 2px;
}

.blog-search input {
	flex: 1;
	min-width: 0;
	height: 100%;
	padding: 0 0 0 16px;
	border: 0;
	background: transparent;
	font-size: var(--t-body-s);
	line-height: var(--lh-body-s);
	font-weight: 500;
	appearance: none;
}

.blog-search input:focus {
	outline: none;
}

.blog-search input::placeholder {
	color: var(--c-muted);
	opacity: 1;
}

.blog-search input::-webkit-search-cancel-button {
	display: none;
}

.blog-search button {
	display: grid;
	place-items: center;
	flex: none;
	width: 50px;
	height: 100%;
	padding: 0;
	border: 0;
	background: none;
	color: var(--c-muted);
}

.blog-search button:hover {
	color: var(--c-text);
}

.blog-search .icon {
	width: 18px;
	height: 18px;
}

/* Post cards. */
.blog-main__note {
	margin-bottom: 32px;
	font-size: var(--t-body-s);
	line-height: var(--lh-body-s);
	color: var(--c-text-2);
}

.blog-main__empty {
	color: var(--c-text-2);
}

.post-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 40px 16px;
}

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

.post-card__media {
	aspect-ratio: 368 / 160;
	margin-bottom: 32px;
	overflow: hidden;
	background: var(--c-beige);
}

.post-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Visually the date line comes before the title; in the page order the title comes first. */
.post-card__meta {
	order: 1;
	margin-bottom: 8px;
	font-size: var(--t-sub);
	line-height: var(--lh-sub);
	font-weight: 500;
	color: var(--c-text-2);
}

.post-card__title {
	order: 2;
	font-size: var(--t-title-s);
	line-height: var(--lh-title-s);
}

.post-card__title a {
	text-decoration: none;
	text-underline-offset: 4px;
}

.post-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.post-card:hover .post-card__title a {
	text-decoration: underline;
}

.post-card__title a:focus-visible {
	outline: none;
}

.post-card:has(a:focus-visible) {
	outline: 2px solid var(--c-text);
	outline-offset: 4px;
}

/* Page links (Figma "Pagination"). */
.pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin-top: 60px;
	font-size: var(--t-body-s);
	line-height: var(--lh-body-s);
}

.pagination__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pagination .page-numbers,
.pagination__step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 32px;
	min-height: 34px;
	padding: 8px 12px;
	border-radius: 8px;
	color: var(--c-text);
	text-decoration: none;
}

.pagination a:hover {
	background: var(--c-beige);
}

.pagination .page-numbers.current {
	border-radius: 0;
	background: var(--c-text);
	color: var(--c-light);
}

.pagination .page-numbers.dots {
	padding-inline: 16px;
	font-weight: 700;
}

.pagination__step .icon {
	width: 16px;
	height: 16px;
}

.pagination__step.is-disabled {
	opacity: 0.5;
}

/* Article. */
.article__trail {
	margin-bottom: 32px;
	font-size: var(--t-sub);
	line-height: var(--lh-sub);
	font-weight: 500;
	color: var(--c-text-2);
}

.article__trail ol {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.article__trail li + li::before {
	content: ">" / "";
	margin-right: 4px;
}

.article__trail a {
	text-decoration: none;
}

.article__trail a:hover {
	text-decoration: underline;
}

.article__image {
	aspect-ratio: 752 / 300;
	margin-bottom: 32px;
	overflow: hidden;
	background: var(--c-beige);
}

.article__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.article__date {
	margin-bottom: 8px;
	font-size: var(--t-sub);
	line-height: var(--lh-sub);
	font-weight: 500;
	color: var(--c-text-2);
}

.article__title {
	margin-bottom: 8px;
	font-size: var(--t-title-l);
	line-height: var(--lh-title-l);
}

/* Article text, including posts brought over from Shopify. */
.article .article__content {
	line-height: var(--lh-body);
	color: var(--c-text-2);
}

.article .article__content > * + * {
	margin-top: 20px;
}

.article .article__content :is(h2, h3, h4, h5, h6) {
	margin-top: 32px;
	font-size: var(--t-title-s);
	line-height: var(--lh-title-s);
	color: var(--c-text);
}

.article .article__content :is(h2, h3, h4, h5, h6) + * {
	margin-top: 16px;
}

.article__content a {
	color: var(--c-text);
}

.article__content a:hover {
	color: var(--c-accent);
}

.article__content strong,
.article__content b {
	font-weight: 600;
	color: var(--c-text);
}

.article__content iframe,
.article__content video {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border: 0;
}

/* Old posts lay out photos and text side by side in tables: equal columns, so photos keep their size. */
.article__content table {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
}

.article__content :is(td, th) {
	padding: 0;
	vertical-align: top;
	text-align: left;
}

.article__content :is(td, th) + :is(td, th) {
	padding-left: 24px;
}

.article__content tr + tr > * {
	padding-top: 20px;
}

.article__content :is(td, th) > * + * {
	margin-top: 20px;
}

.article__content blockquote {
	padding-left: 20px;
	border-left: 2px solid var(--c-line);
}

/* Default call-to-action band, until the cta_band section exists. */
.blog-cta__inner {
	display: grid;
	justify-items: center;
	gap: 32px;
	text-align: center;
}

.blog-cta__heading {
	max-width: 805px;
	font-size: var(--t-title);
	line-height: var(--lh-title);
}

.blog-cta__buttons {
	justify-content: center;
}

/* 404 */
.not-found {
	display: grid;
	justify-items: start;
	gap: 32px;
}

.not-found__title {
	font-size: var(--t-display);
	line-height: var(--lh-display);
}

.not-found__text {
	color: var(--c-text-2);
}

@media (max-width: 1023px) {
	.blog-page {
		padding-top: 16px;
	}

	.blog-layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 32px;
	}

	.blog-side {
		grid-template-columns: auto minmax(0, 1fr);
		grid-template-areas: "title menu" "search search";
		align-items: center;
		column-gap: 16px;
		padding-top: 0;
	}

	.blog-side__title {
		font-size: var(--t-title);
		line-height: var(--lh-title);
	}

	.blog-side__menu {
		display: block;
	}

	.blog-side__cats {
		display: none;
	}

	.blog-side__search {
		width: 100%;
	}
}

@media (max-width: 767px) {
	.post-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 32px;
	}

	.post-card__media {
		margin-bottom: 16px;
	}

	.pagination {
		margin-top: 40px;
	}

	.pagination__step {
		padding-inline: 12px;
	}

	.pagination__step span {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.article__image {
		aspect-ratio: 328 / 300;
	}

	/* Mobile keeps the article title at 40/56. */
	.article__title {
		font-size: var(--t-display);
		line-height: var(--lh-display);
	}

	.article__content :is(table, tbody, tr, td, th) {
		display: block;
		width: auto;
	}

	.article__content :is(td, th) + :is(td, th) {
		padding: 20px 0 0;
	}

	.blog-cta__buttons,
	.blog-cta__buttons .btn {
		width: 100%;
	}
}
