/*
 * Additive front-end styles, loaded after the compiled form stylesheet. Everything is scoped to
 * the .embrace-donation wrapper to match the form's stylesheet and never leak onto the page.
 *
 * This file is hand-authored (it is NOT generated by the Tailwind build), so it is safe to edit.
 */

/* Regular-donation explainer: a small info badge inline in the "Regular Donation" button label,
 * with a hover / focus tooltip bubble that holds the (editable) explainer copy and contact links. */

/* The cell wraps the button so the absolutely-positioned bubble has a positioning context while
 * the button still fills its grid column. */
.embrace-donation .edf-type-cell { position: relative; }
.embrace-donation .edf-type-cell > .donation--type__button { width: 100%; }

/* Inline badge, sized in currentColor so the "i" reads on both the inactive and selected button. */
.embrace-donation .edf-tip__icon--inline {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	vertical-align: middle;
	margin-left: 8px;
	width: 18px;
	height: 18px;
	border: 1.5px solid currentColor;
	border-radius: 50%;
	font-size: 11px;
	font-style: italic;
	font-weight: 700;
	line-height: 1;
}

/* The tooltip bubble. Right-anchored and flush under the button (top:100%, no gap) so the path from
 * the button into the bubble never crosses dead space — its links stay reachable on hover. */
.embrace-donation .edf-tip__bubble {
	position: absolute;
	right: 0;
	left: auto;
	top: 100%;
	z-index: 30;
	width: 320px;
	max-width: min(90vw, 360px);
	margin-top: 8px;
	padding: 14px 16px;
	background: #fff;
	color: #374151;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
	font-size: 14px;
	line-height: 1.5;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease, visibility 0.15s ease;
}
/* Invisible bridge spanning the 8px margin so moving from the button to the bubble doesn't flicker. */
.embrace-donation .edf-tip__bubble::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: -8px;
	height: 8px;
}

/* Reveal on hover (pointer) or keyboard focus of the button. :focus-visible matches keyboard focus
 * but NOT the focus a mouse click leaves behind, so choosing "Regular Donation" with the mouse no
 * longer pins the explainer open. The two triggers are separate rules so a browser without :has()
 * just drops the keyboard one and hover still works. */
.embrace-donation .edf-type-cell:hover .edf-tip__bubble {
	opacity: 1;
	visibility: visible;
}
.embrace-donation .edf-type-cell:has(.donation--type__button:focus-visible) .edf-tip__bubble {
	opacity: 1;
	visibility: visible;
}
/* Clicking the button to select the mode dismisses the explainer even while the pointer stays on it
 * (form-enhancements.js adds the class); it clears on mouse-leave so a later hover still previews. */
.embrace-donation .edf-type-cell.edf-tip--dismissed .edf-tip__bubble {
	opacity: 0;
	visibility: hidden;
}

.embrace-donation .edf-tip__heading { display: block; font-weight: 700; color: #111827; margin-bottom: 4px; }
.embrace-donation .edf-tip__p { margin: 0 0 8px; }
.embrace-donation .edf-tip__p:last-child { margin-bottom: 0; }
.embrace-donation .edf-tip__bubble a { color: #1f6feb; text-decoration: underline; }

/* Further-details accordion: the card header is a full-width trigger; the panel below it animates
 * open/closed. JS toggles .is-open (see form-enhancements.js); the markup keeps the textarea in
 * the DOM either way so the payload is unaffected. */
.embrace-donation .edf-accordion__trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	text-align: left;
	color: inherit;
	cursor: pointer;
}
.embrace-donation .edf-accordion__title { padding-bottom: 0; }

/* Plus icon that becomes a minus when open. */
.embrace-donation .edf-accordion__icon {
	position: relative;
	flex: none;
	width: 14px;
	height: 14px;
	color: #3c0041;
}
.embrace-donation .edf-accordion__icon::before,
.embrace-donation .edf-accordion__icon::after {
	content: "";
	position: absolute;
	background: currentColor;
	transition: transform 0.3s ease;
}
.embrace-donation .edf-accordion__icon::before { top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; }
.embrace-donation .edf-accordion__icon::after { left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.embrace-donation .edf-accordion.is-open .edf-accordion__icon::after { transform: scaleY(0); }

/* The collapsible panel. max-height/opacity transition mirrors the original reveal, now driven by
 * the header rather than a checkbox. */
.embrace-donation .edf-accordion__panel {
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	transition: max-height 0.35s ease, opacity 0.35s ease;
}
.embrace-donation .edf-accordion.is-open .edf-accordion__panel { max-height: 600px; opacity: 1; }
.embrace-donation .edf-accordion__panel-inner { padding-top: 16px; }

/* Tighter spacing: trim the generous card padding/margins, heading and step bar (compiled originals:
 * .box 2rem padding / 2rem gap, section my 2.5rem, .box__title pb 1rem, steps py 1rem, nav mt 1.5rem).
 * Mobile-first values stay comfortable and free up content width by using less side padding; the 768px
 * block — the form's own desktop breakpoint — gives cards their roomier padding/margins back where
 * there's space. Inter-field (gap-4) and paragraph gaps are deliberately left alone so a phone never
 * crowds. These override the compiled utilities (this sheet loads after styles.css). Tune here. */
.embrace-donation section.my-10 { margin-top: 1.25rem; margin-bottom: 1.25rem; }
.embrace-donation h1.font-heading { padding-bottom: 0.5rem; }
.embrace-donation #donation__steps { padding-top: 0.25rem; padding-bottom: 0.5rem; }
.embrace-donation .box { margin-bottom: 1rem; padding: 1.25rem; }
.embrace-donation .box__title { padding-bottom: 0.5rem; }
.embrace-donation .step-navigation { margin-top: 1rem; }

@media (min-width: 768px) {
	.embrace-donation section.my-10 { margin-top: 1.75rem; margin-bottom: 1.75rem; }
	.embrace-donation .box { margin-bottom: 1.25rem; padding: 1.5rem; }
}

/* Where Next/Back scrolling stops (donation-form.js scrollToFormTop): the form's top lands this far
 * below the viewport edge. A theme with a sticky header can raise it without a plugin edit, e.g.
 * `:root { --edf-scroll-offset: 100px; }`. The admin-bar rules match WP core's bar heights (32px,
 * 46px at <=782px, and not fixed at all at <=600px). */
.embrace-donation form { scroll-margin-top: var(--edf-scroll-offset, 24px); }
body.admin-bar .embrace-donation form { scroll-margin-top: calc(var(--edf-scroll-offset, 24px) + 32px); }
@media screen and (max-width: 782px) {
	body.admin-bar .embrace-donation form { scroll-margin-top: calc(var(--edf-scroll-offset, 24px) + 46px); }
}
@media screen and (max-width: 600px) {
	body.admin-bar .embrace-donation form { scroll-margin-top: var(--edf-scroll-offset, 24px); }
}

/* Field row layout. Each "Your details" row is a 4-column grid on desktop, so a field's Width control
 * (quarter / half / three-quarters / full) maps to a 1- / 2- / 3- / 4-column span. The container keeps
 * Tailwind's `flex flex-col gap-4` for the mobile stack and `md:grid` for the switch to grid; this
 * sheet supplies the 4-column template and the span classes because the compiled Tailwind build does
 * not ship col-span-1/3/4. The spans live inside the media query, so on mobile every field is a full
 * stacked row regardless of its width. */
@media (min-width: 768px) {
	.embrace-donation .edf-fieldgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.embrace-donation .edf-fieldgrid > .edf-w-25 { grid-column: span 1 / span 1; }
	.embrace-donation .edf-fieldgrid > .edf-w-50 { grid-column: span 2 / span 2; }
	.embrace-donation .edf-fieldgrid > .edf-w-75 { grid-column: span 3 / span 3; }
	.embrace-donation .edf-fieldgrid > .edf-w-100 { grid-column: span 4 / span 4; }
}

/* Toggle switches — the email and post opt-ins in the Preferences step. The existing
 * .checkbox__override markup (visually-hidden native checkbox + .checkmark + label text) is
 * restyled into a sliding switch wherever .edf-toggle is present, so the Gift Aid and
 * processing-fee tick boxes keep their original checkbox look. Checked colour is the brand
 * primary (#3c0041). */
.embrace-donation .edf-toggle-row { margin-bottom: 10px; }
.embrace-donation .edf-toggle label {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding-left: 0;
	cursor: pointer;
	min-height: 28px;
}
.embrace-donation .edf-toggle input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}
.embrace-donation .edf-toggle .checkmark {
	position: relative;
	flex: 0 0 auto;
	width: 48px;
	height: 26px;
	border-radius: 9999px;
	background: #cbd5e1;
	transition: background-color .2s ease;
}
.embrace-donation .edf-toggle .checkmark::after {
	content: "";
	/* The compiled sheet hides .checkmark::after until the box is checked (it's the tick); force the
	 * knob visible in both states and reset the tick's rotated-border shape to a plain round knob. */
	display: block;
	position: absolute;
	top: 3px;
	left: 3px;
	right: auto;
	bottom: auto;
	width: 20px;
	height: 20px;
	margin: 0;
	border: 0;
	transform: none;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
	transition: left .2s ease;
}
.embrace-donation .edf-toggle input[type="checkbox"]:checked + .checkmark { background: #3c0041; }
.embrace-donation .edf-toggle input[type="checkbox"]:checked + .checkmark::after { display: block; left: 25px; transform: none; }
.embrace-donation .edf-toggle input[type="checkbox"]:focus-visible + .checkmark {
	outline: 2px solid #3c0041;
	outline-offset: 2px;
}

/* Phone field. The compiled Tailwind build only emitted input styling for the text/email/number
 * types that existed in the original form, so the new type="tel" phone input renders unstyled.
 * Mirror the same .embrace-donation input look here (kept in sync with styles.css lines ~705-725). */
.embrace-donation input[type="tel"] {
	height: 3rem;
	width: 100%;
	border-radius: 0.25rem;
	border-width: 2px;
	border-color: rgb(60 0 65 / 1);
	background-color: rgb(249 250 251 / 1);
	padding: 1rem;
}
.embrace-donation input[type="tel"].invalid { border-color: rgb(185 28 28 / 1); }
.embrace-donation input[type="tel"]:focus,
.embrace-donation input[type="tel"]:active { border-color: rgb(60 0 65 / 1); }
