/*
 * TBMH child theme styles: only what Elementor cannot style.
 * Colours and fonts are Elementor Variables, published by Elementor as :root custom properties
 * (--forest, --copper, --font-body, ...). Do not hard-code brand values here.
 */

/* Page base: Elementor 4 has no body-level styles. */
body {
	background: var(--ivory);
	color: var(--forest);
	font-family: var(--font-body), Arial, sans-serif;
	font-size: 17px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

/* Home's Built to execute cards share rows so a wrapped statistic keeps the labels aligned. */
@media (min-width: 768px) {
	.elementor-3094 .e-8fbcd87-7711 {
		row-gap: 0;
	}

	.elementor-3094 .e-8fbcd87-7711 > .tbmh-rule-top-dark {
		display: grid;
		grid-row: span 3;
		grid-template-rows: subgrid;
		row-gap: 0;
	}
}

/*
 * Keyboard focus. Elementor's atomic links reset everything (all: unset at .elementor .e-*-link-base), so restore a
 * ring for keyboard users only, with enough specificity to win inside Elementor content. Copper on light surfaces,
 * copper light on dark ones (both at least 3:1 against the surface).
 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
.elementor a:focus-visible,
.elementor button:focus-visible {
	outline: 2px solid var(--copper);
	outline-offset: 3px;
}

.tbmh-dark a:focus-visible,
.tbmh-dark button:focus-visible,
.tbmh-dark [tabindex]:focus-visible {
	outline-color: var(--copper-light);
}

:focus:not(:focus-visible) {
	outline: none;
}

/* Hello's "Skip to content" link. Hello's theme.css, which normally styles it, is switched off by a Hello setting. */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	white-space: nowrap;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	top: 8px;
	left: 8px;
	z-index: 100000;
	width: auto;
	height: auto;
	padding: 12px 20px;
	clip: auto;
	clip-path: none;
	background: var(--near-white);
	color: var(--forest);
	font: 600 15px/1.2 var(--font-body), Arial, sans-serif;
	text-decoration: underline;
}

/* Links inside running text: underlined in the text colour, so they never rely on colour alone. */
.elementor .e-paragraph-base a:not([class]),
.elementor .e-heading-base a:not([class]) {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

/* Long-form text (policy pages): Elementor's Text Editor content, marked with the tbmh-prose CSS class. */
.tbmh-prose {
	overflow-wrap: break-word; /* long words and pasted URLs wrap instead of widening phone screens */
}

.tbmh-prose h2 {
	margin: 2.2em 0 0.6em;
	color: var(--forest);
	font-family: var(--font-heading), Georgia, serif;
	font-size: var(--text-h3);
	font-weight: 400;
	line-height: 1.2;
	scroll-margin-top: 24px;
}

.tbmh-prose h3 {
	margin: 1.8em 0 0.5em;
	color: var(--forest);
	font-family: var(--font-heading), Georgia, serif;
	font-size: 24px;
	font-weight: 400;
	line-height: 1.25;
}

.tbmh-prose h4 {
	margin: 1.5em 0 0.4em;
	color: var(--forest);
	font-size: 1em;
	font-weight: 600;
	line-height: 1.4;
}

.tbmh-prose h2:first-child,
.tbmh-prose h3:first-child {
	margin-top: 0;
}

.tbmh-prose p,
.tbmh-prose ul,
.tbmh-prose ol {
	margin: 0 0 1em;
}

.tbmh-prose ul,
.tbmh-prose ol {
	padding-left: 1.4em;
}

.tbmh-prose li {
	margin-bottom: 0.35em;
}

.tbmh-prose li > ol,
.tbmh-prose li > ul {
	margin: 0.4em 0 0;
}

.tbmh-prose a {
	color: var(--forest);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.tbmh-prose a:hover {
	color: var(--copper-deep);
}

.tbmh-prose > *:last-child,
.tbmh-prose p:last-child {
	margin-bottom: 0;
}

/* Quotes and images in news posts (block editor markup). */
.tbmh-prose blockquote {
	margin: 1.6em 0;
	padding: 2px 0 2px 24px;
	border-left: 3px solid var(--copper);
	color: var(--forest);
	font-family: var(--font-heading), Georgia, serif;
	font-size: 22px;
	line-height: 1.4;
}

.tbmh-prose blockquote p {
	margin: 0;
}

.tbmh-prose figure {
	margin: 1.6em 0;
}

.tbmh-prose img {
	display: block;
	max-width: 100%;
	height: auto;
}

/*
 * Pages with the sticky "On this page" bar (tbmh-subnav, 49 px): keep anchor targets and keyboard focus clear of it.
 * Elementor cannot style the html element.
 */
html:has(.tbmh-subnav) {
	scroll-padding-top: 64px;
}

/* On phones the bar wraps and is not sticky (Elementor Class tbmh-subnav), so no offset is needed. */
@media (max-width: 767px) {
	html:has(.tbmh-subnav) {
		scroll-padding-top: 0;
	}
}

/*
 * Links to Brain & Mind Hub open a new site: a drawn arrow after the text, the same on every device (the ↗ character
 * showed as an emoji on iPhone).
 */
.elementor a[href^="https://www.brainandmindhub.org.au"][target="_blank"]::after {
	content: "";
	display: inline-block;
	flex: 0 0 auto;
	width: 0.62em;
	height: 0.62em;
	margin-left: 0.4em;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3.5 1.5h7v7M10.5 1.5l-9 9' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3.5 1.5h7v7M10.5 1.5l-9 9' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
}

/*
 * Pro Menu adapter (Elementor Pro 4.3 Menu widget). The widget pads the item wrapper, so each link and the dropdown
 * button are only as big as their text. Stretch every link over its padded item and give the dropdown button a
 * centred 44 x 44 px hit area (DESIGN.md: menu targets at least 44 px). Item padding is set in the header's menu.
 */
.elementor-widget-n-menu .e-n-menu-title-container.e-link::before {
	content: "";
	position: absolute;
	inset: 0;
}

.elementor-widget-n-menu .e-n-menu-dropdown-icon::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 44px;
	height: 44px;
	transform: translate(-50%, -50%);
}

/*
 * Phone and tablet menu: the open panel covers the page below the header, with a rule between items. The selector
 * matches the widget's own (which sets the panel transparent) so this one wins.
 */
@media (max-width: 1024px) {
	.elementor-widget-n-menu .e-n-menu[data-layout="dropdown"] .e-n-menu-wrapper {
		min-height: calc(100vh - 94px);
		min-height: calc(100dvh - 94px);
		background: var(--forest-soft);
		border-top: 1px solid var(--rule-on-dark);
	}

	.elementor-widget-n-menu .e-n-menu-item + .e-n-menu-item {
		border-top: 1px solid var(--rule-on-dark);
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* Fluent Forms adapter: maps the plugin's own variables and markup (Fluent Forms 6.2.16) to TBMH tokens. */
.fluentform {
	--fluentform-primary: var(--copper);
	--fluentform-secondary: var(--forest);
	--fluentform-danger: var(--error);
	--fluentform-border-color: var(--field-border);
	--fluentform-border-radius: 3px;
	font-family: var(--font-body), Arial, sans-serif;
}

.fluentform .ff-el-group {
	margin-bottom: 18px;
}

.fluentform .ff-el-input--label label {
	color: var(--forest);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
}

.fluentform .ff-el-form-control {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	min-height: 48px;
	background: var(--near-white);
	color: var(--forest);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.5;
}

.fluentform textarea.ff-el-form-control {
	min-height: 140px;
}

/* WebKit counts a select's longest option in its container's width; clip it so phones don't scroll sideways. */
.fluentform select.ff-el-form-control {
	text-overflow: ellipsis;
}

.fluentform .ff-el-input--content:has(> select) {
	overflow: hidden;
}

/* Drawn inside the field so the clipped select container never hides it. */
.fluentform .ff-el-form-control:focus {
	border-color: var(--forest);
	box-shadow: none;
	outline: 2px solid var(--copper);
	outline-offset: -3px;
}

.fluentform .ff-el-is-required.asterisk-right label::after {
	color: var(--copper-deep);
}

.fluentform .ff-el-form-check-label {
	align-items: flex-start;
	display: flex;
	gap: 10px;
	color: var(--ink-soft);
	font-size: 14px;
	line-height: 1.55;
}

.fluentform .ff-el-form-check-label a,
.fluentform .ff-message-success a {
	color: var(--copper-deep);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.fluentform .ff-btn-submit {
	min-height: 48px;
	padding: 0 22px;
	border-radius: 3px;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
}

.fluentform .ff-btn-submit:hover {
	background-color: var(--copper-deep);
	opacity: 1;
}

.fluentform .ff-btn-submit:focus-visible {
	outline: 2px solid var(--copper);
	outline-offset: 3px;
}

/*
 * News: Elementor Pro's Posts widget (News page, tbmh-news-grid) and post widgets (post template). They take no
 * Elementor Classes, so they are styled here to match tbmh-h1-page, tbmh-eyebrow, tbmh-small and tbmh-muted.
 */
.elementor .tbmh-post-title .elementor-heading-title {
	max-width: 22em;
	margin-top: 18px;
	color: var(--forest);
	font-family: var(--font-heading), Georgia, serif;
	font-size: clamp(34px, 4.4vw, 56px);
	font-weight: 400;
	line-height: 1.06;
	letter-spacing: -0.01em;
}

.elementor .tbmh-post-meta {
	margin-top: 20px;
}

.elementor .tbmh-post-meta .elementor-icon-list-text {
	color: var(--ink-soft);
	font-family: var(--font-body), Arial, sans-serif;
	font-size: 15px;
}

.elementor .tbmh-post-image img {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.elementor .tbmh-news-grid .elementor-post__thumbnail {
	background: var(--warm-grey);
}

.elementor .tbmh-news-grid .elementor-post__text {
	margin-top: 22px;
}

.elementor .tbmh-news-grid .elementor-post__title,
.elementor .tbmh-news-grid .elementor-post__title a {
	color: var(--forest);
	font-family: var(--font-heading), Georgia, serif;
	font-size: 24px;
	font-weight: 400;
	line-height: 1.2;
}

.elementor .tbmh-news-grid .elementor-post__title a:hover {
	color: var(--copper-deep);
}

.elementor .tbmh-news-grid .elementor-post__meta-data {
	margin-top: 12px;
	color: var(--copper-deep);
	font-family: var(--font-body), Arial, sans-serif;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
}

.elementor .tbmh-news-grid .elementor-post__excerpt p {
	margin-top: 10px;
	color: var(--ink-soft);
	font-family: var(--font-body), Arial, sans-serif;
	font-size: 15px;
	line-height: 1.6;
}
