/**
 * Curio rich text: long-form body copy (articles, pages).
 *
 * Wrap content in `.curio-rich-text`. Every direct child is centered at
 * `--block-max-width` with a `--block-rhythm` vertical rhythm.
 *
 * Handle: 'curio-rich-text' (registered in inc/article.php).
 */

.curio-rich-text {
	/* Merriweather, including its own bold; headings below switch back to the site font. */
	font-family: var(--f-text);
	font-size: 1.125rem;
	font-weight: 300;
	line-height: 1.5555555556;
	color: var(--c-text);
}

.curio-rich-text::after {
	content: "";
	display: table;
	clear: both;
}

/* -------------------------------------------------------------
 * Column + vertical rhythm
 * ----------------------------------------------------------- */
.curio-rich-text > * {
	max-width: var(--block-max-width);
	margin-block: var(--rt-space-top, var(--block-rhythm)) var(--rt-space-bottom, var(--block-rhythm));
	margin-inline: var(--rt-inline-start, auto) var(--rt-inline-end, auto);
}

.curio-rich-text > :first-child {
	margin-block-start: 0;
}

.curio-rich-text > :last-child {
	margin-block-end: 0;
}

.curio-rich-text > :where(style, script) {
	display: none;
}

.curio-rich-text > .alignwide {
	max-width: var(--block-wide-max-width);
}

.curio-rich-text > .alignfull {
	max-width: var(--content-max);
}

/* -------------------------------------------------------------
 * Text
 * ----------------------------------------------------------- */
.curio-rich-text p {
	margin-top: 0;
}

/* Every link in article text looks the same: link color, plain underline. */
.curio-rich-text :where(p, li, dd, td, figcaption) a:not([class]) {
	color: var(--c-link);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

.curio-rich-text :where(p, li, dd, td, figcaption) a:not([class]):hover,
.curio-rich-text :where(p, li, dd, td, figcaption) a:not([class]):focus-visible {
	color: var(--c-link);
	text-decoration-thickness: 2px;
}

@media (prefers-reduced-motion: no-preference) {
	.curio-rich-text :where(p, li) a:not([class]) {
		transition: color 250ms ease-in-out;
	}
}

.curio-rich-text :where(strong, b) {
	font-weight: 700;
}

.curio-rich-text :where(h1, h2, h3, h4, h5, h6) {
	margin-bottom: 0.75rem;
	font-family: var(--f-primary);
	font-weight: 700;
	line-height: 1.25;
	color: var(--c-heading);
}

.curio-rich-text :where(h3, h4, h5, h6) {
	margin-bottom: 0.5rem;
}

.curio-rich-text :where(h1, h2, h3, h4, h5, h6) a {
	border: 0;
	color: inherit;
	text-decoration: none;
}

/* A heading groups with the section it opens: more space above than below.
   (The first block in the text keeps no top margin.) */
.curio-rich-text > :where(h1, h2) {
	--rt-space-top: 2.25rem;
}

.curio-rich-text > :where(h3, h4, h5, h6) {
	--rt-space-top: 1.75rem;
}

/* Whatever follows a heading (list, figure, quote…) sits at the heading's gap. */
.curio-rich-text > :where(h1, h2, h3, h4, h5, h6) + * {
	--rt-space-top: 0px;
}

.curio-rich-text h1 { font-size: 1.875rem; }
.curio-rich-text h2 { font-size: 1.5rem; }
.curio-rich-text h3 { font-size: 1.25rem; }
.curio-rich-text h4 { font-size: 1.125rem; }
.curio-rich-text h5 { font-size: 1.0625rem; }
.curio-rich-text h6 { font-size: 1rem; }

@media (min-width: 64rem) {
	.curio-rich-text :where(h1, h2, h3, h4, h5, h6) {
		line-height: 1.35;
	}

	.curio-rich-text h1 { font-size: 2.25rem; }
	.curio-rich-text h2 { font-size: 1.75rem; }
	.curio-rich-text h3 { font-size: 1.375rem; }
	.curio-rich-text h4 { font-size: 1.1875rem; }
	.curio-rich-text h5 { font-size: 1.125rem; }
	.curio-rich-text h6 { font-size: 1.0625rem; }
}

.curio-rich-text .has-small-font-size { font-size: 0.8125rem !important; }
.curio-rich-text .has-normal-font-size { font-size: 1.125rem !important; }
.curio-rich-text .has-medium-font-size { font-size: 1.375rem !important; }
.curio-rich-text .has-large-font-size { font-size: 1.625rem !important; }
.curio-rich-text .has-huge-font-size { font-size: 1.875rem !important; }

@media (min-width: 64rem) {
	.curio-rich-text .has-medium-font-size { font-size: 1.625rem !important; }
	.curio-rich-text .has-large-font-size { font-size: 2.25rem !important; }
	.curio-rich-text .has-huge-font-size { font-size: 2.875rem !important; }
}

.curio-rich-text p.has-drop-cap:not(:focus)::first-letter {
	float: left;
	margin: 0.05em 0.1em 0 0;
	font-family: var(--f-primary);
	font-size: 5.5em;
	font-weight: 700;
	line-height: 0.8;
	color: var(--c-heading);
}

/* Lists */
.curio-rich-text :where(ul, ol) {
	padding-left: 0;
}

.curio-rich-text ul {
	list-style-type: circle;
}

.curio-rich-text ol {
	list-style: decimal outside none;
}

.curio-rich-text ol ol {
	list-style-type: lower-roman;
}

.curio-rich-text ol ol ol {
	list-style-type: lower-alpha;
}

/* Phones: about 1.25em of indent (the bullet sits in it); 40px from 48rem as before. */
.curio-rich-text li {
	margin-bottom: 0.5rem;
	margin-left: 1em;
	padding-left: 0.25em;
}

@media (min-width: 48rem) {
	.curio-rich-text li {
		margin-left: 1.25rem;
		padding-left: 1.25rem;
	}
}

.curio-rich-text li :where(ul, ol) {
	margin-top: 0.5rem;
}

/* Definition lists */
.curio-rich-text dt {
	margin-bottom: 0.25rem;
	font-weight: 700;
}

.curio-rich-text dd {
	margin: 0 0 0.9375rem;
	padding-left: 0.9375rem;
	border-left: 2px solid var(--c-rule);
	font-size: 1.0625rem;
	line-height: 1.5;
}

/* Quotes */
.curio-rich-text blockquote,
.curio-rich-text .wp-block-quote {
	margin-inline: var(--rt-inline-start, auto) var(--rt-inline-end, auto);
	padding: 0.625rem var(--grid-gap);
	border-left: 1px solid var(--c-tag);
}

.curio-rich-text blockquote p {
	margin: 0;
	font-family: var(--f-primary);
	font-size: 1.125rem;
	font-style: normal;
	font-weight: 700;
	line-height: 1.5555555556;
	color: var(--c-secondary);
}

.curio-rich-text blockquote p + p {
	margin-top: 1rem;
}

@media (min-width: 64rem) {
	.curio-rich-text blockquote p {
		line-height: 1.7777777778;
	}
}

.curio-rich-text blockquote cite {
	display: block;
	width: 100%;
	margin-top: 1rem;
	font-size: 0.9375rem;
	font-style: normal;
	text-align: right;
	text-transform: none;
	color: var(--c-text);
}

.curio-rich-text blockquote cite::before {
	content: "\2014";
}

/* Pull quote: same treatment as a block quote, set in the text column. */
.curio-rich-text .wp-block-pullquote {
	padding: 0;
	border: 0;
	font-size: inherit;
	text-align: left;
}

.curio-rich-text .wp-block-pullquote blockquote {
	margin: 0;
}

.curio-rich-text .wp-block-pullquote p {
	font-size: 1.25rem;
}

/* Separator */
.curio-rich-text hr,
.curio-rich-text .wp-block-separator {
	height: 1px;
	border: 0;
	background: none;
	opacity: 1;
}

.curio-rich-text hr::before,
.curio-rich-text .wp-block-separator::before {
	content: "";
	display: block;
	width: 13rem;
	height: 1px;
	margin-inline: auto;
	background-color: var(--c-rule);
}

.curio-rich-text .wp-block-separator.is-style-wide::before {
	width: 100%;
}

.curio-rich-text .wp-block-separator.is-style-dots {
	height: auto;
	text-align: center;
}

.curio-rich-text .wp-block-separator.is-style-dots::before {
	content: "\00b7 \00b7 \00b7";
	width: auto;
	height: auto;
	background: none;
	font-size: 1.5rem;
	letter-spacing: 1em;
	color: var(--c-rule);
}

/* Tables */
.curio-rich-text table {
	min-width: calc(100% - 2px);
	border: 1px solid var(--c-gray-light);
	border-spacing: 0;
	border-collapse: separate;
}

.curio-rich-text th,
.curio-rich-text td {
	padding: 0.8125rem 0.9375rem;
	border: 1px solid var(--c-gray-light);
	border-left: 0;
	text-align: left;
}

.curio-rich-text th {
	border-width: 1px 1px 3px;
	font-weight: 700;
}

.curio-rich-text tbody tr:nth-child(odd) {
	background-color: color-mix(in srgb, var(--c-gray-light) 50%, transparent);
}

.curio-rich-text .wp-block-table {
	overflow-x: auto;
}

/* Code */
.curio-rich-text code {
	padding: 0 0.3em;
	border: 1px solid var(--c-rule);
	border-radius: 2px;
	background-color: var(--c-gray-light);
	font: 400 90% var(--f-mono);
}

.curio-rich-text pre,
.curio-rich-text .wp-block-preformatted,
.curio-rich-text .wp-block-code {
	padding: 0.5rem 0.625rem;
	overflow-x: auto;
	font: 400 90% var(--f-mono);
	white-space: pre-wrap;
	word-break: break-word;
}

.curio-rich-text pre code {
	padding: 0;
	border: 0;
	background: none;
}

/* -------------------------------------------------------------
 * Figures: images, embeds, captions + credits
 * ----------------------------------------------------------- */
.curio-rich-text figure {
	margin-inline: var(--rt-inline-start, auto) var(--rt-inline-end, auto);
}

.curio-rich-text img {
	max-width: 100%;
	height: auto;
}

.curio-rich-text > .wp-block-image img,
.curio-rich-text > figure > img {
	width: 100%;
}

.curio-rich-text figcaption,
.curio-rich-text .wp-element-caption {
	margin: 0.5rem 0;
	font-family: var(--f-primary);
	font-size: 0.875rem;
	font-weight: 300;
	line-height: 1.4285714286;
	text-align: left;
	color: var(--c-heading);
}

.curio-rich-text figcaption a:not([class]) {
	color: var(--c-primary);
}

.curio-caption,
.curio-credit {
	display: block;
}

.curio-caption:not(:only-child) {
	margin-bottom: 0.5rem;
}

.curio-credit {
	font-size: var(--fs-credit);
	font-weight: 300;
	line-height: 1.2;
	letter-spacing: 0.075em;
	text-transform: uppercase;
}

/* Embeds (video, social). */
.curio-rich-text .wp-block-embed__wrapper {
	position: relative;
}

.curio-rich-text .wp-block-embed iframe {
	display: block;
	max-width: 100%;
}

.curio-rich-text .wp-block-embed.wp-has-aspect-ratio .wp-block-embed__wrapper::before {
	content: "";
	display: block;
	padding-top: var(--rt-embed-ratio, 56.25%);
}

.curio-rich-text .wp-block-embed.wp-has-aspect-ratio iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.curio-rich-text .wp-embed-aspect-4-3 { --rt-embed-ratio: 75%; }
.curio-rich-text .wp-embed-aspect-1-1 { --rt-embed-ratio: 100%; }
.curio-rich-text .wp-embed-aspect-9-16 { --rt-embed-ratio: 177.78%; }
.curio-rich-text .wp-embed-aspect-21-9 { --rt-embed-ratio: 42.86%; }
.curio-rich-text .wp-embed-aspect-18-9 { --rt-embed-ratio: 50%; }
.curio-rich-text .wp-embed-aspect-1-2 { --rt-embed-ratio: 200%; }

.curio-rich-text .wp-block-video video,
.curio-rich-text .wp-block-audio audio {
	width: 100%;
}

/* -------------------------------------------------------------
 * Alignment: floats from 48rem, stacked below.
 * ----------------------------------------------------------- */
.curio-rich-text .aligncenter {
	clear: both;
	margin-inline: auto;
	text-align: center;
}

.curio-rich-text .aligncenter > * {
	margin-inline: auto;
}

.curio-rich-text .aligncenter figcaption {
	text-align: left;
}

@media (max-width: 47.9375rem) {
	.curio-rich-text .alignleft,
	.curio-rich-text .alignright {
		float: none;
		margin-inline: auto;
	}
}

@media (min-width: 48rem) {
	.curio-rich-text > .alignleft,
	.curio-rich-text > .alignright {
		max-width: calc(var(--block-max-width) / 2 - var(--grid-gap) / 2);
		margin-block: 0;
	}

	.curio-rich-text > .alignleft {
		float: left;
		--rt-inline-start: calc(50% - var(--block-wide-max-width) / 2);
		--rt-inline-end: 1.25rem;
	}

	.curio-rich-text > .alignright {
		float: right;
		--rt-inline-start: 1.25rem;
		--rt-inline-end: calc(50% - var(--block-wide-max-width) / 2);
	}
}

.curio-rich-text > .alignleft figcaption,
.curio-rich-text > .alignright figcaption {
	margin-bottom: 0;
}

/* Blocks that start a new section never wrap around floats. */
.curio-rich-text > :where(h2, h3, .wp-block-separator, hr) {
	clear: both;
}

/* Buttons from the core buttons block. */
.curio-rich-text .wp-block-button__link {
	border-radius: var(--radius-button);
	background-color: var(--c-tag);
	color: var(--c-tag-text);
	font-size: 0.875rem;
	font-weight: 700;
	letter-spacing: 0.075em;
	text-transform: uppercase;
}

@media print {
	.curio-rich-text figure,
	.curio-rich-text blockquote,
	.curio-rich-text table {
		break-inside: avoid;
	}
}
