/**
 * Single blog post (single.php). Loaded on single posts only, after
 * home-visit.css (the closing band) and the core block styles.
 * Fonts, colors and heading sizes come from style.css.
 *
 * Plain white page: breadcrumb, centered title, one reading column with a
 * contents list beside it on desktop. No decoration on the article text.
 */

.vac-post {
	--vac-gutter: clamp(1rem, 4vw, 3rem);
	--post-line: color-mix(in srgb, var(--color-dark) 14%, transparent);
	--post-muted: color-mix(in srgb, var(--color-dark) 72%, var(--color-white));
	/* Where a heading stops when jumped to, and where the sticky contents list sits. */
	--post-offset: calc(var(--vac-adminbar) + var(--vac-header-height-solid) + 1.5rem);
	padding-bottom: clamp(3rem, 7vw, 5rem);
	background: var(--color-white);
	color: var(--color-dark);
}

.vac-post__inner {
	width: min(100% - 2 * var(--vac-gutter), 62rem);
	margin-inline: auto;
}

.vac-post a:focus-visible,
.vac-post summary:focus-visible,
.vac-post button:focus-visible,
.vac-post .vac-table:focus-visible {
	outline: 3px solid var(--color-dark);
	outline-offset: 3px;
}

/* Visually hidden text that screen readers still announce. */
.vac-post__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* 1. Breadcrumb                                                       */
/* ------------------------------------------------------------------ */

.vac-post-crumbs {
	padding-top: 0.75rem;
}

.vac-post-crumbs ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

.vac-post-crumbs li {
	display: flex;
	align-items: center;
	min-width: 0;
}

.vac-post-crumbs li + li::before {
	content: "/";
	margin-inline: 0.6rem;
	color: var(--post-muted);
}

.vac-post-crumbs a,
.vac-post-crumbs [aria-current] {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	font-size: 0.9375rem;
	font-weight: 500;
	color: var(--post-muted);
}

.vac-post-crumbs a {
	text-decoration: underline;
	text-decoration-color: var(--post-line);
	text-underline-offset: 0.25em;
}

.vac-post-crumbs a:hover {
	color: var(--color-dark);
	text-decoration-color: var(--color-red);
}

/* The current title can be long: one line with an ellipsis. */
.vac-post-crumbs [aria-current] {
	display: block;
	max-width: 24ch;
	overflow: hidden;
	line-height: 2.75rem;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--color-dark);
	font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* 2. Title and meta line                                              */
/* ------------------------------------------------------------------ */

.vac-post-head {
	margin-top: clamp(1rem, 3vw, 2rem);
	text-align: center;
}

.vac-post-head__title {
	max-width: 30ch;
	margin-inline: auto;
	overflow-wrap: break-word;
}

.vac-post-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.25rem 0;
	margin-top: 1.25rem;
	font-size: 0.9375rem;
	line-height: 1.5;
	color: var(--post-muted);
}

.vac-post-meta > * + *::before,
.vac-post-meta__cats a + a::before {
	content: "\00b7";
	margin-inline: 0.6rem;
	color: var(--post-muted);
	font-weight: 700;
}

.vac-post-meta__cats a + a::before {
	margin-inline: 0.4rem;
	text-decoration: none;
	display: inline-block;
}

.vac-post-meta__cats a {
	display: inline-block;
	min-height: 1.5rem;
	color: var(--color-dark);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: var(--post-line);
	text-underline-offset: 0.2em;
}

.vac-post-meta__cats a:hover {
	color: var(--color-red);
	text-decoration-color: var(--color-red);
}

/* ------------------------------------------------------------------ */
/* 3. Featured image (only when the post has one)                      */
/* ------------------------------------------------------------------ */

.vac-post-figure {
	max-width: 52rem;
	margin: clamp(1.5rem, 4vw, 2.5rem) auto 0;
}

.vac-post__img {
	width: 100%;
	height: auto;
	border-radius: 6px;
}

.vac-post-figure figcaption {
	margin-top: 0.625rem;
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--post-muted);
}

/* ------------------------------------------------------------------ */
/* 4. Body: contents list and the article                              */
/* ------------------------------------------------------------------ */

.vac-post-body {
	margin-top: clamp(1.5rem, 4vw, 2.5rem);
}

/* Contents list, shared. */
.vac-toc ul {
	list-style: none;
}

.vac-toc a {
	display: block;
	color: var(--post-muted);
	text-decoration: none;
	overflow-wrap: anywhere;
}

.vac-toc a:hover {
	color: var(--color-dark);
	text-decoration: underline;
	text-decoration-color: var(--color-red);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.2em;
}

.vac-toc a[aria-current] {
	color: var(--color-dark);
	font-weight: 650;
}

/* Phones and tablets: a closed "On this page" panel above the article. */
.vac-toc--panel {
	max-width: 44rem;
	margin: 0 auto 2rem;
	border: 1px solid var(--post-line);
	border-radius: 6px;
	background: var(--color-surface-light);
}

.vac-toc--panel summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	min-height: 3rem;
	padding: 0.5rem 1rem;
	font-family: var(--font-heading);
	font-weight: 700;
	cursor: pointer;
	list-style: none;
}

.vac-toc--panel summary::-webkit-details-marker {
	display: none;
}

.vac-toc--panel summary::after {
	content: "";
	flex: none;
	width: 0.6rem;
	height: 0.6rem;
	margin-top: -0.25rem;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
}

.vac-toc--panel[open] summary::after {
	margin-top: 0.2rem;
	transform: rotate(-135deg);
}

.vac-toc--panel > ul {
	padding: 0 1rem 0.75rem;
}

.vac-toc--panel a {
	padding: 0.6rem 0;
	line-height: 1.4;
}

.vac-toc--panel ul ul {
	padding-left: 1rem;
}

/* The sidebar copy is desktop only. */
.vac-toc--side {
	display: none;
}

/* ------------------------------------------------------------------ */
/* 5. Article text                                                     */
/* ------------------------------------------------------------------ */

.vac-post-article {
	min-width: 0;
	max-width: 44rem;
	margin-inline: auto;
}

.vac-post__content {
	font-size: 1.125rem;
	line-height: 1.7;
	color: var(--color-dark);
	overflow-wrap: break-word;
}

.vac-post__content::after {
	content: "";
	display: table;
	clear: both;
}

/* One rhythm: 1.25em between blocks. */
.vac-post__content > * + * {
	margin-top: 1.25em;
}

.vac-post__content :is(h2, h3, h4, h5, h6) {
	font-family: var(--font-heading);
	text-align: left;
	letter-spacing: -0.01em;
	text-wrap: balance;
	clear: both;
}

.vac-post__content h2 {
	margin-top: 2.25em;
	margin-bottom: 0.6em;
	font-size: clamp(1.75rem, 1.55rem + 0.6vw, 2rem);
	font-weight: 800;
	line-height: 1.2;
}

.vac-post__content h3 {
	margin-top: 1.9em;
	margin-bottom: 0.5em;
	font-size: clamp(1.375rem, 1.3rem + 0.3vw, 1.5rem);
	font-weight: 700;
	line-height: 1.3;
}

.vac-post__content :is(h4, h5, h6) {
	margin-top: 1.6em;
	margin-bottom: 0.4em;
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.35;
}

.vac-post__content :is(h2, h3, h4, h5, h6) + * {
	margin-top: 0;
}

.vac-post__content > :first-child {
	margin-top: 0;
}

/* A heading jumped to from the contents list stops below the header and the progress bar. */
.vac-post__content :is(h2, h3) {
	scroll-margin-top: var(--post-offset);
}

.vac-post__content a:not(.wp-block-button__link) {
	color: var(--color-red);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	overflow-wrap: anywhere;
}

.vac-post__content a:not(.wp-block-button__link):hover {
	color: var(--color-dark);
	text-decoration-color: var(--color-red);
	text-decoration-thickness: 2px;
}

.vac-post__content a:focus-visible {
	border-radius: 2px;
}

.vac-post__content :is(strong, b) {
	font-weight: 700;
}

.vac-post__content mark {
	padding: 0 0.15em;
	background: color-mix(in srgb, var(--color-red) 14%, var(--color-white));
	color: inherit;
}

/* Lists. style.css gives .entry-content its bullets and numbers. */
.vac-post__content :is(ul, ol) {
	margin-top: 1.25em;
	margin-bottom: 0;
	padding-left: 1.5em;
}

.vac-post__content li {
	margin-bottom: 0.5em;
	padding-left: 0.25em;
}

.vac-post__content li:last-child {
	margin-bottom: 0;
}

.vac-post__content li > :is(ul, ol) {
	margin-top: 0.5em;
}

/* Blockquote: a plain left border. */
.vac-post__content blockquote {
	margin-inline: 0;
	padding: 0.25em 0 0.25em 1.25em;
	border-left: 4px solid var(--color-red);
}

.vac-post__content blockquote > * + * {
	margin-top: 0.75em;
}

.vac-post__content :is(cite, blockquote cite) {
	display: block;
	font-size: 0.9375rem;
	font-style: normal;
	color: var(--post-muted);
}

/* Pullquote: set off by two rules, still left aligned. */
.vac-post__content .wp-block-pullquote {
	margin-inline: 0;
	padding: 1.25em 0;
	border-block: 2px solid var(--color-dark);
	text-align: left;
}

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

.vac-post__content .wp-block-pullquote p {
	font-family: var(--font-heading);
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1.4;
}

/* Images and figures. */
.vac-post__content img {
	border-radius: 6px;
}

.vac-post__content figure {
	margin-inline: 0;
	max-width: 100%;
}

.vac-post__content :is(figcaption, .wp-caption-text, .gallery-caption) {
	margin-top: 0.625rem;
	font-size: 0.875rem;
	line-height: 1.5;
	text-align: left;
	color: var(--post-muted);
}

.vac-post__content .wp-caption {
	max-width: 100%;
}

/* Wide and full width stay inside the column, so nothing can push the page sideways. */
.vac-post__content :is(.alignwide, .alignfull) {
	width: 100%;
	max-width: 100%;
	margin-inline: 0;
}

.vac-post__content .aligncenter {
	display: block;
	margin-inline: auto;
}

.vac-post__content :is(.alignleft, .alignright) {
	max-width: 100%;
}

@media (min-width: 640px) {
	.vac-post__content .alignleft {
		float: left;
		max-width: 50%;
		margin: 0.4em 1.5em 0.75em 0;
	}

	.vac-post__content .alignright {
		float: right;
		max-width: 50%;
		margin: 0.4em 0 0.75em 1.5em;
	}
}

/* Galleries: block and classic shortcode. */
.vac-post__content .gallery {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.75rem;
}

.vac-post__content .gallery-item {
	margin: 0;
}

.vac-post__content .gallery-icon img,
.vac-post__content .wp-block-gallery img {
	width: 100%;
}

@media (min-width: 640px) {
	.vac-post__content .gallery-columns-1 { grid-template-columns: minmax(0, 1fr); }
	.vac-post__content .gallery-columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.vac-post__content .gallery-columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.vac-post__content .gallery-columns-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.vac-post__content .wp-block-gallery {
	gap: 0.75rem;
}

/* Tables: the wrapper (added in inc/single.php) scrolls, the page does not. */
.vac-table {
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.vac-post__content table {
	width: 100%;
	min-width: 30rem;
	border-collapse: collapse;
	font-size: 1rem;
	line-height: 1.5;
}

.vac-post__content :is(th, td) {
	padding: 0.6rem 0.85rem;
	border: 1px solid var(--post-line);
	text-align: left;
	vertical-align: top;
}

.vac-post__content th {
	background: var(--color-surface-light);
	font-weight: 700;
}

.vac-post__content .wp-block-table {
	margin-inline: 0;
}

.vac-post__content .wp-block-table table {
	border: 0;
}

/* Code. System monospace only: the theme loads no third font. */
.vac-post__content :is(code, kbd, pre, samp) {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.vac-post__content :not(pre) > code {
	padding: 0.1em 0.35em;
	border-radius: 4px;
	background: var(--color-surface-light);
	font-size: 0.9em;
	overflow-wrap: anywhere;
}

.vac-post__content pre {
	max-width: 100%;
	padding: 1rem;
	overflow-x: auto;
	border: 1px solid var(--post-line);
	border-radius: 6px;
	background: var(--color-surface-light);
	font-size: 0.9375rem;
	line-height: 1.55;
	white-space: pre;
	tab-size: 4;
}

.vac-post__content pre code {
	padding: 0;
	background: none;
	font-size: inherit;
}

.vac-post__content .wp-block-verse {
	font-family: var(--font-body);
}

/* Horizontal rule. */
.vac-post__content hr,
.vac-post__content .wp-block-separator {
	height: 0;
	margin-block: 2.5em;
	border: 0;
	border-top: 1px solid var(--post-line);
	background: none;
}

.vac-post__content :is(hr, .wp-block-separator) + * {
	margin-top: 0;
}

/* Embedded video and iframes: 16:9, full column. */
.vac-post__content iframe {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border: 0;
	border-radius: 6px;
}

.vac-post__content :is(video, embed, object) {
	max-width: 100%;
	height: auto;
}

/* Collapsible answers (details), as written in the live posts. */
.vac-post__content details {
	padding: 0 1rem;
	border: 1px solid var(--post-line);
	border-radius: 6px;
}

.vac-post__content details + details {
	margin-top: 0.75rem;
}

.vac-post__content summary {
	min-height: 2.75rem;
	padding-block: 0.6rem;
	font-weight: 650;
	cursor: pointer;
}

.vac-post__content details[open] summary {
	margin-bottom: 0.25rem;
}

.vac-post__content details > :not(summary) {
	padding-bottom: 0.75rem;
}

/* Buttons from the block editor: the theme's button, square-cornered. */
.vac-post__content .wp-block-buttons {
	gap: 0.75rem;
}

.vac-post__content .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 3.25rem;
	padding: 0.75rem 1.5rem;
	border: 2px solid var(--color-red);
	border-radius: 3px;
	background: var(--color-red);
	font-family: var(--font-body);
	font-size: 1.0625rem;
	font-weight: 650;
	line-height: 1.2;
	color: var(--color-white);
	text-decoration: none;
	transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.vac-post__content .wp-block-button__link:hover {
	border-color: var(--color-dark);
	background: var(--color-dark);
	color: var(--color-white);
}

.vac-post__content .is-style-outline > .wp-block-button__link:not(.has-background) {
	border-color: var(--color-dark);
	background: transparent;
	color: var(--color-dark);
}

.vac-post__content .is-style-outline > .wp-block-button__link:not(.has-background):hover {
	background: var(--color-dark);
	color: var(--color-white);
}

/* ------------------------------------------------------------------ */
/* 6. Call-to-action block, previous / next, all posts                 */
/* ------------------------------------------------------------------ */

/* The home page closing band, as a contained block under the article. */
.vac-post-cta {
	max-width: 52rem;
	margin: clamp(3rem, 7vw, 4.5rem) auto 0;
	padding-block: clamp(2rem, 5vw, 3rem);
	border-radius: 6px;
}

.vac-post-cta .vac-visit__inner {
	width: auto;
	padding-inline: 1.25rem;
}

.vac-post-cta .vac-visit__actions {
	margin-top: 1.5rem;
}

.vac-post-nav {
	max-width: 52rem;
	margin: clamp(1.5rem, 4vw, 2.5rem) auto 0;
}

.vac-post-nav ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.5rem 2rem;
}

.vac-post-nav li {
	flex: 1 1 18rem;
	max-width: 100%;
}

.vac-post-nav__next {
	text-align: right;
}

.vac-post-nav a {
	display: inline-block;
	padding-block: 0.6rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--color-dark);
	text-decoration: underline;
	text-decoration-color: var(--post-line);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.25em;
	overflow-wrap: break-word;
}

.vac-post-nav a:hover {
	color: var(--color-dark);
	text-decoration-color: var(--color-red);
}

.vac-post-nav__dir {
	color: var(--post-muted);
	font-weight: 500;
}

.vac-post-all {
	margin-top: 1rem;
	text-align: center;
}

.vac-post-all a {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	padding-inline: 0.5rem;
	font-weight: 650;
	color: var(--color-dark);
	text-decoration: underline;
	text-decoration-color: var(--color-red);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.25em;
}

/* ------------------------------------------------------------------ */
/* 7. Reading aids (shown by post.js only)                             */
/* ------------------------------------------------------------------ */

/* Progress bar: along the bottom edge of the fixed header. */
.vac-post-progress {
	position: fixed;
	top: calc(var(--vac-adminbar) + var(--vac-header-height-solid));
	right: 0;
	left: 0;
	z-index: 999;
	height: 4px;
	background: var(--color-red);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.1s linear;
	pointer-events: none;
}

.vac-post-top {
	position: fixed;
	right: max(1rem, env(safe-area-inset-right));
	bottom: max(1rem, env(safe-area-inset-bottom));
	z-index: 998;
	display: inline-grid;
	place-items: center;
	width: 3rem;
	height: 3rem;
	padding: 0;
	border: 2px solid var(--color-white);
	border-radius: var(--radius-full);
	background: var(--color-dark);
	color: var(--color-white);
	box-shadow: var(--shadow-md);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s, background-color 0.18s ease;
}

.vac-post-top.is-visible {
	opacity: 1;
	visibility: visible;
}

.vac-post-top:hover {
	background: var(--color-red);
}

.vac-post-top:focus-visible {
	outline: 3px solid var(--color-red);
	outline-offset: 3px;
}

/* ------------------------------------------------------------------ */
/* 8. Small phones, desktop, reduced motion                            */
/* ------------------------------------------------------------------ */

@media (max-width: 400px) {
	.vac-post__content {
		font-size: 1.0625rem;
	}
}

@media (min-width: 1024px) {
	.vac-post-body--toc {
		display: grid;
		grid-template-columns: 15rem minmax(0, 44rem);
		gap: 3rem;
		justify-content: center;
		align-items: start;
	}

	.vac-post-body--toc .vac-post-article {
		margin-inline: 0;
	}

	.vac-toc--panel {
		display: none;
	}

	/* Sticky below the header; scrolls on its own when it is taller than the screen. */
	.vac-toc--side {
		position: sticky;
		top: var(--post-offset);
		display: block;
		max-height: calc(100vh - var(--post-offset) - 1rem);
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	.vac-toc__title {
		margin-bottom: 0.5rem;
		font-family: var(--font-heading);
		font-weight: 700;
	}

	.vac-toc--side > ul {
		border-left: 2px solid var(--post-line);
	}

	.vac-toc--side a {
		margin-left: -2px;
		padding: 0.35rem 0.75rem;
		border-left: 2px solid transparent;
		font-size: 0.9375rem;
		line-height: 1.4;
	}

	.vac-toc--side a[aria-current] {
		border-left-color: var(--color-red);
	}

	.vac-toc--side ul ul a {
		padding-left: 1.5rem;
		font-size: 0.875rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	/* style.css smooth-scrolls the whole site; a post jumps instantly. */
	html {
		scroll-behavior: auto;
	}

	.vac-post-progress,
	.vac-post-top,
	.vac-post__content .wp-block-button__link {
		transition: none;
	}
}
