/**
 * Content styles: text and blocks written in the editor, with the approved
 * visual identity (D-021, applied in Stage 8, D-030).
 *
 * Shared by the site and the block editor canvas (add_editor_style), so the
 * editor shows content as it appears on the site. Only content elements live
 * here: no header, menu, footer or page layout (see site.css). Column widths
 * and wide/full alignments are handled by site.css on the site and by
 * WordPress (theme.json "layout") in the editor.
 *
 * Every value comes from tokens.css, which mirrors theme.json: this file has
 * no colors or fonts of its own. Colors are used by role (text, heading,
 * link, accent…), so the dark and peach sections of the home page only switch
 * the roles (tokens.css).
 */

/* ---------- Text ---------- */

:where(h1, h2, h3, h4, h5, h6) {
	font-family: var(--carolsaling-font-heading);
	font-weight: var(--carolsaling-weight-heading);
	letter-spacing: -0.01em;
	text-wrap: balance;
}

:where(h2, h3, h4, h5, h6) {
	margin-block: 1.75em 0.5em;
}

:where(p, li) {
	text-wrap: pretty;
}

/* Links: always underlined, because brand blue and the text color are close
 * (1.13:1); on hover the underline gets thicker and takes the accent color. */
:where(a:not(.wp-element-button)) {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

:where(a:not(.wp-element-button)):hover {
	text-decoration-color: var(--carolsaling-color-accent);
	text-decoration-thickness: 2px;
}

:where(strong, b) {
	font-weight: 600;
}

:where(ul, ol) {
	padding-inline-start: 1.5em;
}

:where(li) > :where(ul, ol) {
	margin-block: 0.25em;
}

:where(li)::marker {
	color: var(--carolsaling-color-heading);
}

:where(code, kbd, samp, pre) {
	font-family: var(--carolsaling-font-mono);
	font-size: 0.9em;
}

/* Inline code: a light surface so it stands out from the text. */
:where(:not(pre)) > code {
	background-color: var(--carolsaling-color-surface);
	border-radius: var(--carolsaling-radius-small);
	padding: 0.1em 0.3em;
}

/* Code and preformatted text wrap instead of scrolling: no hidden overflow on
 * small screens and nothing that needs a keyboard-focusable scroll area. */
pre:not(.wp-block-verse) {
	background-color: var(--carolsaling-color-surface);
	border-radius: var(--carolsaling-radius-small);
	overflow-wrap: anywhere;
	padding: 1em;
	white-space: pre-wrap;
}

pre code {
	font-size: 1em;
}

/* The Verse block is poetry, not code: keep the text font. */
pre.wp-block-verse {
	font-family: inherit;
	font-size: inherit;
	white-space: pre-wrap;
}

hr,
.wp-block-separator {
	border: 0;
	border-top: var(--carolsaling-border-thin) solid var(--carolsaling-color-border);
	margin-block: 2.5em;
}

::selection {
	background-color: var(--carolsaling-color-highlight);
	color: var(--wp--preset--color--graphite);
}

/* ---------- Quotes ---------- */

blockquote {
	border-inline-start: var(--carolsaling-border-thick) solid var(--carolsaling-color-accent);
	margin-inline: 0;
	padding-inline-start: 1.25em;
}

.wp-block-quote {
	font-family: var(--carolsaling-font-heading);
	font-size: 1.25rem;
	line-height: 1.5;
}

blockquote cite,
.wp-block-pullquote cite {
	color: var(--carolsaling-color-muted);
	display: block;
	font-family: var(--carolsaling-font-text);
	font-size: var(--carolsaling-font-size-small);
	font-style: normal;
	margin-top: 0.5em;
}

.wp-block-pullquote {
	border-block: var(--carolsaling-border-thin) solid var(--carolsaling-color-accent);
	color: var(--carolsaling-color-heading);
	font-size: var(--carolsaling-font-size-large);
	line-height: 1.4;
	padding-block: 1.5em;
}

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

/* ---------- Media ---------- */

img,
video {
	height: auto;
	max-width: 100%;
}

iframe,
embed,
object {
	max-width: 100%;
}

figure {
	margin-inline: 0;
}

/* Classic editor captions (the block editor uses .wp-element-caption, styled in theme.json). */
.wp-caption {
	max-width: 100%;
}

.wp-caption-text,
.gallery-caption {
	font-size: var(--carolsaling-font-size-small);
}

.wp-element-caption,
.wp-caption-text {
	margin-block: 0.5em 0;
}

/* A full-width block reaches the screen edges; its caption should not. */
.alignfull > .wp-element-caption {
	padding-inline: var(--carolsaling-gutter);
}

/* ---------- Files (File block: PDFs of the resources) ----------
 * A card in the surface tone, as the cards of the home page: the name of the
 * file (a link that opens it) and the download button, a pill. With "Show
 * inline embed" on, the PDF preview takes the full width of the card, above
 * them. The name and the button are what the editor wrote: nothing is added.
 */

.wp-block-file {
	align-items: center;
	background-color: var(--carolsaling-color-surface);
	border-radius: var(--carolsaling-radius-large);
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.25rem;
	justify-content: space-between;
	padding: 1.25rem 1.5rem;
}

.wp-block-file:not(.wp-element-button) {
	font-size: 1rem;
}

.wp-block-file > a:not(.wp-block-file__button) {
	color: var(--carolsaling-color-heading);
	flex: 1 1 12rem;
	font-weight: var(--carolsaling-weight-cta);
	min-width: 0;
	overflow-wrap: anywhere;
}

.wp-block-file > .wp-block-file__embed {
	border-radius: var(--carolsaling-radius-medium);
	flex: 1 1 100%;
	margin: 0;
}

.wp-block-file .wp-block-file__button.wp-element-button {
	justify-content: center;
	margin: 0;
	padding: 0.5rem 1.375rem;
}

/* ---------- Tables ---------- */

table {
	border-collapse: collapse;
	font-size: var(--carolsaling-font-size-small);
	width: 100%;
}

th,
td {
	border: var(--carolsaling-border-thin) solid var(--carolsaling-color-border);
	padding: 0.5em 0.75em;
	text-align: start;
	vertical-align: top;
}

thead th {
	background-color: var(--carolsaling-color-surface);
	color: var(--carolsaling-color-heading);
	font-weight: 600;
}

/* Wide tables scroll sideways inside their own box (WordPress core sets
 * overflow-x: auto on .wp-block-table); the page itself never scrolls sideways.
 * Cells keep a minimum width so words are not split letter by letter. */
.wp-block-table th,
.wp-block-table td {
	min-width: 6rem;
}

/* ---------- Buttons ----------
 * Pills everywhere, as on the home page (internal pages review). Filled:
 * brand blue with ivory text (9.68:1); on hover, support blue (ivory on
 * support blue 5.65:1). In dark sections: peach with brand blue text
 * (6.61:1). Outline: the role colors, no fill. Colors chosen in the editor
 * (has-*-color classes) still win, because WordPress marks them !important.
 */

.wp-block-button__link.wp-element-button,
.wp-element-button {
	align-items: center;
	background-color: var(--carolsaling-color-button);
	border: 2px solid var(--carolsaling-color-button);
	border-radius: var(--carolsaling-radius-pill);
	color: var(--carolsaling-color-button-text);
	display: inline-flex;
	font-family: var(--carolsaling-font-text);
	font-weight: var(--carolsaling-weight-cta);
	gap: 0.5em;
	min-height: var(--carolsaling-touch-target);
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wp-block-button__link.wp-element-button:hover {
	background-color: var(--carolsaling-color-button-hover);
	border-color: var(--carolsaling-color-button-hover);
	color: var(--carolsaling-color-button-text);
}

.wp-block-button.is-style-outline > .wp-block-button__link.wp-element-button {
	background: transparent;
	border: 2px solid currentColor;
	color: var(--carolsaling-color-link);
	padding: 0.75rem 1.375rem;
}

.wp-block-button.is-style-outline > .wp-block-button__link.wp-element-button:hover {
	background-color: var(--carolsaling-color-link);
	border-color: var(--carolsaling-color-link);
	color: var(--carolsaling-color-background);
}

.wp-block-buttons {
	gap: 0.75rem;
}

/* ---------- Home page sections (patterns/home-*.php) ----------
 *
 * Layout reviewed after Stage 8 (D-031, proposed): a light, centred opening
 * with a short line, the main heading, a description and three pill buttons;
 * a personal presentation in two columns (photo and text); areas, latest
 * articles and resources as rounded cards under a section heading row; a
 * closing invitation in a brand blue card. Each section is a Group block with
 * its own class; the class sets its background, and tokens.css switches the
 * role colors so text, links and buttons keep the contrast:
 *   intro, areas, resources  derived surface (peach 30% on ivory), graphite text;
 *   about, posts, contact    ivory (page background);
 *   contact card (.carolsaling-cta)  brand blue, ivory text.
 * The order follows D-029; Carolina may move or remove sections and every one
 * keeps its look. Pages made with the Stage 7/8 patterns keep working.
 * The full width bands are in site.css and editor.css.
 */

.carolsaling-section {
	background-color: var(--carolsaling-color-background);
	color: var(--carolsaling-color-text);
	padding-block: var(--carolsaling-section-space);
}

.carolsaling-section--intro,
.carolsaling-section--areas,
.carolsaling-section--resources {
	background-color: var(--carolsaling-color-surface);
}

/* Contact section of the Stage 7/8 patterns (no card): peach band. */
.carolsaling-section--contact:not(:has(> .carolsaling-cta)) {
	background-color: var(--carolsaling-color-highlight);
}

/* Inside a section the blocks use the wide width, so headings, text and the
 * card grids share one left edge; paragraphs keep a reading measure of the
 * content width (about 65 characters) through their right padding. */
.carolsaling-section.is-layout-constrained > * {
	max-width: var(--carolsaling-wide-width);
}

.carolsaling-section.is-layout-constrained > p:not(.carolsaling-eyebrow) {
	padding-inline-end: max(0px, min(100%, var(--carolsaling-wide-width)) - var(--carolsaling-content-width));
}

/* Headings and links take the colors of the section (beats the global
 * theme.json colors, which have the specificity of :root). */
.carolsaling-section :is(h1, h2, h3, h4, h5, h6) {
	color: var(--carolsaling-color-heading);
}

.carolsaling-section a:not(.wp-element-button) {
	color: var(--carolsaling-color-link);
}

.carolsaling-section h2 {
	margin-block: 0 1rem;
}

.carolsaling-section > .wp-block-heading:first-child,
.carolsaling-section > :first-child {
	margin-top: 0;
}

.carolsaling-section > :last-child {
	margin-bottom: 0;
}

/* Section headings of the Stage 7/8 patterns (no short line above): a short
 * terracotta rule above (a detail, not text). */
.carolsaling-section > h2.wp-block-heading:first-child::before {
	background-color: var(--carolsaling-color-accent);
	content: "";
	display: block;
	height: 3px;
	margin-bottom: 1rem;
	width: 3rem;
}

/* Short line above a heading (eyebrow): small capitals in Manrope 600, with a
 * terracotta rule before it (a detail, not text). */
.carolsaling-eyebrow {
	align-items: center;
	color: var(--carolsaling-color-muted);
	display: flex;
	font-family: var(--carolsaling-font-text);
	font-size: 0.8125rem;
	font-weight: var(--carolsaling-weight-cta);
	gap: 0.75rem;
	letter-spacing: 0.12em;
	line-height: 1.4;
	margin-block: 0 0.75rem;
	text-transform: uppercase;
}

.carolsaling-eyebrow::before {
	background-color: var(--carolsaling-color-accent);
	content: "";
	flex: none;
	height: 2px;
	width: 2rem;
}

/* Buttons of the home sections: pills, a little taller. */
.carolsaling-section .wp-block-button__link.wp-element-button,
.carolsaling-section .wp-block-button.is-style-outline > .wp-block-button__link.wp-element-button {
	border-radius: var(--carolsaling-radius-pill);
	padding: 0.8125rem 1.625rem;
}

/* ----- Opening ----- */

.carolsaling-section--intro {
	padding-block: clamp(3.5rem, 2rem + 7vw, 7.5rem);
	text-align: center;
}

.carolsaling-section--intro.is-layout-constrained > * {
	margin-inline: auto;
	max-width: 48rem;
}

.carolsaling-section--intro.is-layout-constrained > p:not(.carolsaling-eyebrow) {
	max-width: var(--carolsaling-content-width);
	padding-inline-end: 0;
}

.carolsaling-section--intro .carolsaling-eyebrow {
	justify-content: center;
	margin-bottom: 1.25rem;
}

.carolsaling-section--intro .carolsaling-eyebrow::after {
	background-color: var(--carolsaling-color-accent);
	content: "";
	flex: none;
	height: 2px;
	width: 2rem;
}

.carolsaling-section--intro h1 {
	font-size: var(--carolsaling-font-size-xx-large);
	font-weight: var(--carolsaling-weight-heading);
	line-height: 1.1;
	margin-block: 0 1.25rem;
	text-wrap: balance;
}

.carolsaling-section--intro > p:not(.carolsaling-eyebrow) {
	font-size: 1.25rem;
	line-height: 1.6;
}

.carolsaling-section--intro .wp-block-buttons {
	justify-content: center;
	margin-top: 2.25rem;
}

/* ----- Personal presentation: photo and text ----- */

.carolsaling-split.wp-block-columns {
	align-items: center;
	gap: clamp(2rem, 1rem + 4vw, 4.5rem);
	margin-block: 0;
}

.carolsaling-split__media img,
.carolsaling-split__media .wp-block-image img {
	aspect-ratio: 4 / 5;
	border-radius: var(--carolsaling-radius-large);
	display: block;
	height: auto;
	object-fit: cover;
	width: 100%;
}

.carolsaling-split__media .wp-block-image {
	margin: 0;
}

/* Provisional photo space: dashed frame with the instruction inside, so it is
 * never mistaken for a picture. */
.carolsaling-photo-placeholder {
	align-items: center;
	aspect-ratio: 4 / 5;
	background-color: var(--carolsaling-color-surface);
	border: 2px dashed var(--carolsaling-color-field-border);
	border-radius: var(--carolsaling-radius-large);
	box-sizing: border-box;
	color: var(--carolsaling-color-text);
	display: flex;
	justify-content: center;
	padding: 2rem;
	text-align: center;
}

/* Phones: the photo (or its space) does not take a whole screen. */
@media (max-width: 48rem) {

	.carolsaling-split__media .wp-block-image,
	.carolsaling-photo-placeholder {
		margin-inline: auto;
		max-width: 20rem;
	}
}

.carolsaling-photo-placeholder > p {
	font-size: var(--carolsaling-font-size-small);
	margin: 0;
	max-width: 18rem;
}

.carolsaling-split__text > p:not(.carolsaling-eyebrow) {
	max-width: var(--carolsaling-content-width);
}

.carolsaling-split__text .wp-block-buttons {
	margin-top: 1.75rem;
}

/* ----- Heading row of a list: heading on the left, link on the right ----- */

.carolsaling-section-header {
	align-items: flex-end;
	display: flex;
	flex-wrap: wrap;
	gap: 1rem 2rem;
	justify-content: space-between;
	margin-bottom: 2rem;
}

.carolsaling-section-header__text > * {
	margin-block: 0;
}

.carolsaling-section-header__text .carolsaling-eyebrow {
	margin-bottom: 0.75rem;
}

.carolsaling-section-header .wp-block-buttons {
	margin: 0;
}

/* ----- Cards: lists of posts and resources (Query Loop) ----- */

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

.carolsaling-section .wp-block-post-template {
	display: grid;
	gap: clamp(1rem, 0.5rem + 1.5vw, 1.75rem);
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
	margin-block: 0;
}

.wp-block-post-template > li + li {
	margin-top: var(--carolsaling-space);
}

.carolsaling-section .wp-block-post-template > li {
	background-color: var(--wp--preset--color--ivory);
	border: var(--carolsaling-border-thin) solid var(--carolsaling-color-border);
	border-radius: var(--carolsaling-radius-large);
	display: flex;
	flex-direction: column;
	margin: 0;
	overflow: hidden;
	padding: 1.75rem;
}

.carolsaling-section--posts .wp-block-post-template > li {
	background-color: var(--carolsaling-color-surface);
	border-color: transparent;
}

/* The featured image fills the top of the card, edge to edge. */
.carolsaling-section .wp-block-post-template .wp-block-post-featured-image {
	margin: -1.75rem -1.75rem 1.5rem;
}

.carolsaling-section .wp-block-post-template .wp-block-post-featured-image img {
	display: block;
	width: 100%;
}

.wp-block-post-template .wp-block-post-terms {
	font-size: 0.8125rem;
	font-weight: var(--carolsaling-weight-cta);
	letter-spacing: 0.08em;
	margin-bottom: 0.5rem;
	text-transform: uppercase;
}

.carolsaling-section .wp-block-post-template .wp-block-post-terms a {
	color: var(--carolsaling-color-muted);
	text-decoration: none;
}

.carolsaling-section .wp-block-post-template .wp-block-post-terms a:hover {
	text-decoration: underline;
}

.wp-block-post-template .wp-block-post-title {
	font-size: 1.375rem;
	line-height: 1.25;
	margin-block: 0 0.5rem;
}

.wp-block-post-template .wp-block-post-title a {
	color: var(--carolsaling-color-heading);
	text-decoration: none;
}

.wp-block-post-template .wp-block-post-title a:hover {
	text-decoration: underline;
	text-decoration-color: var(--carolsaling-color-accent);
}

.wp-block-post-template .wp-block-post-date {
	color: var(--carolsaling-color-muted);
	font-size: var(--carolsaling-font-size-small);
	margin-bottom: 0.5rem;
}

.wp-block-post-template .wp-block-post-excerpt {
	font-size: 1rem;
}

.wp-block-post-template .wp-block-post-excerpt__excerpt {
	margin-block: 0.25rem 0;
}

/* "Read" link at the bottom of each card, with an arrow drawn in CSS. */
.wp-block-post-template .wp-block-read-more {
	align-items: center;
	align-self: flex-start;
	display: inline-flex;
	font-weight: var(--carolsaling-weight-cta);
	gap: 0.5rem;
	margin-top: auto;
	min-height: var(--carolsaling-touch-target);
	padding-top: 0.75rem;
	text-decoration: none;
}

.wp-block-post-template .wp-block-read-more::after {
	content: "\2192";
}

.wp-block-post-template .wp-block-read-more:hover {
	text-decoration: underline;
	text-decoration-color: var(--carolsaling-color-accent);
	text-underline-offset: 0.25em;
}

.wp-block-query + .wp-block-buttons,
.wp-block-categories + .wp-block-buttons {
	margin-top: calc(1.5 * var(--carolsaling-space));
}

/* ----- Content areas (Categories block): one card per area ----- */

.carolsaling-section .wp-block-categories {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
	list-style: none;
	margin: 2rem 0 0;
	padding: 0;
}

.carolsaling-section .wp-block-categories li {
	margin: 0;
}

.wp-block-categories-list a {
	display: inline-block;
	padding-block: 0.375rem;
}

.carolsaling-section .wp-block-categories-list a {
	align-items: center;
	background-color: var(--wp--preset--color--ivory);
	border: var(--carolsaling-border-thin) solid var(--carolsaling-color-border);
	border-radius: var(--carolsaling-radius-medium);
	box-sizing: border-box;
	color: var(--wp--preset--color--brand);
	display: flex;
	font-family: var(--carolsaling-font-heading);
	font-size: 1.25rem;
	font-weight: var(--carolsaling-weight-heading);
	gap: 1rem;
	height: 100%;
	justify-content: space-between;
	line-height: 1.25;
	min-height: 4.5rem;
	padding: 1rem 1.25rem;
	text-decoration: none;
}

.carolsaling-section .wp-block-categories-list a::after {
	color: var(--carolsaling-color-accent);
	content: "\2192";
	flex: none;
	font-family: var(--carolsaling-font-text);
}

.carolsaling-section .wp-block-categories-list a:hover {
	border-color: var(--wp--preset--color--brand);
	text-decoration: underline;
	text-decoration-color: var(--carolsaling-color-accent);
}

/* ----- Closing invitation: brand blue card ----- */

.carolsaling-cta {
	background-color: var(--carolsaling-color-background);
	border-radius: var(--carolsaling-radius-large);
	box-sizing: border-box;
	color: var(--carolsaling-color-text);
	padding: clamp(2.5rem, 1.5rem + 4vw, 4.5rem) clamp(1.25rem, 0.5rem + 4vw, 4rem);
	text-align: center;
}

.carolsaling-cta > * {
	margin-inline: auto;
	max-width: 40rem;
}

.carolsaling-cta > :first-child {
	margin-top: 0;
}

.carolsaling-cta > :last-child {
	margin-bottom: 0;
}

.carolsaling-cta .carolsaling-eyebrow {
	justify-content: center;
}

.carolsaling-cta h2 {
	text-wrap: balance;
}

.carolsaling-cta .wp-block-buttons {
	justify-content: center;
	margin-top: 2rem;
}

/* ---------- Internal pages (patterns/page-*.php, internal pages review) ----------
 *
 * Same language as the home page (D-031), inside the column of a page:
 * the presentation in two columns (photo and text) of the About page, cards
 * for the professional information, and the text beside the contact form.
 * Pages saved with the Stage 7/8 patterns keep their simple column.
 */

.entry-content > .carolsaling-split.wp-block-columns,
.entry-content > .carolsaling-info-grid {
	margin-block: clamp(2rem, 1rem + 3vw, 3.5rem);
}

.entry-content > :first-child {
	margin-top: 0;
}

/* Cards of professional information: two per row on large screens, one on
 * phones. */
.carolsaling-info-grid.wp-block-group {
	display: grid;
	gap: clamp(1rem, 0.5rem + 1.5vw, 1.75rem);
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr));
}

.carolsaling-info-grid.wp-block-group > * {
	margin: 0;
}

.carolsaling-info-card.wp-block-group {
	background-color: var(--carolsaling-color-surface);
	border-radius: var(--carolsaling-radius-large);
	box-sizing: border-box;
	padding: 1.75rem;
}

.carolsaling-info-card.wp-block-group > :first-child {
	margin-top: 0;
}

.carolsaling-info-card.wp-block-group > :last-child {
	margin-bottom: 0;
}

.carolsaling-info-card h2,
.carolsaling-info-card h3 {
	font-size: var(--carolsaling-font-size-large);
	margin-block: 0 0.75rem;
}

.carolsaling-info-card h2::before,
.carolsaling-info-card h3::before {
	background-color: var(--carolsaling-color-accent);
	content: "";
	display: block;
	height: 3px;
	margin-bottom: 0.875rem;
	width: 2.5rem;
}

/* Contact: the text and the form start at the same height. */
.carolsaling-split--contact.wp-block-columns {
	align-items: flex-start;
}

.carolsaling-split__text > :first-child,
.carolsaling-split__form > :first-child {
	margin-top: 0;
}

/* Small screens: buttons of the home sections take the full width, one
 * under the other, so none is cut and every one is easy to tap. */
@media (max-width: 30rem) {

	.carolsaling-section .wp-block-buttons {
		flex-direction: column;
		align-items: stretch;
	}

	.carolsaling-section .wp-block-buttons > .wp-block-button {
		width: 100%;
	}

	.carolsaling-section .wp-block-button__link.wp-element-button {
		justify-content: center;
		width: 100%;
	}

	.carolsaling-section-header .wp-block-buttons {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {

	.wp-block-button__link.wp-element-button {
		transition: none;
	}
}
