/*
 * Stuaim: blocks.
 * 1. Text pages: the type and spacing of core blocks inside page and post content.
 * 2. Sections: the type and spacing inside a Group with a "Section" style
 *    (the one-pager's look). These come second so they win inside sections.
 * 3. The theme's block styles: Lead, Caption, Display numeral, Numeral,
 *    Editor note, Ruled statements, Hairline.
 * The four custom blocks (phone, share card, strokes, wordmark) carry their
 * own style.css in blocks/.
 */

/* =========================================================
   1. Text pages
   ========================================================= */

:is(.entry-content, .is-root-container) {
	font-size: 1.0625rem;
	line-height: 1.65;
	color: var(--stuaim-ink-82);
}

:is(.entry-content, .is-root-container) > *,
:is(.entry-content, .is-root-container) :where(.wp-block-group.is-layout-flow, .wp-block-group.is-layout-constrained, .wp-block-column, .wp-block-cover__inner-container, .wp-block-media-text__content, .wp-block-details) > * {
	margin-block: 0;
}

:is(.entry-content, .is-root-container) > * + *,
:is(.entry-content, .is-root-container) :where(.wp-block-group.is-layout-flow, .wp-block-group.is-layout-constrained, .wp-block-column, .wp-block-cover__inner-container, .wp-block-media-text__content, .wp-block-details) > * + * {
	margin-block-start: 1.15em;
}

:is(.entry-content, .is-root-container) :where(h2, h3, h4, h5, h6) {
	color: var(--stuaim-text);
	text-wrap: pretty;
}

:is(.entry-content, .is-root-container) :where(h2) {
	font-size: 1.625rem;
	line-height: 1.25;
}

:is(.entry-content, .is-root-container) :where(h3) {
	font-size: 1.25rem;
	line-height: 1.3;
}

:is(.entry-content, .is-root-container) :where(h4, h5, h6) {
	font-family: var(--stuaim-sans);
	font-weight: 600;
	font-size: 1.0625rem;
	line-height: 1.4;
}

:is(.entry-content, .is-root-container) > * + :where(h2),
:is(.entry-content, .is-root-container) :where(.wp-block-group, .wp-block-column) > * + :where(h2) {
	margin-block-start: 2em;
}

:is(.entry-content, .is-root-container) > * + :where(h3, h4, h5, h6),
:is(.entry-content, .is-root-container) :where(.wp-block-group, .wp-block-column) > * + :where(h3, h4, h5, h6) {
	margin-block-start: 1.7em;
}

:is(.entry-content, .is-root-container) > :where(h2, h3, h4, h5, h6) + *,
:is(.entry-content, .is-root-container) :where(.wp-block-group, .wp-block-column) > :where(h2, h3, h4, h5, h6) + * {
	margin-block-start: 0.6em;
}

:is(.entry-content, .is-root-container) a:where(:not(.wp-element-button):not(.wp-block-button__link)) {
	color: var(--stuaim-link);
}

:is(.entry-content, .is-root-container) :where(ul, ol) {
	padding-inline-start: 1.4em;
}

:is(.entry-content, .is-root-container) :where(li + li) {
	margin-top: 0.45em;
}

:is(.entry-content, .is-root-container) :where(li > ul, li > ol) {
	margin-top: 0.45em;
}

:is(.entry-content, .is-root-container) li::marker {
	color: var(--stuaim-ink-66);
}

/* Quote and pullquote: serif, quiet, a rule at the start. The quote uses the
   bundled serif italic; the serif upright is bundled in 600 only. */
:is(.entry-content, .is-root-container) .wp-block-quote {
	padding: 0.2em 0 0.2em 1.1em;
	font-style: italic;
	font-weight: 400;
	border-inline-start: 2px solid var(--stuaim-moss);
	font-family: var(--stuaim-serif);
	font-size: 1.25rem;
	line-height: 1.5;
	color: var(--stuaim-ink);
}

:is(.entry-content, .is-root-container) .wp-block-quote > * + * {
	margin-block-start: 0.6em;
}

:is(.entry-content, .is-root-container) .wp-block-quote cite,
:is(.entry-content, .is-root-container) .wp-block-pullquote cite {
	display: block;
	margin-top: 0.7em;
	font-family: var(--stuaim-sans);
	font-size: 0.875rem;
	font-style: normal;
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
	color: var(--stuaim-ink-66);
}

:is(.entry-content, .is-root-container) .wp-block-pullquote {
	padding: 1.4em 0;
	border-block: 1px solid var(--stuaim-line);
	font-family: var(--stuaim-serif);
	font-weight: 600;
	font-size: 1.625rem;
	line-height: 1.3;
	color: var(--stuaim-ink);
	text-align: center;
}

:is(.entry-content, .is-root-container) .wp-block-pullquote blockquote {
	margin: 0;
}

:is(.entry-content, .is-root-container) .wp-block-pullquote p {
	font-size: inherit;
	line-height: inherit;
	margin: 0;
}

/* Code. */
:is(.entry-content, .is-root-container) code,
:is(.entry-content, .is-root-container) kbd {
	font-family: var(--stuaim-mono);
	font-size: 0.88em;
	padding: 0.1em 0.3em;
	border-radius: 4px;
	background: var(--stuaim-vellum);
}

:is(.entry-content, .is-root-container) pre,
:is(.entry-content, .is-root-container) .wp-block-code,
:is(.entry-content, .is-root-container) .wp-block-preformatted {
	overflow-x: auto;
	padding: 16px 18px;
	border: 0;
	border-radius: 10px;
	background: var(--stuaim-vellum);
	color: var(--stuaim-ink);
	font-family: var(--stuaim-mono);
	font-size: 0.875rem;
	line-height: 1.6;
	white-space: pre;
}

:is(.entry-content, .is-root-container) pre code,
:is(.entry-content, .is-root-container) .wp-block-code code {
	padding: 0;
	background: none;
	font-size: inherit;
}

/* Tables. */
:is(.entry-content, .is-root-container) .wp-block-table {
	overflow-x: auto;
}

:is(.entry-content, .is-root-container) table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
	line-height: 1.5;
}

:is(.entry-content, .is-root-container) .wp-block-table :is(th, td),
:is(.entry-content, .is-root-container) table :is(th, td) {
	padding: 10px 12px 10px 0;
	border: 0;
	border-bottom: 1px solid var(--stuaim-line);
	text-align: start;
	vertical-align: top;
}

:is(.entry-content, .is-root-container) th {
	font-weight: 600;
	color: var(--stuaim-ink);
}

:is(.entry-content, .is-root-container) .wp-block-table :is(thead, tfoot) {
	border: 0;
}

:is(.entry-content, .is-root-container) .wp-block-table thead :is(th, td) {
	border-bottom: 1px solid var(--stuaim-ink-55);
}

:is(.entry-content, .is-root-container) .wp-block-table tfoot {
	border-top: 0;
}

:is(.entry-content, .is-root-container) .wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background: rgba(228, 223, 210, 0.55);
}

:is(.entry-content, .is-root-container) .wp-block-table.is-style-stripes {
	border-bottom: 0;
}

:is(.entry-content, .is-root-container) .wp-block-table.is-style-stripes :where(th, td) {
	padding-inline-start: 12px;
}

/* Images, galleries, captions. */
:is(.entry-content, .is-root-container) :where(.wp-block-image, .wp-block-gallery, .wp-block-video, .wp-block-audio, .wp-block-embed) img {
	border-radius: 6px;
}

:is(.entry-content, .is-root-container) figcaption,
:is(.entry-content, .is-root-container) .wp-element-caption,
:is(.entry-content, .is-root-container) .wp-block-table figcaption {
	margin-top: 8px;
	margin-bottom: 0;
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--stuaim-ink-66);
	text-align: start;
}

:is(.entry-content, .is-root-container) .wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
	font-size: 0.8125rem;
	text-align: center;
}

/* Separator and spacer. */
:is(.entry-content, .is-root-container) .wp-block-separator {
	border: 0;
	border-top: 1px solid var(--stuaim-line);
	opacity: 1;
	background: none;
	color: var(--stuaim-line);
	height: 0;
}

:is(.entry-content, .is-root-container) .wp-block-separator.has-background:not(.is-style-dots) {
	height: 0;
	border-top-color: currentColor;
}

:is(.entry-content, .is-root-container) .wp-block-separator:not(.is-style-wide):not(.is-style-dots):not(.is-style-hairline) {
	width: 88px;
}

:is(.entry-content, .is-root-container) .wp-block-separator.is-style-dots {
	border: 0;
	height: auto;
	color: var(--stuaim-ink-66);
}

:is(.entry-content, .is-root-container) > * + .wp-block-separator,
:is(.entry-content, .is-root-container) > .wp-block-separator + * {
	margin-block-start: 2em;
}

:is(.entry-content, .is-root-container) .wp-block-spacer {
	margin-block: 0;
}

/* Cover, media and text, group with a background. */
:is(.entry-content, .is-root-container) .wp-block-cover {
	border-radius: 14px;
	overflow: hidden;
}

:is(.entry-content, .is-root-container) .wp-block-cover.alignfull {
	border-radius: 0;
}

:is(.entry-content, .is-root-container) .wp-block-media-text .wp-block-media-text__media img {
	border-radius: 10px;
}

:is(.entry-content, .is-root-container) .wp-block-group.has-background:not([class*="is-style-section"]) {
	padding: 22px 26px;
	border-radius: 14px;
}

:is(.entry-content, .is-root-container) .wp-block-group.has-background.alignfull:not([class*="is-style-section"]) {
	border-radius: 0;
	padding-inline: var(--stuaim-box-inline);
}

/* Details: questions and answers. */
.wp-block-details {
	border-top: 1px solid var(--stuaim-line);
	padding-block: 16px;
}

.wp-block-details + .wp-block-details {
	margin-block-start: 0 !important;
}

.wp-block-details:last-child,
.wp-block-details:has(+ :not(.wp-block-details)) {
	border-bottom: 1px solid var(--stuaim-line);
}

.wp-block-details summary {
	position: relative;
	padding-inline-end: 32px;
	font-family: var(--stuaim-serif);
	font-weight: 600;
	font-size: 1.1875rem;
	line-height: 1.35;
	color: var(--stuaim-text);
	cursor: pointer;
	list-style: none;
}

.wp-block-details summary::-webkit-details-marker {
	display: none;
}

.wp-block-details summary::after {
	content: "";
	position: absolute;
	inset-inline-end: 4px;
	top: 0.35em;
	width: 9px;
	height: 9px;
	border-inline-end: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	opacity: 0.6;
}

.wp-block-details[open] summary::after {
	top: 0.55em;
	transform: rotate(225deg);
}

.wp-block-details > :not(summary) {
	color: var(--stuaim-text-body);
}

.wp-block-details[open] > summary + * {
	margin-block-start: 10px;
}

/* File, search, latest posts, query loop, navigation links. */
:is(.entry-content, .is-root-container) .wp-block-file {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
}

:is(.entry-content, .is-root-container) .wp-block-file .wp-block-file__button {
	min-height: 40px;
	padding: 0 16px;
	border-radius: 10px;
	background: var(--stuaim-lampblack);
	color: var(--stuaim-paper);
	font-size: 0.875rem;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
}

.wp-block-search__label {
	display: block;
	margin-bottom: 8px;
	font-weight: 500;
}

.wp-block-latest-posts,
.wp-block-post-template {
	padding: 0;
	list-style: none;
}

.wp-block-latest-posts > li,
.wp-block-post-template > li {
	padding-block: 16px;
	border-top: 1px solid var(--stuaim-line);
	margin: 0 !important;
}

.wp-block-latest-posts__post-title,
:is(.entry-content, .is-root-container) a.wp-block-latest-posts__post-title,
.wp-block-post-title,
.wp-block-post-title a,
:is(.entry-content, .is-root-container) .wp-block-post-title a {
	font-family: var(--stuaim-serif);
	font-weight: 600;
	font-size: 1.1875rem;
	color: var(--stuaim-ink);
	text-decoration: none;
}

:is(.entry-content, .is-root-container) a.wp-block-latest-posts__post-title:hover,
:is(.entry-content, .is-root-container) .wp-block-post-title a:hover {
	text-decoration: underline;
	text-decoration-thickness: 1px;
}

.wp-block-post-template > li > * {
	margin-block: 0;
}

.wp-block-post-template > li > * + * {
	margin-block-start: 6px;
}

.wp-block-latest-posts__post-date,
.wp-block-post-date {
	display: block;
	margin-top: 4px;
	font-size: 0.875rem;
	color: var(--stuaim-ink-66);
}

.wp-block-latest-posts__post-excerpt,
.wp-block-post-excerpt {
	margin-top: 6px;
	color: var(--stuaim-ink-75);
}

.wp-block-query-pagination {
	gap: 16px;
	margin-top: 20px;
}

.wp-block-navigation a {
	color: var(--stuaim-ink);
}

/* =========================================================
   2. Sections (the one-pager's look)
   ========================================================= */

[class*="is-style-section"] {
	font-size: var(--stuaim-fs-body);
	line-height: normal;
}

/* Inside a section, blocks carry no margin of their own; the rules below space them. */
[class*="is-style-section"] :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, figure, blockquote, pre, hr, table, .wp-block-buttons, .wp-block-columns, .wp-block-group, .wp-block-details, .wp-block-image, .wp-block-separator, .wp-block-quote, .wp-block-stuaim-strokes, .wp-block-stuaim-phone, .wp-block-stuaim-share-card, .wp-block-stuaim-wordmark) {
	margin-block: 0;
}

[class*="is-style-section"] > :where(* + *),
[class*="is-style-section"] :where(.wp-block-column, .wp-block-group.is-layout-flow, .wp-block-group.is-layout-constrained, .wp-block-details) > :where(* + *) {
	margin-block-start: var(--stuaim-flow);
}

[class*="is-style-section"] :where(h1 + *) {
	margin-block-start: var(--stuaim-after-h1);
}

[class*="is-style-section"] :where(h2 + *) {
	margin-block-start: var(--stuaim-after-h2);
}

[class*="is-style-section"] :where(h3 + *, h4 + *) {
	margin-block-start: var(--stuaim-after-h3);
}

[class*="is-style-section"] :where(* + .wp-block-buttons) {
	margin-block-start: var(--stuaim-before-buttons);
}

[class*="is-style-section"] :where(.wp-block-buttons + *) {
	margin-block-start: var(--stuaim-after-buttons);
}

[class*="is-style-section"] :where(* + .is-style-ruled-statements) {
	margin-block-start: var(--stuaim-before-list);
}

[class*="is-style-section"] :where(.is-style-ruled-statements + *) {
	margin-block-start: var(--stuaim-after-list);
}

[class*="is-style-section"] :where(.wp-block-stuaim-strokes + *) {
	margin-block-start: var(--stuaim-after-strokes);
}

[class*="is-style-section"] :where(.is-style-display-numeral + *) {
	margin-block-start: var(--stuaim-after-numeral);
}

[class*="is-style-section"] :where(* + h2, * + h3) {
	margin-block-start: clamp(32px, calc(32px + 16 * ((100vw - 390px) / 850)), 48px);
}

[class*="is-style-section"] :where(.wp-block-stuaim-strokes + h3) {
	margin-block-start: var(--stuaim-after-strokes);
}

/* Headings. */
[class*="is-style-section"] :where(h1, h2, h3, h4) {
	font-family: var(--stuaim-serif);
	font-weight: 600;
	line-height: normal;
	color: var(--stuaim-text);
}

[class*="is-style-section"] h1 {
	font-size: var(--stuaim-fs-h1);
	line-height: 1.15;
	text-wrap: pretty;
}

[class*="is-style-section"] h2 {
	font-size: var(--stuaim-fs-h2);
}

[class*="is-style-section"] h3 {
	font-size: var(--stuaim-fs-h3);
}

[class*="is-style-section"] h4 {
	font-size: 1.125rem;
}

/* Body text. */
[class*="is-style-section"] p {
	font-size: var(--stuaim-fs-body);
	line-height: 1.65;
	color: var(--stuaim-text-body);
}

[class*="is-style-section"] :where(ul, ol):not(.is-style-ruled-statements) {
	padding-inline-start: 1.3em;
	font-size: var(--stuaim-fs-body);
	line-height: 1.65;
	color: var(--stuaim-text-body);
}

[class*="is-style-section"] a:where(:not(.wp-element-button):not(.wp-block-button__link)) {
	color: var(--stuaim-link);
}

/* Text beside media in a split row: 480px at most, as designed. */
@media (min-width: 782px) {
	[class*="is-style-section"] h1 {
		line-height: 1.12;
	}

	[class*="is-style-section"] p {
		line-height: 1.7;
	}

	.is-style-split > .wp-block-column:first-child > p:not(.is-style-lead):not(.is-style-caption) {
		max-width: 480px;
	}
}

/* Stacked (under 782px), text lines stay readable on a tablet; at phone widths
   the column is narrower than these limits anyway. */
@media (max-width: 781px) {
	.is-style-split > .wp-block-column > p:not(.is-style-display-numeral),
	.is-style-steps p {
		max-width: 560px;
	}
}

/* A paragraph placed straight in a section (not in columns) keeps a reading width. */
[class*="is-style-section"] > p:not(.has-text-align-center) {
	max-width: 640px;
}

[class*="is-style-section"] > p.has-text-align-center {
	max-width: 640px;
	margin-inline: auto;
}

/* The three steps: smaller, softer body. */
.is-style-steps p {
	font-size: var(--stuaim-fs-step);
	line-height: 1.6;
	color: var(--stuaim-text-soft);
}

@media (min-width: 782px) {
	.is-style-steps p {
		line-height: 1.6;
	}
}

/* =========================================================
   3. Block styles
   ========================================================= */

/* Paragraph: Lead. */
p.is-style-lead,
[class*="is-style-section"] p.is-style-lead {
	max-width: 520px;
	font-size: var(--stuaim-fs-lead);
	line-height: 1.6;
	color: var(--stuaim-text-body);
}

@media (min-width: 782px) {
	p.is-style-lead,
	[class*="is-style-section"] p.is-style-lead {
		line-height: 1.65;
	}
}

/* Paragraph: Caption. */
p.is-style-caption,
[class*="is-style-section"] p.is-style-caption {
	font-size: var(--stuaim-fs-caption);
	line-height: normal;
	color: var(--stuaim-text-caption);
}

/* A caption under a display numeral is a touch larger. */
.is-style-display-numeral + p.is-style-caption,
[class*="is-style-section"] .is-style-display-numeral + p.is-style-caption {
	font-size: var(--stuaim-fs-caption-large);
}

/* Under full-width stacked buttons, the caption centres. */
@media (max-width: 781px) {
	.wp-block-buttons + p.is-style-caption {
		text-align: center;
	}
}

/* Paragraph: Display numeral (Space Grotesk, 80px at 1240, 52px at 390). */
p.is-style-display-numeral,
[class*="is-style-section"] p.is-style-display-numeral {
	font-family: var(--stuaim-numeral);
	font-weight: 500;
	font-size: var(--stuaim-fs-numeral);
	line-height: 1;
	color: var(--stuaim-text);
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum" 1;
	white-space: nowrap;
}

/* Paragraph: Numeral (Space Grotesk at the current size). */
p.is-style-numeral,
[class*="is-style-section"] p.is-style-numeral,
.has-numeral-font-family {
	font-family: var(--stuaim-numeral);
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum" 1;
}

[class*="is-style-section"] p.is-style-numeral {
	color: var(--stuaim-text);
}

/* Paragraph: Editor note. A note to the site owner; visitors never see it
   (the theme removes it from the page for anyone who cannot edit). */
p.is-style-editor-note,
[class*="is-style-section"] p.is-style-editor-note {
	padding: 10px 14px;
	border-inline-start: 3px solid var(--stuaim-moss);
	border-radius: 2px;
	background: var(--stuaim-vellum);
	color: var(--stuaim-ink);
	font-family: var(--stuaim-sans);
	font-size: 0.875rem;
	line-height: 1.5;
}

p.is-style-editor-note::before {
	content: var(--stuaim-note-label, "Note:") " ";
	font-weight: 600;
	color: var(--stuaim-moss);
}

/* List: Ruled statements (the "Yours alone." list). */
.wp-block-list.is-style-ruled-statements,
ul.is-style-ruled-statements,
ol.is-style-ruled-statements {
	padding: 0;
	list-style: none;
}

.is-style-ruled-statements > li,
:is(.entry-content, .is-root-container) .is-style-ruled-statements > li {
	margin: 0;
	padding-block: clamp(15px, calc(15px + 2 * ((100vw - 390px) / 850)), 17px);
	border-top: 1px solid var(--stuaim-line);
	font-family: var(--stuaim-serif);
	font-weight: 600;
	font-size: var(--stuaim-fs-statement);
	line-height: normal;
	color: var(--stuaim-text);
}

.is-style-ruled-statements > li:last-child {
	border-bottom: 1px solid var(--stuaim-line);
}

.is-style-ruled-statements > li::marker {
	content: none;
}

@media (min-width: 782px) {
	.wp-block-list.is-style-ruled-statements {
		max-width: 560px;
	}
}

/* The closing line under ruled statements. */
.is-style-ruled-statements + p,
[class*="is-style-section"] .is-style-ruled-statements + p {
	font-size: var(--stuaim-fs-step);
	line-height: normal;
	color: var(--stuaim-text-soft);
}

/* Separator: Hairline. */
.wp-block-separator.is-style-hairline,
:is(.entry-content, .is-root-container) .wp-block-separator.is-style-hairline {
	width: 100%;
	height: 0;
	border: 0;
	border-top: 1px solid var(--stuaim-line-faint);
	background: none;
	opacity: 1;
}

/* Media and text inside a section: lines up with the section box, 72px between
   image and text (30px when stacked), image corners softened. */
[class*="is-style-section"] .wp-block-media-text {
	column-gap: 72px;
	row-gap: 30px;
}

[class*="is-style-section"] .wp-block-media-text > .wp-block-media-text__content {
	padding: 0;
}

[class*="is-style-section"] .wp-block-media-text__media img {
	border-radius: 14px;
}

@media (max-width: 600px) {
	[class*="is-style-section"] .wp-block-media-text.is-stacked-on-mobile {
		column-gap: 0;
	}
}
