/*
 * Free counseling popup (template-parts/counseling-modal.php,
 * js/counseling-modal.js).
 *
 * Phones: a sheet that slides up from the bottom, the navy header on top and
 * the form scrolling under it. From 640px: a centred card. From 1024px: the
 * navy panel moves beside the form and gains the points and the call card.
 *
 * Above the live chat (9990) and below the course list panel of
 * js/fancy-select.js (10000), so that list still opens over the form.
 * Plain CSS, outside the frozen Tailwind build.
 */

.tia-counsel {
	--tc-primary: #4F46E5;
	--tc-navy: #0F172A;
	--tc-cyan: #22D3EE;
	--tc-ink: #1E293B;
	--tc-muted: #64748B;
	--tc-faint: #94A3B8;
	--tc-line: #E2E8F0;
	--tc-field: #F8FAFC;
	--tc-error: #DC2626;
	--tc-ease: cubic-bezier(0.22, 1, 0.36, 1);

	position: fixed;
	inset: 0;
	z-index: 9995;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	color: var(--tc-ink);
	font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
	line-height: 1.5;
	text-align: left;
}

.tia-counsel[hidden] {
	display: none;
}

.tia-counsel *,
.tia-counsel *::before,
.tia-counsel *::after {
	box-sizing: border-box;
}

/* The page under it stays put; the gutter keeps it from jumping sideways. */
html.tia-counsel-lock {
	overflow: hidden;
}

html.tia-counsel-lock body {
	padding-right: var(--tia-counsel-gutter, 0px);
}

.tia-counsel__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------------------------------------------------------------------------
 * Backdrop and dialog (phone sheet)
 * ------------------------------------------------------------------------ */

.tia-counsel__backdrop {
	position: absolute;
	inset: 0;
	background-color: rgb(15 23 42 / 0.72);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 0.28s ease;
}

.tia-counsel.is-open .tia-counsel__backdrop {
	opacity: 1;
}

.tia-counsel__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-height: calc(100% - 12px);
	overflow: hidden;
	border-radius: 22px 22px 0 0;
	background-color: #FFFFFF;
	box-shadow: 0 -20px 50px -20px rgb(15 23 42 / 0.5);
	outline: none;
	transform: translateY(100%);
	transition: transform 0.32s var(--tc-ease);
}

.tia-counsel.is-open .tia-counsel__dialog {
	transform: none;
}

.tia-counsel__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background-color: rgb(255 255 255 / 0.12);
	color: #FFFFFF;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.25s ease;
}

.tia-counsel__close:hover {
	background-color: rgb(255 255 255 / 0.22);
	transform: rotate(90deg);
}

.tia-counsel__close:focus-visible {
	outline: 2px solid var(--tc-cyan);
	outline-offset: 2px;
}

.tia-counsel .tia-counsel__close .material-symbols-outlined {
	font-size: 22px;
}

/* ---------------------------------------------------------------------------
 * Navy panel: a compact header on phones and tablets
 * ------------------------------------------------------------------------ */

.tia-counsel__aside {
	position: relative;
	flex: 0 0 auto;
	overflow: hidden;
	padding: 20px 64px 18px 20px;
	background-color: var(--tc-navy);
	color: #CBD5E1;
}

.tia-counsel__layer {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.tia-counsel__aside-body {
	position: relative;
}

.tia-counsel__tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border: 1px solid rgb(255 255 255 / 0.14);
	border-radius: 999px;
	background-color: rgb(255 255 255 / 0.06);
	color: var(--tc-cyan);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.4;
	text-transform: uppercase;
}

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

.tia-counsel__title {
	margin: 10px 0 0;
	color: #FFFFFF;
	font-size: 21px;
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.2;
}

.tia-counsel__intro {
	margin: 6px 0 0;
	color: #CBD5E1;
	font-size: 13.5px;
	line-height: 1.55;
}

.tia-counsel__points,
.tia-counsel__call {
	display: none;
}

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

.tia-counsel__main {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
}

.tia-counsel__form[hidden] {
	display: none;
}

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

.tia-counsel__label {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px;
	margin: 0 0 6px;
	color: var(--tc-ink);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
}

.tia-counsel__req {
	color: var(--tc-error);
}

.tia-counsel__opt {
	color: var(--tc-faint);
	font-size: 12px;
	font-weight: 500;
}

.tia-counsel__control {
	position: relative;
}

.tia-counsel .tia-counsel__icon {
	position: absolute;
	top: 50%;
	left: 14px;
	z-index: 1;
	color: var(--tc-faint);
	font-size: 20px;
	pointer-events: none;
	transform: translateY(-50%);
	transition: color 0.2s ease;
}

.tia-counsel .tia-counsel__control--area .tia-counsel__icon {
	top: 14px;
	transform: none;
}

/* Scoped twice so the forms plugin's input rules in main.css never win. */
.tia-counsel .tia-counsel__input {
	display: block;
	width: 100%;
	min-height: 50px;
	margin: 0;
	padding: 12px 14px 12px 44px;
	border: 1.5px solid var(--tc-line);
	border-radius: 12px;
	background-color: var(--tc-field);
	box-shadow: none;
	color: var(--tc-ink);
	font-family: inherit;
	/* 16px: anything smaller makes iOS zoom the page on focus. */
	font-size: 16px;
	line-height: 1.4;
	transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.tia-counsel .tia-counsel__input::placeholder {
	color: var(--tc-faint);
	opacity: 1;
}

.tia-counsel .tia-counsel__input:hover {
	border-color: #CBD5E1;
}

.tia-counsel .tia-counsel__input:focus {
	border-color: var(--tc-primary);
	outline: none;
	background-color: #FFFFFF;
	box-shadow: 0 0 0 4px rgb(79 70 229 / 0.14);
}

.tia-counsel__control:focus-within .tia-counsel__icon {
	color: var(--tc-primary);
}

/* Room for the chevron fancy-select.css draws. */
.tia-counsel select.tia-counsel__input {
	padding-right: 40px;
	text-overflow: ellipsis;
}

/* "Select a course" still showing reads as a placeholder. */
.tia-counsel select.tia-counsel__input:invalid {
	color: var(--tc-faint);
}

.tia-counsel select.tia-counsel__input option {
	color: var(--tc-ink);
}

.tia-counsel .tia-counsel__textarea {
	min-height: 96px;
	resize: vertical;
}

.tia-counsel__field.has-error .tia-counsel__input {
	border-color: var(--tc-error);
	background-color: #FEF2F2;
}

.tia-counsel__field.has-error .tia-counsel__input:focus {
	box-shadow: 0 0 0 4px rgb(220 38 38 / 0.14);
}

.tia-counsel__field.has-error .tia-counsel__icon {
	color: var(--tc-error);
}

.tia-counsel__error {
	margin: 6px 0 0;
	color: var(--tc-error);
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.4;
}

.tia-counsel__error:empty {
	display: none;
}

.tia-counsel__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.tia-counsel__alert {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 16px 0 0;
	padding: 12px 14px;
	border-radius: 12px;
	background-color: #FEF2F2;
	color: #B91C1C;
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.45;
}

.tia-counsel__alert[hidden] {
	display: none;
}

.tia-counsel .tia-counsel__alert .material-symbols-outlined {
	flex-shrink: 0;
	font-size: 20px;
}

/* The fill and its hover sweep are .btn-gradient (buttons.css). */
.tia-counsel__submit {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 54px;
	margin: 18px 0 0;
	padding: 14px 20px;
	border: 0;
	border-radius: 12px;
	color: #FFFFFF;
	cursor: pointer;
	font-family: inherit;
	font-size: 15px;
	font-weight: 800;
	letter-spacing: 0.01em;
	line-height: 1.3;
}

.tia-counsel__submit:focus-visible {
	outline: 3px solid rgb(79 70 229 / 0.4);
	outline-offset: 3px;
}

.tia-counsel__submit:disabled {
	cursor: progress;
	opacity: 0.85;
	transform: none;
}

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

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

.tia-counsel__spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2.5px solid rgb(255 255 255 / 0.35);
	border-top-color: #FFFFFF;
	border-radius: 50%;
	animation: tia-counsel-spin 0.7s linear infinite;
}

.tia-counsel__submit.is-loading .tia-counsel__spinner {
	display: inline-block;
}

.tia-counsel__submit.is-loading .tia-counsel__submit-icon {
	display: none;
}

.tia-counsel__privacy {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: 12px 0 0;
	color: var(--tc-muted);
	font-size: 12px;
	line-height: 1.45;
	text-align: center;
}

.tia-counsel .tia-counsel__privacy .material-symbols-outlined {
	flex-shrink: 0;
	font-size: 16px;
}

.tia-counsel__alt {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 4px 6px;
	margin: 14px 0 0;
	padding-top: 14px;
	border-top: 1px dashed var(--tc-line);
	color: var(--tc-muted);
	font-size: 13px;
	text-decoration: none;
}

.tia-counsel__alt strong {
	color: var(--tc-primary);
}

.tia-counsel .tia-counsel__alt .material-symbols-outlined {
	color: var(--tc-primary);
	font-size: 18px;
}

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

.tia-counsel__done {
	padding: 28px 8px 12px;
	outline: none;
	text-align: center;
}

.tia-counsel__done[hidden] {
	display: none;
}

.tia-counsel__done-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background-color: #DCFCE7;
	box-shadow: 0 0 0 10px rgb(22 163 74 / 0.08);
	color: #16A34A;
	animation: tia-counsel-pop 0.45s var(--tc-ease);
}

.tia-counsel .tia-counsel__done-icon .material-symbols-outlined {
	font-size: 40px;
	font-weight: 700;
}

.tia-counsel__done-title {
	margin: 22px 0 0;
	color: var(--tc-ink);
	font-size: 22px;
	font-weight: 800;
	line-height: 1.25;
}

.tia-counsel__done-text {
	max-width: 36ch;
	margin: 8px auto 0;
	color: var(--tc-muted);
	font-size: 15px;
}

.tia-counsel__done-text[hidden] {
	display: none;
}

.tia-counsel__done-btn {
	min-height: 48px;
	margin-top: 22px;
	padding: 12px 32px;
	border: 1.5px solid var(--tc-line);
	border-radius: 12px;
	background-color: #FFFFFF;
	color: var(--tc-ink);
	cursor: pointer;
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.tia-counsel__done-btn:hover,
.tia-counsel__done-btn:focus-visible {
	border-color: var(--tc-primary);
	color: var(--tc-primary);
}

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

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

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

/* ---------------------------------------------------------------------------
 * Breakpoints
 * ------------------------------------------------------------------------ */

/* Two fields to a row once there is room. */
@media (min-width: 480px) {
	.tia-counsel__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 16px 14px;
	}

	.tia-counsel__field--wide {
		grid-column: 1 / -1;
	}
}

/* Tablets: a centred card. */
@media (min-width: 640px) {
	.tia-counsel {
		align-items: center;
		padding: 24px;
	}

	.tia-counsel__dialog {
		max-width: 620px;
		max-height: 100%;
		border-radius: 24px;
		box-shadow: 0 40px 80px -24px rgb(15 23 42 / 0.6);
		opacity: 0;
		transform: translateY(16px) scale(0.97);
		transition: transform 0.3s var(--tc-ease), opacity 0.24s ease;
	}

	.tia-counsel.is-open .tia-counsel__dialog {
		opacity: 1;
		transform: none;
	}

	.tia-counsel__close {
		top: 16px;
		right: 16px;
	}

	.tia-counsel__aside {
		padding: 26px 72px 24px 28px;
	}

	.tia-counsel__title {
		font-size: 24px;
	}

	.tia-counsel__main {
		padding: 24px 28px 28px;
	}
}

/* Desktop: the navy panel beside the form, with the points and the call card. */
@media (min-width: 1024px) {
	.tia-counsel {
		padding: 32px;
	}

	.tia-counsel__dialog {
		flex-direction: row;
		max-width: 960px;
	}

	.tia-counsel__aside {
		display: flex;
		flex: 0 0 38%;
		padding: 40px 34px 34px;
	}

	.tia-counsel__aside-body {
		display: flex;
		flex-direction: column;
		width: 100%;
	}

	.tia-counsel__title {
		margin-top: 18px;
		font-size: 30px;
	}

	.tia-counsel__intro {
		margin-top: 12px;
		font-size: 15px;
		line-height: 1.6;
	}

	.tia-counsel__points {
		display: grid;
		gap: 12px;
		margin: 26px 0 28px;
		padding: 0;
		list-style: none;
	}

	.tia-counsel__points li {
		display: flex;
		align-items: flex-start;
		gap: 10px;
		margin: 0;
		color: #E2E8F0;
		font-size: 14px;
		font-weight: 600;
		line-height: 1.45;
	}

	.tia-counsel .tia-counsel__points .material-symbols-outlined {
		flex-shrink: 0;
		color: var(--tc-cyan);
		font-size: 20px;
	}

	.tia-counsel__call {
		display: flex;
		align-items: center;
		gap: 12px;
		margin-top: auto;
		padding: 14px 16px;
		border: 1px solid rgb(255 255 255 / 0.1);
		border-radius: 16px;
		background-color: rgb(255 255 255 / 0.05);
		color: #FFFFFF;
		text-decoration: none;
		transition: background-color 0.2s ease, border-color 0.2s ease;
	}

	.tia-counsel__call:hover,
	.tia-counsel__call:focus-visible {
		border-color: rgb(34 211 238 / 0.4);
		background-color: rgb(255 255 255 / 0.09);
	}

	.tia-counsel .tia-counsel__call-icon {
		display: inline-flex;
		flex-shrink: 0;
		align-items: center;
		justify-content: center;
		width: 42px;
		height: 42px;
		border-radius: 12px;
		background-image: linear-gradient(135deg, #16A34A, #0F766E);
		font-size: 22px;
	}

	.tia-counsel__call small {
		display: block;
		color: var(--tc-faint);
		font-size: 12px;
		font-weight: 600;
	}

	.tia-counsel__call strong {
		display: block;
		font-size: 16px;
		font-weight: 800;
		letter-spacing: 0.01em;
	}

	.tia-counsel__alt {
		display: none;
	}

	.tia-counsel__main {
		flex: 1 1 auto;
		min-width: 0;
		padding: 56px 40px 36px;
	}

	.tia-counsel__done {
		padding-top: 48px;
	}

	/* Over the white form now, not the navy panel. */
	.tia-counsel__close {
		background-color: #F1F5F9;
		color: #475569;
	}

	.tia-counsel__close:hover {
		background-color: #E2E8F0;
		color: var(--tc-ink);
	}

	.tia-counsel__close:focus-visible {
		outline-color: var(--tc-primary);
	}
}

/* Short screens (a phone on its side, a small laptop): drop the extras. */
@media (max-height: 520px) {
	.tia-counsel__intro {
		display: none;
	}
}

@media (min-width: 1024px) and (max-height: 680px) {
	.tia-counsel__points {
		display: none;
	}

	.tia-counsel__call {
		margin-top: 24px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tia-counsel__backdrop,
	.tia-counsel__dialog,
	.tia-counsel__close {
		transition: none;
	}

	.tia-counsel__done-icon {
		animation: none;
	}
}
