/*
 * Blog: index / archives header, filters, single post typography, table of
 * contents, share, author box, post navigation, related posts, and the
 * block-editor (Gutenberg) content styles. Loaded on blog views only.
 * Colours, fonts and radius come from the global design tokens.
 */

/* ---- Index / archive header ---------------------------------------- */

.pbd-blog-header {
	display: grid;
	gap: 16px;
	margin-bottom: 20px;
}

@media (min-width: 768px) {
	.pbd-blog-header {
		grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
		align-items: end;
	}
}

.pbd-blog-header .pbd-page-title {
	margin-bottom: 4px;
}

.pbd-blog-header__intro {
	margin: 0;
	color: var(--pbd-ink-soft);
}

.pbd-blog-search {
	display: flex;
	gap: 8px;
}

.pbd-blog-search input[type="search"] {
	flex: 1;
	min-width: 0;
}

.pbd-blog-filters {
	margin-bottom: 24px;
}

.pbd-blog-filters .pbd-chips {
	display: flex;
	flex-wrap: nowrap;
	gap: 8px;
	margin: 0;
	padding: 2px 0 6px;
	overflow-x: auto;
	list-style: none;
	scrollbar-width: thin;
}

.pbd-blog-filters .pbd-chip {
	white-space: nowrap;
}

.pbd-blog-filters .pbd-chip.is-active {
	border-color: var(--pbd-brand);
	background: var(--pbd-brand);
	color: var(--pbd-on-brand);
}

/* ---- Breadcrumb ----------------------------------------------------- */

.pbd-blog-breadcrumb ol {
	display: flex;
	flex-wrap: wrap;
	gap: 2px 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pbd-blog-breadcrumb li + li::before {
	content: "/";
	margin: 0 8px;
	color: var(--pbd-muted);
}

.pbd-blog-breadcrumb li[aria-current] span {
	overflow-wrap: anywhere;
}

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

.pbd-single {
	max-width: calc(820px + (var(--pbd-gutter) * 2));
}

.pbd-article__title {
	margin-bottom: 8px;
	font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
	line-height: 1.2;
}

.pbd-article__media {
	margin: 16px 0 24px;
}

/* The image box is as wide as the column, so its height is known up front. */
.pbd-article__media img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.pbd-article__media figcaption {
	margin-top: 6px;
	color: var(--pbd-muted);
	font-size: 0.8125rem;
	text-align: center;
}

.pbd-article__footer {
	display: grid;
	gap: 16px;
	margin-top: 32px;
	padding-top: 20px;
	border-top: 1px solid var(--pbd-line);
}

.pbd-article__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
}

.pbd-article__tags a {
	padding: 4px 12px;
	border: 1px solid var(--pbd-line);
	border-radius: 999px;
	color: var(--pbd-ink-soft);
	font-size: 0.8125rem;
	text-decoration: none;
}

.pbd-article__tags a:hover {
	border-color: var(--pbd-brand);
	color: var(--pbd-brand);
}

/* ---- Table of contents --------------------------------------------- */

.pbd-toc {
	margin: 0 0 28px;
	border: 1px solid var(--pbd-line);
	border-radius: var(--pbd-radius);
	background: var(--pbd-tint);
}

.pbd-toc summary {
	padding: 12px 16px;
	font-weight: 700;
	cursor: pointer;
}

.pbd-toc ol {
	margin: 0;
	padding: 0 16px 14px 36px;
}

.pbd-toc li {
	padding: 2px 0;
}

.pbd-toc__l3 {
	margin-inline-start: 16px;
	font-size: 0.9375rem;
}

.pbd-toc a {
	color: var(--pbd-ink);
	text-decoration: none;
}

.pbd-toc a:hover {
	color: var(--pbd-brand);
	text-decoration: underline;
}

/* Headings jump below the sticky header. */
.pbd-entry__content :is(h2, h3, h4) {
	scroll-margin-top: calc(var(--pbd-header-h) + 16px);
}

/* ---- Share ---------------------------------------------------------- */

.pbd-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
}

.pbd-share__label {
	font-weight: 700;
}

.pbd-share ul {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pbd-share a,
.pbd-share__copy {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 40px;
	min-height: 40px;
	padding: 0 12px;
	border: 1px solid var(--pbd-line);
	border-radius: 999px;
	background: var(--pbd-surface);
	color: var(--pbd-ink);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.pbd-share a:hover,
.pbd-share__copy:hover {
	border-color: var(--pbd-brand);
	color: var(--pbd-brand);
}

/* ---- Author box ----------------------------------------------------- */

.pbd-author {
	display: flex;
	gap: 16px;
	margin: 32px 0;
	padding: 20px;
	border: 1px solid var(--pbd-line);
	border-radius: var(--pbd-radius-lg);
	background: var(--pbd-surface);
}

.pbd-author__avatar {
	flex: 0 0 72px;
	width: 72px;
	height: 72px;
	border-radius: 50%;
}

.pbd-author__name {
	margin: 0 0 4px;
	font-family: var(--pbd-font-display);
	font-size: 1.125rem;
	font-weight: 600;
}

.pbd-author__name a {
	color: var(--pbd-ink);
	text-decoration: none;
}

.pbd-author__bio {
	margin: 0;
	color: var(--pbd-ink-soft);
}

/* ---- Previous / next ------------------------------------------------ */

.post-navigation .nav-links {
	display: grid;
	gap: 12px;
	margin-bottom: 32px;
}

@media (min-width: 600px) {
	.post-navigation .nav-links {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.post-navigation a {
	display: block;
	height: 100%;
	padding: 14px 16px;
	border: 1px solid var(--pbd-line);
	border-radius: var(--pbd-radius);
	background: var(--pbd-surface);
	color: var(--pbd-ink);
	text-decoration: none;
}

.post-navigation a:hover {
	border-color: var(--pbd-brand);
}

.post-navigation .nav-next {
	text-align: end;
}

.pbd-postnav__label {
	display: block;
	color: var(--pbd-muted);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.pbd-postnav__title {
	display: block;
	font-weight: 600;
	overflow-wrap: anywhere;
}

/* ---- Related posts -------------------------------------------------- */

.pbd-related-posts {
	margin: 40px 0;
}

.pbd-related-posts > h2 {
	margin-bottom: 16px;
}

/* ---- Content (Gutenberg + classic) ---------------------------------- */

.pbd-entry__content {
	font-size: 1.0625rem;
	line-height: 1.75;
	overflow-wrap: break-word;
}

.pbd-entry__content > * {
	max-width: 100%;
}

.pbd-entry__content h2 {
	margin: 2em 0 0.6em;
}

.pbd-entry__content h3 {
	margin: 1.6em 0 0.5em;
}

.pbd-entry__content :is(h4, h5, h6) {
	margin: 1.4em 0 0.4em;
}

.pbd-entry__content p,
.pbd-entry__content ul,
.pbd-entry__content ol,
.pbd-entry__content figure,
.pbd-entry__content table,
.pbd-entry__content pre,
.pbd-entry__content blockquote {
	margin-block: 0 1.25em;
}

.pbd-entry__content ul,
.pbd-entry__content ol {
	padding-inline-start: 1.4em;
}

.pbd-entry__content li + li {
	margin-top: 0.3em;
}

.pbd-entry__content a {
	color: var(--pbd-link, var(--pbd-brand));
	text-decoration: underline;
	text-underline-offset: 0.18em;
}

.pbd-entry__content img,
.pbd-entry__content video {
	max-width: 100%;
	height: auto;
}

.pbd-entry__content figure {
	margin-inline: 0;
}

.pbd-entry__content figcaption,
.wp-element-caption {
	margin-top: 6px;
	color: var(--pbd-muted);
	font-size: 0.875rem;
	text-align: center;
}

.pbd-entry__content blockquote,
.wp-block-quote {
	margin-inline: 0;
	padding: 4px 0 4px 20px;
	border-inline-start: 4px solid var(--pbd-brand);
	color: var(--pbd-ink-soft);
	font-family: var(--pbd-font-display);
	font-size: 1.15em;
	font-style: italic;
}

.pbd-entry__content blockquote cite,
.wp-block-quote cite {
	display: block;
	margin-top: 8px;
	color: var(--pbd-muted);
	font-family: var(--pbd-font-ui);
	font-size: 0.875rem;
	font-style: normal;
}

.wp-block-pullquote {
	padding: 24px 0;
	border-block: 3px solid var(--pbd-brand);
	text-align: center;
}

.wp-block-pullquote blockquote {
	border: 0;
	padding: 0;
}

.pbd-entry__content table,
.wp-block-table table {
	display: block;
	width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	font-size: 0.9375rem;
}

.pbd-entry__content th,
.pbd-entry__content td {
	padding: 10px 12px;
	border: 1px solid var(--pbd-line);
	text-align: start;
}

.pbd-entry__content thead th {
	background: var(--pbd-tint);
	font-weight: 700;
}

.pbd-entry__content :is(pre, code, kbd, samp) {
	font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
	font-size: 0.9em;
}

.pbd-entry__content code {
	padding: 2px 6px;
	border-radius: 4px;
	background: var(--pbd-tint);
}

.pbd-entry__content pre {
	padding: 16px;
	overflow-x: auto;
	border: 1px solid var(--pbd-line);
	border-radius: var(--pbd-radius);
	background: var(--pbd-tint);
	line-height: 1.55;
}

.pbd-entry__content pre code {
	padding: 0;
	background: none;
}

.pbd-entry__content hr,
.wp-block-separator {
	margin: 2em auto;
	border: 0;
	border-top: 1px solid var(--pbd-line);
}

.pbd-entry__content .wp-block-button__link {
	border-radius: var(--pbd-btn-radius);
	background: var(--pbd-btn-bg, var(--pbd-brand));
	color: var(--pbd-btn-ink, var(--pbd-on-brand));
	text-decoration: none;
}

.pbd-entry__content .wp-block-image img {
	border-radius: var(--pbd-radius);
}

.pbd-entry__content .wp-block-columns {
	gap: 24px;
}

.pbd-entry__content .wp-block-embed iframe,
.pbd-entry__content iframe {
	max-width: 100%;
}

.pbd-entry__content .wp-block-embed__wrapper {
	position: relative;
}

.pbd-entry__content .wp-block-group.has-background,
.pbd-entry__content .wp-block-cover {
	border-radius: var(--pbd-radius);
}

/* Wide / full images stay inside the page: 100vw would add a horizontal
   scrollbar wherever the browser draws one. */
.pbd-single .alignwide,
.pbd-single .alignfull {
	width: auto;
	max-width: 100%;
	margin-inline: 0;
}

.pbd-entry__content .alignleft {
	float: left;
	margin: 4px 20px 12px 0;
}

.pbd-entry__content .alignright {
	float: right;
	margin: 4px 0 12px 20px;
}

@media (max-width: 599px) {
	.pbd-entry__content .alignleft,
	.pbd-entry__content .alignright {
		float: none;
		margin: 0 0 1em;
	}
}

.pbd-entry__content::after {
	content: "";
	display: table;
	clear: both;
}

/* ---- Comments -------------------------------------------------------- */

.pbd-comments__title {
	font-size: 1.375rem;
}

.pbd-comments .comment-respond {
	margin-top: 24px;
}

.pbd-comments .comment-form {
	display: grid;
	gap: 12px;
}

.pbd-comments .comment-form p {
	margin: 0;
}

.pbd-comments .comment-form label {
	display: block;
	margin-bottom: 4px;
	font-weight: 600;
}

.pbd-comments .comment-form .submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 22px;
	border: 2px solid var(--pbd-btn-bg, var(--pbd-brand));
	border-radius: var(--pbd-btn-radius);
	background: var(--pbd-btn-bg, var(--pbd-brand));
	color: var(--pbd-btn-ink, var(--pbd-on-brand));
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.pbd-comments .children {
	margin-top: 12px;
	padding-inline-start: 20px;
	list-style: none;
}

/* Print: just the article. */
@media print {
	.pbd-share,
	.pbd-related-posts,
	.post-navigation,
	.pbd-comments,
	.pbd-toc {
		display: none;
	}
}
