/*
 * Desktop mega menu.
 *
 * Plain CSS kept out of the Tailwind build for the same reason as
 * mobile-nav.css. Keyed to the tia-mega__* classes emitted by
 * theitaid_mega_menu_panel() in inc/mega-menu.php.
 *
 * The panel hangs from the sticky <nav>, not from its menu item: the item is
 * made position:static, so the nearest positioned ancestor is the full-width
 * nav and the panel centres under the header instead of running off the right
 * edge from wherever "Courses" happens to sit.
 */

.tia-desktop-nav .tia-has-mega {
	position: static;
}

.tia-mega {
	--tia-mega-ink: #0f172a;
	--tia-mega-muted: #64748b;
	--tia-mega-line: #e9edf3;
	--tia-mega-ease: cubic-bezier(0.16, 1, 0.3, 1);

	position: absolute;
	top: 100%;
	left: 50%;
	z-index: 50;
	width: min(1040px, calc(100vw - 2rem));
	/* The gap under the header is padding, so it still counts as hovering. */
	padding-top: 0.625rem;
	opacity: 0;
	visibility: hidden;
	transform: translate(-50%, 12px);
	/* Closing waits a beat, so a pointer cutting a corner on its way down
	   from the nav link does not snap the panel shut. */
	transition:
		opacity 0.18s ease 0.1s,
		transform 0.24s ease 0.1s,
		visibility 0s linear 0.34s;
	color: var(--tia-mega-ink);
	font-size: 0.875rem;
	font-weight: 400;
	line-height: 1.5;
	text-align: left;
	cursor: default;
}

/* Hover bridge over the nav's bottom padding, between the link and the panel. */
.tia-mega::before {
	content: '';
	position: absolute;
	top: -1.25rem;
	left: 0;
	right: 0;
	height: 1.25rem;
}

.tia-has-mega:hover > .tia-mega,
.tia-has-mega:focus-within > .tia-mega {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
	transition:
		opacity 0.2s ease,
		transform 0.32s var(--tia-mega-ease),
		visibility 0s;
}

.tia-mega__panel {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 18rem;
	overflow: hidden;
	background-color: #fff;
	border: 1px solid var(--tia-mega-line);
	border-radius: 1.25rem;
	box-shadow:
		0 1px 2px rgba(15, 23, 42, 0.04),
		0 18px 36px -12px rgba(15, 23, 42, 0.16),
		0 44px 88px -36px rgba(79, 70, 229, 0.28);
}

.tia-mega--solo .tia-mega__panel {
	grid-template-columns: minmax(0, 1fr);
}

/* ---------------------------------------------------------------------------
 * Link area
 * ------------------------------------------------------------------------ */

/* A column, so the footer strip can sit on the bottom edge whatever height
   the counselling box gives the row. */
.tia-mega__main {
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: 1.375rem 1.25rem 1.25rem;
	/* The panel hangs from a sticky header, so whatever runs past the bottom
	   of the window can never be scrolled into view; scroll inside instead.
	   10rem is the top bar, the header and the gap above the panel. */
	max-height: calc(100vh - 10rem);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.tia-mega__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin: 0 0.25rem 0.875rem;
	padding: 0 0.5rem 0.875rem;
	border-bottom: 1px solid #f1f5f9;
}

.tia-mega__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 0.625rem;
	color: #0891b2;
	font-size: 0.6875rem;
	font-weight: 800;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.tia-mega__eyebrow::before {
	content: '';
	width: 1.25rem;
	height: 2px;
	border-radius: 2px;
	background: linear-gradient(90deg, #06b6d4, #4f46e5);
}

.tia-mega__all {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	margin-right: -0.5rem;
	padding: 0.375rem 0.5rem 0.375rem 0.75rem;
	border-radius: 999px;
	color: #4f46e5;
	font-size: 0.8125rem;
	font-weight: 700;
	transition: background-color 0.18s ease, color 0.18s ease;
}

.tia-mega__all:hover,
.tia-mega__all:focus-visible {
	background-color: rgb(79 70 229 / 0.08);
	color: #4338ca;
}

.tia-mega__all .material-symbols-outlined {
	font-size: 1.125rem;
	transition: transform 0.18s ease;
}

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

.tia-mega__grid,
.tia-mega__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tia-mega__grid {
	display: grid;
	grid-template-columns: repeat(var(--tia-mega-cols, 2), minmax(0, 1fr));
	gap: 0.25rem 0.5rem;
}

/* Two columns, each a stack of groups (.tia-mega__col: title over list).
   The stacks are filled independently, so a short group sits straight under
   the one above it rather than waiting for a long group beside it to end;
   theitaid_mega_menu_panel() deals the groups out to keep the two even. */
.tia-mega__cols {
	display: grid;
	grid-template-columns: repeat(var(--tia-mega-cols, 2), minmax(0, 1fr));
	align-items: start;
	column-gap: 1.25rem;
}

.tia-mega__stack,
.tia-mega__col {
	min-width: 0;
}

/* Spaces one group from the next in its stack. */
.tia-mega__col > .tia-mega__list {
	margin-bottom: 1rem;
}

.tia-mega__col-title {
	display: block;
	margin-bottom: 0.375rem;
	padding: 0.25rem 0.75rem;
	color: var(--tia-mega-muted);
	font-size: 0.6875rem;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	transition: color 0.18s ease;
}

a.tia-mega__col-title:hover {
	color: #4f46e5;
}

.tia-mega__list {
	display: grid;
	gap: 0.375rem;
}

/* One course link. Its hue arrives as --c / --c-soft / --c-line / --c-glow on
   the element, from theitaid_course_color_vars(), same as the course cards. */
.tia-mega__link {
	display: flex;
	align-items: center;
	gap: 0.875rem;
	padding: 0.6875rem 0.75rem;
	border: 1px solid transparent;
	border-radius: 0.875rem;
	color: var(--tia-mega-ink);
	text-decoration: none;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.tia-mega__link:hover,
.tia-mega__link:focus-visible,
.tia-mega__link.is-current {
	background-color: var(--c-soft);
	border-color: var(--c-line);
}

.tia-mega__link:focus-visible {
	outline: 2px solid var(--c);
	outline-offset: 2px;
}

.tia-mega__icon {
	display: grid;
	flex: none;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 0.75rem;
	background-color: var(--c-soft);
	box-shadow: inset 0 0 0 1px var(--c-line);
	color: var(--c);
	transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.tia-mega__icon .material-symbols-outlined {
	font-size: 1.375rem;
}

.tia-mega__link:hover .tia-mega__icon,
.tia-mega__link:focus-visible .tia-mega__icon,
.tia-mega__link.is-current .tia-mega__icon {
	background-color: var(--c);
	box-shadow: 0 10px 20px -8px var(--c-glow);
	color: #fff;
}

.tia-mega__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

/* Balanced, so a wrapped "… with AI" breaks as "Basic Computing / with AI"
   rather than leaving "AI" alone on the second line. */
.tia-mega__name {
	color: var(--tia-mega-ink);
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.35;
	text-wrap: balance;
	transition: color 0.2s ease;
}

.tia-mega__link:hover .tia-mega__name,
.tia-mega__link:focus-visible .tia-mega__name,
.tia-mega__link.is-current .tia-mega__name {
	color: var(--c);
}

.tia-mega__meta {
	margin-top: 0.1875rem;
	overflow: hidden;
	color: var(--tia-mega-muted);
	font-size: 0.75rem;
	font-weight: 500;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tia-mega__go {
	flex: none;
	color: var(--c);
	font-size: 1.125rem;
	opacity: 0;
	transform: translateX(-6px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.tia-mega__link:hover .tia-mega__go,
.tia-mega__link:focus-visible .tia-mega__go {
	opacity: 1;
	transform: translateX(0);
}

/* Footer strip: BTEB approval on the left, the top bar's news on the right. */
.tia-mega__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-top: auto;
	padding: 0.75rem 0.875rem;
	border: 1px solid #eef2f7;
	border-radius: 0.875rem;
	background-color: #f8fafc;
}

/* margin-top:auto on the strip shrinks to nothing once the links fill the
   row, so the gap above it comes from here (plus the lists' own 1rem). */
.tia-mega__grid {
	margin-bottom: 1.25rem;
}

.tia-mega__cols {
	margin-bottom: 0.25rem;
}

.tia-mega__trust {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-width: 0;
}

.tia-mega__trust img {
	flex: none;
	width: 2.125rem;
	height: auto;
}

.tia-mega__trust > span {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.tia-mega__trust strong {
	overflow: hidden;
	color: var(--tia-mega-ink);
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.35;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tia-mega__trust small {
	color: var(--tia-mega-muted);
	font-size: 0.6875rem;
	font-weight: 500;
	line-height: 1.4;
}

.tia-mega__news {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 0.5rem;
	padding: 0.375rem 0.75rem 0.375rem 0.625rem;
	border: 1px solid rgb(5 150 105 / 0.22);
	border-radius: 999px;
	background-color: rgb(5 150 105 / 0.08);
	color: #047857;
	font-size: 0.75rem;
	font-weight: 700;
	white-space: nowrap;
}

.tia-mega__pulse {
	position: relative;
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 999px;
	background-color: #10b981;
}

.tia-mega__pulse::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background-color: #10b981;
	animation: tia-mega-pulse 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* A 1366x768 laptop leaves about 650px of window: drop the strip there so
   two rows of courses still fit without the panel having to scroll. */
@media (max-height: 760px) {
	.tia-mega__foot {
		display: none;
	}
}

@keyframes tia-mega-pulse {
	75%,
	100% {
		opacity: 0;
		transform: scale(2.4);
	}
}

/* ---------------------------------------------------------------------------
 * Counselling box
 *
 * Same Deep Slate Navy ground and brand washes as the page banner
 * (.page-hero-glow / .page-hero-grid in src/tailwind.css), scaled down.
 * ------------------------------------------------------------------------ */

.tia-mega__promo {
	position: relative;
	z-index: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	padding: 1.5rem 1.5rem 1.25rem;
	background-color: #0f172a;
	color: #cbd5e1;
}

.tia-mega__promo::before,
.tia-mega__promo::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
}

.tia-mega__promo::before {
	background:
		radial-gradient(18rem 13rem at 100% 0%, rgb(79 70 229 / 0.55), transparent 70%),
		radial-gradient(15rem 11rem at 0% 100%, rgb(8 145 178 / 0.4), transparent 70%);
}

.tia-mega__promo::after {
	background-image:
		linear-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1px),
		linear-gradient(90deg, rgb(255 255 255 / 0.05) 1px, transparent 1px);
	background-size: 28px 28px;
	-webkit-mask-image: radial-gradient(90% 60% at 80% 10%, #000, transparent);
	mask-image: radial-gradient(90% 60% at 80% 10%, #000, transparent);
}

.tia-mega__badge {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	gap: 0.375rem;
	padding: 0.3125rem 0.75rem 0.3125rem 0.5rem;
	border: 1px solid rgb(6 182 212 / 0.3);
	border-radius: 999px;
	background-color: rgb(6 182 212 / 0.12);
	color: #67e8f9;
	font-size: 0.6875rem;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.tia-mega__badge .material-symbols-outlined {
	font-size: 1rem;
}

.tia-mega__promo-title {
	margin: 0.875rem 0 0.375rem;
	color: #fff;
	font-size: 1.25rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.3;
}

.tia-mega__promo-text {
	margin: 0 0 1rem;
	color: #94a3b8;
	font-size: 0.8125rem;
	line-height: 1.65;
}

.tia-mega__actions {
	display: grid;
	gap: 0.375rem;
	margin-top: auto;
}

.tia-mega__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 2.875rem;
	padding: 0 1.25rem;
	border-radius: 0.75rem;
	font-size: 0.8125rem;
	font-weight: 700;
	transition: background-color 0.18s ease;
	background-color: #4f46e5;
	box-shadow:
		0 14px 28px -12px rgb(79 70 229 / 0.9),
		inset 0 1px 0 rgb(255 255 255 / 0.15);
	color: #fff;
}

.tia-mega__cta:hover,
.tia-mega__cta:focus-visible {
	background-color: #4338ca;
	color: #fff;
}

.tia-mega__cta .material-symbols-outlined {
	font-size: 1.125rem;
	transition: transform 0.18s ease;
}

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

.tia-mega__phone {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.375rem;
	min-height: 2rem;
	border-radius: 0.5rem;
	color: #94a3b8;
	font-size: 0.75rem;
	font-weight: 500;
	transition: color 0.18s ease;
}

.tia-mega__phone strong {
	color: #e2e8f0;
	font-weight: 700;
	transition: color 0.18s ease;
}

.tia-mega__phone:hover strong,
.tia-mega__phone:focus-visible strong {
	color: #67e8f9;
}

.tia-mega__phone .material-symbols-outlined {
	color: #22d3ee;
	font-size: 1rem;
}

.tia-mega__cta:focus-visible,
.tia-mega__phone:focus-visible,
.tia-mega__all:focus-visible {
	outline: 2px solid #22d3ee;
	outline-offset: 2px;
}

.tia-mega__rating {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.875rem;
	padding-top: 0.875rem;
	border-top: 1px solid rgb(255 255 255 / 0.08);
	color: #94a3b8;
	font-size: 0.75rem;
}

.tia-mega__rating strong {
	color: #fff;
	font-weight: 800;
}

a.tia-mega__rating:hover span {
	color: #e2e8f0;
}

.tia-mega__g {
	display: grid;
	flex: none;
	place-items: center;
	width: 1.375rem;
	height: 1.375rem;
	border-radius: 999px;
	background-color: #fff;
}

.tia-mega__g svg {
	width: 0.875rem;
	height: 0.875rem;
}

.tia-mega__stars {
	display: inline-flex;
	color: #f59e0b;
}

.tia-mega__stars .material-icons {
	font-size: 0.875rem;
}

.tia-mega__rating > span:last-child {
	white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
	.tia-mega,
	.tia-has-mega:hover > .tia-mega,
	.tia-has-mega:focus-within > .tia-mega,
	.tia-mega__link,
	.tia-mega__icon,
	.tia-mega__go,
	.tia-mega__all .material-symbols-outlined,
	.tia-mega__cta .material-symbols-outlined {
		transition-duration: 0.01ms;
		transition-delay: 0s;
	}

	.tia-mega__pulse::after {
		animation: none;
	}
}
