/**
 * Digital School Enquiry Form - public styles.
 *
 * Every selector is prefixed with .sef- and nothing targets a bare element,
 * so the active theme (Avada included) is never affected. Colours come from
 * custom properties written onto .sef-wrap by PHP.
 */

.sef-wrap {
	--sef-primary: #166534;
	--sef-accent: #22c55e;
	--sef-bg: #ffffff;
	--sef-text: #15241d;
	--sef-radius: 12px;
	--sef-on-primary: #ffffff;

	/* Derived tones, with flat fallbacks for browsers without color-mix(). */
	--sef-border: rgba(21, 36, 29, 0.16);
	--sef-muted: rgba(21, 36, 29, 0.64);
	--sef-soft: rgba(21, 36, 29, 0.04);
	--sef-danger: #b42318;
	--sef-danger-soft: rgba(180, 35, 24, 0.08);

	box-sizing: border-box;
	max-width: 760px;
	margin: 0 auto;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.55;
	color: var(--sef-text);
	text-align: left;
}

@supports (color: color-mix(in srgb, #000 20%, transparent)) {
	.sef-wrap {
		--sef-border: color-mix(in srgb, var(--sef-text) 20%, transparent);
		--sef-muted: color-mix(in srgb, var(--sef-text) 68%, transparent);
		--sef-soft: color-mix(in srgb, var(--sef-text) 5%, transparent);
	}
}

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

.sef-sr-only,
.sef-sr-live {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.sef-is-hidden {
	display: none !important;
}

/* ---------------------------------------------------------------------
 * Form shell
 * ------------------------------------------------------------------ */

.sef-form {
	--sef-pad: clamp(20px, 4vw, 36px);

	background: var(--sef-bg);
	border: 1px solid var(--sef-border);
	border-radius: var(--sef-radius);
	padding: var(--sef-pad);
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 18px 40px -24px rgba(16, 24, 40, 0.28);
	animation: sef-rise 0.4s ease both;
}

/* A tinted band across the top of the card, so heading and fields read as
   two distinct sections rather than one run of centred text. */
.sef-form__header {
	margin: calc(var(--sef-pad) * -1) calc(var(--sef-pad) * -1) 28px;
	padding: clamp(20px, 3.5vw, 30px) var(--sef-pad);
	text-align: center;
	background: var(--sef-soft);
	border-bottom: 1px solid var(--sef-border);
	border-radius: var(--sef-radius) var(--sef-radius) 0 0;
}

.sef-form__logo-wrap {
	margin-bottom: 14px;
}

.sef-form__logo {
	display: inline-block;
	max-width: 160px;
	max-height: 80px;
	width: auto;
	height: auto;
}

.sef-form__title {
	margin: 0;
	font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem);
	font-weight: 650;
	line-height: 1.25;
	letter-spacing: -0.01em;
	color: var(--sef-text);
}

.sef-form__title::after {
	content: "";
	display: block;
	width: 48px;
	height: 3px;
	margin: 12px auto 0;
	border-radius: 3px;
	background: var(--sef-accent);
}

.sef-form__subtitle {
	margin: 12px 0 0;
	font-size: 0.95rem;
	color: var(--sef-muted);
}

/* ---------------------------------------------------------------------
 * Fields
 * ------------------------------------------------------------------ */

.sef-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px 16px;
}

.sef-field {
	min-width: 0;
}

.sef-field--full {
	grid-column: 1 / -1;
}

.sef-field__label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--sef-text);
}

.sef-field__required {
	color: var(--sef-danger);
	font-weight: 700;
}

.sef-field__optional {
	font-weight: 400;
	font-size: 0.8rem;
	color: var(--sef-muted);
}

.sef-field__control {
	display: block;
	width: 100%;
	max-width: 100%;
	min-height: 46px;
	padding: 11px 14px;
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.4;
	color: var(--sef-text);
	background-color: var(--sef-bg);
	border: 1px solid var(--sef-border);
	border-radius: calc(var(--sef-radius) * 0.6);
	transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
}

.sef-field__control::placeholder {
	color: var(--sef-muted);
	opacity: 1;
}

.sef-field__control:hover {
	border-color: var(--sef-primary);
}

.sef-field__control:focus,
.sef-field__control:focus-visible {
	outline: 2px solid var(--sef-primary);
	outline-offset: 2px;
	border-color: var(--sef-primary);
	background-color: var(--sef-soft);
}

textarea.sef-field__control {
	min-height: 118px;
	resize: vertical;
}

select.sef-field__control {
	padding-right: 40px;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5 7 7.5l6-6' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	background-size: 14px 9px;
}

.sef-field__error {
	display: block;
	margin: 6px 0 0;
	font-size: 0.82rem;
	font-weight: 500;
	color: var(--sef-danger);
	animation: sef-fade 0.2s ease both;
}

.sef-field__error[hidden] {
	display: none;
}

.sef-field--invalid .sef-field__control {
	border-color: var(--sef-danger);
	background-color: var(--sef-danger-soft);
}

.sef-field--invalid .sef-field__control:focus {
	outline-color: var(--sef-danger);
}

/* Honeypot: off-screen rather than display:none, and out of the tab order. */
.sef-hp {
	position: absolute !important;
	left: -9999px;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------------------------------------------------------------------
 * Messages and actions
 * ------------------------------------------------------------------ */

.sef-form__status {
	margin: 0 0 18px;
	padding: 12px 16px;
	font-size: 0.9rem;
	border-radius: calc(var(--sef-radius) * 0.5);
	border: 1px solid var(--sef-danger);
	background: var(--sef-danger-soft);
	color: var(--sef-danger);
	animation: sef-fade 0.25s ease both;
}

.sef-form__status[hidden] {
	display: none;
}

.sef-form__actions {
	display: flex;
	justify-content: flex-end;
	margin-top: 28px;
	padding-top: 22px;
	border-top: 1px solid var(--sef-border);
}

.sef-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 48px;
	padding: 12px 28px;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	color: var(--sef-on-primary);
	background: var(--sef-primary);
	border: 1px solid var(--sef-primary);
	border-radius: calc(var(--sef-radius) * 0.6);
	cursor: pointer;
	transition: transform 0.16s ease, box-shadow 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.sef-btn:hover {
	filter: brightness(1.07);
	box-shadow: 0 10px 22px -12px var(--sef-primary);
	transform: translateY(-1px);
}

.sef-btn:focus-visible {
	outline: 2px solid var(--sef-primary);
	outline-offset: 3px;
}

.sef-btn:active {
	transform: translateY(0);
	filter: brightness(0.96);
}

.sef-btn[disabled],
.sef-btn[aria-busy="true"] {
	opacity: 0.7;
	cursor: progress;
	transform: none;
	filter: none;
}

.sef-btn--ghost {
	color: var(--sef-primary);
	background: transparent;
	border-color: var(--sef-border);
}

.sef-btn--ghost:hover {
	border-color: var(--sef-primary);
	box-shadow: none;
}

.sef-btn__spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: sef-spin 0.7s linear infinite;
}

.sef-btn.is-busy .sef-btn__spinner {
	display: inline-block;
}

.sef-note {
	margin: 0;
	padding: 18px 20px;
	border: 1px dashed var(--sef-border);
	border-radius: var(--sef-radius);
	color: var(--sef-muted);
	background: var(--sef-bg);
}

/* ---------------------------------------------------------------------
 * Animated success state
 * ------------------------------------------------------------------ */

.sef-success {
	background: var(--sef-bg);
	border: 1px solid var(--sef-border);
	border-radius: var(--sef-radius);
	padding: clamp(28px, 5vw, 44px) clamp(20px, 4vw, 36px);
	text-align: center;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 18px 40px -24px rgba(16, 24, 40, 0.28);
}

.sef-success[hidden] {
	display: none;
}

.sef-success:focus {
	outline: 2px solid var(--sef-primary);
	outline-offset: 4px;
}

.sef-success.is-visible {
	animation: sef-pop 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.sef-success__badge {
	width: 84px;
	height: 84px;
	margin: 0 auto 18px;
	border-radius: 50%;
	background: var(--sef-soft);
	display: flex;
	align-items: center;
	justify-content: center;
}

.sef-success__svg {
	width: 56px;
	height: 56px;
	overflow: visible;
}

.sef-success__circle {
	stroke: var(--sef-primary);
	stroke-width: 2.5;
	stroke-dasharray: 150;
	stroke-dashoffset: 150;
	opacity: 0.45;
}

.sef-success__check {
	stroke: var(--sef-primary);
	stroke-width: 4;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 44;
	stroke-dashoffset: 44;
}

.sef-success.is-visible .sef-success__circle {
	animation: sef-draw 0.5s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.sef-success.is-visible .sef-success__check {
	animation: sef-draw 0.34s 0.38s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.sef-success__heading {
	margin: 0 0 8px;
	font-size: clamp(1.2rem, 1rem + 0.8vw, 1.45rem);
	font-weight: 650;
	color: var(--sef-text);
}

.sef-success__message {
	margin: 0;
	color: var(--sef-muted);
}

.sef-success__note {
	margin: 14px 0 0;
	font-size: 0.85rem;
	color: var(--sef-muted);
}

.sef-success__note[hidden] {
	display: none;
}

/* ---------------------------------------------------------------------
 * Staff portal
 * ------------------------------------------------------------------ */

.sef-portal {
	max-width: 1000px;
}

.sef-portal__login,
.sef-portal__bar,
.sef-portal__filters,
.sef-record {
	--sef-pad: clamp(18px, 3vw, 30px);

	background: var(--sef-bg);
	border: 1px solid var(--sef-border);
	border-radius: var(--sef-radius);
	padding: var(--sef-pad);
}

.sef-portal__login {
	max-width: 440px;
	margin: 0 auto;
	animation: sef-rise 0.4s ease both;
}

.sef-portal__login .sef-field {
	margin-bottom: 16px;
}

.sef-portal__title {
	margin: 0 0 6px;
	font-size: 1.35rem;
	font-weight: 650;
}

.sef-portal__lede {
	margin: 0 0 20px;
	font-size: 0.9rem;
	color: var(--sef-muted);
}

.sef-portal__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
	padding: 14px 18px;
}

.sef-portal__user {
	margin: 0;
	font-size: 0.95rem;
}

.sef-portal__logout {
	margin: 0;
}

.sef-portal__filters {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 14px;
	margin-bottom: 16px;
	padding: 16px 18px;
}

.sef-portal__filters .sef-field {
	flex: 1 1 200px;
}

.sef-portal__filters .sef-field--action {
	flex: 0 0 auto;
}

.sef-portal__back {
	margin: 0 0 14px;
}

.sef-notice {
	margin: 0 0 16px;
	padding: 12px 16px;
	border-radius: calc(var(--sef-radius) * 0.5);
	font-size: 0.9rem;
	border: 1px solid var(--sef-border);
	background: var(--sef-soft);
}

.sef-notice--error {
	border-color: var(--sef-danger);
	background: var(--sef-danger-soft);
	color: var(--sef-danger);
}

.sef-link {
	color: var(--sef-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.sef-link:focus-visible {
	outline: 2px solid var(--sef-primary);
	outline-offset: 2px;
}

.sef-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--sef-bg);
	border: 1px solid var(--sef-border);
	border-radius: var(--sef-radius);
	overflow: hidden;
	font-size: 0.93rem;
}

.sef-table th,
.sef-table td {
	padding: 12px 14px;
	text-align: left;
	border-bottom: 1px solid var(--sef-border);
	vertical-align: top;
}

.sef-table thead th {
	font-size: 0.78rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--sef-muted);
	background: var(--sef-soft);
}

.sef-table tbody tr:last-child th,
.sef-table tbody tr:last-child td {
	border-bottom: 0;
}

.sef-table__sub {
	display: block;
	font-size: 0.85em;
	color: var(--sef-muted);
}

.sef-status {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 600;
	border: 1px solid var(--sef-border);
	background: var(--sef-soft);
	color: var(--sef-text);
}

.sef-status--new {
	border-color: var(--sef-primary);
	color: var(--sef-primary);
}

.sef-record__header {
	margin: calc(var(--sef-pad) * -1) calc(var(--sef-pad) * -1) 18px;
	padding: 16px var(--sef-pad);
	background: var(--sef-soft);
	border-bottom: 1px solid var(--sef-border);
	border-radius: var(--sef-radius) var(--sef-radius) 0 0;
}

.sef-record__title {
	margin: 0 0 4px;
	font-size: 1.25rem;
	font-weight: 650;
}

.sef-record__meta {
	margin: 0;
	font-size: 0.85rem;
	color: var(--sef-muted);
}

.sef-record__list {
	margin: 0;
}

.sef-record__row {
	display: grid;
	grid-template-columns: minmax(140px, 220px) 1fr;
	gap: 8px 20px;
	padding: 10px 0;
	border-top: 1px solid var(--sef-border);
}

.sef-record__row dt {
	margin: 0;
	font-weight: 600;
	font-size: 0.9rem;
}

.sef-record__row dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.sef-record__empty {
	color: var(--sef-muted);
	font-style: italic;
}

.sef-record__status {
	margin-top: 22px;
	padding-top: 18px;
	border-top: 1px solid var(--sef-border);
}

.sef-record__status-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin-top: 8px;
}

.sef-record__status-row .sef-field__control {
	width: auto;
	min-width: 180px;
}

.sef-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 18px;
}

.sef-pagination .page-numbers {
	display: inline-block;
	min-width: 40px;
	padding: 8px 12px;
	text-align: center;
	border: 1px solid var(--sef-border);
	border-radius: calc(var(--sef-radius) * 0.5);
	text-decoration: none;
	color: var(--sef-text);
}

.sef-pagination .page-numbers.current {
	background: var(--sef-primary);
	border-color: var(--sef-primary);
	color: var(--sef-on-primary);
}

.sef-pagination .page-numbers:focus-visible {
	outline: 2px solid var(--sef-primary);
	outline-offset: 2px;
}

.sef-captcha {
	margin-top: 20px;
}

/* ---------------------------------------------------------------------
 * Password reveal
 * ------------------------------------------------------------------ */

.sef-reveal {
	position: relative;
	display: block;
}

.sef-reveal .sef-field__control {
	padding-right: 48px;
}

.sef-reveal__button {
	position: absolute;
	top: 50%;
	right: 6px;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	color: var(--sef-muted);
}

.sef-reveal__button:hover {
	color: var(--sef-primary);
	background: var(--sef-soft);
}

.sef-reveal__button:focus-visible {
	outline: 2px solid var(--sef-primary);
	outline-offset: 1px;
}

/* An eye drawn in CSS, so no icon font or SVG request is needed. */
.sef-reveal__eye,
.sef-reveal__eye::before,
.sef-reveal__eye::after {
	box-sizing: border-box;
}

.sef-reveal__eye {
	position: relative;
	display: block;
	width: 20px;
	height: 12px;
	border: 1.6px solid currentColor;
	border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}

.sef-reveal__eye::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 6px;
	height: 6px;
	margin: -3px 0 0 -3px;
	border-radius: 50%;
	background: currentColor;
}

/* The struck-through state means "hidden", shown while the password is
   masked, so the control is never conveyed by colour alone. */
.sef-reveal__eye::after {
	content: "";
	position: absolute;
	top: 50%;
	left: -2px;
	width: 24px;
	height: 1.6px;
	background: currentColor;
	transform: rotate(-45deg);
	transform-origin: center;
}

.sef-reveal__button.is-shown .sef-reveal__eye::after {
	display: none;
}

/* ---------------------------------------------------------------------
 * Standalone portal application shell
 * ------------------------------------------------------------------ */

body.sef-app {
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.sef-portal__export {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin: 0 0 16px;
}

.sef-portal__export-hint {
	font-size: 0.82rem;
	color: var(--sef-muted);
}

/* ---------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------ */

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

	.sef-field--half {
		grid-column: 1 / -1;
	}

	.sef-btn {
		width: 100%;
	}

	.sef-portal__filters .sef-btn {
		width: auto;
	}
}

@media (max-width: 782px) {
	/*
	 * The enquiry table becomes a stack of cards so nothing scrolls
	 * sideways. Explicit ARIA roles in the markup keep the table semantics
	 * that `display: block` would otherwise remove.
	 */
	.sef-table,
	.sef-table tbody,
	.sef-table tr,
	.sef-table td {
		display: block;
		width: 100%;
	}

	.sef-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.sef-table {
		border: 0;
		background: transparent;
	}

	.sef-table tr {
		margin-bottom: 12px;
		padding: 6px 14px;
		border: 1px solid var(--sef-border);
		border-radius: var(--sef-radius);
		background: var(--sef-bg);
	}

	.sef-table td {
		display: flex;
		justify-content: space-between;
		align-items: baseline;
		gap: 16px;
		padding: 8px 0;
		border-bottom: 1px solid var(--sef-border);
		text-align: right;
	}

	.sef-table tr td:last-child {
		border-bottom: 0;
	}

	.sef-table td::before {
		content: attr(data-label);
		flex: 0 0 auto;
		font-size: 0.78rem;
		font-weight: 700;
		letter-spacing: 0.03em;
		text-transform: uppercase;
		color: var(--sef-muted);
		text-align: left;
	}

	.sef-record__row {
		grid-template-columns: 1fr;
		gap: 2px;
	}
}

/* ---------------------------------------------------------------------
 * Animation
 * ------------------------------------------------------------------ */

@keyframes sef-rise {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes sef-fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes sef-pop {
	from {
		opacity: 0;
		transform: scale(0.96);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes sef-draw {
	to {
		stroke-dashoffset: 0;
	}
}

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

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

	/* The tick is drawn with stroke offsets, so reveal it outright. */
	.sef-success__circle,
	.sef-success__check {
		stroke-dashoffset: 0;
		animation: none !important;
	}

	.sef-btn:hover {
		transform: none;
	}
}
