/* Blog: editorial single post + index. Loaded only on blog views (inc/blog.php).
   Tokens come from design-system.css. */

:root {
	--cr-read: 760px;
}

/* --- Reading progress --- */
.cr-progress {
	position: fixed;
	inset: 0 0 auto;
	height: 4px;
	z-index: 1000;
	pointer-events: none;
}

.cr-progress span {
	display: block;
	height: 100%;
	width: 0;
	background: var(--cr-red);
	transition: width 0.08s linear;
}

/* --- Hero --- */
.cr-post__hero {
	background: var(--cr-ink);
	color: var(--cr-on-dark);
	padding: clamp(48px, 7vw, 96px) var(--cr-gutter) clamp(40px, 5vw, 64px);
}

.cr-post__head {
	max-width: var(--cr-read);
	margin-inline: auto;
}

.cr-post__eyebrow {
	margin-bottom: 14px;
	font: 700 0.8125rem / 1.2 var(--cr-sans);
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--cr-red-type);
}

.cr-post__title {
	font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4.5rem);
	line-height: 1;
	color: #fff;
}

.cr-post__byline {
	margin-top: 18px;
	font-size: 1rem;
	color: var(--cr-on-dark-soft);
}

.cr-post__cover {
	max-width: 1040px;
	margin: clamp(32px, 4vw, 48px) auto 0;
}

.cr-post__cover img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--cr-radius);
}

/* --- Reading column --- */
.cr-post__body {
	max-width: calc(var(--cr-read) + 2 * var(--cr-gutter));
	margin-inline: auto;
	padding: clamp(40px, 5vw, 64px) var(--cr-gutter) 0;
	font-size: 1.15rem;
	line-height: 1.75;
	color: var(--cr-text);
}

.cr-post__body > * + * {
	margin-top: 1.15em;
}

.cr-post__body > p:first-child {
	font-size: 1.3rem;
	line-height: 1.6;
	font-weight: 500;
	color: var(--cr-ink);
}

.cr-post__body h2 {
	position: relative;
	margin-top: 2.2em;
	padding-top: 1.1rem;
	font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem);
	line-height: 1.05;
	color: var(--cr-ink);
	scroll-margin-top: calc(var(--cr-header-h) + 24px);
}

.cr-post__body h2::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 52px;
	height: 4px;
	background: var(--cr-red);
	border-radius: 2px;
}

.cr-post__body h3 {
	margin-top: 1.8em;
	font-size: 1.5rem;
	line-height: 1.15;
	color: var(--cr-ink);
}

.cr-post__body a {
	color: var(--cr-red-deep);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	text-decoration-color: rgba(22, 25, 28, 0.25);
	transition: text-decoration-color 0.15s;
}

.cr-post__body a:hover {
	text-decoration-color: var(--cr-red-deep);
}

.cr-post__body ul,
.cr-post__body ol {
	padding-left: 0;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.cr-post__body ul {
	list-style: none;
}

.cr-post__body ul li {
	position: relative;
	padding-left: 1.9rem;
}

.cr-post__body ul li::before {
	content: "";
	position: absolute;
	left: 0.3rem;
	top: 0.66em;
	width: 8px;
	height: 8px;
	background: var(--cr-red);
	border-radius: 2px;
	transform: rotate(45deg);
}

.cr-post__body ol {
	padding-left: 1.6rem;
}

.cr-post__body ol li::marker {
	font-weight: 800;
	color: var(--cr-red);
}

.cr-post__body img {
	display: block;
	max-width: 100%;
	height: auto;
	max-height: 520px;
	width: auto;
	margin-inline: auto;
	border-radius: var(--cr-radius);
}

.cr-post__body figure {
	margin-inline: 0;
	text-align: center;
}

.cr-post__body figcaption {
	margin-top: 0.7rem;
	font-size: 0.9rem;
	font-style: italic;
	color: var(--cr-muted);
}

.cr-post__body blockquote {
	margin-inline: 0;
	padding: 0.3rem 0 0.3rem 1.5rem;
	border-left: 4px solid var(--cr-red);
	font-size: 1.35rem;
	line-height: 1.5;
	font-weight: 600;
	color: var(--cr-ink);
}

/* Tables: the post wraps each in an overflow-x div; style the table itself. */
.cr-post__body table {
	width: 100%;
	border-collapse: collapse;
	font-size: 1rem;
	line-height: 1.45;
}

.cr-post__body th,
.cr-post__body td {
	padding: 12px 14px;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid var(--cr-line);
}

.cr-post__body thead th {
	background: var(--cr-ink);
	color: #fff;
	font-weight: 700;
}

.cr-post__body tbody tr:nth-child(even) {
	background: var(--cr-mist);
}

/* FAQ accordions: <details class="faq"><summary><h3>Q</h3></summary><p>A</p></details> */
.cr-post__body details.faq {
	border: 1px solid var(--cr-line);
	border-radius: var(--cr-radius);
	background: var(--cr-paper);
}

.cr-post__body details.faq + details.faq {
	margin-top: 10px;
}

.cr-post__body details.faq summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 18px;
	cursor: pointer;
	list-style: none;
}

.cr-post__body details.faq summary::-webkit-details-marker {
	display: none;
}

.cr-post__body details.faq summary::after {
	content: "+";
	flex: 0 0 auto;
	font: 700 1.5rem / 1 var(--cr-sans);
	color: var(--cr-red);
	transition: transform 0.2s var(--cr-ease);
}

.cr-post__body details.faq[open] summary::after {
	transform: rotate(45deg);
}

.cr-post__body details.faq summary h3 {
	margin: 0;
	font: 700 1.1rem / 1.35 var(--cr-sans);
	color: var(--cr-ink);
}

.cr-post__body details.faq > :not(summary) {
	margin: 0;
	padding: 0 18px 18px;
	font-size: 1.05rem;
}

/* --- Table of contents (wide screens only, shown by blog.js while the body is in view) --- */
.cr-toc {
	display: none;
}

@media (min-width: 1200px) {
	.cr-toc:not([hidden]) {
		display: block;
		position: fixed;
		top: calc(var(--cr-header-h) + 48px);
		left: max(24px, calc((100vw - var(--cr-read)) / 2 - 290px));
		width: 230px;
		max-height: 66vh;
		overflow-y: auto;
		padding-left: 16px;
		border-left: 2px solid var(--cr-line);
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.25s ease;
		z-index: 40;
	}

	.cr-toc.is-visible {
		opacity: 1;
		pointer-events: auto;
	}
}

.cr-toc__label {
	margin-bottom: 12px;
	font: 700 0.6875rem / 1.2 var(--cr-sans);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--cr-red);
}

.cr-toc ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cr-toc a {
	display: block;
	margin-left: -18px;
	padding: 5px 0 5px 16px;
	border-left: 2px solid transparent;
	font-size: 0.85rem;
	line-height: 1.4;
	color: var(--cr-muted);
	text-decoration: none;
	transition: color 0.15s, border-color 0.15s;
}

.cr-toc a:hover {
	color: var(--cr-ink);
}

.cr-toc a.is-active {
	color: var(--cr-ink);
	font-weight: 700;
	border-left-color: var(--cr-red);
}

/* --- Author card --- */
.cr-post__author {
	max-width: calc(var(--cr-read) + 2 * var(--cr-gutter));
	margin: clamp(48px, 6vw, 72px) auto 0;
	padding-inline: var(--cr-gutter);
}

.cr-author {
	display: flex;
	gap: 22px;
	align-items: center;
	padding: 22px 24px;
	background: var(--cr-mist);
	border: 1px solid var(--cr-line);
	border-left: 4px solid var(--cr-red);
	border-radius: var(--cr-radius);
	color: inherit;
	text-decoration: none;
	transition: transform 0.18s var(--cr-ease), box-shadow 0.18s var(--cr-ease);
}

.cr-author:hover {
	transform: translateY(-3px);
	box-shadow: var(--cr-shadow);
}

.cr-author__logo {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 104px;
	height: 104px;
	background: var(--cr-ink);
	border-radius: var(--cr-radius);
}

.cr-author__logo img {
	width: 76px;
	height: auto;
}

.cr-author__text {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.cr-author__eyebrow {
	font: 700 0.75rem / 1.2 var(--cr-sans);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--cr-red);
}

.cr-author__name {
	font: 800 1.5rem / 1.1 var(--cr-display);
	color: var(--cr-ink);
}

.cr-author__bio {
	font-size: 0.975rem;
	line-height: 1.55;
	color: var(--cr-text);
}

.cr-author__go {
	margin-top: 6px;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--cr-red-deep);
	transition: transform 0.18s var(--cr-ease);
}

.cr-author:hover .cr-author__go {
	transform: translateX(4px);
}

@media (max-width: 560px) {
	.cr-author {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* --- Post cards (index + Keep reading) --- */
.cr-post-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
	gap: 22px;
}

.cr-card-post {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--cr-paper);
	border: 1px solid var(--cr-line);
	border-radius: var(--cr-radius);
	color: inherit;
	text-decoration: none;
	transition: transform 0.18s var(--cr-ease), box-shadow 0.18s var(--cr-ease);
}

.cr-card-post:hover {
	transform: translateY(-4px);
	box-shadow: var(--cr-shadow);
}

.cr-card-post__img img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
	object-fit: cover;
}

.cr-card-post__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 8px;
	padding: 22px;
}

.cr-card-post__kind {
	font: 700 0.75rem / 1.2 var(--cr-sans);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--cr-red);
}

.cr-card-post__title {
	font: 800 1.55rem / 1.08 var(--cr-display);
	color: var(--cr-ink);
}

.cr-card-post__meta {
	font-size: 0.9rem;
	color: var(--cr-muted);
}

.cr-card-post__go {
	margin-top: auto;
	padding-top: 8px;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--cr-red-deep);
}

.cr-related {
	margin-top: clamp(56px, 7vw, 96px);
	padding: clamp(48px, 6vw, 80px) 0;
	background: var(--cr-mist);
}

.cr-related__inner,
.cr-blog-list__inner {
	max-width: var(--cr-max);
	margin-inline: auto;
	padding-inline: var(--cr-gutter);
}

.cr-related__title {
	margin-bottom: 24px;
	font-size: clamp(2rem, 1.5rem + 1.8vw, 3rem);
	color: var(--cr-ink);
}

/* --- Blog index --- */
.cr-blog-hero {
	background: var(--cr-ink);
	color: var(--cr-on-dark);
	padding: clamp(56px, 8vw, 112px) var(--cr-gutter);
}

.cr-blog-hero__inner {
	max-width: var(--cr-max);
	margin-inline: auto;
}

.cr-blog-hero__title {
	max-width: 14ch;
	font-size: clamp(2.75rem, 1.8rem + 4vw, 5.25rem);
	color: #fff;
}

.cr-blog-hero__lede {
	max-width: 56ch;
	margin-top: 18px;
	font-size: 1.15rem;
	color: var(--cr-on-dark-soft);
}

.cr-blog-list {
	padding-block: clamp(48px, 6vw, 88px);
}

.cr-blog-list__empty {
	font-size: 1.1rem;
	color: var(--cr-muted);
}

.cr-blog-list .pagination,
.cr-blog-list .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 36px;
}

.cr-blog-list .page-numbers {
	padding: 8px 14px;
	border: 1px solid var(--cr-line);
	border-radius: var(--cr-radius);
	color: var(--cr-ink);
	text-decoration: none;
}

.cr-blog-list .page-numbers.current {
	background: var(--cr-ink);
	border-color: var(--cr-ink);
	color: #fff;
}

/* --- Quote band --- */
.cr-blog-cta {
	padding: clamp(48px, 6vw, 88px) var(--cr-gutter);
}

.cr-related + .cr-blog-cta {
	padding-top: 0;
	background: linear-gradient(var(--cr-mist) 50%, transparent 50%);
}

.cr-blog-cta__card {
	max-width: 1040px;
	margin-inline: auto;
	padding: clamp(32px, 5vw, 56px);
	background: var(--cr-ink);
	border-radius: var(--cr-radius);
	color: var(--cr-on-dark);
}

.cr-blog-cta__eyebrow {
	margin-bottom: 12px;
	font: 700 0.8125rem / 1.2 var(--cr-sans);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--cr-red-type);
}

.cr-blog-cta__title {
	font-size: clamp(2rem, 1.4rem + 2.2vw, 3.25rem);
	color: #fff;
}

.cr-blog-cta__text {
	max-width: 56ch;
	margin-top: 14px;
	color: var(--cr-on-dark-soft);
}

.cr-blog-cta__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 26px;
}
