/* The blog: index, archives and single posts. Markup comes from
   inc/blog.php; the hero reuses .wtc-pagehero and the closing line
   reuses .wtc-newsletter, both in style.css. */

.wtc-blog-main {
	--wtc-slate-deep: #46586a;
	--wtc-slate-soft: #8b99a8;
	--wtc-rule: #e5e1d6;
}

/* The templates' flow layout would put a block gap between sections
   that already carry their own vertical rhythm. */
.wtc-blog-main > *,
.wtc-post > * {
	margin-block: 0;
}

/* ---- Category index -------------------------------------------------- */

.wtc-blog-cats {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem 1.75rem;
	margin-top: clamp(1.75rem, 4vh, 2.5rem);
	padding-top: 1.1rem;
	border-top: 1px solid var(--wtc-rule);
}

/* The blog index has no title block above the index, so the rule that
   separated the two goes with it. */
.wtc-blog-hero--bare {
	padding-top: clamp(0.75rem, 2vh, 1.5rem);
}

.wtc-blog-hero--bare .wtc-blog-cats {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}

.wtc-blog-cats a,
.wtc-card__meta,
.wtc-blog__pager,
.wtc-blog__all,
.wtc-post__eyebrow,
.wtc-post__meta,
.wtc-post__tags {
	font-family: var(--wp--preset--font-family--geist-mono);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wtc-slate-deep);
}

.wtc-blog-cats a {
	display: inline-flex;
	align-items: baseline;
	gap: 0.5rem;
	font-size: 11px;
	text-decoration: none;
	transition: color 200ms ease;
}

.wtc-blog-cats small {
	font-size: 10px;
	color: var(--wtc-slate-soft);
}

.wtc-blog-cats a:hover,
.wtc-blog-cats a[aria-current],
.wtc-blog__pager a:hover,
.wtc-blog__all:hover,
.wtc-post__eyebrow a:hover,
.wtc-post__meta a:hover,
.wtc-post__tags a:hover {
	color: var(--wp--preset--color--contrast);
}

.wtc-blog-cats a[aria-current] {
	text-decoration: underline;
	text-underline-offset: 0.5em;
}

/* ---- Article list ---------------------------------------------------- */

.wtc-blog {
	padding: clamp(1rem, 3vh, 2rem) 0 clamp(3rem, 8vh, 5rem);
}

.wtc-blog__inner {
	max-width: var(--wp--style--global--wide-size, 1340px);
	margin-inline: auto;
	padding-inline: var(--wp--style--root--padding-left, 2rem) var(--wp--style--root--padding-right, 2rem);
}

.wtc-blog__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(2.25rem, 5vh, 3.25rem) clamp(1.5rem, 2.6vw, 2.5rem);
}

.wtc-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.wtc-card__media {
	display: block;
	overflow: hidden;
	aspect-ratio: 16 / 10;
	border-radius: 16px;
	background: var(--wp--preset--color--accent-5);
}

.wtc-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 600ms cubic-bezier(0.2, 0.6, 0.2, 1);
}

/* No lead image: a tile in the site's dot language instead of a hole. */
.wtc-card__media--blank {
	background-image: radial-gradient(circle, #8b99a8 1.2px, transparent 1.6px);
	background-size: 14px 14px;
	background-position: center;
}

.wtc-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1.1rem;
	margin: 1.1rem 0 0.6rem;
	font-size: 11px;
}

.wtc-card__title {
	margin: 0;
	font-size: clamp(1.1875rem, 1.6vw, 1.375rem);
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: -0.01em;
	text-wrap: balance;
	overflow-wrap: anywhere;
}

.wtc-card__title a {
	color: inherit;
	text-decoration: none;
}

/* The whole card is the link's hit area; the title stays its name. */
.wtc-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

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

.wtc-card:has(.wtc-card__title a:focus-visible) {
	outline: 2px solid var(--wtc-slate-deep);
	outline-offset: 6px;
	border-radius: 16px;
}

.wtc-card:hover .wtc-card__media img {
	transform: scale(1.03);
}

.wtc-card:hover .wtc-card__title a {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

/* Lead article: the newest post on the page, set wide. */
.wtc-card--lead {
	gap: 1.5rem;
	margin-bottom: clamp(2.5rem, 6vh, 4rem);
	padding-bottom: clamp(2.5rem, 6vh, 4rem);
	border-bottom: 1px solid var(--wtc-rule);
}

.wtc-card--lead .wtc-card__media {
	border-radius: 24px;
}

.wtc-card--lead .wtc-card__meta {
	margin-top: 0;
}

.wtc-card--lead .wtc-card__title {
	font-size: clamp(1.75rem, 3.2vw, 2.75rem);
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.wtc-card__excerpt {
	margin: 1.1rem 0 0;
	max-width: 52ch;
	color: var(--wp--preset--color--accent-4);
	font-size: 1.0625rem;
	line-height: 1.55;
}

.wtc-card--lead .wtc-pill {
	display: inline-flex;
	margin-top: 1.6rem;
}

/* The pill is decoration over the card-wide link: hovering the card
   plays its sliding dot. */
.wtc-card--lead:hover .wtc-pill::before {
	max-width: 0.625rem;
	margin-right: 0.5rem;
	transform: translateX(0);
}

.wtc-card__copy {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
}

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

@media (min-width: 1000px) {
	.wtc-blog__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.wtc-card--lead {
		display: grid;
		grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
		gap: clamp(2rem, 4vw, 4rem);
		align-items: center;
	}
}

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

.wtc-blog__pager {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 1rem;
	margin-top: clamp(2.5rem, 6vh, 4rem);
	padding-top: 1.35rem;
	border-top: 1px solid var(--wtc-rule);
	font-size: 11px;
}

.wtc-blog__pager a {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	justify-self: start;
	color: inherit;
	text-decoration: none;
	transition: color 200ms ease;
}

.wtc-blog__pager a[rel="next"] {
	justify-self: end;
}

.wtc-blog__pager a[rel="prev"]::before,
.wtc-blog__pager a[rel="next"]::after {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentColor;
	transition: transform 300ms cubic-bezier(0.42, 0, 0.58, 1);
}

.wtc-blog__pager a:hover::before,
.wtc-blog__pager a:hover::after {
	transform: scale(1.6);
}

.wtc-blog__page {
	color: var(--wtc-slate-soft);
	white-space: nowrap;
}

/* "Load more": shown by wtc-blog-more.js, which hides the pager above. */
.wtc-blog__more {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.1rem;
	margin-top: clamp(2.5rem, 6vh, 4rem);
	padding-top: clamp(2rem, 5vh, 3rem);
	border-top: 1px solid var(--wtc-rule);
}

.wtc-blog__pager[hidden],
.wtc-blog__more[hidden] {
	display: none;
}

.wtc-blog__more .wtc-pill[aria-busy="true"] {
	opacity: 0.5;
	pointer-events: none;
}

.wtc-blog__count,
.wtc-blog__latest {
	margin: 0;
	font-family: var(--wp--preset--font-family--geist-mono);
	font-size: 11px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wtc-slate-soft);
}

.wtc-blog__latest {
	text-decoration: none;
	transition: color 200ms ease;
}

.wtc-blog__latest:hover {
	color: var(--wp--preset--color--contrast);
}

/* A loaded page repeats the rhythm: its lead article, ruled off from the grid above. */
.wtc-blog__grid + .wtc-card--lead {
	margin-top: clamp(2.5rem, 6vh, 4rem);
	padding-top: clamp(2.5rem, 6vh, 4rem);
	border-top: 1px solid var(--wtc-rule);
}

/* Loaded cards wait hidden, then fade up as they scroll into view, a row at a time. */
@keyframes wtc-card-in {
	from {
		opacity: 0;
		transform: translateY(36px);
	}
}

.wtc-card[tabindex="-1"]:focus {
	outline: none;
}

.wtc-card--wait {
	opacity: 0;
}

.wtc-card--in {
	animation: wtc-card-in 900ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
	animation-delay: calc(var(--i, 0) * 120ms);
}

@media (prefers-reduced-motion: no-preference) {
	.wtc-blog__more .wtc-pill[aria-busy="true"] {
		animation: wtc-more-busy 900ms ease-in-out infinite alternate;
	}
}

@keyframes wtc-more-busy {
	from {
		opacity: 0.75;
	}

	to {
		opacity: 0.35;
	}
}

.wtc-blog__empty {
	margin: 0;
	color: var(--wp--preset--color--accent-4);
}

/* ---- Single post: header --------------------------------------------- */

.wtc-post__head {
	padding: clamp(2rem, 6vh, 4rem) 0 0;
}

.wtc-post__headinner,
.wtc-post__body,
.wtc-post__tags {
	box-sizing: border-box;
	max-width: calc(46rem + var(--wp--style--root--padding-left, 2rem) + var(--wp--style--root--padding-right, 2rem));
	margin-inline: auto;
	padding-inline: var(--wp--style--root--padding-left, 2rem) var(--wp--style--root--padding-right, 2rem);
}

.wtc-post__eyebrow {
	margin: 0 0 1.1rem;
	font-size: 12px;
}

.wtc-post__eyebrow a,
.wtc-post__meta a,
.wtc-post__tags a {
	color: inherit;
	text-decoration: none;
	transition: color 200ms ease;
}

.wtc-post__head h1 {
	margin: 0 0 1.5rem;
	font-size: clamp(2rem, 4.2vw, 3.25rem);
	font-weight: 500;
	line-height: 1.08;
	letter-spacing: -0.02em;
	text-wrap: balance;
	overflow-wrap: anywhere;
}

.wtc-post__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1.25rem;
	margin: 0;
	padding-top: 1.1rem;
	border-top: 1px solid var(--wtc-rule);
	font-size: 11px;
}

/* ---- Single post: body ----------------------------------------------- */

/* Twelve years of posts: classic-editor HTML, page-builder leftovers
   and block markup all land here, so the rules address plain elements
   rather than any one editor's classes. */
.wtc-post__body {
	padding-top: clamp(2rem, 5vh, 3rem);
	padding-bottom: clamp(2.5rem, 6vh, 4rem);
	font-size: 1.125rem;
	line-height: 1.7;
	overflow-wrap: anywhere;
}

.wtc-post__body > * {
	margin-block: 0 1.35em;
}

.wtc-post__body > *:last-child {
	margin-bottom: 0;
}

.wtc-post__body h1,
.wtc-post__body h2,
.wtc-post__body h3,
.wtc-post__body h4,
.wtc-post__body h5,
.wtc-post__body h6 {
	margin: 2.1em 0 0.7em;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: -0.015em;
	text-wrap: balance;
}

.wtc-post__body h1,
.wtc-post__body h2 { font-size: clamp(1.5rem, 2.4vw, 1.875rem); }
.wtc-post__body h3 { font-size: clamp(1.25rem, 1.9vw, 1.4375rem); }
.wtc-post__body h4,
.wtc-post__body h5,
.wtc-post__body h6 { font-size: 1.125rem; }

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

.wtc-post__body a {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: var(--wtc-slate-soft);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	transition: text-decoration-color 200ms ease;
}

.wtc-post__body a:hover {
	text-decoration-color: currentColor;
}

.wtc-post__body strong,
.wtc-post__body b {
	font-weight: 600;
}

.wtc-post__body ul,
.wtc-post__body ol {
	padding-left: 1.35em;
}

.wtc-post__body li {
	margin-bottom: 0.45em;
}

.wtc-post__body li > ul,
.wtc-post__body li > ol {
	margin: 0.45em 0 0;
}

.wtc-post__body img,
.wtc-post__body video {
	max-width: 100%;
	height: auto;
	border-radius: 12px;
}

.wtc-post__body figure,
.wtc-post__body .wp-caption {
	max-width: 100%;
	margin-inline: 0;
}

/* The classic editor wrote pixel widths onto its caption boxes. */
.wtc-post__body .wp-caption {
	width: auto !important;
}

.wtc-post__body .aligncenter,
.wtc-post__body figure.aligncenter,
.wtc-post__body .wp-block-image.aligncenter {
	display: block;
	margin-inline: auto;
	text-align: center;
}

.wtc-post__body img.aligncenter {
	display: block;
}

.wtc-post__body .alignleft,
.wtc-post__body .alignright {
	float: none;
	margin-inline: 0;
}

.wtc-post__body figcaption,
.wtc-post__body .wp-caption-text,
.wtc-post__body .wp-element-caption {
	margin: 0.75rem 0 0;
	color: var(--wp--preset--color--accent-4);
	font-size: 0.875rem;
	line-height: 1.5;
	text-align: left;
}

.wtc-post__body blockquote {
	margin-inline: 0;
	padding: 0.2em 0 0.2em 1.4em;
	border-left: 1px solid var(--wtc-slate-deep);
	color: var(--wtc-slate-deep);
	font-size: 1.1875rem;
	line-height: 1.55;
}

.wtc-post__body blockquote > :last-child {
	margin-bottom: 0;
}

.wtc-post__body blockquote cite {
	display: block;
	margin-top: 0.75rem;
	font-size: 0.875rem;
	font-style: normal;
}

.wtc-post__body hr {
	height: 0;
	margin-block: 2.5em;
	border: 0;
	border-top: 1px solid var(--wtc-rule);
}

/* Tables scroll inside themselves; the page never side-scrolls. */
.wtc-post__body table {
	display: block;
	width: 100%;
	max-width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	font-size: 0.9375rem;
	line-height: 1.45;
	overflow-wrap: normal;
}

.wtc-post__body th,
.wtc-post__body td {
	padding: 0.7rem 0.9rem 0.7rem 0;
	border: 0;
	border-bottom: 1px solid var(--wtc-rule);
	text-align: left;
	vertical-align: top;
}

.wtc-post__body th {
	font-weight: 600;
}

.wtc-post__body iframe,
.wtc-post__body embed,
.wtc-post__body object {
	max-width: 100%;
	border: 0;
	border-radius: 12px;
}

.wtc-post__body iframe[src*="youtube"],
.wtc-post__body iframe[src*="v.qq.com"],
.wtc-post__body iframe[src*="vimeo"] {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

.wtc-post__body pre {
	padding: 1rem 1.2rem;
	overflow-x: auto;
	border-radius: 12px;
	background: var(--wp--preset--color--accent-5);
	font-family: var(--wp--preset--font-family--geist-mono);
	font-size: 0.875rem;
	line-height: 1.55;
	overflow-wrap: normal;
}

.wtc-post__body .wp-block-columns,
.wtc-post__body .wp-block-gallery {
	gap: 1.25rem;
}

.wtc-post__body .wp-video,
.wtc-post__body .wp-block-embed__wrapper {
	max-width: 100%;
}

/* ---- Single post: footer --------------------------------------------- */

.wtc-post__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.25rem;
	padding-bottom: clamp(2.5rem, 6vh, 4rem);
	font-size: 11px;
}

.wtc-post__tags span {
	color: var(--wtc-slate-soft);
}

.wtc-blog--more {
	padding-top: clamp(2.5rem, 6vh, 4rem);
	border-top: 1px solid var(--wtc-rule);
}

.wtc-blog__head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: clamp(1.5rem, 4vh, 2.25rem);
}

.wtc-blog__head h2 {
	margin: 0;
	font-size: clamp(1.75rem, 3vw, 2.5rem);
	font-weight: 500;
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.wtc-blog__all {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	font-size: 11px;
	text-decoration: none;
	transition: color 200ms ease;
}

.wtc-blog__all::after {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentColor;
}

@media (prefers-reduced-motion: reduce) {
	.wtc-card__media img,
	.wtc-blog__pager a::before,
	.wtc-blog__pager a::after {
		transition: none;
	}

	.wtc-card:hover .wtc-card__media img {
		transform: none;
	}
}

/* Some posts were pasted in with their own typography written inline —
   a typeface, a narrower measure, pixel sizes. The article sets those;
   the post keeps its emphasis and colour. */
.wtc-post__body [style*="font-family"] {
	font-family: inherit !important;
}

.wtc-post__body > div[style*="max-width"] {
	max-width: none !important;
	margin: 0 !important;
	font-size: inherit !important;
	line-height: inherit !important;
	color: inherit !important;
}

.wtc-post__body p[style*="font-size"],
.wtc-post__body span[style*="font-size"],
.wtc-post__body li[style*="font-size"] {
	font-size: inherit !important;
}
