/* ==========================================================================
   The English Connection – child theme styles
   Brand values come from Elementor Global Settings (CSS variables):
   --e-global-color-primary / secondary / accent / text / ec_dark / ec_light
   ========================================================================== */

/* Anchor targets: offset for the sticky header when jumping to sections. */
html {
	scroll-behavior: smooth;
}

[id] {
	scroll-margin-top: var(--ec-header-offset, 90px);
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}

/* Visible keyboard focus. */
a:focus-visible,
button:focus-visible,
.elementor-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
	outline: 2px solid var(--e-global-color-accent, #dd8e18);
	outline-offset: 2px;
}

/* ---------- Gravity Forms (scoped to .gform_wrapper) ----------
   Colors/sizes come from the gform_default_styles filter (inc/gravity-forms.php).
   Typography below aligns forms with the Elementor global fonts. */

.gform_wrapper.gform-theme--framework .gfield_label,
.gform_wrapper.gform-theme--framework .gform-field-label {
	font-family: var(--e-global-typography-text-font-family, "Open Sans"), sans-serif;
	font-weight: 600;
	font-size: 16px;
}

.gform_wrapper .gfield_required,
.gform_wrapper .gfield_required_asterisk {
	color: #b42318;
}

.gform_wrapper.gform-theme--framework.gform-theme .gform_footer input.gform_button.button,
.gform_wrapper.gform-theme--framework.gform-theme .gform_page_footer input.button {
	font-family: var(--e-global-typography-accent-font-family, "Open Sans"), sans-serif;
	font-weight: var(--e-global-typography-accent-font-weight, 800);
	font-size: var(--e-global-typography-accent-font-size, 15px);
	letter-spacing: var(--e-global-typography-accent-letter-spacing, 1.5px);
	text-transform: uppercase;
	padding: 16px 32px;
	border-radius: 0;
	transition: background-color 0.2s ease;
}

/* Field-level validation messages directly under each input. */
.gform_wrapper.gform-theme--framework .gfield_validation_message {
	margin-top: 6px;
	font-size: 14px;
}

/* ---------- Blog post content (Single Post template, .ec-post-content) ----------
   Imported posts use classic WordPress markup (alignleft/aligncenter, captions,
   inline images with width/height attributes). Keep it responsive and on-brand. */
.ec-post-content p,
.ec-post-content ul,
.ec-post-content ol,
.ec-post-content blockquote,
.ec-post-content figure,
.ec-post-content .wp-caption {
	margin: 0 0 1.4em;
}

.ec-post-content img {
	max-width: 100%;
	height: auto;
	display: block;
}

.ec-post-content a {
	color: var(--e-global-color-ec_primary_dark, #5e6343);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ec-post-content a:hover {
	color: var(--e-global-color-ec_dark, #2f3127);
}

.ec-post-content h2,
.ec-post-content h3,
.ec-post-content h4 {
	margin: 1.6em 0 0.6em;
	color: var(--e-global-color-ec_dark, #2f3127);
	font-family: var(--e-global-typography-primary-font-family, "Lora"), serif;
	line-height: 1.3;
}

.ec-post-content ul,
.ec-post-content ol {
	padding-left: 1.4em;
}

.ec-post-content li + li {
	margin-top: 0.4em;
}

.ec-post-content blockquote {
	padding: 0.2em 0 0.2em 1.2em;
	border-left: 4px solid var(--e-global-color-primary, #8b9064);
	font-style: italic;
	color: var(--e-global-color-ec_dark, #2f3127);
}

.ec-post-content .aligncenter,
.ec-post-content .alignnone {
	margin-left: auto;
	margin-right: auto;
}

.ec-post-content .alignleft {
	float: left;
	margin: 0.3em 1.5em 1em 0;
	max-width: 50%;
}

.ec-post-content .alignright {
	float: right;
	margin: 0.3em 0 1em 1.5em;
	max-width: 50%;
}

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

.ec-post-content .wp-caption-text,
.ec-post-content figcaption {
	margin-top: 0.5em;
	font-size: 0.85em;
	color: var(--e-global-color-text, #555555);
	text-align: center;
}

.ec-post-content iframe,
.ec-post-content embed,
.ec-post-content video {
	max-width: 100%;
}

.ec-post-content iframe[src*="vimeo"],
.ec-post-content iframe[src*="youtube"] {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

.ec-post-content::after {
	content: "";
	display: table;
	clear: both;
}

@media (max-width: 767px) {
	.ec-post-content .alignleft,
	.ec-post-content .alignright {
		float: none;
		max-width: 100%;
		margin: 0 0 1.4em;
	}
}

/* ---------- Post cards (Loop Item "Post Card") ---------- */
.e-loop-item .elementor-widget-theme-post-featured-image,
.e-loop-item .elementor-widget-theme-post-featured-image a {
	display: block;
	width: 100%;
}

.e-loop-item .elementor-widget-theme-post-featured-image img {
	width: 100%;
	height: 230px;
	object-fit: cover;
	display: block;
}

@media (max-width: 767px) {
	.e-loop-item .elementor-widget-theme-post-featured-image img {
		height: 210px;
	}
}

/* Loop Grid prev/next: two separate outlined buttons with a clear gap. */
.elementor-pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 16px;
}

.elementor-pagination .page-numbers.prev,
.elementor-pagination .page-numbers.next {
	display: inline-flex;
	align-items: center;
	margin: 0;
	padding: 12px 24px;
	border: 2px solid var(--e-global-color-ec_primary_dark, #5e6343);
	color: var(--e-global-color-ec_primary_dark, #5e6343);
	line-height: 1;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.elementor-pagination a.page-numbers.prev:hover,
.elementor-pagination a.page-numbers.next:hover,
.elementor-pagination a.page-numbers.prev:focus-visible,
.elementor-pagination a.page-numbers.next:focus-visible {
	background-color: var(--e-global-color-ec_primary_dark, #5e6343);
	color: #ffffff;
}

/* Inactive link (e.g. "Previous updates" on page 1). */
.elementor-pagination span.page-numbers.prev,
.elementor-pagination span.page-numbers.next {
	opacity: 0.4;
	cursor: default;
}

/* ---------- Gravity Forms: compact vertical rhythm ---------- */
.gform_wrapper.gform-theme--framework {
	--gf-form-gap-y: 20px;
	--gf-label-space-primary: 6px;
}

.gform_wrapper.gform-theme--framework .gform_fields {
	row-gap: 20px;
}

.gform_wrapper.gform-theme--framework .gfield textarea.large {
	block-size: 160px;
	min-block-size: 160px;
}

.gform_wrapper.gform-theme--framework .gform_footer {
	margin-top: 8px;
	padding-top: 0;
}

/* ---------- Single post: previous / next navigation ---------- */
.elementor-post-navigation .elementor-post-navigation__prev {
	padding-right: 24px;
}

.elementor-post-navigation .elementor-post-navigation__next {
	padding-left: 24px;
}

@media (max-width: 767px) {
	.elementor-post-navigation .elementor-post-navigation__prev {
		padding-right: 14px;
	}

	.elementor-post-navigation .elementor-post-navigation__next {
		padding-left: 14px;
	}
}

/* ---------- Donate form (Gravity Form "Donate") ---------- */
/* Section headings inside the form (e.g. "DONATE NOW", "Personal Information"). */
.gform_wrapper.gform-theme--framework .gsection {
	padding-bottom: 10px;
	border-bottom: 1px solid var(--e-global-color-ec_border, #e5e5e5);
}

.gform_wrapper.gform-theme--framework .gsection_title {
	font-family: var(--e-global-typography-primary-font-family, "Lora"), serif;
	font-weight: 700;
	font-size: 22px;
	color: var(--e-global-color-ec_dark, #2f3127);
}

.gform_wrapper.gform-theme--framework .gsection_description {
	margin-top: 4px;
	color: var(--e-global-color-text, #555555);
}

/* Donation amount: tiles in a grid. */
.gform_wrapper.gform-theme--framework .ec-choices-grid .gfield_radio {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px;
}

.gform_wrapper.gform-theme--framework .ec-choices-grid .gchoice {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 12px 14px;
	border: 1px solid #cfcfc6;
	background: #ffffff;
}

.gform_wrapper.gform-theme--framework .ec-choices-grid .gchoice:has(input:checked) {
	border-color: var(--e-global-color-ec_primary_dark, #5e6343);
	box-shadow: inset 0 0 0 1px var(--e-global-color-ec_primary_dark, #5e6343);
}

.gform_wrapper.gform-theme--framework .ec-choices-grid .gchoice label {
	margin: 0;
	font-weight: 600;
	cursor: pointer;
}

/* Donation schedule: options side by side. */
.gform_wrapper.gform-theme--framework .ec-choices-inline .gfield_radio {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 28px;
}

@media (max-width: 767px) {
	.gform_wrapper.gform-theme--framework .ec-choices-grid .gfield_radio {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Totals stand out. */
.gform_wrapper.gform-theme--framework .gfield--type-total .ginput_total {
	font-family: var(--e-global-typography-primary-font-family, "Lora"), serif;
	font-weight: 700;
	font-size: 24px;
	color: var(--e-global-color-ec_dark, #2f3127);
}

/* Multi-page: progress bar + Previous / Next buttons on brand. */
.gform_wrapper.gform-theme--framework .gf_progressbar_title {
	font-family: var(--e-global-typography-accent-font-family, "Open Sans"), sans-serif;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--e-global-color-ec_primary_dark, #5e6343);
}

.gform_wrapper.gform-theme--framework.gform-theme .gform_page_footer input.gform_next_button,
.gform_wrapper.gform-theme--framework.gform-theme .gform_page_footer input.gform_previous_button,
.gform_wrapper.gform-theme--framework.gform-theme .gform_page_footer input.gform_button {
	font-family: var(--e-global-typography-accent-font-family, "Open Sans"), sans-serif;
	font-weight: 700;
	font-size: var(--e-global-typography-accent-font-size, 14px);
	letter-spacing: 1.5px;
	text-transform: uppercase;
	padding: 16px 32px;
	border-radius: 0;
}

.gform_wrapper.gform-theme--framework .gform_confirmation_message h3 {
	margin: 0 0 0.5em;
	font-family: var(--e-global-typography-primary-font-family, "Lora"), serif;
	color: var(--e-global-color-ec_dark, #2f3127);
}

/* ---------- Gravity Forms: hide the "* indicates required fields" legend and the
   top-of-form validation summary on all forms. Field-level messages (below each
   input) and the red asterisks remain, so validation stays visible per field. */
.gform_wrapper .gform_required_legend,
.gform_wrapper .gform_validation_errors {
	display: none;
}

/* ---------- Sticky header: subtle shadow while stuck, so it stays distinct from
   any section it scrolls over (e.g. olive bands). ---------- */
.elementor-location-header .e-con.elementor-sticky--active {
	box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
}

/* Donation amount tiles: the whole tile is clickable. The label's ::after
   covers the tile; clicking a <label> selects its radio – CSS only. */
.gform_wrapper.gform-theme--framework .ec-choices-grid .gchoice {
	cursor: pointer;
}

.gform_wrapper.gform-theme--framework .ec-choices-grid .gchoice label::after {
	content: "";
	position: absolute;
	inset: 0;
	cursor: pointer;
}

.gform_wrapper.gform-theme--framework .ec-choices-grid .gchoice:hover {
	border-color: var(--e-global-color-ec_primary_dark, #5e6343);
}

/* Single-row radios / checkboxes (e.g. Donation Type): only the control and
   its text are clickable – the label shrinks to its text instead of
   stretching across the row. */
.gform_wrapper.gform-theme--framework .gfield:not(.ec-choices-grid) .gchoice label {
	display: inline-block;
	flex: 0 1 auto;
	width: auto;
	max-width: calc(100%);
	cursor: pointer;
}

.gform_wrapper.gform-theme--framework .gchoice input {
	cursor: pointer;
	width: 50px !important;
    max-width: 20px;
}

/* Empty form sections (no title and no description, e.g. a spacer section)
   add only blank space and a stray rule – hide them on every form. */
.gform_wrapper .gsection:has(.gsection_title:empty):not(:has(.gsection_description:not(:empty))) {
	display: none;
}

.gform_wrapper.gform-theme--framework .ec-choices-grid .gchoice:has(input:focus-visible) {
	outline: 2px solid var(--e-global-color-accent, #dd8e18);
	outline-offset: 2px;
}

/* Hello Elementor "Skip to content" link (keyboard users) – brand body font. */
.skip-link {
	font-family: var(--e-global-typography-text-font-family, "Open Sans"), sans-serif;
}

/* Very small phones (<360px): slightly smaller header logo so logo + Donate +
   menu toggle fit without horizontal scroll. */
@media (max-width: 359px) {
	.elementor-location-header .e-con .elementor-element.elementor-widget-image img {
		width: 108px;
	}

	.elementor-location-header .e-con:not(.elementor-sticky__spacer) {
		--column-gap: 8px;
		--row-gap: 8px;
	}
}

/* ---------- Homepage hero: consistent vertical rhythm on every screen.
   heading → text 20px (Elementor widget spacing), text → buttons 22px,
   10px between button rows when they wrap. Buttons never stretch. ---------- */
#home .elementor-widget-text-editor {
	margin-bottom: 22px;
}

#home .elementor-widget-text-editor p:last-child {
	margin-bottom: 0;
}

#home .elementor-widget-button {
	align-self: flex-start;
	margin: 0 5px 10px;
}

/* Cancel the last button row's 10px so space above and below the hero
   content is exactly equal (content sits in the true vertical centre). */
#home > .elementor-container > .elementor-column > .elementor-widget-wrap {
	margin-bottom: -10px;
}

/* ---------- Contact section form card (homepage #contact) ---------- */
@media (min-width: 768px) {
	.ec-form-card .gform_wrapper .gform_fields {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: 20px;
	}

	.ec-form-card .gform_wrapper .gfield {
		grid-column: 1 / -1;
	}

	.ec-form-card .gform_wrapper .gfield--type-text,
	.ec-form-card .gform_wrapper .gfield--type-email {
		grid-column: span 1;
	}
}

.ec-form-card .gform_wrapper.gform-theme--framework .gform_footer {
	margin-top: 20px;
	padding-top: 0;
}

/* Loop Grid empty states (blog, archives, search): readable, clearly linked. */
.e-loop-nothing-found-message p {
	margin: 0 0 1em;
}

.e-loop-nothing-found-message a:not(.elementor-button) {
	color: var(--e-global-color-ec_primary_dark, #5e6343);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.e-loop-nothing-found-message a:not(.elementor-button):hover {
	color: var(--e-global-color-ec_dark, #2f3127);
}

/* ---------- Donate form: cover processing fees ---------- */
.gform_wrapper.gform-theme--framework .ec-cover-fees .gchoice {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 14px 16px;
	border: 1px solid #cfcfc6;
	background: #ffffff;
	cursor: pointer;
}

.gform_wrapper.gform-theme--framework .ec-cover-fees .gchoice:hover {
	border-color: var(--e-global-color-ec_primary_dark, #5e6343);
}

.gform_wrapper.gform-theme--framework .ec-cover-fees .gchoice:has(input:checked) {
	border-color: var(--e-global-color-ec_primary_dark, #5e6343);
	box-shadow: inset 0 0 0 1px var(--e-global-color-ec_primary_dark, #5e6343);
}

.gform_wrapper.gform-theme--framework .ec-cover-fees .gchoice:has(input:focus-visible) {
	outline: 2px solid var(--e-global-color-accent, #dd8e18);
	outline-offset: 2px;
}

.gform_wrapper.gform-theme--framework .ec-cover-fees .gchoice label::after {
	content: "";
	position: absolute;
	inset: 0;
	cursor: pointer;
}

/* The field label already names the fee; hide the redundant "Price:". */
.gform_wrapper.gform-theme--framework .ec-processing-fee .ginput_product_price_label {
	display: none;
}
