/*
 * Core and plugin block coverage.
 * ===========================================================================
 *
 * WHY THIS SHEET EXISTS
 * ---------------------------------------------------------------------------
 * theme.json and style.css style the blocks the theme's own templates and
 * patterns happen to use. The client can insert any registered block from the
 * editor, and everything nobody designed for falls back to Gutenberg's generic
 * defaults — which is precisely what makes a bespoke site read as a stock
 * theme. This sheet covers the remainder.
 *
 * It is enqueued site-wide at priority 19, after style.css and before
 * flourishes.css (20), woocommerce.css (21), forms.css (22) and content.css
 * (23). Anything more specific in those sheets therefore still wins, by
 * design. Nothing here restates a rule that already lives in theme.json,
 * style.css or one of those sheets.
 *
 * COLOUR AND CONTRAST
 * ---------------------------------------------------------------------------
 * Every colour pairing below was measured, not eyeballed. The load-bearing
 * numbers:
 *
 *   Ink #14171c on Cream #f7f4ed .................. 16.35:1  AA/AAA
 *   Slate #4a5058 on Cream ........................  7.41:1  AA/AAA
 *   Slate #4a5058 on Sand #ece6d8 .................  6.54:1  AA/AAA
 *   Brass Dark #8a5c1f on Cream ...................  5.26:1  AA
 *   Brass Dark #8a5c1f on Sand ....................  4.65:1  AA
 *   Brass #a8712a on Cream ........................  3.78:1  FAILS — never text
 *   Cream #f7f4ed on Stage Black #0e1116 .......... 17.22:1  AA/AAA
 *   Brass Light #d3a04a on Stage Black ............  8.01:1  AA/AAA
 *   Brass Dark #8a5c1f on Stage Black .............  3.27:1  FAILS on dark
 *   Slate #4a5058 on Stage Black ..................  2.03:1  FAILS on dark
 *   Ink #14171c on Brass Light #d3a04a ............  7.61:1  AA/AAA
 *
 * Two consequences drive the token block below:
 *
 * 1. Brass is a border/rule colour, never a text colour. Where brass-toned
 *    text is wanted, use `--mts-brass-text` (defined in flourishes.css), which
 *    resolves to Brass Dark on light surfaces and flips to Brass Light on dark
 *    ones. The literal fallback keeps this sheet accessible on its own.
 *
 * 2. Slate is the muted/meta colour on light surfaces and is unusable on dark
 *    ones (2.03:1). `--mtsb-muted` below therefore flips per surface rather
 *    than being a fixed value. Every meta line in this sheet uses that token.
 *
 * SPECIFICITY OF THE DARK-SURFACE RULES
 * ---------------------------------------------------------------------------
 * The dark-surface corrections use `:is(...)`, not `:where(...)`. `:where()`
 * contributes zero specificity, so a rule written as
 * `:where(.is-style-stage) :where(.wp-block-code)` scores 0,0,0 and LOSES to
 * the plain `.wp-block-code` rule it is meant to override — the block then
 * keeps its Ink text on a near-black panel. `:is()` takes the specificity of
 * its most specific argument, so these corrections reliably win. This was
 * caught by measuring computed colour in the browser, not by reading the CSS.
 *
 * NAMESPACE
 * ---------------------------------------------------------------------------
 * Local tokens are prefixed `--mtsb-` (blocks) rather than reusing `--mts-`.
 * `--mts-rule` in particular means different things in flourishes.css (a
 * colour) and woocommerce.css (a full `1px solid …` shorthand); borrowing it
 * would break one of them. Those sheets are owned by other workstreams.
 *
 * @package MarkTheShark
 */

/* ==========================================================================
 * 1. Surface-aware tokens
 * ========================================================================== */

:root {
	/* Ink at 14% — hairlines between rows, list items, comment threads. */
	--mtsb-hairline: color-mix(in srgb, var(--wp--preset--color--contrast) 14%, transparent);
	/* Ink at 5% over Cream = #ece9e3. Ink on it is 14.82:1, Slate 6.72:1. */
	--mtsb-panel: color-mix(in srgb, var(--wp--preset--color--contrast) 5%, transparent);
	/* Slate: 7.41:1 on Cream, 6.72:1 on the panel fill above. Both AA. */
	--mtsb-muted: var(--wp--preset--color--contrast-2);
	/* Visible edges — table header underline, tag pills, inputs. */
	--mtsb-edge: color-mix(in srgb, var(--wp--preset--color--contrast) 22%, transparent);
	/* Minimum comfortable hit area. WCAG 2.2 AA (2.5.8) requires 24px; 44px
	   is the AAA target and what the rest of the theme already uses. */
	--mtsb-touch: 44px;
}

/*
 * Dark surfaces. Same selector list flourishes.css uses, so a block behaves
 * identically wherever it lands.
 *
 * `:where()` is correct HERE and only here: custom properties cascade by
 * inheritance from the nearest ancestor that sets them, so this block beats
 * the `:root` defaults above regardless of specificity, and keeping it at 0
 * lets a nested component still override a token if it needs to.
 */
:where(
	.wp-block-group.is-style-stage,
	.has-surface-dark-background-color,
	.has-contrast-background-color,
	footer.wp-block-group
) {
	--mtsb-hairline: color-mix(in srgb, var(--wp--preset--color--base) 22%, transparent);
	/* Cream at 7% over Stage Black = #1e2125. Cream on it is 14.71:1. */
	--mtsb-panel: color-mix(in srgb, var(--wp--preset--color--base) 7%, transparent);
	/* Cream at 72% = #b6b4b1 — 9.14:1 on Stage Black, 7.81:1 on the panel.
	   Slate would be 2.03:1 here, which is why this token is not a constant. */
	--mtsb-muted: color-mix(in srgb, var(--wp--preset--color--base) 72%, transparent);
	--mtsb-edge: color-mix(in srgb, var(--wp--preset--color--base) 34%, transparent);
}

/* ==========================================================================
 * 2. Captions — every figure block
 * ========================================================================== */

:where(figcaption, .wp-element-caption) {
	text-wrap: pretty;
	margin-block-start: 0.6em;
}

/* ==========================================================================
 * 3. Table
 * ==========================================================================
 * Reflow, not overflow. The primary strategy is that cells wrap: the table
 * keeps `table-layout: auto`, cells are allowed to break long words, and
 * padding and type step down on small screens. A four-column tour-date table
 * therefore narrows and grows taller rather than pushing the page sideways.
 */

.wp-block-table {
	margin-block: var(--wp--preset--spacing--40);
}

.wp-block-table table {
	width: 100%;
	border-collapse: collapse;
	table-layout: auto;
}

/*
 * Core paints `border: 1px solid` on all four sides of every cell, which reads
 * as a spreadsheet, plus a 3px currentColor rule under <thead> and over
 * <tfoot>. All of that is reset here so only the row rule remains.
 *
 * Specificity matters: core's selector is `.wp-block-table td` (0,1,1), so the
 * obvious `.wp-block-table :where(th, td)` scores 0,1,0 and silently loses.
 * Qualifying with `table` and using `:is()` gives 0,1,2, which wins outright
 * rather than depending on sheet order.
 */
.wp-block-table table :is(th, td) {
	border: 0;
	border-block-end: 1px solid var(--mtsb-hairline);
	padding: 0.75em 1em;
	text-align: start;
	vertical-align: top;
	/* The reflow lever: long venue names and URLs break instead of forcing
	   the table wider than the viewport. */
	overflow-wrap: anywhere;
}

.wp-block-table thead,
.wp-block-table tfoot {
	border: 0;
}

/* Core draws a pale 1px rule under the striped variation's figure. */
.wp-block-table.is-style-stripes {
	border-block-end: 0;
}

.wp-block-table thead th {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	/* Inherited, not hard-coded Ink: the header fill is a *tinted* panel that
	   follows the surface, so Ink would sit on a near-black panel inside a
	   Stage band and measure 1.06:1. Inheriting gives Ink on #ece9e3
	   (14.65:1) on Cream and Cream on #1e2125 (14.71:1) on Stage Black. */
	color: inherit;
	background-color: var(--mtsb-panel);
	border-block-end: 2px solid var(--wp--preset--color--primary);
}

.wp-block-table tfoot td {
	font-weight: 600;
	border-block-start: 2px solid var(--mtsb-edge);
}

.wp-block-table table tbody tr:last-child :is(th, td) {
	border-block-end: 0;
}

/* Core's stripe variation paints its own grey; repoint it at the palette. */
.wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background-color: var(--mtsb-panel);
}

/* Core sets these to transparent at 0,2,1; match it at 0,2,2. */
.wp-block-table.is-style-stripes table :is(th, td) {
	border-block-end: 0;
}

.wp-block-table figcaption {
	text-align: start;
}

@media (max-width: 600px) {
	.wp-block-table table {
		font-size: var(--wp--preset--font-size--small);
	}

	.wp-block-table table :is(th, td) {
		padding: 0.55em 0.6em;
		hyphens: auto;
	}

	/* Safety net, phones only: a table with more columns than can ever wrap
	   scrolls instead of clipping. Scoped to this breakpoint so it can never
	   create a scroll container — and therefore clipping — on desktop. */
	.wp-block-table {
		overflow-x: auto;
	}
}

@media (forced-colors: active) {
	.wp-block-table table :is(th, td) {
		border-block-end: 1px solid CanvasText;
	}

	.wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
		background-color: Canvas;
	}
}

/* ==========================================================================
 * 4. Calendar
 * ========================================================================== */

.wp-block-calendar {
	margin-block: var(--wp--preset--spacing--40);
}

.wp-block-calendar table {
	width: 100%;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.wp-block-calendar caption {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: inherit;
	padding-block-end: 0.75em;
	caption-side: top;
	text-align: start;
}

.wp-block-calendar th {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	background-color: var(--mtsb-panel);
	border-block-end: 2px solid var(--wp--preset--color--primary);
	padding: 0.5em;
	text-align: center;
}

.wp-block-calendar td {
	padding: 0.5em;
	text-align: center;
	border: 1px solid var(--mtsb-hairline);
}

/* A day with a post. Brass Dark on the Cream page measures 4.72:1 as rendered
   (AA for normal text); the token flips to Brass Light on dark surfaces. */
.wp-block-calendar td a {
	font-weight: 600;
	color: var(--mts-brass-text, #8a5c1f);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

/* Today is marked by weight and an outline as well as by fill, so the
   distinction survives greyscale and forced-colors. */
.wp-block-calendar td#today {
	background-color: var(--mtsb-panel);
	font-weight: 700;
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: -2px;
}

.wp-block-calendar .wp-calendar-nav {
	display: flex;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--20);
	padding-block-start: 0.75em;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.wp-block-calendar .wp-calendar-nav-next {
	text-align: end;
}

/* ==========================================================================
 * 5. Gallery
 * ========================================================================== */

.wp-block-gallery {
	margin-block: var(--wp--preset--spacing--40);
}

.wp-block-gallery.has-nested-images {
	gap: var(--wp--preset--spacing--30);
}

/* Core lays the per-image caption over a gradient scrim. That is illegible
   over pale artwork, so it is set beneath the image like every other caption
   in the theme. */
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
	position: static;
	background: none;
	padding: 0;
	color: var(--mtsb-muted);
	font-size: var(--wp--preset--font-size--small);
	text-align: start;
	max-height: none;
	overflow: visible;
}

.wp-block-gallery > .blocks-gallery-caption {
	width: 100%;
	text-align: center;
	color: var(--mtsb-muted);
	font-size: var(--wp--preset--font-size--small);
	margin-block-start: var(--wp--preset--spacing--20);
}

/* ==========================================================================
 * 6. Media & Text
 * ========================================================================== */

.wp-block-media-text {
	margin-block: var(--wp--preset--spacing--50);
}

/* Core gives the content column a flat 8% inline padding, which collapses to
   nothing once the block stacks. Use the spacing scale instead. */
.wp-block-media-text > .wp-block-media-text__content {
	padding: var(--wp--preset--spacing--40);
}

.wp-block-media-text.is-stacked-on-mobile > .wp-block-media-text__content {
	padding-inline: 0;
}

@media (min-width: 601px) {
	.wp-block-media-text.is-stacked-on-mobile > .wp-block-media-text__content {
		padding-inline: var(--wp--preset--spacing--40);
	}
}

.wp-block-media-text__media img,
.wp-block-media-text__media video {
	border-radius: 2px;
}

/* ==========================================================================
 * 7. Cover
 * ==========================================================================
 * Two real defects are corrected here.
 *
 * 1. theme.json sets `elements.heading.color.text` to Ink. Inside a cover with
 *    a dark overlay that is near-invisible. Headings and paragraphs in the
 *    inner container are made to inherit the cover's own colour instead.
 *
 * 2. Core's default dim is 50% opacity. Measured over Cream, that renders a
 *    #868685 fill, and core's own white cover text on it is 3.64:1 — a FAIL.
 *    At 60% the fill is #6f6f70 and white measures 5.02:1 (Cream text
 *    4.57:1); both pass AA. An explicit `has-background-dim-NN` chosen by the
 *    client is deliberately left alone.
 */

.wp-block-cover {
	padding: var(--wp--preset--spacing--50);
}

.wp-block-cover .wp-block-cover__background:not([class*="-background-dim-"]) {
	opacity: 0.6;
}

.wp-block-cover .wp-block-cover__inner-container :where(h1, h2, h3, h4, h5, h6, p, li) {
	color: inherit;
}

.wp-block-cover :where(.wp-block-cover__inner-container) > * {
	text-wrap: pretty;
}

/* ==========================================================================
 * 8. Columns and legacy text columns
 * ========================================================================== */

.wp-block-columns {
	margin-block: var(--wp--preset--spacing--40);
}

/* Core zeroes the row gap when columns stack, so stacked columns collide. */
@media (max-width: 781px) {
	.wp-block-columns:not(.is-not-stacked-on-mobile) {
		row-gap: var(--wp--preset--spacing--40);
	}
}

/* core/text-columns is deprecated but still registered and still insertable. */
.wp-block-text-columns {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--40);
	margin-block: var(--wp--preset--spacing--40);
}

.wp-block-text-columns .wp-block-column {
	flex: 1 1 16rem;
}

/* ==========================================================================
 * 9. Details (disclosure) and Accordion
 * ==========================================================================
 * core/accordion, core/accordion-item, core/accordion-heading and
 * core/accordion-panel are new in WordPress 7.1 and ship with almost no
 * styling — an inherited-colour button and nothing else.
 */

.wp-block-details {
	margin-block: var(--wp--preset--spacing--30);
	border-block: 1px solid var(--mtsb-hairline);
	padding-block: var(--wp--preset--spacing--20);
}

.wp-block-details summary {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	letter-spacing: 0.01em;
	padding-block: 0.5em;
	min-height: var(--mtsb-touch);
	display: flex;
	align-items: center;
	gap: 0.5em;
	color: inherit;
}

.wp-block-details summary::marker {
	color: var(--wp--preset--color--primary); /* A glyph, not text. */
}

.wp-block-details summary:hover {
	color: var(--mts-brass-text, #8a5c1f); /* 5.26:1 Cream / 8.01:1 dark — AA */
}

.wp-block-details[open] > summary {
	border-block-end: 1px solid var(--mtsb-hairline);
	margin-block-end: var(--wp--preset--spacing--20);
}

/* --- Accordion (7.1) --- */

.wp-block-accordion {
	margin-block: var(--wp--preset--spacing--40);
	border-block-start: 1px solid var(--mtsb-hairline);
}

.wp-block-accordion-item {
	border-block-end: 1px solid var(--mtsb-hairline);
}

.wp-block-accordion-heading {
	margin: 0;
	font-size: var(--wp--preset--font-size--medium);
}

.wp-block-accordion-heading__toggle {
	min-height: var(--mtsb-touch);
	padding-block: var(--wp--preset--spacing--30);
	gap: var(--wp--preset--spacing--20);
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
	letter-spacing: 0.01em;
	/* Inherit rather than hard-code Ink: the block then works unchanged on
	   the Stage Black surface, where Ink would be invisible. */
	color: inherit;
	transition: color var(--wp--custom--transition--base, 180ms) ease;
}

.wp-block-accordion-heading__toggle:hover {
	color: var(--mts-brass-text, #8a5c1f); /* 5.26:1 Cream / 8.01:1 dark — AA */
}

.wp-block-accordion-heading__toggle-icon {
	color: var(--wp--preset--color--primary); /* Icon, not text. */
	flex: 0 0 auto;
	transition: transform var(--wp--custom--transition--base, 180ms) ease;
}

.wp-block-accordion-heading__toggle[aria-expanded="true"] .wp-block-accordion-heading__toggle-icon {
	transform: rotate(180deg);
}

.wp-block-accordion-panel {
	padding-block-end: var(--wp--preset--spacing--30);
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-accordion-heading__toggle-icon {
		transition: none;
	}
}

@media (forced-colors: active) {
	.wp-block-accordion-item,
	.wp-block-details {
		border-color: CanvasText;
	}
}

/* ==========================================================================
 * 10. Tabs (7.1)
 * ==========================================================================
 * Core draws the selected tab with a 2px currentColor underline and leaves
 * everything else inherited. Rebuilt in the display face with a brass marker.
 * Note `aria-selected` is bound at runtime by the Interactivity API, so this
 * was verified in a live browser rather than from the server-rendered HTML.
 */

.wp-block-tabs {
	margin-block: var(--wp--preset--spacing--40);
}

.wp-block-tab-list {
	display: flex;
	flex-wrap: wrap;
	border-block-end: 1px solid var(--mtsb-hairline);
}

.wp-block-tab-list button {
	min-height: var(--mtsb-touch);
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--mtsb-muted); /* Slate 7.41:1 light / #b6b4b1 9.14:1 dark */
	transition: color var(--wp--custom--transition--base, 180ms) ease;
}

.wp-block-tab-list button:hover,
.wp-block-tab-list button[aria-selected="true"] {
	/* Inherit resolves to Ink on Cream (16.35:1) and Cream on Stage Black
	   (17.22:1), so the selected tab is correct on either surface. */
	color: inherit;
}

/* Repoint core's currentColor underline at brass. The selected tab is marked
   by weight of colour and a rule, not by hue alone. */
.wp-block-tab-list button[aria-selected="true"]::before {
	border-block-end-width: 3px;
	border-block-end-color: var(--wp--preset--color--primary);
}

.wp-block-tab-panel {
	padding-block-start: var(--wp--preset--spacing--30);
}

@media (forced-colors: active) {
	.wp-block-tab-list button[aria-selected="true"] {
		text-decoration: underline;
	}
}

/* ==========================================================================
 * 11. File
 * ========================================================================== */

.wp-block-file {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--30);
	padding: var(--wp--preset--spacing--30);
	background-color: var(--mtsb-panel);
	border-inline-start: 3px solid var(--wp--preset--color--primary);
	margin-block: var(--wp--preset--spacing--30);
}

/* Ink on the light panel is 14.65:1; Cream on the dark panel 17.36:1. */
.wp-block-file :where(a:not(.wp-block-file__button)) {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
	flex: 1 1 12rem;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

/* .wp-block-file__button also carries .wp-element-button, so theme.json's
   button styling already applies. Only the hit area needs asserting. */
.wp-block-file__button {
	min-height: var(--mtsb-touch);
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
}

.wp-block-file__embed {
	width: 100%;
	border: 1px solid var(--mtsb-hairline);
	margin-block-end: var(--wp--preset--spacing--20);
}

/* ==========================================================================
 * 12. Code, Preformatted, Verse
 * ========================================================================== */

.wp-block-code,
.wp-block-preformatted {
	background-color: var(--mtsb-panel);
	border: 1px solid var(--mtsb-hairline);
	border-inline-start: 3px solid var(--wp--preset--color--primary);
	padding: var(--wp--preset--spacing--30);
	margin-block: var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.6;
	overflow-x: auto;
	tab-size: 2;
	/* Inherited, so the same panel works on Cream (14.65:1) and on Stage
	   Black (14.71:1). Hard-coding Ink here failed on the dark surface. */
	color: inherit;
}

.wp-block-code code,
.wp-block-preformatted {
	font-family: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
	white-space: pre;
}

/* Inline code inside prose. */
:where(p, li, td, dd) > code {
	font-family: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
	font-size: 0.9em;
	padding: 0.15em 0.4em;
	background-color: var(--mtsb-panel);
	border-radius: 2px;
}

/*
 * Verse. The poetry patterns add `.mts-poem__verse` and content.css (loaded
 * after this sheet) owns that case completely — a poem's authored line breaks
 * must not be second-guessed. This rule is scoped away from it and covers only
 * a bare core/verse the client inserts by hand.
 */
.wp-block-verse:not(.mts-poem__verse) {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.7;
	/* pre-wrap, not pre: a long line wraps on a phone instead of overflowing. */
	white-space: pre-wrap;
	padding-inline-start: var(--wp--preset--spacing--30);
	border-inline-start: 2px solid var(--wp--preset--color--primary);
	margin-block: var(--wp--preset--spacing--40);
}

/* ==========================================================================
 * 13. Pullquote
 * ==========================================================================
 * theme.json already sets the display face and size. Layout and the citation
 * are unstyled, and the citation defaults to italic grey.
 */

.wp-block-pullquote {
	border-block: 2px solid var(--wp--preset--color--primary);
	padding: var(--wp--preset--spacing--40) 0;
	margin-block: var(--wp--preset--spacing--50);
	text-align: start;
}

.wp-block-pullquote blockquote p {
	line-height: 1.2;
	text-wrap: balance;
}

.wp-block-pullquote__citation,
.wp-block-pullquote cite {
	display: block;
	margin-block-start: var(--wp--preset--spacing--20);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-style: normal;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--mtsb-muted); /* 7.41:1 light / 9.14:1 dark — AA */
}

/* ==========================================================================
 * 14. Embed, Audio, Video, Playlist
 * ========================================================================== */

.wp-block-embed {
	margin-block: var(--wp--preset--spacing--40);
}

.wp-block-embed iframe {
	max-width: 100%;
	border: 0;
	display: block;
}

/* Non-video embeds (posts, rich cards) get a frame so they do not float
   loose on the cream; video embeds are already a solid rectangle. */
.wp-block-embed.is-type-rich .wp-block-embed__wrapper {
	border: 1px solid var(--mtsb-hairline);
	padding: var(--wp--preset--spacing--20);
}

.wp-block-audio {
	margin-block: var(--wp--preset--spacing--40);
}

.wp-block-audio audio {
	width: 100%;
	min-height: var(--mtsb-touch);
	display: block;
}

.wp-block-video {
	margin-block: var(--wp--preset--spacing--40);
}

.wp-block-video video {
	width: 100%;
	height: auto;
	display: block;
	background-color: var(--wp--preset--color--surface-dark);
}

/* --- Playlist (7.1). This is a blues pianist's site; the playlist block is
   the single most likely "new" block to be reached for. --- */

.wp-block-playlist {
	margin-block: var(--wp--preset--spacing--40);
	border: 1px solid var(--mtsb-hairline);
	padding: var(--wp--preset--spacing--30);
}

.wp-block-playlist audio {
	width: 100%;
	min-height: var(--mtsb-touch);
}

.wp-block-playlist__tracklist {
	list-style: none;
	margin: var(--wp--preset--spacing--30) 0 0;
	padding: 0;
	max-height: 22rem;
	overflow-y: auto;
}

.wp-block-playlist-track {
	border-block-end: 1px solid var(--mtsb-hairline);
}

.wp-block-playlist-track:last-child {
	border-block-end: 0;
}

.wp-block-playlist-track__button {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	width: 100%;
	min-height: var(--mtsb-touch);
	padding: 0.6em 0.25em;
	background: none;
	border: 0;
	cursor: pointer;
	text-align: start;
	color: inherit;
	font-family: inherit;
}

.wp-block-playlist-track__button:hover {
	background-color: var(--mtsb-panel);
}

.wp-block-playlist-track__title {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
	flex: 1 1 auto;
}

.wp-block-playlist-track__artist,
.wp-block-playlist-track__length {
	font-size: var(--wp--preset--font-size--small);
	color: var(--mtsb-muted); /* 7.41:1 light / 9.14:1 dark — AA */
}

.wp-block-playlist-track__length {
	font-variant-numeric: tabular-nums;
	flex: 0 0 auto;
}

/* The playing track is marked by weight and a brass rule as well as by
   colour, so the state is not conveyed by colour alone. */
.wp-block-playlist-track[aria-current="true"] .wp-block-playlist-track__title,
.wp-block-playlist-track.is-playing .wp-block-playlist-track__title {
	color: var(--mts-brass-text, #8a5c1f); /* 5.26:1 Cream / 8.01:1 dark — AA */
	box-shadow: inset 3px 0 0 var(--wp--preset--color--primary);
	padding-inline-start: 0.5em;
}

/* ==========================================================================
 * 15. List-shaped widget blocks
 * ==========================================================================
 * archives, categories, page-list, latest-posts, latest-comments, rss.
 * All six render bare <ul>s with browser-default bullets and blue links.
 */

.wp-block-archives-list,
.wp-block-categories-list,
.wp-block-page-list,
.wp-block-latest-posts__list,
.wp-block-latest-comments,
.wp-block-rss {
	list-style: none;
	margin-inline: 0;
	padding-inline: 0;
}

.wp-block-archives-list li,
.wp-block-categories-list li,
.wp-block-page-list li {
	border-block-end: 1px solid var(--mtsb-hairline);
}

.wp-block-archives-list li:last-child,
.wp-block-categories-list li:last-child,
.wp-block-page-list > li:last-child {
	border-block-end: 0;
}

/*
 * Core emits the post count as a bare text node *after* the link
 * ("<a>September 2026</a> (4)"). A block-level link therefore pushes the
 * count onto its own line. Laying the row out as a flex line keeps the count
 * on the baseline at the end of the row where it belongs. page-list is
 * excluded because it nests a child <ul> inside the <li>.
 */
.wp-block-archives-list li,
.wp-block-categories-list li {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.5em;
	color: var(--mtsb-muted); /* the count — 7.41:1 light / 9.14:1 dark */
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-archives-list a,
.wp-block-categories-list a,
.wp-block-page-list a {
	min-height: var(--mtsb-touch);
	display: flex;
	align-items: center;
	flex: 1 1 auto;
	padding-block: 0.6em;
	font-family: var(--wp--preset--font-family--display);
	font-weight: 500;
	text-decoration: none;
}

/* theme.json points links at Midnight Blue, which is right for links in prose
   but turns a navigational list into a wall of blue. Ink is 16.35:1 on Cream.
   Set explicitly rather than inherited, because the row above is deliberately
   muted for the count and the link must not inherit that lower emphasis.
   The dark-surface section flips this to Cream (17.22:1). */
.wp-block-archives-list a,
.wp-block-categories-list a,
.wp-block-page-list a {
	font-size: var(--wp--preset--font-size--medium);
	color: var(--wp--preset--color--contrast);
}

.wp-block-archives-list a:hover,
.wp-block-categories-list a:hover,
.wp-block-page-list a:hover {
	color: var(--mts-brass-text, #8a5c1f); /* 5.26:1 Cream / 8.01:1 dark — AA */
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

/* Nested pages / child categories. */
.wp-block-page-list ul,
.wp-block-categories-list ul {
	list-style: none;
	padding-inline-start: var(--wp--preset--spacing--30);
	border-inline-start: 1px solid var(--mtsb-hairline);
	margin-block: 0;
}

/* Dropdown variants. These <select>s can appear anywhere on the site, while
   forms.css only loads on pages that carry a form, so they are covered here.
   Scoped tightly to the two blocks to avoid overlapping that sheet. */
.wp-block-archives-dropdown select,
.wp-block-categories-dropdown select {
	width: 100%;
	min-height: var(--mtsb-touch);
	padding: 0.5em 0.75em;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--medium);
	color: var(--wp--preset--color--contrast); /* 16.35:1 on the Cream field */
	background-color: var(--wp--preset--color--base);
	border: 1px solid var(--mtsb-edge);
	border-radius: 2px;
}

.wp-block-categories__label,
.wp-block-archives-dropdown label {
	display: block;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin-block-end: 0.4em;
}

/* --- Latest posts --- */

.wp-block-latest-posts__list li {
	margin-block-end: var(--wp--preset--spacing--30);
	padding-block-end: var(--wp--preset--spacing--30);
	border-block-end: 1px solid var(--mtsb-hairline);
}

.wp-block-latest-posts__list li:last-child {
	border-block-end: 0;
	margin-block-end: 0;
	padding-block-end: 0;
}

.wp-block-latest-posts__post-title {
	display: block;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	line-height: 1.2;
	color: inherit; /* Ink on Cream 16.35:1 / Cream on Stage Black 17.22:1 */
	text-decoration: none;
}

.wp-block-latest-posts__post-title:hover {
	color: var(--mts-brass-text, #8a5c1f);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.wp-block-latest-posts__post-date,
.wp-block-latest-posts__post-author {
	display: block;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--mtsb-muted); /* 7.41:1 light / 9.14:1 dark — AA */
	margin-block-start: 0.3em;
}

.wp-block-latest-posts__post-excerpt,
.wp-block-latest-posts__post-full-content {
	margin-block-start: var(--wp--preset--spacing--20);
	text-wrap: pretty;
}

.wp-block-latest-posts__featured-image img {
	border-radius: 2px;
}

.wp-block-latest-posts__read-more {
	display: inline-block;
	margin-block-start: var(--wp--preset--spacing--20);
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--mts-brass-text, #8a5c1f); /* 5.26:1 Cream / 8.01:1 dark — AA */
}

.wp-block-latest-posts.is-grid {
	gap: var(--wp--preset--spacing--40);
}

/* --- Latest comments --- */

.wp-block-latest-comments__comment {
	display: flex;
	gap: var(--wp--preset--spacing--30);
	padding-block: var(--wp--preset--spacing--30);
	border-block-end: 1px solid var(--mtsb-hairline);
	margin: 0;
	line-height: 1.6;
}

.wp-block-latest-comments__comment:last-child {
	border-block-end: 0;
}

.wp-block-latest-comments__comment-avatar {
	border-radius: 50%;
	flex: 0 0 auto;
}

.wp-block-latest-comments__comment-meta {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
}

.wp-block-latest-comments__comment-date {
	display: block;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--mtsb-muted);
}

.wp-block-latest-comments__comment-excerpt p {
	font-size: var(--wp--preset--font-size--small);
	margin-block: 0.4em 0;
}

/* --- RSS --- */

.wp-block-rss__item {
	padding-block: var(--wp--preset--spacing--30);
	border-block-end: 1px solid var(--mtsb-hairline);
}

.wp-block-rss__item:last-child {
	border-block-end: 0;
}

.wp-block-rss__item-title a {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	line-height: 1.2;
	color: inherit; /* Ink on Cream 16.35:1 / Cream on Stage Black 17.22:1 */
	text-decoration: none;
}

.wp-block-rss__item-title a:hover {
	color: var(--mts-brass-text, #8a5c1f);
	text-decoration: underline;
}

.wp-block-rss__item-publish-date,
.wp-block-rss__item-author {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--mtsb-muted);
}

.wp-block-rss__item-excerpt {
	margin-block-start: var(--wp--preset--spacing--20);
	text-wrap: pretty;
}

.wp-block-rss.is-grid {
	gap: var(--wp--preset--spacing--40);
}

/* ==========================================================================
 * 16. Tag cloud
 * ==========================================================================
 * Core prints an inline `font-size` on every tag, scaled by post count, that
 * bottoms out at 8pt (~10.7px). That is below the theme's smallest type and
 * genuinely hard to read, and an inline style can only be beaten by
 * `!important` — hence the single documented use in this sheet. The tags are
 * normalised to one legible size and rendered as pills instead.
 */

.wp-block-tag-cloud {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
	margin-block: var(--wp--preset--spacing--30);
}

.wp-block-tag-cloud a {
	font-size: var(--wp--preset--font-size--small) !important; /* see above */
	display: inline-flex;
	align-items: center;
	min-height: 2.25rem;
	padding: 0.35em 0.85em;
	font-family: var(--wp--preset--font-family--display);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
	color: inherit; /* Ink on Cream 16.35:1 / Cream on Stage Black 17.22:1 */
	border: 1px solid var(--mtsb-edge);
	border-radius: 999px;
	transition: background-color var(--wp--custom--transition--base, 180ms) ease;
}

.wp-block-tag-cloud a:hover {
	background-color: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base); /* 16.35:1 inverted — AA/AAA */
	border-color: var(--wp--preset--color--contrast);
}

.wp-block-tag-cloud .tag-link-count {
	color: var(--mtsb-muted);
	margin-inline-start: 0.35em;
}

/* ==========================================================================
 * 17. Search (site-wide)
 * ==========================================================================
 * woocommerce.css styles the shop's own `.mts-shop-search` and loads after
 * this sheet, so it continues to win there. This covers a search block placed
 * anywhere else — 404 page, footer, sidebar.
 */

.wp-block-search__label {
	display: block;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin-block-end: 0.5em;
}

.wp-block-search__input {
	min-height: var(--mtsb-touch);
	padding: 0.5em 0.85em;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--medium);
	color: var(--wp--preset--color--contrast); /* 16.35:1 on the Cream field */
	background-color: var(--wp--preset--color--base);
	border: 1px solid var(--mtsb-edge);
	border-radius: 2px;
}

.wp-block-search__input::placeholder {
	color: var(--wp--preset--color--contrast-2); /* Slate 7.41:1 — AA */
	opacity: 1; /* Firefox dims placeholders by default, which fails AA. */
}

.wp-block-search__button {
	min-height: var(--mtsb-touch);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
}

/* The button-inside variant wraps both controls in one bordered box. */
.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper {
	border: 1px solid var(--mtsb-edge);
	border-radius: 2px;
	padding: 3px;
	background-color: var(--wp--preset--color--base);
}

.wp-block-search.wp-block-search__button-inside .wp-block-search__input {
	border: 0;
	background: none;
}

.wp-block-search__button svg {
	fill: currentColor;
	width: 1.25em;
	height: 1.25em;
}

/* ==========================================================================
 * 18. Buttons — the variations theme.json does not reach
 * ==========================================================================
 * theme.json styles the filled button via `elements.button`. The outline
 * variation sets its own transparent background and currentColor border, so
 * it needs its own hover/focus contract.
 */

.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color) {
	color: var(--wp--preset--color--contrast); /* 16.35:1 on Cream — AA/AAA */
}

.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background) {
	border: 2px solid currentColor;
	background-color: transparent;
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover,
.wp-block-button.is-style-outline > .wp-block-button__link:focus-visible {
	background-color: var(--wp--preset--color--primary-dark);
	border-color: var(--wp--preset--color--primary-dark);
	color: var(--wp--preset--color--base); /* Cream on #8a5c1f = 5.26:1 — AA */
}

.wp-block-buttons {
	gap: var(--wp--preset--spacing--30);
}

.wp-block-button__link {
	min-height: var(--mtsb-touch);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* ==========================================================================
 * 19. Social links
 * ========================================================================== */

.wp-block-social-links {
	gap: var(--wp--preset--spacing--20);
}

.wp-block-social-link {
	transition: transform var(--wp--custom--transition--base, 180ms) ease;
}

.wp-block-social-link:hover {
	transform: translateY(-2px);
}

.wp-block-social-links .wp-block-social-link-anchor {
	/* WCAG 2.2 target size. Core's default is 36px. */
	min-width: var(--mtsb-touch);
	min-height: var(--mtsb-touch);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* The logos-only variation inherits currentColor, which is correct on both
   surfaces once it inherits rather than hard-coding Ink. */
.wp-block-social-links.is-style-logos-only .wp-block-social-link {
	color: inherit;
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-social-link,
	.wp-block-social-link:hover {
		transition: none;
		transform: none;
	}
}

/* ==========================================================================
 * 20. Query loop, pagination, post meta
 * ==========================================================================
 * woocommerce.css owns the shop's `.mts-shop-pagination`; this is the generic
 * case — blog archives, the writing index, search results.
 */

.wp-block-query-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	margin-block-start: var(--wp--preset--spacing--50);
	padding-block-start: var(--wp--preset--spacing--30);
	border-block-start: 1px solid var(--mtsb-hairline);
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.wp-block-query-pagination :where(a, .current) {
	min-width: var(--mtsb-touch);
	min-height: var(--mtsb-touch);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding-inline: 0.5em;
	text-decoration: none;
	color: inherit; /* Ink on Cream 16.35:1 / Cream on Stage Black 17.22:1 */
}

.wp-block-query-pagination a:hover {
	color: var(--mts-brass-text, #8a5c1f); /* 5.26:1 Cream / 8.01:1 dark — AA */
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* Current page is marked by a brass rule and weight, not colour alone. */
.wp-block-query-pagination-numbers .current {
	font-weight: 700;
	box-shadow: inset 0 -3px 0 var(--wp--preset--color--primary);
}

.wp-block-post-date,
.wp-block-post-terms,
.wp-block-post-author-name,
.wp-block-post-time-to-read,
.wp-block-post-comments-count {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--mtsb-muted); /* 7.41:1 light / 9.14:1 dark — AA */
}

.wp-block-post-terms a,
.wp-block-post-author-name a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.wp-block-post-author {
	display: flex;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--30);
	padding: var(--wp--preset--spacing--30);
	background-color: var(--mtsb-panel);
	border-inline-start: 3px solid var(--wp--preset--color--primary);
	margin-block: var(--wp--preset--spacing--40);
}

.wp-block-post-author__avatar img,
.wp-block-avatar img {
	border-radius: 50%;
	display: block;
}

.wp-block-post-author-biography,
.wp-block-term-description {
	font-size: var(--wp--preset--font-size--medium);
	color: var(--mtsb-muted);
	text-wrap: pretty;
}

.wp-block-read-more {
	display: inline-block;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--mts-brass-text, #8a5c1f); /* 5.26:1 Cream / 8.01:1 dark — AA */
	text-decoration: none;
	border-block-end: 1px solid currentColor;
}

.wp-block-post-navigation-link {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.wp-block-post-navigation-link a {
	text-decoration: none;
	border-block-end: 1px solid var(--wp--preset--color--primary);
}

/* ==========================================================================
 * 21. Comments
 * ========================================================================== */

.wp-block-comments-title,
.wp-block-post-comments-form .comment-reply-title {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--large);
	margin-block-end: var(--wp--preset--spacing--30);
}

.wp-block-comment-template {
	list-style: none;
	margin-inline: 0;
	padding-inline: 0;
}

.wp-block-comment-template li {
	padding-block: var(--wp--preset--spacing--30);
	border-block-end: 1px solid var(--mtsb-hairline);
}

.wp-block-comment-template li ol {
	list-style: none;
	margin-block-start: var(--wp--preset--spacing--30);
	padding-inline-start: var(--wp--preset--spacing--30);
	border-inline-start: 2px solid var(--mtsb-hairline);
}

.wp-block-comment-author-name {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
}

.wp-block-comment-date,
.wp-block-comment-edit-link {
	font-size: var(--wp--preset--font-size--small);
	color: var(--mtsb-muted); /* 7.41:1 light / 9.14:1 dark — AA */
}

.wp-block-comment-content {
	margin-block: var(--wp--preset--spacing--20);
	text-wrap: pretty;
}

.wp-block-comment-reply-link a {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--mts-brass-text, #8a5c1f); /* 5.26:1 Cream / 8.01:1 dark — AA */
}

.wp-block-comments-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
	margin-block-start: var(--wp--preset--spacing--40);
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.wp-block-comments-pagination :where(a, .current) {
	min-height: var(--mtsb-touch);
	display: inline-flex;
	align-items: center;
}

/* ==========================================================================
 * 22. Footnotes
 * ========================================================================== */

.wp-block-footnotes {
	margin-block-start: var(--wp--preset--spacing--50);
	padding-block-start: var(--wp--preset--spacing--30);
	border-block-start: 1px solid var(--mtsb-hairline);
	font-size: var(--wp--preset--font-size--small);
	color: var(--mtsb-muted); /* 7.41:1 light / 9.14:1 dark — AA */
}

.wp-block-footnotes li {
	margin-block-end: 0.6em;
	text-wrap: pretty;
}

.wp-block-footnotes li:target {
	background-color: var(--mtsb-panel);
	box-shadow: inset 3px 0 0 var(--wp--preset--color--primary);
	padding-inline-start: 0.5em;
}

/* The ↩ back-link, and the superscript reference in the prose. */
.wp-block-footnotes a,
a[data-fn] {
	color: var(--mts-brass-text, #8a5c1f); /* 5.26:1 Cream / 8.01:1 dark — AA */
	text-underline-offset: 0.15em;
}

a[data-fn] {
	/* Enlarge the tap target of a superscript marker without moving it. */
	padding-inline: 0.15em;
}

/* ==========================================================================
 * 23. Login/out, Math, Icon
 * ========================================================================== */

.wp-block-loginout {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.wp-block-loginout a {
	text-decoration: none;
	border-block-end: 1px solid var(--wp--preset--color--primary);
}

/* core/math (7.1). Long expressions must scroll rather than break the page. */
.wp-block-math {
	overflow-x: auto;
	margin-block: var(--wp--preset--spacing--40);
	padding-block: var(--wp--preset--spacing--20);
}

.wp-block-math math {
	font-size: 1.15em;
}

/* core/icon (7.1) renders a bare SVG that inherits currentColor. */
.wp-block-icon svg {
	fill: currentColor;
	display: block;
}

.wp-block-icon a {
	display: inline-flex;
	min-width: var(--mtsb-touch);
	min-height: var(--mtsb-touch);
	align-items: center;
	justify-content: center;
}

/* ==========================================================================
 * 24. Classic-editor (core/freeform) content
 * ==========================================================================
 * Freeform output carries no block classes at all — only the legacy alignment
 * classes. Any content migrated from the old site lands here.
 */

.wp-block-post-content :where(.alignleft) {
	float: left;
	margin: 0.3em var(--wp--preset--spacing--30) var(--wp--preset--spacing--20) 0;
}

.wp-block-post-content :where(.alignright) {
	float: right;
	margin: 0.3em 0 var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
}

.wp-block-post-content :where(.aligncenter) {
	display: block;
	margin-inline: auto;
}

.wp-block-post-content :where(.wp-caption) {
	max-width: 100%;
}

.wp-block-post-content :where(.wp-caption-text) {
	font-size: var(--wp--preset--font-size--small);
	color: var(--mtsb-muted);
	margin-block-start: 0.5em;
}

/* Floats must not escape their section. */
.wp-block-post-content::after {
	content: "";
	display: table;
	clear: both;
}

@media (max-width: 600px) {
	/* A 200px float in a 320px viewport leaves a two-word column beside it. */
	.wp-block-post-content :where(.alignleft, .alignright) {
		float: none;
		display: block;
		margin-inline: 0;
	}
}

/* ==========================================================================
 * 25. Plugin blocks — Yoast structured content
 * ==========================================================================
 * Yoast's FAQ and How-to blocks are the two the client could plausibly insert
 * from the SEO plugin. They ship entirely unstyled on the front end.
 */

.schema-faq-section {
	padding-block: var(--wp--preset--spacing--30);
	border-block-end: 1px solid var(--mtsb-hairline);
}

.schema-faq-question {
	display: block;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	line-height: 1.25;
	color: inherit;
}

.schema-faq-answer {
	margin-block-start: var(--wp--preset--spacing--20);
	text-wrap: pretty;
}

.schema-how-to-steps {
	list-style: none;
	margin-inline: 0;
	padding-inline: 0;
	counter-reset: mtsb-step;
}

.schema-how-to-step {
	position: relative;
	counter-increment: mtsb-step;
	padding-inline-start: 2.75rem;
	padding-block: var(--wp--preset--spacing--20);
}

.schema-how-to-step::before {
	content: counter(mtsb-step);
	position: absolute;
	inset-inline-start: 0;
	top: var(--wp--preset--spacing--20);
	width: 1.9rem;
	height: 1.9rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background-color: var(--wp--preset--color--primary-dark);
	color: var(--wp--preset--color--base); /* Cream on #8a5c1f = 5.26:1 — AA */
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
}

.schema-how-to-step-name {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
}

.schema-how-to-duration {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--mtsb-muted);
}

/* ==========================================================================
 * 26. Dark-surface corrections
 * ==========================================================================
 * Most blocks above already work on Stage Black because they inherit their
 * text colour and read the surface-aware tokens. What remains are the cases
 * where a colour genuinely has to change rather than inherit.
 *
 * These use `:is()`, NOT `:where()`. See the specificity note in the file
 * header: `:where()` scores zero and silently loses to the light base rules.
 */

/*
 * theme.json sets `elements.caption` to Slate, which is 7.41:1 on Cream but
 * only 2.03:1 on Stage Black. theme.json cannot express a surface-aware
 * value, so the dark case is corrected here. Affects image, gallery, table,
 * embed, audio and video captions alike.
 */
:is(
	.wp-block-group.is-style-stage,
	.has-surface-dark-background-color,
	.has-contrast-background-color,
	footer.wp-block-group
) :is(figcaption, .wp-element-caption) {
	color: var(--mtsb-muted); /* #b6b4b1 on Stage Black — 9.14:1 AA/AAA */
}

/* theme.json points links at Midnight Blue (10.58:1 on Cream, unreadable on
   Stage Black). Cream is 17.22:1. */
:is(
	.wp-block-group.is-style-stage,
	.has-surface-dark-background-color,
	.has-contrast-background-color,
	footer.wp-block-group
) :is(
	.wp-block-archives-list,
	.wp-block-categories-list,
	.wp-block-page-list,
	.wp-block-latest-posts__list,
	.wp-block-rss
) a {
	color: var(--wp--preset--color--base);
}

/* The search field must not stay Cream-on-Cream on a dark band. */
:is(
	.wp-block-group.is-style-stage,
	.has-surface-dark-background-color,
	.has-contrast-background-color,
	footer.wp-block-group
) :is(
	.wp-block-search__input,
	.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper
) {
	background-color: var(--mtsb-panel);
	color: var(--wp--preset--color--base); /* Cream on #1e2125 = 14.71:1 */
	border-color: var(--mtsb-edge);
}

:is(
	.wp-block-group.is-style-stage,
	.has-surface-dark-background-color,
	.has-contrast-background-color,
	footer.wp-block-group
) .wp-block-search__input::placeholder {
	color: var(--mtsb-muted); /* #b6b4b1 on #1e2125 = 7.81:1 — AA */
}

/* The dropdown <select>s keep a light field on a dark band, so their text
   must stay Ink rather than inheriting Cream onto Cream. */
:is(
	.wp-block-group.is-style-stage,
	.has-surface-dark-background-color,
	.has-contrast-background-color,
	footer.wp-block-group
) :is(.wp-block-archives-dropdown select, .wp-block-categories-dropdown select) {
	color: var(--wp--preset--color--contrast); /* 16.35:1 on the Cream field */
}

/* Tag pills: hover inverts to Brass Light with Ink text, because Cream-on-Ink
   would vanish into the Stage Black band behind it. */
:is(
	.wp-block-group.is-style-stage,
	.has-surface-dark-background-color,
	.has-contrast-background-color,
	footer.wp-block-group
) .wp-block-tag-cloud a:hover {
	background-color: var(--wp--preset--color--primary-light);
	color: var(--wp--preset--color--contrast); /* Ink on Brass Light 7.61:1 */
	border-color: var(--wp--preset--color--primary-light);
}

/* Outline buttons: an Ink outline is invisible on Stage Black. Hover goes to
   Brass Light with Ink text (7.61:1) rather than Brass Dark, which is only
   3.27:1 against the surrounding band. */
:is(
	.wp-block-group.is-style-stage,
	.has-surface-dark-background-color,
	.has-contrast-background-color,
	footer.wp-block-group
) .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color) {
	color: var(--wp--preset--color--base); /* 17.22:1 on Stage Black */
}

:is(
	.wp-block-group.is-style-stage,
	.has-surface-dark-background-color,
	.has-contrast-background-color,
	footer.wp-block-group
) .wp-block-button.is-style-outline > .wp-block-button__link:is(:hover, :focus-visible) {
	background-color: var(--wp--preset--color--primary-light);
	border-color: var(--wp--preset--color--primary-light);
	color: var(--wp--preset--color--contrast); /* Ink on Brass Light 7.61:1 */
}

/* The filled button: theme.json paints it Ink-on-Cream, which disappears into
   Stage Black. Invert it. */
:is(
	.wp-block-group.is-style-stage,
	.has-surface-dark-background-color,
	.has-contrast-background-color,
	footer.wp-block-group
) .wp-block-button:not(.is-style-outline) > .wp-block-button__link:not(.has-background) {
	background-color: var(--wp--preset--color--base);
	border-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast); /* Ink on Cream 16.35:1 */
}

:is(
	.wp-block-group.is-style-stage,
	.has-surface-dark-background-color,
	.has-contrast-background-color,
	footer.wp-block-group
) .wp-block-button:not(.is-style-outline) > .wp-block-button__link:is(:hover, :focus-visible):not(.has-background) {
	background-color: var(--wp--preset--color--primary-light);
	border-color: var(--wp--preset--color--primary-light);
	color: var(--wp--preset--color--contrast); /* Ink on Brass Light 7.61:1 */
}

/* ==========================================================================
 * 27. Print
 * ========================================================================== */

@media print {
	.wp-block-table,
	.wp-block-code,
	.wp-block-preformatted,
	.wp-block-math {
		overflow: visible;
	}

	.wp-block-code,
	.wp-block-preformatted {
		white-space: pre-wrap;
	}

	.wp-block-details:not([open]) > summary {
		border-block-end: 0;
	}

	.wp-block-playlist__tracklist {
		max-height: none;
		overflow: visible;
	}
}
