/*
 * Insights blog layer — listing (/blog/), archives, single posts.
 *
 * Listing/archives reproduce the frozen export design-exports/blog/
 * (ad-hoc values mapped onto --piu-* tokens; the export's glass chrome
 * is replaced by the built header/footer). Singles are spec-built.
 * FULLY FLAT LIGHT — zero glass on any blog surface.
 */

/* ------------------------------------------------------------------ */
/* Listing header (export: .head / .sub / .filters)                    */
/* ------------------------------------------------------------------ */

.page-blog .blog-head {
	padding: 80px 0 44px;
}

.page-blog .blog-head__sub {
	color: var(--piu-ink-muted);
	max-width: 56ch;
	margin: 24px 0 0;
}

/* Quiet archive breadcrumb — the second explicit escape back to Insights. */
.page-blog .blog-breadcrumb {
	margin: 0 0 16px;
}

.page-blog .blog-breadcrumb a {
	color: var(--piu-meridian-deep);
	font-size: 14px;
	line-height: 20px;
	text-decoration: none;
}

.page-blog .blog-breadcrumb a:hover {
	text-decoration: underline;
}

/* Archive H1 sits at the H2 display scale — the full 60px H1 read oversized. */
.page-blog .blog-archive .blog-head h1 {
	font-size: 38px;
	line-height: 46px;
}

@media (max-width: 640px) {
	.page-blog .blog-archive .blog-head h1 {
		font-size: 28px;
		line-height: 36px;
	}
}

.page-blog .blog-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 32px;
}

.page-blog .blog-filters__chip {
	font-family: var(--piu-font-mono);
	font-size: 12px;
	line-height: 18px;
	letter-spacing: 0.03em;
	color: var(--piu-meridian-deep);
	background: color-mix(in srgb, var(--piu-meridian) 6%, transparent);
	border: 1px solid color-mix(in srgb, var(--piu-meridian) 28%, transparent);
	border-radius: 999px;
	padding: 7px 14px;
	text-decoration: none;
	transition: background-color 150ms ease, color 150ms ease;
}

.page-blog .blog-filters__chip:hover {
	text-decoration: none;
	background: color-mix(in srgb, var(--piu-meridian) 12%, transparent);
}

.page-blog .blog-filters__chip.is-on {
	background: var(--piu-ink);
	border-color: var(--piu-ink);
	color: var(--piu-white);
}

/* ------------------------------------------------------------------ */
/* Card grid (export: .sec .g3)                                        */
/* ------------------------------------------------------------------ */

.page-blog .blog-list {
	padding: 12px 0 88px;
}

.page-blog .blog-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	margin-top: 56px;
}

@media (max-width: 1024px) {
	.page-blog .blog-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 640px) {
	.page-blog .blog-grid {
		grid-template-columns: 1fr;
	}
}

/* Post card (export: .pcard) — flat, stretched-link, standard lift.   */

.page-blog .post-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--piu-white);
	border: 1px solid var(--piu-border);
	border-radius: var(--piu-radius-card);
	overflow: hidden;
	transition: transform 180ms ease, border-color 180ms ease;
}

.page-blog .post-card:hover {
	transform: translateY(-6px);
	border-color: rgba(28, 44, 60, 0.14);
}

.page-blog .post-card:has(.post-card__link:focus-visible) {
	outline: 2px solid var(--piu-meridian);
	outline-offset: 2px;
}

.page-blog .post-card__thumb {
	position: relative;
	aspect-ratio: 16 / 9;
	background: linear-gradient(135deg, var(--piu-horizon), var(--piu-border));
	border-bottom: 1px solid var(--piu-border);
}

.page-blog .post-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Flat category chip — never glass on blog surfaces. */
.page-blog .post-card__cat {
	position: absolute;
	left: 16px;
	top: 16px;
	font-family: var(--piu-font-mono);
	font-size: 12px;
	line-height: 18px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--piu-meridian-deep);
	background: var(--piu-white);
	border: 1px solid var(--piu-border);
	border-radius: 6px;
	padding: 4px 9px;
}

.page-blog .post-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 22px 22px 24px;
}

.page-blog .post-card__title {
	font-family: var(--piu-font-sans);
	font-size: 19px;
	line-height: 26px;
	font-weight: 600;
}

.page-blog .post-card__link {
	color: var(--piu-ink);
	text-decoration: none;
}

.page-blog .post-card__link:hover {
	text-decoration: none;
}

/* Stretched link: the whole card is the click target. */
.page-blog .post-card__link::after {
	content: '';
	position: absolute;
	inset: 0;
}

.page-blog .post-card__link:focus-visible {
	outline: none; /* the ring is drawn on the card via :has() above */
}

.page-blog .post-card__excerpt {
	font-size: 14px;
	line-height: 20px;
	color: var(--piu-ink-muted);
	margin-top: 10px;
}

.page-blog .post-card__meta {
	margin-top: auto;
	padding-top: 18px;
	font-family: var(--piu-font-mono);
	font-size: 12px;
	line-height: 18px;
	letter-spacing: 0.03em;
	color: var(--piu-ink-muted);
}

/* ------------------------------------------------------------------ */
/* the_posts_pagination() emits <h2 class="screen-reader-text"> for its label.
   The global stylesheet only defines .visually-hidden, so scope the clip here —
   this keeps the "Insights pagination" heading screen-reader-only instead of
   rendering as a visible display H2. */
.page-blog .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Pagination (the_posts_pagination) — chip language of the export      */
/* ------------------------------------------------------------------ */

.page-blog .pagination {
	margin-top: 56px;
}

.page-blog .pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
}

.page-blog .pagination .page-numbers {
	font-family: var(--piu-font-mono);
	font-size: 12px;
	line-height: 18px;
	letter-spacing: 0.03em;
	color: var(--piu-meridian-deep);
	background: var(--piu-white);
	border: 1px solid var(--piu-border);
	border-radius: var(--piu-radius);
	padding: 7px 14px;
	text-decoration: none;
}

.page-blog .pagination a.page-numbers:hover {
	text-decoration: none;
	background: var(--piu-horizon);
}

/* Current page: ink chip, not a link (WP renders a <span>). */
.page-blog .pagination .page-numbers.current {
	background: var(--piu-ink);
	border-color: var(--piu-ink);
	color: var(--piu-white);
}

/* ------------------------------------------------------------------ */
/* Empty state — calm, centered, honest                                */
/* ------------------------------------------------------------------ */

.page-blog .blog-empty {
	text-align: center;
	padding: 64px 0;
}

.page-blog .blog-empty__line {
	font-size: 21px;
	line-height: 28px;
	font-weight: 600;
	margin-top: 12px;
}

/* ------------------------------------------------------------------ */
/* Listing CTA band (export: .ctab)                                    */
/* ------------------------------------------------------------------ */

.page-blog .blog-cta {
	padding: 96px 0;
	text-align: center;
}

.page-blog .piu-tick--center {
	margin-left: auto;
	margin-right: auto;
}

.page-blog .blog-cta .piu-eyebrow {
	margin-bottom: 16px;
}

.page-blog .blog-cta__actions {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 16px;
	margin-top: 40px;
}

/* ------------------------------------------------------------------ */
/* Archive extras                                                      */
/* ------------------------------------------------------------------ */

.page-blog .blog-archive__count {
	color: var(--piu-ink-muted);
	margin-top: 20px;
}

/* ------------------------------------------------------------------ */
/* Single post — one 720px reading column, left-aligned                */
/* ------------------------------------------------------------------ */

.page-blog .post-single__col {
	max-width: 720px;
}

.page-blog .post-single__header {
	padding-top: 96px;
}

.page-blog .post-single__header h1 {
	overflow-wrap: break-word;
}

.page-blog .post-single__meta {
	color: var(--piu-ink-muted);
	margin-top: 20px;
}

.page-blog .post-single__hero {
	margin: 40px 0 0;
}

.page-blog .post-single__hero img {
	width: 100%;
	height: auto;
	border-radius: var(--piu-radius-card);
	border: 1px solid var(--piu-border);
}

/* ------------------------------------------------------------------ */
/* .post-content — legacy-tolerant typography (harvested posts)        */
/* Renders immediately; never behind a reveal.                         */
/* ------------------------------------------------------------------ */

.page-blog .post-content {
	margin-top: 48px;
	overflow-wrap: break-word;
}

.page-blog .post-content > * {
	max-width: 100%;
}

.page-blog .post-content p {
	margin: 0 0 24px;
}

.page-blog .post-content h2 {
	margin: 48px 0 16px;
}

.page-blog .post-content h3 {
	margin: 40px 0 12px;
}

.page-blog .post-content h4,
.page-blog .post-content h5,
.page-blog .post-content h6 {
	font-family: var(--piu-font-sans);
	font-weight: 600;
	margin: 32px 0 12px;
}

.page-blog .post-content h4 {
	font-size: 20px;
	line-height: 28px;
}

.page-blog .post-content h5 {
	font-size: 17px;
	line-height: 24px;
}

.page-blog .post-content h6 {
	font-size: 14px;
	line-height: 20px;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

/* In-content links are ALWAYS underlined — never color alone. */
.page-blog .post-content a {
	color: var(--piu-meridian-deep);
	text-decoration: underline;
	overflow-wrap: anywhere;
}

.page-blog .post-content ul,
.page-blog .post-content ol {
	margin: 0 0 24px;
	padding-left: 28px;
}

.page-blog .post-content li + li {
	margin-top: 8px;
}

.page-blog .post-content ul ul,
.page-blog .post-content ul ol,
.page-blog .post-content ol ul,
.page-blog .post-content ol ol {
	margin: 8px 0 0;
}

.page-blog .post-content blockquote {
	border-left: 2px solid var(--piu-meridian);
	padding: 4px 0 4px 20px;
	margin: 32px 0;
	color: var(--piu-ink); /* not italic, not gray */
}

.page-blog .post-content blockquote p:last-child {
	margin-bottom: 0;
}

.page-blog .post-content img {
	max-width: 100%;
	height: auto;
	border-radius: var(--piu-radius);
}

.page-blog .post-content figure {
	margin: 32px 0;
}

.page-blog .post-content figure img {
	margin: 0;
}

.page-blog .post-content figcaption {
	font-family: var(--piu-font-mono);
	font-size: 12px;
	line-height: 18px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--piu-ink-muted);
	margin-top: 10px;
}

/* Wide legacy tables scroll inside their own box — never break layout. */
.page-blog .post-content table {
	display: block;
	width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	margin: 32px 0;
	font-size: 15px;
	line-height: 22px;
}

.page-blog .post-content th,
.page-blog .post-content td {
	border: 1px solid var(--piu-border);
	padding: 10px 14px;
	text-align: left;
	vertical-align: top;
}

.page-blog .post-content th {
	background: var(--piu-horizon);
	font-weight: 600;
}

.page-blog .post-content code {
	font-family: var(--piu-font-mono);
	font-size: 14px;
	background: var(--piu-horizon);
	border: 1px solid var(--piu-border);
	border-radius: 2px;
	padding: 2px 6px;
}

.page-blog .post-content pre {
	font-family: var(--piu-font-mono);
	font-size: 14px;
	line-height: 22px;
	background: var(--piu-horizon);
	border: 1px solid var(--piu-border);
	border-radius: var(--piu-radius);
	padding: 20px;
	overflow-x: auto;
	margin: 32px 0;
}

.page-blog .post-content pre code {
	background: none;
	border: 0;
	padding: 0;
	font-size: inherit;
}

.page-blog .post-content hr {
	border: 0;
	border-top: 1px solid var(--piu-border);
	margin: 48px 0;
}

/* Flagged legacy embeds: constrained responsive, never overflow. */
.page-blog .post-content iframe {
	max-width: 100%;
	width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
	border: 0;
	margin: 32px 0;
}

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

.page-blog .post-single__footer {
	margin-top: 64px;
	padding-bottom: 96px;
}

.page-blog .post-single__terms {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.page-blog .post-single__nav {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-top: 40px;
}

@media (max-width: 640px) {
	.page-blog .post-single__nav {
		grid-template-columns: 1fr;
	}
}

.page-blog .post-single__nav-card {
	display: block;
	padding: 20px;
	text-decoration: none;
}

.page-blog .post-single__nav-card:hover {
	text-decoration: none;
}

.page-blog .post-single__nav-label {
	color: var(--piu-meridian-deep);
}

.page-blog .post-single__nav-title {
	display: block;
	font-size: 17px;
	line-height: 24px;
	font-weight: 600;
	color: var(--piu-ink);
	margin-top: 8px;
}

.page-blog .post-single__nav-card--next {
	text-align: right;
}

.page-blog .post-single__back {
	margin-top: 40px;
}

/* Single CTA — restrained, the page's one primary CTA. */
.page-blog .blog-single-cta {
	padding: 64px 0;
}

.page-blog .blog-single-cta h3 {
	margin-top: 12px;
}

.page-blog .blog-single-cta__action {
	margin-top: 24px;
}

/* ------------------------------------------------------------------ */
/* Mobile rhythm                                                       */
/* ------------------------------------------------------------------ */

@media (max-width: 640px) {
	.page-blog .blog-head {
		padding: 56px 0 32px;
	}

	.page-blog .blog-list {
		padding-bottom: 56px;
	}

	.page-blog .blog-cta {
		padding: 64px 0;
	}

	.page-blog .post-single__header {
		padding-top: 56px;
	}

	.page-blog .post-single__footer {
		padding-bottom: 56px;
	}
}

/* ================================================================== */
/* Single-post marginalia — sticky share rail (L) + interactive TOC (R) */
/* Mobile-first: one column; rails become an inline row + a disclosure. */
/* Reading column (720px) position/width identical in with-TOC and      */
/* no-TOC variants (grid is left-aligned, center track fixed).          */
/* ================================================================== */

.page-blog .post-single__grid {
	display: grid;
	grid-template-columns: minmax(0, 720px);
	justify-content: start;
}

/* Desktop-only rails: hidden until the 3/2-column grid engages. */
.page-blog .post-single__share--rail,
.page-blog .post-single__toc--rail {
	display: none;
}

/* Anchor offset so heading targets clear the 72px sticky header. */
.page-blog .post-content h2 {
	scroll-margin-top: calc(72px + 24px);
}

/* ---- Share group (shared button styling, both variants) ---- */
.page-blog .post-single__share {
	gap: 4px;
}

.page-blog .post-single__share--inline {
	display: flex;
	margin-top: 20px;
}

.page-blog .post-single__share-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 999px;
	color: var(--piu-ink);
	text-decoration: none;
	cursor: pointer;
	transition: color 160ms ease, background-color 160ms ease;
}

.page-blog .post-single__share-btn:hover,
.page-blog .post-single__share-btn:focus-visible {
	color: var(--piu-meridian);
	background: var(--piu-glass-chip);
}

.page-blog .post-single__share-btn:focus-visible {
	outline: 2px solid var(--piu-meridian);
	outline-offset: 2px;
}

.page-blog .post-single__share-ico {
	display: inline-flex;
}

/* Copy: swap link glyph -> check on success. */
.page-blog .post-single__ico--check {
	display: none;
}

.page-blog .post-single__share-btn.is-copied .post-single__ico:not(.post-single__ico--check) {
	display: none;
}

.page-blog .post-single__share-btn.is-copied .post-single__ico--check {
	display: block;
	color: var(--piu-meridian);
}

/* "Link copied" tooltip-label (also an aria-live region). */
.page-blog .post-single__copy-tip {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	white-space: nowrap;
	padding: 4px 8px;
	border-radius: var(--piu-radius);
	background: var(--piu-ink);
	color: var(--piu-white);
	font-size: 11px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 160ms ease;
	z-index: 5;
}

.page-blog .post-single__share-btn.is-copied .post-single__copy-tip {
	opacity: 1;
}

/* ---- TOC (shared) ---- */
.page-blog .post-single__toc-head {
	color: var(--piu-ink-muted);
	margin: 0 0 12px;
}

.page-blog .post-single__toc-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.page-blog .post-single__toc-link {
	display: block;
	padding: 6px 0 6px 16px;
	color: var(--piu-ink-muted);
	font-size: 14px;
	line-height: 20px;
	text-decoration: none;
	transition: color 160ms ease;
}

.page-blog .post-single__toc-link:hover {
	color: var(--piu-ink);
	text-decoration: underline;
}

.page-blog .post-single__toc-link[aria-current='true'] {
	color: var(--piu-meridian-deep);
}

/* ---- TOC disclosure (mobile) ---- */
.page-blog .post-single__toc--inline {
	margin: 8px 0 4px;
	border: 1px solid var(--piu-border);
	border-radius: var(--piu-radius);
	background: var(--piu-white);
}

.page-blog .post-single__toc-summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 14px 16px;
	color: var(--piu-ink-muted);
	cursor: pointer;
	list-style: none;
}

.page-blog .post-single__toc-summary::-webkit-details-marker {
	display: none;
}

.page-blog .post-single__toc-summary:focus-visible {
	outline: 2px solid var(--piu-meridian);
	outline-offset: -2px;
}

.page-blog .post-single__toc-chevron {
	flex: none;
	transition: transform 160ms ease;
}

.page-blog .post-single__toc--inline[open] .post-single__toc-chevron {
	transform: rotate(180deg);
}

.page-blog .post-single__toc--inline .post-single__toc-list {
	padding: 0 16px 12px;
}

/* ================================================================== */
/* >= 1200px — engage the marginalia grid                              */
/* ================================================================== */
@media (min-width: 1200px) {
	.page-blog .post-single__grid {
		grid-template-columns: 56px 720px;
		column-gap: 40px;
	}

	.page-blog .post-single__grid--with-toc {
		grid-template-columns: 56px 720px minmax(0, 280px);
	}

	/* Align the rail tops with the post content (the header's 96px padding-top
	   pushes the article down, so the rails need the same top offset on load),
	   and leave a matching gap at the end so the sticky rails don't butt against
	   the footer once scrolled all the way down. */
	.page-blog .post-single__share--rail,
	.page-blog .post-single__toc--rail {
		margin-top: 96px;
		margin-bottom: 96px;
	}

	/* Swap which share/TOC variant is live (display:none removes the other
	   from the a11y tree entirely). */
	.page-blog .post-single__share--inline,
	.page-blog .post-single__toc--inline {
		display: none;
	}

	.page-blog .post-single__share--rail {
		display: flex;
		flex-direction: column;
		align-self: start;
		position: sticky;
		top: calc(72px + 24px);
		padding: 6px;
		background: var(--piu-white);
		border: 1px solid var(--piu-border);
		border-radius: 999px;
		box-shadow: 0 8px 28px rgba(28, 44, 60, 0.06);
	}

	.page-blog .post-single__toc--rail {
		display: block;
		align-self: start;
		position: sticky;
		top: calc(72px + 24px);
	}

	.page-blog .post-single__toc-scroll {
		position: relative;
		max-height: calc(100vh - 72px - 96px);
		overflow-y: auto;
		border-left: 1px solid var(--piu-border);
		scrollbar-width: thin;
		scrollbar-color: var(--piu-border) transparent;
	}

	.page-blog .post-single__toc-scroll::-webkit-scrollbar {
		width: 6px;
	}

	.page-blog .post-single__toc-scroll::-webkit-scrollbar-thumb {
		background: var(--piu-border);
		border-radius: 3px;
	}

	/* Sliding active indicator — overlays the left rule, transform-only. */
	.page-blog .post-single__toc-indicator {
		position: absolute;
		left: -1px;
		top: 0;
		width: 2px;
		height: 0;
		background: var(--piu-meridian);
		transform: translateY(0);
		transition: transform 200ms ease, height 200ms ease;
		will-change: transform;
	}
}

/* ================================================================== */
/* Reduced motion — states still change, nothing animates              */
/* ================================================================== */
@media (prefers-reduced-motion: reduce) {
	.page-blog .post-single__share-btn,
	.page-blog .post-single__copy-tip,
	.page-blog .post-single__toc-link,
	.page-blog .post-single__toc-chevron,
	.page-blog .post-single__toc-indicator {
		transition: none;
	}
}
