/*
Theme Name: Barasch & McGarry Foundation
Theme URI: https://baraschfoundation.org
Author: Escape Hatch
Author URI: https://escapehatch.com
Description: Theme designed specifically for Barasch & McGarry Foundation.
Tags: full-site-editing
Requires at least: 6.9
Tested up to: 6.9
Requires PHP: 8.2
Version: 1.0.2
Text Domain: bmf
*/

:root {
	--wp--custom--top--offset: calc(var(--wp-admin--admin-bar--height, 0px) + var(--eh--alert-banner--height, 0px));
}

/* Declare custom properties that rely on inline properties */
:is(body, .is-root-container) {
	--wp--custom--root--padding-offset: calc(var(--wp--style--root--padding-left) + var(--wp--style--root--padding-left));
	--wp--custom--spacing--gutter: calc((100vw - 100%) / 2);
	--wp--custom--hero--border-radius: 0;
	--wp--custom--main--spacing--padding--inline: 0;

	/* Header */
	--head--background--opacity: 0;

	/* Main container */
	--main--spacing--padding--block-start: 0;
	--main--spacing--padding--block-end: var(--wp--preset--spacing--60);
}

@media (width >= 768px) {
	:is(body, .is-root-container) {
		--wp--custom--hero--border-radius: var(--wp--preset--border-radius--medium) var(--wp--preset--border-radius--medium) 0 0;
		--wp--custom--main--spacing--padding--inline: var(--wp--style--root--padding-left);
	}
}

@media (width >= 1024px) {
	:is(body, .is-root-container) {
		--wp--style--root--padding-right: var(--wp--preset--spacing--60);
		--wp--style--root--padding-left: var(--wp--preset--spacing--60);
		--wp--custom--head--dimensions--height: var(--wp--custom--head--dimensions--desktop-height);
	}
}

@media (width >= 1920px) {
	:is(body, .is-root-container) {
		--wp--custom--spacing--gutter: calc((var(--wp--custom--width--full) - 100%) / 2);
		--wp--custom--main--dimensions--width: var(--wp--custom--width--full);
	}
}


/* Global box-sizing */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	text-size-adjust: none;
	scroll-behavior: smooth;

	/* scroll-padding-top: calc(var(--wp--custom--head--dimensions--height) + var(--wp-admin--admin-bar--height, 0px) + var(--wp--preset--spacing--60)); */
}

/* Has alert banner */
html:has(.wp-block-eh-alert-banner) {
	margin-block-start: var(--wp--custom--top--offset) !important;
}

/* Only apply background color to front end */
html:not(.block-editor-iframe__html) {
	background-color: var(--wp--preset--color--contrast);
}

/* Force editor styles wrapper to have base background color when not in iframe editor mode */
.editor-styles-wrapper {
	background-color: var(--wp--preset--color--base) !important;
}

/* Prevent page from scrolling when modal is open */
html.has-modal-open,
html:has(dialog[open]),
html:has(.lightbox-image-container img[src ^='http']) {
	overflow: hidden;
}

.disable-transitions * {
	transition: none !important;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
	html:focus-within {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		scroll-behavior: auto !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}


/**
 * Elements
 */

/* <body> */
body {
	position: relative;
	margin-inline: auto;
	border: 0;
	-moz-osx-font-smoothing: grayscale;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeSpeed;
	z-index: var(--wp--custom--z-index--body);
	scrollbar-gutter: stable;
}

body:not(.editor-styles-wrapper) {
	background-color: var(--wp--preset--color--blue-darker);
}

body:not(.admin-bar) {
	--wp-admin--admin-bar--height: 0px;
}

body::before {
	display: block;
	position: absolute;
	inset-block-start: 0;
	inset-inline-start: 0;
	block-size: 100%;
	inline-size: 100%;
	background: var(--wp--custom--overlay--color);
	content: '';
	opacity: var(--wp--custom--overlay--opacity);
	visibility: hidden;
	transition: visibility 0s ease-in-out 0.25s, opacity 0.25s ease-in-out;
	z-index: calc(var(--wp--custom--z-index--head) - 1);
}

/* Add translucent background to the body when modal is open */
.has-modal-open body {
	--wp--custom--overlay--opacity: var(--wp--custom--overlay--opacity-active);

	min-block-size: 100vh;
	overflow: hidden;
	z-index: 1;
}

.has-modal-open body::before {
	visibility: visible;
	transition-delay: 0s;
}


/* <iframe> */
iframe {
	--wp--style--global--content-size: 100%;
}

/* <main> */
main {
	position: relative;
	margin-block: 0 !important;
	margin-inline: auto;
	overflow: clip;
	z-index: var(--wp--custom--z-index--main);

	&.has-global-padding {
		padding-inline: var(--wp--custom--main--spacing--padding--inline);
	}

	& > .wp-block-group {
		border-end-start-radius: var(--wp--preset--spacing--10);
		border-end-end-radius: var(--wp--preset--spacing--10);
		overflow: clip;
	}
}

/* Reduce top padding when first or last child meet criteria */
main:has(.entry-content > .has-background.alignfull:first-child, > .has-background.alignwide:first-child, .wp-block-cover:first-child) {
	--main--spacing--padding--block-start: 0;
}

/* Full template parts - stretch to full-width */
.wp-block-template-part:has(> .alignfull, > .is-style-hero) {
	/* inline-size: calc(100% + var(--wp--custom--root--padding-offset)); */
	max-inline-size: none;
	margin-inline: calc(var(--wp--style--root--padding-left) * -1) auto !important;
}

/* Remove bottom padding when last child has contrast background color */
main:has(
	.entry-content > .has-background.alignfull:last-child,
	> .has-background.alignfull:last-child
) {
	--main--spacing--padding--block-end: 0;
}

@media (width < 1692px) {
	main:has(
		.entry-content > .has-background.alignwide.is-style-section:last-child,
		> .has-background.alignwide.is-style-section:last-child,
		.wp-block-cover:last-child
	) {
		--main--spacing--padding--block-end: 0;
	}
}

/* Block content */
.entry-content {
	padding-block: var(--main--spacing--padding--block-start) var(--main--spacing--padding--block-end);
}

.entry-content:has(> .wp-block-cover.alignfull:first-child) {
	border-radius: var(--wp--custom--hero--border-radius);
}

/* Hide empty paragraphs */
.entry-content p:empty {
	display: none;
}

.wp-site-blocks {
	background-color: var(--wp--preset--color--base-2);
}

/* Remove margins from :first-child, :last-child */
*:last-child:where(p, [class*='wp-block']) {
	margin-block-end: 0 !important;
}

*:first-child:where(p, [class*='wp-block']):not(.wp-block-navigation__responsive-dialog) {
	margin-block-start: 0 !important;
}


/* Phone links */
a:where([href ^='tel:']) {
	color: inherit;
	font: inherit;
	text-decoration: none;
}

/* Headings */
:where(h1, h2, h3, h4, h5, h6) {
	text-wrap: balance;
}

:where(h1, h2, h3, h4, h5, h6).has-x-large-font-size,
h1:where(h1, h2, h3, h4, h5, h6):not([class*='font-size']) {
	font-family: var(--wp--custom--heading--x-large--font-family);
	font-size: var(--wp--custom--heading--x-large--font-size);
	line-height: var(--wp--custom--heading--x-large--line-height);
}

:where(h1, h2, h3, h4, h5, h6).has-large-font-size,
h2:where(h1, h2, h3, h4, h5, h6):not([class*='font-size']) {
	font-size: var(--wp--custom--heading--large--font-size);
	line-height: var(--wp--custom--heading--large--line-height);
}

:where(h1, h2, h3, h4, h5, h6).has-medium-font-size,
h3:where(h1, h2, h3, h4, h5, h6):not([class*='font-size']),
:where(.ceba-single__content, .post-type-post) :is(h1, h2):not([class*='font-size']) {
	font-size: var(--wp--custom--heading--medium--font-size);
	line-height: var(--wp--custom--heading--medium--line-height);
}

:where(h1, h2, h3, h4, h5, h6).has-small-font-size,
h4:where(h1, h2, h3, h4, h5, h6):not([class*='font-size']),
:is(.ceba-single__content, .post-type-post) :is(h3, h4, h5, h6):not([class*='font-size']) {
	margin-block-end: var(--wp--preset--spacing--20);
	font-size: var(--wp--custom--heading--small--font-size);
	font-weight: var(--wp--custom--heading--small--font-weight);
	letter-spacing: 0;
	line-height: var(--wp--custom--heading--small--line-height);
	text-transform: none;
}

:where(h1, h2, h3, h4, h5, h6).has-x-small-font-size,
h5:where(h1, h2, h3, h4, h5, h6):not([class*='font-size']) {
	font-size: var(--wp--custom--heading--x-small--font-size);
	line-height: var(--wp--custom--heading--x-small--line-height);
}

:where(h1, h2, h3, h4, h5, h6).has-xx-small-font-size,
h6:where(h1, h2, h3, h4, h5, h6):not([class*='font-size']) {
	margin-block-end: var(--wp--preset--spacing--30);
	color: var(--wp--preset--color--primary);
	font-size: var(--wp--custom--heading--xx-small--font-size);
	letter-spacing: var(--wp--custom--heading--xx-small--letter-spacing);
	line-height: var(--wp--custom--heading--xx-small--line-height);
	text-transform: var(--wp--custom--heading--xx-small--text-transform);

	&:has(+ :is(h1, h2, h3, h4, h5, h6)) {
		margin-block-end: 0;
	}

	+ :is(h1, h2, h3, h4, h5, h6) {
		margin-block-start: var(--wp--preset--spacing--30);
	}
}

:where(h1, h2, h3, h4, h5, h6) a.has-icon,
:where(h1, h2, h3, h4, h5, h6)[class*='has-icon-']:has(a, .wp-block-button__link) > *::after {
	--icon--color: var(--wp--preset--color--accent-2);
	--icon--width: 24px;
	--icon--height: 24px;
	--icon--spacing--block-gap: var(--wp--preset--spacing--20);
}

:where(h1, h2, h3, h4, h5, h6) a.has-icon svg {
	color: currentColor;
}

:where(h1, h2, h3, h4, h5, h6) + .wp-block-query {
	margin-block-start: var(--wp--preset--spacing--30);
}

/* X-Large and Large font size */
:is(h1, h2, h3, h4, h5, h6):where(.has-x-large-font-size, .has-large-font-size):not(.wp-block-post-title),
:is(h1, h2):not([class*='font-size'], .wp-block-post-title) {
	text-box: trim-start cap alphabetic;
}

:where(.ceba-single__content, .post-type-post) {
	:is(h1, h2, h3, h4, h5, h6):where(.has-x-large-font-size, .has-large-font-size),
	:is(h1, h2):not([class*='font-size']) {
		margin-block-start: revert;
	}
}

/* Space between heading and query */
:where(h1, h2, h3, h4, h5, h6):where(.has-x-large-font-size, .has-large-font-size) + .wp-block-query,
:where(h1, h2):not([class*='font-size']) + .wp-block-query {
	margin-block-start: var(--wp--preset--spacing--60);
}

/* Adds inline padding to highlighted <mark> text */
.wp-block-heading mark[style*='background'] {
	--padding: 0.25ch;
	--highlight-color: transparent;

	box-shadow: calc(var(--padding) * -1) 0 0 0 var(--highlight-color), var(--padding) 0 0 0 var(--highlight-color);
	line-height: 1.3;
	box-decoration-break: clone;
}


/**
 * Vendor styles
 */

/* --- Gravity forms --- */
.gform-theme--api, .gform-theme--foundation.gform-theme--foundation {
	--gf-ctrl-border-color: var(--wp--preset--color--gray-lighter) !important;
	--gf-ctrl-border-color-focus: var(--wp--preset--color--contrast);
	--gf-ctrl-border-width: 1px;
	--gf-ctrl-btn-bg-color-primary: var(--wp--preset--color--primary);
	--gf-ctrl-btn-bg-color-hover-primary: var(--wp--preset--color--contrast);
	--gf-ctrl-btn-padding-y: var(--wp--preset--spacing--20);
	--gf-ctrl-btn-padding-x: var(--wp--preset--spacing--40);
	--gf-ctrl-btn-font-size: 1rem;
	--gf-ctrl-btn-font-weight: 800;
	--gf-ctrl-btn-icon-gap: 10px;
	--gf-ctrl-btn-letter-spacing: 0.075ch;
	--gf-ctrl-btn-line-height: 1;
	--gf-ctrl-btn-radius: var(--wp--preset--border-radius--medium);
	--gf-ctrl-btn-text-transform: uppercase;
	--gf-ctrl-label-color-req: var(--wp--preset--color--contrast);
	--gf-ctrl-label-font-size-primary: var(--wp--preset--font-size--small);
	--gf-ctrl-label-font-size-tertiary: var(--wp--preset--font-size--small);
	--gf-ctrl-label-font-weight-primary: 700;
	--gf-ctrl-label-letter-spacing-primary: 0;
	--gf-ctrl-label-line-height: 1;
	--gf-ctrl-outline-width: 0px;
	--gf-ctrl-outline-offset: 0px;
	--gf-ctrl-shadow: none;
	--gf-ctrl-transition: all var(--wp--custom--transition--hover);
	--gf-field-gap-x: var(--wp--preset--spacing--30);
	--gf-field-gap-y: var(--wp--preset--spacing--30);
	--gf-form-footer-margin-y-start: var(--wp--preset--spacing--30);
	--gf-form-gap-x: var(--wp--preset--spacing--30);
	--gf-form-gap-y: var(--wp--preset--spacing--30);
	--gf-form-spinner-fg-color: var(--wp--preset--color--accent-1);
	--gf-label-req-gap: 2px;

	/* Labels */
	.gform-field-label:not(.gform-field-label--type-inline) {
		display: block;

		--gf-local-color: var(--wp--preset--color--contrast);
		--gf-local-line-height: 1;
	}

	/* Sublabels */
	.gfield.field_sublabel_above .gform-field-label--type-sub {
		--gf-local-font-size: var(--wp--preset--font-size--small);
		--gf-local-font-weight: 700;
		--gf-local-letter-spacing: 0;
	}

	.gfield:not(.field_sublabel_above) {
		& .gform-field-label--type-sub {
			font-size: 14px;
			text-transform: revert;
		}
	}
}

/* Legend - Hide "required" text note */
.gform_required_legend {
	display: none;
}

/* Change "required to an asterisk */
.gfield_required {
	.gfield_required_text {
		font-size: 0;
	}

	.gfield_required_text::before {
		font-size: 16px;
		content: '*';
	}
}

.gform-theme--foundation .gform_fields {
	--gf-form-gap-y: var(--wp--preset--spacing--20);
}

.gform-theme.gform-theme--framework.gform_wrapper {
	margin-block: 0;
}

/* Text inputs */
.gform-theme.gform-theme--framework.gform_wrapper :is(input[type='email'], input[type='phone'], input[type='text'],
input[type='url'], input[type='tel'], input[type='number'], select, textarea) {
	--gf-local-font-size: 16px;
	--gf-local-line-height: 1.15;
	--gf-local-height: auto;
	--gf-local-padding-y: 1rem;
	--gf-local-padding-x: 1rem;
	--gf-local-radius: var(--wp--preset--border-radius--medium);
	--gf-local-transition: none;
}

.gform-theme.gform-theme--framework.gform_wrapper :is(input[type='email'], input[type='phone'], input[type='text'],
input[type='url'], input[type='tel'], input[type='number'], select, textarea):focus-visible {
	--gf-local-outline-color: -webkit-focus-ring-color;
	--gf-local-outline-width: 2px;
	--gf-local-transition: none;
}

/* Checkbox and radio inputs */
.gform-theme--framework :is(.gfield_radio, .gfield_checkbox) {
	.gform-field-label--type-inline {
		--gf-local-font-size: 18px;

		translate: 0 2px;
	}
}

.gform-theme--framework :is(input[type='checkbox'], input[type='radio']) {
	--gf-ctrl-choice-check-color: var(--wp--preset--color--base);
	--gf-ctrl-choice-size: 24px;
	--gf-local-radius: var(--wp--preset--border-radius--small);
	--gf-local-transition: none;

	align-items: center;
}

.gform-theme--framework :is(input[type='checkbox'], input[type='radio']):checked {
	background-color: var(--wp--preset--color--primary);
}


/* Inline Variant for Checkboxes and Radio Buttons */
.gform-theme--framework .gfield--type-choice--inline.gfield--type-choice :is(.gfield_radio, .gfield_checkbox) {
	--gf-field-choice-gap: var(--wp--preset--spacing--40);

	flex-direction: row;
}

/* Checkbox */
.gform-theme--framework .gfield_checkbox {
	input[type='checkbox'] {
		--gf-local-radius: 0;
	}
}

/* Radio */
.gform-theme--framework input[type='radio'] {
	--gf-ctrl-radio-check-size: calc(var(--gf-ctrl-choice-size) * 0.25);
}

/* Consent checkbox */
.gravity-theme .ginput_container.ginput_container_consent {
	display: flex;
	gap: var(--wp--preset--spacing--10);
}

.gfield.gfield--type-consent.gfield--input-type-consent {
	margin-block: var(--wp--preset--spacing--10) 0;
}

.gform-theme--framework.gform-theme.gform_wrapper  button.gform_button.wp-element-button {
	padding: calc(1.25em - 1px) calc(var(--wp--preset--spacing--40) - 1px);
	font-family: var(--wp--preset--font-family--secondary);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 800;
	letter-spacing: 0.075ch;
	line-height: 1;
	text-transform: uppercase;
	transition: all var(--wp--custom--transition--hover);
}

/* Dates */
.ginput_container_date {
	position: relative;
}

.ui-datepicker-trigger {
	position: absolute;
	inset-block-start: 50%;
	inset-inline-end: var(--wp--preset--spacing--10);
	transform: translateY(-50%);
}

.gform-theme--framework:where(:not(.gform_editor)) .gfield--type-section {
	margin: var(--wp--preset--spacing--10) 0;
	padding: 0;

	&:first-child {
		margin-block-start: 0;
	}

	&:last-child {
		margin-block-end: 0;
	}
}

/* Hide section title from screen readers */
.gfield--type-section .gsection_title {
	position: absolute;
	block-size: 1px;
	inline-size: 1px;
	margin: 0;
	padding: 0;
	clip: rect(1px, 1px, 1px, 1px);
	border: 0;
	white-space: nowrap;
	overflow: hidden;
	clip-path: inset(50%);
}

/* Lists */
.gfield--input-type-list {
	--gf-ctrl-label-font-size-primary: var(--wp--preset--font-size--medium);

	.gfield_header_item.gform-field-label {
		--gf-ctrl-label-font-size-primary: var(--wp--preset--font-size--x-small);
		--gf-ctrl-label-font-weight-primary: 400;
	}

	.gfield_label_before_complex {
		inline-size: 100%;
		padding-block-end: var(--gf-field-section-padding-y-end);
		border-block-end: var(--gf-field-section-border-width) var(--gf-field-section-border-style) var(--gf-field-section-border-color);
	}
}

/* Embedded OL/UL Elements in HTML */
.gfield--input-type-html {
	flex: 0 0 auto;
	translate: 0 0.4375em;

	.wp-block-list {
		display: flex;
		flex-direction: column;
		gap: var(--wp--preset--spacing--10);
	}

	.wp-block-list:where(ul) li::marker {
		color: currentColor;
		font-size: 12px;
		line-height: 1;
	}
}


/** File Fields **/
.ginput_container_fileupload {
	padding: var(--wp--preset--spacing--10);
	background-color: var(--wp--preset--color--gray-lightest);
	border-radius: var(--wp--preset--border-radius--medium);
}

.gfield--input-type-fileupload {
	input[type='file'] {
		--gf-ctrl-size: auto;

		padding: 0;
		background-color: transparent;
		border: 0;
		box-shadow: none;
		font-size: 1rem;
	}

	/* Button */
	input[type='file']::file-selector-button {
		display: inline-block;
		inset: auto;
		order: 2;
		margin: 0 var(--wp--preset--spacing--20) 0 0;
		padding: calc(var(--wp--preset--spacing--20) - 2px);
		background: var(--wp--preset--color--base);
		border: 2px solid var(--wp--preset--color--primary);
		border-radius: var(--wp--preset--border-radius--medium);
		color: var(--wp--preset--color--primary);
		font-size: var(--wp--preset--font-size--medium);
		font-weight: 500;
		letter-spacing: 0;
		line-height: 1;
		text-align: center;
		text-decoration: none;
		text-transform: none;
		cursor: pointer;
		vertical-align: middle;
		transition: all 0.33s ease-out;
		appearance: none;
	}

	/* Hover */
	input[type='file']::file-selector-button:is(:hover, :focus) {
		background-color: var(--wp--preset--color--primary-dark);
		border-color: var(--wp--preset--color--primary-dark);
		color: var(--wp--preset--color--base);
		text-decoration: none;
	}

	/* Label */
	.gform-field-label {
		--gf-local-margin-y: 0 var(--wp--preset--spacing--10);
	}

	.gfield_description {
		--gf-ctrl-desc-font-size: 1.2rem;

		order: 1;
		margin-block-end: 1rem;
	}

	.ginput_container.ginput_container_fileupload {
		order: 3;
	}

	.ginput_container.ginput_container_fileupload .gfield_description {
		--gf-local-font-size: var(--wp--preset--font-size--x-small);

		margin-block: var(--wp--preset--spacing--10)0;
	}
}


/* Removes extra vertical spacing between hidden gravity forms elements */
.gform-footer .wp-block-buttons:has(+ [name='gform_ajax'], +[name='gform_ajax']) {
	margin-block-end: 0 !important;
}

.has-script-tag {
	display: none;
}


/**
 * Blocks
 */

/**
 * Patterns
 */

/* --- Header --- */
.bmf-part-head {
	/* CTA button */
	.wp-block-button__link {
		--button--spacing--padding-inline: var(--wp--preset--spacing--20);

		white-space: nowrap;
	}

	@media (width >= 782px) {
		.wp-block-button__link {
			--button--typography--font-size: 1rem;
			--button--spacing--padding-block: 1em;
			--button--spacing--padding-inline: var(--wp--preset--spacing--30);
		}
	}
}

/* --- Footer --- */
footer:has(> .bmf-part-foot) {
	margin-block: 0;
}



/**
 * WordPress styles
 */

/* --- Admin bar --- */

/* stylelint-disable-next-line selector-max-id */
#wpadminbar {
	position: fixed;
	inset-block-start: 0;
	inset-inline-start: 0;
}

/* Prevent admin bar user menu from overflowing on tablet widths */
@media (width >= 782px) and (width <= 1024px) {
	/* stylelint-disable-next-line selector-max-id */
	:where(#wpadminbar #wp-admin-bar-customize, #wpadminbar #wp-admin-bar-edit, #wpadminbar #wp-admin-bar-my-account, #wpadminbar #wp-admin-bar-my-sites, #wpadminbar #wp-admin-bar-site-editor, #wpadminbar #wp-admin-bar-site-name) > .ab-item {
		position: relative;
		inline-size: 42px;
		padding: 0;
		color: #a7aaad;
		text-indent: 100%;
		white-space: nowrap;
		overflow: hidden;
	}

	/* stylelint-disable-next-line selector-max-id */
	#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar > a img {
		position: absolute;
		inset-block-start: 12px;
		inset-inline-end: 10px;
		block-size: 16px;
		inline-size: auto;
	}
}

/* --- Lightbox --- */
.wp-lightbox-overlay {
	--wp--preset--color--contrast: var(--wp--preset--color--base);
}

/* Lightbox backdrop */
.wp-lightbox-overlay .scrim {
	--wp--preset--color--base: rgb(0 0 0 / 90%);
}
