/**
 * Access Equity Form — front-end styles.
 *
 * All colours, fonts and radii come from CSS custom properties that
 * AEF_Form::theme_css() prints from the admin settings, so the palette can be
 * changed without editing this file. Anything typed into the "Custom CSS"
 * box in the admin is appended after this stylesheet.
 *
 * @package Access_Equity_Form
 */

/* ---------------------------------------------------------------------------
 * Fallbacks — used only if the inline custom-property block is missing.
 * ------------------------------------------------------------------------ */
.aef-wrap {
	--aef-primary: #0f2440;
	--aef-primary-dark: #0c1d35;
	--aef-primary-soft: rgba( 15, 36, 64, 0.08 );
	--aef-accent: #e0a33e;
	--aef-accent-soft: rgba( 224, 163, 62, 0.15 );
	--aef-text: #1b2a3d;
	--aef-muted: #5b6b80;
	--aef-bg: #ffffff;
	--aef-card: #f4f6f9;
	--aef-border: #dce3ec;
	--aef-error: #c0392b;
	--aef-radius: 12px;
	--aef-btn-radius: 999px;
	--aef-max-width: 720px;

	box-sizing: border-box;
	width: 100%;
	max-width: var( --aef-max-width );
	margin: 0 auto;
	padding: 0;
	color: var( --aef-text );
	font-family: var( --aef-font-body, inherit );
	text-align: center;
}

.aef-wrap *,
.aef-wrap *::before,
.aef-wrap *::after {
	box-sizing: border-box;
}

/* Card vs plain layout */
.aef-layout-card {
	background: var( --aef-bg );
	border: 1px solid var( --aef-border );
	border-radius: calc( var( --aef-radius ) + 6px );
	padding: 40px 36px;
	box-shadow: 0 18px 48px -24px rgba( 15, 36, 64, 0.28 );
}

@media ( max-width: 600px ) {
	.aef-layout-card {
		padding: 28px 20px;
		border-radius: var( --aef-radius );
	}
}

/* ---------------------------------------------------------------------------
 * Title + progress
 * ------------------------------------------------------------------------ */
.aef-title {
	margin: 0 0 20px;
	font-family: var( --aef-font-heading, inherit );
	font-size: clamp( 24px, 3vw, 34px );
	line-height: 1.2;
	color: var( --aef-primary );
}

.aef-progress {
	margin-bottom: 28px;
}

.aef-progress-track {
	height: 6px;
	background: var( --aef-card );
	border-radius: 999px;
	overflow: hidden;
}

.aef-progress-bar {
	height: 100%;
	width: 0;
	background: var( --aef-accent );
	border-radius: 999px;
	transition: width 0.35s ease;
}

.aef-progress-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 8px;
	font-size: 13px;
	color: var( --aef-muted );
	letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------------------
 * Steps
 * ------------------------------------------------------------------------ */
.aef-step {
	animation: aef-fade 0.28s ease both;
}

@keyframes aef-fade {
	from {
		opacity: 0;
		transform: translateY( 8px );
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.aef-step,
	.aef-progress-bar {
		animation: none;
		transition: none;
	}
}

.aef-fieldset {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.aef-legend {
	display: block;
	width: 100%;
	float: none;
	margin: 0 0 6px;
	padding: 0;
	font-family: var( --aef-font-heading, inherit );
	font-size: clamp( 22px, 2.6vw, 30px );
	font-weight: 600;
	line-height: 1.25;
	color: var( --aef-primary );
}

.aef-sub {
	margin: 0 0 24px;
	font-size: 15px;
	line-height: 1.5;
	color: var( --aef-muted );
}

.aef-legend + .aef-options,
.aef-legend + .aef-field,
.aef-legend + .aef-grid {
	margin-top: 24px;
}

/* ---------------------------------------------------------------------------
 * Radio option cards
 * ------------------------------------------------------------------------ */
.aef-options {
	display: grid;
	gap: 14px;
	margin: 0 auto 8px;
}

.aef-cols-2 {
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	max-width: 420px;
}

.aef-cols-3 {
	grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
}

@media ( max-width: 520px ) {
	.aef-cols-3 {
		grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
		gap: 8px;
	}
}

.aef-option {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 18px 10px 16px;
	background: var( --aef-card );
	border: 2px solid transparent;
	border-radius: var( --aef-radius );
	cursor: pointer;
	transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.aef-option:hover {
	border-color: var( --aef-accent );
	transform: translateY( -2px );
}

.aef-option.is-selected {
	background: var( --aef-accent-soft );
	border-color: var( --aef-accent );
}

.aef-option-media {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 64px;
}

/*
 * Give the icons a definite box. An inline SVG source that carries only a
 * viewBox has no intrinsic size, so width/height:auto would collapse it —
 * the explicit values here keep the icons visible in every browser.
 */
.aef-option-media img {
	display: block;
	width: 64px;
	height: 64px;
	max-width: 100%;
	object-fit: contain;
}

@media ( max-width: 420px ) {
	.aef-option-media,
	.aef-option-media img {
		height: 48px;
	}

	.aef-option-media img {
		width: 48px;
	}
}

/* The real radio is hidden but focusable for keyboard and screen readers. */
.aef-radio {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}

.aef-option-dot {
	width: 22px;
	height: 22px;
	border: 2px solid var( --aef-border );
	border-radius: 50%;
	background: #fff;
	transition: border-color 0.18s ease, background 0.18s ease;
}

.aef-option.is-selected .aef-option-dot,
.aef-radio:checked + .aef-option-dot {
	border-color: var( --aef-accent );
	background: var( --aef-accent );
	box-shadow: inset 0 0 0 4px #fff;
}

.aef-radio:focus-visible + .aef-option-dot {
	outline: 3px solid var( --aef-primary );
	outline-offset: 3px;
}

.aef-option-label {
	font-size: 16px;
	font-weight: 700;
	color: var( --aef-primary );
	line-height: 1.2;
}

/* ---------------------------------------------------------------------------
 * Text and currency inputs
 * ------------------------------------------------------------------------ */
.aef-field {
	margin: 0 auto 4px;
	max-width: 440px;
	text-align: left;
}

.aef-label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 600;
	color: var( --aef-muted );
	letter-spacing: 0.02em;
}

.aef-input {
	width: 100%;
	height: 56px;
	padding: 0 16px;
	font-family: inherit;
	font-size: 17px;
	color: var( --aef-text );
	background: #fff;
	border: 1px solid var( --aef-border );
	border-radius: var( --aef-radius );
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
}

.aef-input:focus {
	outline: none;
	border-color: var( --aef-accent );
	box-shadow: 0 0 0 3px var( --aef-accent-soft );
}

.aef-input::placeholder {
	color: #9aa8b8;
}

.aef-currency-wrap {
	display: flex;
	align-items: stretch;
}

.aef-currency-symbol {
	display: flex;
	align-items: center;
	padding: 0 18px;
	font-size: 20px;
	font-weight: 700;
	color: var( --aef-primary );
	background: var( --aef-card );
	border: 1px solid var( --aef-border );
	border-right: 0;
	border-radius: var( --aef-radius ) 0 0 var( --aef-radius );
}

.aef-currency-input {
	border-radius: 0 var( --aef-radius ) var( --aef-radius ) 0;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.01em;
}

/* Final step grid */
.aef-grid {
	display: grid;
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	gap: 14px;
	text-align: left;
}

.aef-grid .aef-field {
	max-width: none;
	margin: 0;
}

.aef-grid .aef-field-email,
.aef-grid .aef-field-phone {
	grid-column: 1 / -1;
}

@media ( max-width: 560px ) {
	.aef-grid {
		grid-template-columns: 1fr;
	}
}

.aef-consent {
	margin: 16px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: var( --aef-muted );
	text-align: left;
}

/* ---------------------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------------------ */
.aef-actions {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-top: 26px;
	flex-wrap: wrap;
}

.aef-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 56px;
	padding: 0 34px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #fff;
	background: var( --aef-primary );
	border: 2px solid var( --aef-primary );
	border-radius: var( --aef-btn-radius );
	cursor: pointer;
	transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.aef-btn:hover {
	background: var( --aef-primary-dark );
	border-color: var( --aef-primary-dark );
	transform: translateY( -1px );
}

.aef-btn:focus-visible {
	outline: 3px solid var( --aef-accent );
	outline-offset: 3px;
}

.aef-btn-back {
	color: var( --aef-primary );
	background: transparent;
	border-color: var( --aef-border );
	text-transform: none;
	letter-spacing: 0;
	font-weight: 600;
	padding: 0 22px;
}

.aef-btn-back:hover {
	background: var( --aef-card );
	border-color: var( --aef-primary );
}

.aef-btn-submit {
	background: var( --aef-accent );
	border-color: var( --aef-accent );
	color: var( --aef-primary );
}

.aef-btn-submit:hover {
	background: var( --aef-primary );
	border-color: var( --aef-primary );
	color: #fff;
}

.aef-btn.is-busy,
.aef-btn[disabled] {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

.aef-btn-icon {
	font-size: 15px;
	line-height: 1;
}

/* ---------------------------------------------------------------------------
 * Errors, alerts and loading
 * ------------------------------------------------------------------------ */
.aef-error-slot {
	min-height: 20px;
	margin-top: 6px;
	text-align: center;
}

.aef-grid .aef-error-slot {
	text-align: left;
}

.aef-error {
	display: inline-block;
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.4;
	color: var( --aef-error );
}

.aef-field.has-error .aef-input {
	border-color: var( --aef-error );
	box-shadow: 0 0 0 3px rgba( 192, 57, 43, 0.12 );
}

.aef-options.has-error .aef-option {
	border-color: rgba( 192, 57, 43, 0.4 );
}

.aef-alert {
	margin-bottom: 0;
}

.aef-alert.is-visible {
	margin-bottom: 18px;
}

.aef-alert-error {
	padding: 12px 16px;
	font-size: 14px;
	line-height: 1.5;
	color: var( --aef-error );
	background: rgba( 192, 57, 43, 0.08 );
	border: 1px solid rgba( 192, 57, 43, 0.25 );
	border-radius: var( --aef-radius );
	text-align: left;
}

/* The [hidden] attribute must beat the display rules below. */
.aef-wrap [hidden] {
	display: none !important;
}

.aef-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	margin-top: 22px;
	font-size: 14px;
	color: var( --aef-muted );
}

.aef-loading p {
	margin: 0;
}

.aef-spinner {
	width: 30px;
	height: 30px;
	border: 3px solid var( --aef-card );
	border-top-color: var( --aef-accent );
	border-radius: 50%;
	animation: aef-spin 0.8s linear infinite;
}

@keyframes aef-spin {
	to {
		transform: rotate( 360deg );
	}
}

/* Honeypot — off-screen, never focusable by a real user. */
.aef-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Screen-reader-only helper, in case the theme does not provide one. */
.aef-wrap .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}
