/**
 * The look of post and page content, i.e. everything the editor produces.
 *
 * This is the only theme stylesheet the block editor gets (add_editor_style), so it is also the
 * only one that has to survive WordPress prefixing every selector with
 * `:where(.editor-styles-wrapper)`. That prefixing walks nested rules too and mangles them, so
 * keep this file flat: no nesting, no `&`.
 *
 * Everything around the content (cards, menus, sidebar) belongs in ds-main.css. Anything
 * general enough to be a framework rule (typography, code blocks, loading states) belongs in the
 * foundation fork at spaces-markup/vendor/dol-lab/foundation-sites-template, which the editor
 * loads as well.
 */

body {
	/* The editor iframe does not inherit the front end's font. */
	font-family: "Roboto", helvetica, arial, sans-serif;
}

/*
 * Content as a whole: `.user-generated` on the front end, `.editor-styles-wrapper` in the editor.
 * The inliner leaves a selector naming `.editor-styles-wrapper` unprefixed, so it still matches there.
 */
.user-generated,
.editor-styles-wrapper {
	overflow-wrap: break-word;
	color: var(--f-color-text-1);
	-webkit-font-smoothing: subpixel-antialiased;
}

.user-generated.post-content,
.editor-styles-wrapper.post-content {
	--f-prose-offset-left: 66px;
}

.user-generated .wp-block-image,
.editor-styles-wrapper .wp-block-image {
	margin-top: 0 !important;
}

.user-generated a:not([class^="wp-block"]):not(.button),
.editor-styles-wrapper a:not([class^="wp-block"]):not(.button) {
	text-decoration: underline;
	word-wrap: break-word;
	word-break: break-word;
	hyphens: auto;
}

.user-generated a:not([class^="wp-block"]):not(.button):not(:hover),
.editor-styles-wrapper a:not([class^="wp-block"]):not(.button):not(:hover) {
	text-decoration-color: color-mix(in oklab, var(--f-color-brand) 50%, transparent 50%);
}

.user-generated .image + :not(.image),
.editor-styles-wrapper .image + :not(.image) {
	padding-top: 1em;
}

.user-generated .wp-block-group,
.editor-styles-wrapper .wp-block-group {
	padding-bottom: 0.5em;
}

.user-generated iframe,
.editor-styles-wrapper iframe {
	max-width: 100%;
}

.user-generated a.external-link.has-text::after,
.user-generated a[target="_blank"]::after,
.editor-styles-wrapper a.external-link.has-text::after,
.editor-styles-wrapper a[target="_blank"]::after {
	font-family: "Font Awesome 7 Free";
	font-weight: 900;
	content: "\00a0\f08e";
}

.user-generated :where(:not(.is-style-rounded) > img),
.editor-styles-wrapper :where(:not(.is-style-rounded) > img) {
	border-radius: var(--f-radius);
	overflow: clip;
}

.user-generated .wp-block-image:has(+ p),
.user-generated :where(figure, img):has(+ p),
.user-generated .wp-block:has(> .wp-block-image):has(+ p),
.editor-styles-wrapper .wp-block-image:has(+ p),
.editor-styles-wrapper :where(figure, img):has(+ p),
.editor-styles-wrapper .wp-block:has(> .wp-block-image):has(+ p) {
	margin-bottom: 1em;
}

.user-generated .is-style-default,
.user-generated .is-style-default > figure,
.user-generated .is-style-default > img,
.user-generated .is-style-default > figure > img,
.editor-styles-wrapper .is-style-default,
.editor-styles-wrapper .is-style-default > figure,
.editor-styles-wrapper .is-style-default > img,
.editor-styles-wrapper .is-style-default > figure > img {
	border-radius: 0;
}

/* The Details block opens and closes like the framework's `.details`. */
.wp-block-details::details-content {
	display: block;
	block-size: 0;
	overflow: hidden;
	transition-property: block-size, content-visibility;
	transition-duration: var(--f-transition-medium);
	transition-behavior: allow-discrete;
	transition-timing-function: ease-out;
}

.wp-block-details[open]::details-content {
	block-size: auto;
	block-size: calc-size(auto, size);
}

/* Captions read the same whether they come from a shortcode or from a block. */
.wp-caption > p,
figcaption {
	max-width: 100%;
	margin: 0.5em 0;
	color: var(--f-color-text-2);
	text-align: center;
	font-size: 13px;
}

.wp-caption > p {
	margin-bottom: 1em;
}

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

.wp-block-gallery {
	margin-left: 0;
}

.wp-block-table {
	/* overwrite wp-block-defaults */
	min-width: 200px;
}

body .wp-block-table td,
body .wp-block-table th,
body .wp-block-table thead {
	/* less obtrusive table borders */
	border-color: var(--f-color-border-1);
}

.wp-block-search__input {
	/* overwrite foundation defaults */
	margin-bottom: 0;
}

.wp-block-file {
	display: flex;
	align-items: center;
}

.wp-block-file:not(.wp-element-button) {
	font-size: 1em;
	line-height: 1.7em;
}

.wp-block-file__button {
	padding: 0.3em 0.8em;
}

.wp-block-embed__wrapper {
	/* make sure an embedded iframe has proper height */
	display: flex;
}

/* embedded pdfs should have their link below, not next to it */
.wp-block-file[data-wp-interactive] {
	flex-direction: column;
}

/*
 * A PDF shown as its first page, with the file link and button below: ds_pdf_preview_card() on
 * the front end, and over core's resizable preview in the editor (ds-editor-assets.js). Both set
 * --ds-pdf-height (the block's preview height) and --ds-pdf-ratio (the page's width / height); the
 * card is that tall unless the column is too narrow for the page at that height.
 */
.wp-block-file.ds-pdf {
	display: grid;
	grid-template-columns: auto 1fr;
	justify-items: start;
	align-items: center;
	gap: 0.75em;
	overflow-wrap: anywhere;
}

.ds-pdf__page,
.ds-pdf .components-resizable-box__container {
	position: relative;
	display: block;
	grid-column: 1 / -1;
	width: 100%;
	max-width: calc(var(--ds-pdf-height) * var(--ds-pdf-ratio));
	aspect-ratio: var(--ds-pdf-ratio);
	overflow: hidden;
	border: 1px solid var(--f-color-border-1);
	border-radius: var(--f-radius);
	background-color: var(--f-color-bg-1);
	box-shadow: 0 1px 4px var(--f-color-shadow);
	transition: box-shadow var(--f-transition-medium);
}

.ds-pdf__page:hover,
.ds-pdf__page:focus-visible {
	box-shadow: 0 2px 8px var(--f-color-shadow);
}

.ds-pdf__image {
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
}

.ds-pdf .components-resizable-box__container {
	height: auto !important; /* Core sets the preview height inline. */
	background-image: var(--ds-pdf-preview);
	background-position: center;
	background-size: cover;
}

/* No rendered first page: a blank page with the file name (--ds-pdf-name in the editor). */
.ds-pdf__name,
.ds-pdf .components-resizable-box__container::after {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 2.5em 1em;
	color: var(--f-color-text-2);
	text-align: center;
	overflow-wrap: anywhere;
}

.ds-pdf .components-resizable-box__container::after {
	content: var(--ds-pdf-name, none);
}

.ds-pdf .wp-block-file__preview,
.ds-pdf .components-resizable-box__handle {
	display: none;
}

/* The badge stands in for the external-link icon of `target="_blank"` links. */
.user-generated .ds-pdf a.ds-pdf__page::after {
	content: none;
}

/* Corner badge of linked media: images (ds-main.js, ds-main.css) and PDF cards. */
.user-generated a.image-link .image-link-badge,
.ds-pdf__badge,
.ds-pdf .components-resizable-box__container::before {
	position: absolute;
	top: 8px;
	right: 8px;
	border-radius: 6px;
	background-color: rgba(0, 0, 0, 0.55);
	color: #fff;
	transition: background-color 0.18s ease;
}

.user-generated a.image-link:hover .image-link-badge,
.user-generated a.image-link:focus-visible .image-link-badge,
.ds-pdf__page:hover .ds-pdf__badge,
.ds-pdf__page:focus-visible .ds-pdf__badge {
	background-color: rgba(0, 0, 0, 0.8);
}

.ds-pdf__badge,
.ds-pdf .components-resizable-box__container::before {
	padding: 0 7px;
	font-size: 11px;
	font-weight: 700;
	line-height: 22px;
	letter-spacing: 0.05em;
}

.ds-pdf .components-resizable-box__container::before {
	content: "PDF";
}

.wp-video,
.wp-video-shortcode,
.mejs-container:not(.mejs-container-fullscreen) {
	max-height: 40vh;
}

.mejs-container video {
	max-height: 100%;
}

/* Core's player CSS resets `.mejs-container:focus` and dots its buttons' `:focus`, and loads after this file, so the
   library's ring needs the extra `div`. The player spans a collapsed post, which clips: its ring goes inside. */
div.mejs-container:focus-visible,
div.mejs-button > button:focus-visible {
	outline: var(--f-focus-width) solid var(--f-focus-color, var(--f-color-text-0));
	outline-offset: var(--f-focus-inset);
}

div.mejs-button > button:focus:not(:focus-visible) {
	outline: none;
}

/* The error overlay is dark in both modes; the library's paragraph color would sink into it. */
.mejs-cannotplay p {
	color: inherit;
}

img.emoji {
	position: relative;
}
