/*
 * Blog index, archives, search results, single posts.
 * Loaded after theme.css on those views only (see oakhive_enqueue_assets).
 * main.css is compiled Tailwind with only the utilities the landing page uses,
 * so all blog geometry lives here under .oh-blog / .oh-post-card.
 */

.oh-blog__head {
	padding-bottom: 3.5rem;
	border-bottom: 1px solid var(--rule);
}

.oh-blog__intro p + p {
	margin-top: 1em;
}

.oh-blog__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2.5rem 2rem;
	margin-top: 3.5rem;
}

@media (min-width: 680px) {
	.oh-blog__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1080px) {
	.oh-blog__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 3rem 2.5rem;
	}
}

.oh-post-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

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

.oh-post-card__media {
	overflow: hidden;
	border-radius: 1rem;
	border: 1px solid var(--rule);
	aspect-ratio: 16 / 9;
	background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.oh-post-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.oh-post-card__link:hover .oh-post-card__media img {
	transform: scale(1.03);
}

.oh-post-card__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	padding-top: 1.25rem;
}

.oh-post-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.oh-post-card__title {
	margin-top: 0.85rem;
	font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.6rem);
	line-height: 1.2;
	letter-spacing: -0.015em;
	transition: color 300ms ease;
}

.oh-post-card__link:hover .oh-post-card__title {
	color: var(--coral-ink);
}

.oh-post-card__excerpt {
	margin-top: 0.75rem;
	font-size: 1rem;
	line-height: 1.6;
}

.oh-post-card__more {
	margin-top: auto;
	padding-top: 1.25rem;
	color: var(--coral-ink);
}

/* Pagination (WordPress core markup) */
.oh-blog__pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.oh-blog__pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	height: 2.5rem;
	padding: 0 0.9rem;
	border: 1px solid var(--rule);
	border-radius: 999px;
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--ink);
	text-decoration: none;
}

.oh-blog__pagination .page-numbers.current {
	background: var(--ink);
	color: var(--ground);
	border-color: var(--ink);
}

.oh-blog__pagination .page-numbers.dots {
	border: 0;
}

.oh-blog__pagination .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
}

/* Single post: featured image and body images */
/*
 * Single post.
 * One reading column (--oh-measure, about 66 characters of 18px Inter) holds the header, the body,
 * the contents list below 1280px and the closing block, so every left and right edge lines up. Only
 * the featured image runs wider. At 1280px and up the contents list moves into the left gutter and
 * stays in view while reading.
 */
.oh-post {
	--oh-measure: 38rem;
	--oh-post-wide: 52rem;
}

.oh-post ::selection {
	background: color-mix(in srgb, var(--coral) 28%, transparent);
}

.oh-post__head {
	max-width: var(--oh-measure);
	margin-inline: auto;
}

.oh-post__head h1 {
	text-wrap: balance;
}

.oh-post__standfirst {
	margin-top: 1.75rem;
	font-size: 1.1875rem;
	line-height: 1.6;
	text-wrap: pretty;
}

/* Separated by space on a phone, where the line wraps; by a dot once it fits on one line. */
.oh-post__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem 1.25rem;
	margin-top: 1.75rem;
	line-height: 1.6;
}

@media (min-width: 640px) {
	.oh-post__meta {
		gap: 0.375rem 0;
	}

	.oh-post__meta > * + *::before {
		content: "\00B7";
		margin-inline: 0.625rem;
		color: var(--ink-faint);
	}
}

.oh-post__meta a {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: var(--rule-strong);
	text-underline-offset: 4px;
	transition: color 300ms ease, text-decoration-color 300ms ease;
}

.oh-post__meta a:hover {
	color: var(--ink);
	text-decoration-color: var(--coral);
}

.oh-post__hero {
	max-width: var(--oh-post-wide);
	margin: 2.5rem auto 0;
	overflow: hidden;
	border-radius: 1.25rem;
	border: 1px solid var(--rule);
}

.oh-post__hero img {
	display: block;
	width: 100%;
	height: auto;
}

.oh-textpage .legal-prose img {
	max-width: 100%;
	height: auto;
	border-radius: 1rem;
}

/* Body: one measure for every block (theme.css caps p and li at 33em, lists at 33em of 16px). */
.oh-post__body {
	max-width: var(--oh-measure);
	margin: 3rem auto 0;
}

.oh-post .legal-prose :is(p, li, ul, ol) {
	max-width: none;
}

.oh-post__body > :first-child {
	margin-top: 0;
}

.oh-post__body p {
	text-wrap: pretty;
}

.oh-post__body h2 {
	margin-top: 3.5rem;
	text-wrap: balance;
	scroll-margin-top: 7rem;
}

.oh-post__body h3 {
	margin-top: 2.25rem;
	text-wrap: balance;
}

.oh-post__body h2 + p,
.oh-post__body h3 + p {
	margin-top: 0.875rem;
}

.oh-post__body :is(ul, ol) {
	margin-top: 1.25rem;
}

.oh-post__body li {
	margin-top: 0.875rem;
	padding-left: 0.25rem;
}

.oh-post__body strong {
	color: var(--ink-heading);
	font-weight: 600;
}

/* Tables: scroll sideways on a phone (with an edge shadow while there is more), never squeeze. */
.oh-table {
	margin-top: 1.75rem;
	overflow-x: auto;
	border: 1px solid var(--rule);
	border-radius: 0.875rem;
	background:
		linear-gradient(to right, var(--ground) 40%, transparent) left / 2rem 100% no-repeat local,
		linear-gradient(to left, var(--ground) 40%, transparent) right / 2rem 100% no-repeat local,
		radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--ink) 16%, transparent), transparent) left / 0.75rem 100% no-repeat scroll,
		radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--ink) 16%, transparent), transparent) right / 0.75rem 100% no-repeat scroll;
}

.oh-table:focus-visible {
	outline: 2px solid var(--oh-focus, var(--ink));
	outline-offset: 3px;
}

.oh-post .legal-prose .oh-table table {
	margin-top: 0;
	min-width: 28rem;
	font-size: 0.9375rem;
	line-height: 1.5;
	font-variant-numeric: tabular-nums;
}

.oh-post .legal-prose .oh-table table:has(tr > :nth-child(4)) {
	min-width: 36rem;
}

.oh-post .legal-prose .oh-table :is(th, td) {
	padding: 0.75rem 1rem;
}

.oh-post .legal-prose .oh-table th {
	background: color-mix(in srgb, var(--ink) 5%, transparent);
	color: var(--ink-heading);
	font-weight: 600;
}

.oh-post .legal-prose .oh-table tbody td:first-child {
	color: var(--ink-heading);
	font-weight: 600;
}

.oh-post .legal-prose .oh-table tbody tr:last-child td {
	border-bottom: 0;
}

/* Contents list: a collapsed box above the body until 1280px, then a sticky rail in the gutter. */
.oh-toc {
	max-width: var(--oh-measure);
	margin: 2.5rem auto 0;
}

.oh-toc__box {
	border: 1px solid var(--rule);
	border-radius: 0.875rem;
}

.oh-toc__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 3rem;
	padding: 0 1.25rem;
	list-style: none;
	cursor: pointer;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

.oh-toc__summary::-webkit-details-marker {
	display: none;
}

.oh-toc__summary::after {
	content: "";
	width: 0.5rem;
	height: 0.5rem;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: translateY(-25%) rotate(45deg);
	transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.oh-toc__box[open] .oh-toc__summary::after {
	transform: translateY(25%) rotate(-135deg);
}

.oh-toc__list {
	margin: 0;
	padding: 0 1.25rem 1rem;
	list-style: none;
}

.oh-toc__list a {
	display: block;
	padding: 0.5rem 0;
	font-size: 0.9375rem;
	line-height: 1.4;
	color: var(--ink-muted);
	text-decoration: none;
	transition: color 200ms ease;
}

.oh-toc__list a:hover,
.oh-toc__list a[aria-current="true"] {
	color: var(--ink-heading);
}

@media (min-width: 1280px) {
	.oh-post__layout {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, var(--oh-measure)) minmax(0, 1fr);
		column-gap: 3rem;
		margin-top: 3rem;
	}

	.oh-post__body {
		grid-column: 2;
		grid-row: 1;
		margin: 0;
	}

	.oh-toc {
		grid-column: 1;
		grid-row: 1;
		justify-self: end;
		align-self: start;
		position: sticky;
		top: 7rem;
		width: 15rem;
		max-height: calc(100vh - 9rem);
		margin: 0;
		overflow-y: auto;
	}

	.oh-toc__box {
		border: 0;
	}

	/* Keeps the list visible on the rail even before (or without) the script opening the box. */
	.oh-toc__box::details-content {
		content-visibility: visible;
		display: block;
	}

	.oh-toc__summary {
		min-height: 0;
		padding: 0 0 0.875rem;
		cursor: default;
		pointer-events: none;
	}

	.oh-toc__summary::after {
		display: none;
	}

	.oh-toc__list {
		padding: 0;
		border-left: 1px solid var(--rule);
	}

	.oh-toc__list a {
		padding: 0.4375rem 0 0.4375rem 1rem;
		font-size: 0.875rem;
	}

	.oh-toc__list a[aria-current="true"] {
		box-shadow: inset 1px 0 0 var(--coral);
	}
}

/* Closing block and related posts */
.oh-post__end {
	max-width: var(--oh-measure);
	margin: 4.5rem auto 0;
	padding-top: 2.5rem;
	border-top: 1px solid var(--rule);
}

.oh-post__end-line {
	max-width: 26ch;
	font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.75rem);
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.015em;
	color: var(--ink-heading);
	text-wrap: balance;
}

.oh-post__end-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem 2rem;
	align-items: center;
	margin-top: 1.75rem;
}

.oh-related {
	margin-top: 6rem;
	padding-top: 3.5rem;
	border-top: 1px solid var(--rule);
}

.oh-related__title {
	font-size: var(--oh-display-3);
	line-height: 1.15;
	letter-spacing: -0.015em;
}

.oh-related .oh-blog__grid {
	margin-top: 2.5rem;
}
