/*
 * Course apply page (course-apply-page.php).
 *
 * Plain CSS for the same reason as certificate.css: the theme ships without
 * node_modules, so the compiled main.css only carries utilities the templates
 * already used, and a rule that needs `npm run build:css` renders as nothing.
 * Keyed to the tia-apply__* classes in the template.
 *
 * The accent is the chosen course's own colour. --c, --c-soft, --c-line and
 * --c-glow arrive inline from theitaid_course_color_vars() — on .tia-apply
 * for the form, on each course panel for that panel — and js/course-apply.js
 * swaps them on .tia-apply when the course changes.
 */

.tia-apply {
	--tia-apply-ink: #0f172a;
	--tia-apply-body: #475569;
	--tia-apply-muted: #64748b;
	--tia-apply-line: #e2e8f0;
	--tia-apply-line-strong: #cbd5e1;
	--tia-apply-surface: #fff;
	--tia-apply-sunken: #f8fafc;
	--tia-apply-page: #f8fafc;
	--tia-apply-bad: #b91c1c;
	--tia-apply-bad-bg: #fef2f2;
	--tia-apply-bad-line: #fecaca;
	padding: 48px 16px 72px;
	background-color: var(--tia-apply-page);
	color: var(--tia-apply-body);
	font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
	/* Lands below the sticky header when the redirect scrolls to #apply. */
	scroll-margin-top: 72px;
}

.dark .tia-apply {
	--tia-apply-ink: #f1f5f9;
	--tia-apply-body: #cbd5e1;
	--tia-apply-muted: #94a3b8;
	--tia-apply-line: #334155;
	--tia-apply-line-strong: #475569;
	--tia-apply-surface: #1e293b;
	--tia-apply-sunken: #0f172a;
	--tia-apply-page: #0f172a;
	--tia-apply-bad: #f87171;
	--tia-apply-bad-bg: rgba(185, 28, 28, 0.14);
	--tia-apply-bad-line: rgba(185, 28, 28, 0.4);
}

@media (min-width: 768px) {
	.tia-apply {
		padding: 72px 24px 96px;
	}
}

/*
 * Phone order: course, form, next steps — the visitor confirms what they are
 * applying for, then applies. From 1024px the course and the steps share the
 * left column and the form takes the right; `auto 1fr` rows stop a tall form
 * from pushing a gap between the two left-hand cards.
 */
.tia-apply__inner {
	display: grid;
	max-width: 1120px;
	margin: 0 auto;
	gap: 24px;
	grid-template-areas:
		'side'
		'main'
		'next';
}

@media (min-width: 1024px) {
	.tia-apply__inner {
		gap: 28px 36px;
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
		grid-template-rows: auto 1fr;
		grid-template-areas:
			'side main'
			'next main';
		align-items: start;
	}
}

.tia-apply__side {
	grid-area: side;
	min-width: 0;
}

.tia-apply__main {
	grid-area: main;
	min-width: 0;
}

.tia-apply__next {
	grid-area: next;
	min-width: 0;
}

.tia-apply .material-symbols-outlined {
	line-height: 1;
}

/* ---------------------------------------------------------------------------
 * Course panel
 * ------------------------------------------------------------------------ */

.tia-apply__side-label {
	margin: 0 0 12px;
	color: var(--tia-apply-muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.tia-apply__course {
	overflow: hidden;
	border: 1px solid var(--tia-apply-line);
	border-radius: 20px;
	background-color: var(--tia-apply-surface);
	box-shadow: 0 28px 56px -36px var(--c-glow, rgba(15, 23, 42, 0.35));
	animation: tia-apply-in 0.35s ease both;
}

.tia-apply__media {
	position: relative;
	display: flex;
	aspect-ratio: 16 / 9;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	background-color: var(--c-soft);
}

.tia-apply__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tia-apply__media > .material-symbols-outlined {
	color: var(--c);
	font-size: 56px;
	opacity: 0.4;
}

.tia-apply__badge,
.tia-apply__price {
	position: absolute;
	top: 12px;
	max-width: calc(50% - 18px);
	overflow: hidden;
	padding: 6px 12px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 800;
	line-height: 1.3;
	text-overflow: ellipsis;
	white-space: nowrap;
	box-shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.3);
}

.tia-apply__badge {
	left: 12px;
	background-color: var(--c);
	color: #fff;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.tia-apply__price {
	right: 12px;
	background-color: rgba(255, 255, 255, 0.95);
	color: var(--c);
	font-size: 12px;
}

/*
 * Tablet: the panel spans the full width above the form, where a 16:9 photo
 * would stand 400px tall and push the form off screen. Photo beside the
 * details instead.
 */
@media (min-width: 640px) and (max-width: 1023px) {
	.tia-apply__course:not(.tia-apply__course--empty) {
		display: grid;
		grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
	}

	.tia-apply__course .tia-apply__media {
		height: 100%;
		min-height: 220px;
		aspect-ratio: auto;
	}
}

.tia-apply__course-body {
	padding: 22px 22px 24px;
}

@media (min-width: 768px) {
	.tia-apply__course-body {
		padding: 24px 26px 26px;
	}
}

.tia-apply__eyebrow {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--c);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.tia-apply__eyebrow::before {
	width: 6px;
	height: 6px;
	flex-shrink: 0;
	border-radius: 50%;
	background-color: currentColor;
	content: '';
}

.tia-apply__course-title {
	margin: 10px 0 18px;
	color: var(--tia-apply-ink);
	font-size: 20px;
	font-weight: 800;
	line-height: 1.35;
}

.tia-apply__chips {
	display: grid;
	margin: 0 0 20px;
	padding: 0;
	gap: 8px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	list-style: none;
}

.tia-apply__chip {
	display: flex;
	min-width: 0;
	align-items: center;
	gap: 6px;
	padding: 8px 10px;
	border-radius: 9px;
	background-color: var(--c-soft);
	color: var(--tia-apply-body);
	font-size: 12px;
	font-weight: 700;
}

.tia-apply__chip .material-symbols-outlined {
	flex-shrink: 0;
	color: var(--c);
	font-size: 17px;
}

.tia-apply__chip-text {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tia-apply__course-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--c);
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
}

.tia-apply__course-link .material-symbols-outlined {
	font-size: 18px;
	transition: transform 0.2s ease;
}

.tia-apply__course-link:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.tia-apply__course-link:hover .material-symbols-outlined {
	transform: translateX(3px);
}

/* No course chosen yet. */
.tia-apply__course--empty {
	padding: 40px 28px;
	border-style: dashed;
	border-width: 2px;
	text-align: center;
	box-shadow: none;
}

.tia-apply__empty-icon {
	display: inline-flex;
	width: 64px;
	height: 64px;
	align-items: center;
	justify-content: center;
	margin-bottom: 16px;
	border-radius: 50%;
	background-color: var(--c-soft);
	color: var(--c);
	font-size: 32px;
}

.tia-apply__empty-title {
	margin: 0 0 6px;
	color: var(--tia-apply-ink);
	font-size: 17px;
	font-weight: 800;
}

.tia-apply__empty-text {
	max-width: 30ch;
	margin: 0 auto;
	color: var(--tia-apply-muted);
	font-size: 14px;
	line-height: 1.6;
}

/* ---------------------------------------------------------------------------
 * Form card
 * ------------------------------------------------------------------------ */

.tia-apply__card {
	position: relative;
	overflow: hidden;
	padding: 30px 20px 26px;
	border: 1px solid var(--tia-apply-line);
	border-radius: 24px;
	background-color: var(--tia-apply-surface);
	box-shadow: 0 32px 64px -40px rgba(15, 23, 42, 0.45);
}

/* Accent rule along the top edge, in the course's colour. */
.tia-apply__card::before {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	height: 5px;
	background: linear-gradient(90deg, var(--c), var(--c-line));
	content: '';
}

@media (min-width: 768px) {
	.tia-apply__card {
		padding: 44px 48px 38px;
	}
}

.tia-apply__kicker {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px;
	border-radius: 999px;
	background-color: var(--c-soft);
	color: var(--c);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.tia-apply__kicker::before {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background-color: currentColor;
	content: '';
}

.tia-apply__title {
	margin: 16px 0 10px;
	color: var(--tia-apply-ink);
	font-size: 28px;
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.2;
}

@media (min-width: 768px) {
	.tia-apply__title {
		font-size: 32px;
	}
}

.tia-apply__lede {
	max-width: 54ch;
	margin: 0 0 28px;
	color: var(--tia-apply-body);
	font-size: 15px;
	line-height: 1.65;
}

.tia-apply__lede p {
	margin: 0 0 10px;
}

.tia-apply__lede p:last-child {
	margin-bottom: 0;
}

.tia-apply__alert {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0 0 24px;
	padding: 14px 16px;
	border: 1px solid var(--tia-apply-bad-line);
	border-radius: 12px;
	background-color: var(--tia-apply-bad-bg);
	color: var(--tia-apply-bad);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
}

.tia-apply__alert .material-symbols-outlined {
	flex-shrink: 0;
	font-size: 20px;
	line-height: 1.05;
}

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

.tia-apply__fields {
	display: grid;
	gap: 20px;
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
	.tia-apply__fields {
		gap: 22px 18px;
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.tia-apply__field--full {
		grid-column: 1 / -1;
	}
}

.tia-apply__label {
	display: block;
	margin-bottom: 8px;
	color: var(--tia-apply-ink);
	font-size: 13px;
	font-weight: 700;
}

.tia-apply__req {
	color: var(--c);
}

.tia-apply__optional {
	margin-left: 2px;
	color: var(--tia-apply-muted);
	font-weight: 500;
}

.tia-apply__control {
	position: relative;
}

.tia-apply__icon {
	position: absolute;
	top: 50%;
	left: 15px;
	color: var(--tia-apply-muted);
	font-size: 20px;
	pointer-events: none;
	transform: translateY(-50%);
	transition: color 0.18s ease;
}

.tia-apply__control:focus-within .tia-apply__icon {
	color: var(--c);
}

/*
 * Two classes so these beat the @tailwindcss/forms base styles in main.css on
 * every state (its :focus rule is an element plus a pseudo-class).
 */
.tia-apply .tia-apply__input {
	display: block;
	width: 100%;
	min-height: 52px;
	margin: 0;
	padding: 0 16px 0 46px;
	border: 1.5px solid var(--tia-apply-line);
	border-radius: 12px;
	background-color: var(--tia-apply-sunken);
	color: var(--tia-apply-ink);
	font-family: inherit;
	font-size: 15px;
	line-height: 1.4;
	box-shadow: none;
	transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.tia-apply .tia-apply__input::placeholder {
	color: var(--tia-apply-muted);
	opacity: 0.75;
}

.tia-apply .tia-apply__input:hover {
	border-color: var(--tia-apply-line-strong);
}

.tia-apply .tia-apply__input:focus {
	border-color: var(--c);
	outline: none;
	background-color: var(--tia-apply-surface);
	box-shadow: 0 0 0 4px var(--c-soft);
}

.tia-apply select.tia-apply__input {
	padding-right: 44px;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
	background-position: right 14px center;
	background-repeat: no-repeat;
	background-size: 20px 20px;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	text-overflow: ellipsis;
}

.tia-apply__field.is-invalid .tia-apply__input {
	border-color: var(--tia-apply-bad);
	background-color: var(--tia-apply-bad-bg);
}

.tia-apply__field.is-invalid .tia-apply__icon {
	color: var(--tia-apply-bad);
}

.tia-apply__error,
.tia-apply__hint {
	margin: 8px 0 0;
	font-size: 12.5px;
	line-height: 1.5;
}

.tia-apply__error {
	color: var(--tia-apply-bad);
	font-weight: 600;
}

.tia-apply__hint {
	color: var(--tia-apply-muted);
}

/* The sum, and its answer box beside it. */
.tia-apply__captcha {
	display: flex;
	align-items: stretch;
	gap: 12px;
}

.tia-apply__sum {
	display: inline-flex;
	min-height: 52px;
	flex-shrink: 0;
	align-items: center;
	gap: 10px;
	padding: 0 18px;
	border: 1.5px dashed var(--c-line);
	border-radius: 12px;
	background-color: var(--c-soft);
	color: var(--tia-apply-ink);
	font-size: 20px;
	font-variant-numeric: tabular-nums;
	font-weight: 800;
	letter-spacing: 0.06em;
	white-space: nowrap;
	user-select: none;
}

.tia-apply__sum .material-symbols-outlined {
	color: var(--c);
	font-size: 22px;
}

/* Flexible within limits so the pair still fits a 320px phone. */
.tia-apply .tia-apply__input--answer {
	width: auto;
	min-width: 64px;
	max-width: 120px;
	flex: 1 1 96px;
	padding: 0 12px;
	font-size: 20px;
	font-weight: 800;
	text-align: center;
}

/* Kept out of sight and out of the tab order; see the template. */
.tia-apply__trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------------------------------------------------------------------------
 * Submit
 * ------------------------------------------------------------------------ */

.tia-apply .tia-apply__submit {
	display: flex;
	width: 100%;
	min-height: 56px;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-top: 28px;
	padding: 0 28px;
	border: 0;
	border-radius: 14px;
	background-color: var(--c);
	color: #fff;
	font-family: inherit;
	font-size: 15px;
	font-weight: 800;
	letter-spacing: 0.02em;
	cursor: pointer;
	box-shadow: 0 18px 36px -16px var(--c-glow);
	transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.tia-apply .tia-apply__submit:hover {
	filter: brightness(0.92);
	transform: translateY(-1px);
	box-shadow: 0 22px 40px -16px var(--c-glow);
}

.tia-apply .tia-apply__submit:focus-visible {
	outline: 3px solid var(--c-line);
	outline-offset: 3px;
}

.tia-apply__submit-icon {
	font-size: 20px;
	transition: transform 0.2s ease;
}

.tia-apply__submit:hover .tia-apply__submit-icon {
	transform: translateX(3px);
}

.tia-apply .tia-apply__submit:disabled {
	cursor: progress;
	filter: none;
	opacity: 0.75;
	transform: none;
}

.tia-apply__submit.is-busy .tia-apply__submit-icon {
	animation: tia-apply-spin 0.8s linear infinite;
}

.tia-apply__privacy {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: 14px 0 0;
	color: var(--tia-apply-muted);
	font-size: 12.5px;
	text-align: center;
}

.tia-apply__privacy .material-symbols-outlined {
	font-size: 16px;
}

/* ---------------------------------------------------------------------------
 * Thank-you state
 * ------------------------------------------------------------------------ */

.tia-apply__done {
	padding: 18px 0 10px;
	text-align: center;
}

.tia-apply__done-icon {
	display: inline-flex;
	width: 84px;
	height: 84px;
	align-items: center;
	justify-content: center;
	margin-bottom: 24px;
	border-radius: 50%;
	background-color: var(--c);
	color: #fff;
	font-size: 46px;
	box-shadow: 0 0 0 12px var(--c-soft), 0 22px 44px -16px var(--c-glow);
	animation: tia-apply-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.tia-apply__done-title {
	margin: 0 0 12px;
	color: var(--tia-apply-ink);
	font-size: 28px;
	font-weight: 800;
	line-height: 1.25;
}

.tia-apply__done-text {
	max-width: 46ch;
	margin: 0 auto 30px;
	color: var(--tia-apply-body);
	font-size: 15px;
	line-height: 1.7;
}

.tia-apply__done-text strong {
	color: var(--tia-apply-ink);
}

.tia-apply__done-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
}

.tia-apply__btn {
	display: inline-flex;
	min-height: 48px;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 0 22px;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
	transition: filter 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.tia-apply__btn .material-symbols-outlined {
	font-size: 19px;
}

.tia-apply__btn--solid {
	background-color: var(--c);
	color: #fff;
}

.tia-apply__btn--solid:hover {
	color: #fff;
	filter: brightness(0.92);
}

.tia-apply__btn--ghost {
	border: 1.5px solid var(--tia-apply-line);
	background-color: var(--tia-apply-surface);
	color: var(--tia-apply-ink);
}

.tia-apply__btn--ghost:hover {
	border-color: var(--c-line);
	background-color: var(--c-soft);
	color: var(--tia-apply-ink);
}

/* ---------------------------------------------------------------------------
 * What happens next
 * ------------------------------------------------------------------------ */

.tia-apply__next {
	padding: 24px 22px;
	border: 1px solid var(--tia-apply-line);
	border-radius: 20px;
	background-color: var(--tia-apply-surface);
}

@media (min-width: 768px) {
	.tia-apply__next {
		padding: 26px 26px 24px;
	}
}

.tia-apply__next-title {
	margin: 0 0 20px;
	color: var(--tia-apply-ink);
	font-size: 16px;
	font-weight: 800;
}

.tia-apply__steps {
	display: grid;
	margin: 0;
	padding: 0;
	gap: 18px;
	list-style: none;
}

.tia-apply__step {
	position: relative;
	display: grid;
	gap: 14px;
	grid-template-columns: 36px minmax(0, 1fr);
}

/* The line that joins one step's number to the next. */
.tia-apply__step:not(:last-child)::after {
	position: absolute;
	top: 42px;
	bottom: -12px;
	left: 17px;
	width: 2px;
	border-radius: 2px;
	background-color: var(--c-line);
	content: '';
	opacity: 0.6;
}

.tia-apply__step-num {
	display: inline-flex;
	width: 36px;
	height: 36px;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background-color: var(--c-soft);
	color: var(--c);
	font-size: 14px;
	font-weight: 800;
}

.tia-apply__step-title {
	margin: 6px 0 0;
	color: var(--tia-apply-ink);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.4;
}

.tia-apply__step-text {
	margin: 3px 0 0;
	color: var(--tia-apply-muted);
	font-size: 13px;
	line-height: 1.55;
}

.tia-apply__call {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	border-radius: 14px;
	background-color: #0f172a;
	color: #fff;
	text-decoration: none;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

/* Only spaced off the steps when there are steps above it. */
.tia-apply__steps + .tia-apply__call {
	margin-top: 24px;
}

.dark .tia-apply__call {
	background-color: #020617;
}

.tia-apply__call:hover {
	color: #fff;
	transform: translateY(-2px);
	box-shadow: 0 16px 32px -18px rgba(15, 23, 42, 0.8);
}

.tia-apply__call-icon {
	display: inline-flex;
	width: 42px;
	height: 42px;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background-color: var(--c);
	color: #fff;
	font-size: 21px;
}

.tia-apply__call-label {
	display: block;
	color: #94a3b8;
	font-size: 12px;
	font-weight: 600;
}

.tia-apply__call-number {
	display: block;
	margin-top: 2px;
	font-size: 16px;
	font-weight: 800;
	letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------------------
 * Motion
 * ------------------------------------------------------------------------ */

@keyframes tia-apply-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}

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

@keyframes tia-apply-pop {
	from {
		opacity: 0;
		transform: scale(0.6);
	}

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

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

/* ---------------------------------------------------------------------------
 * Neighbours
 * ------------------------------------------------------------------------ */

/*
 * main.css's [hidden] rule has the specificity of one class and loads first,
 * so .tia-apply__course's display would win and show every course panel at
 * once. Two classes' worth settles it without !important.
 */
.tia-apply [hidden] {
	display: none;
}

/*
 * The floating review card is decorative and lands on top of the form at
 * desktop widths, the same clash certificate.css settles the same way: an
 * application form outranks a testimonial, and this file only loads here.
 */
#floating-review-left {
	display: none;
}

@media (prefers-reduced-motion: reduce) {

	.tia-apply__course,
	.tia-apply__done-icon {
		animation: none;
	}

	.tia-apply__submit.is-busy .tia-apply__submit-icon {
		animation-duration: 4s;
	}

	.tia-apply .tia-apply__input,
	.tia-apply .tia-apply__submit,
	.tia-apply__call,
	.tia-apply__btn,
	.tia-apply__icon,
	.tia-apply__course-link .material-symbols-outlined,
	.tia-apply__submit-icon {
		transition: none;
	}
}
