/*
 * Front page, phone widths only.
 *
 * Plain CSS for the same reason as the chat widget and the nav drawer: the
 * theme ships without node_modules, so a rule that needs `npm run build:css`
 * before it renders is a rule that renders broken. The compiled main.css has no
 * `lg:px-8` or `md:gap-4`, which is what a Tailwind-only version of the rule
 * below would need to shrink the buttons on a phone without also shrinking them
 * on desktop.
 */

@media (max-width: 639px) {

	/*
	 * The two hero buttons wrapped onto separate rows on a phone: at px-8 and
	 * text-sm the pair needs about 430px and a 390px screen offers 342. Sharing
	 * the row equally and trimming the padding and type fits them on one line
	 * down to 360px, and keeps both tap targets a comfortable size.
	 */
	.hero-cta {
		flex-wrap: nowrap;
		gap: 10px;
	}

	.hero-cta>a {
		flex: 1 1 0;
		min-width: 0;
		/* Also tightens the WhatsApp button's icon-to-label gap, which is gap-2. */
		gap: 6px;
		padding-left: 10px;
		padding-right: 10px;
		/* Taller than py-3 for a bigger tap target; width is what the row can't spare. */
		padding-top: 15px;
		padding-bottom: 15px;
		font-size: 12px;
		text-align: center;
		justify-content: center;
	}
}

/*
 * Below 390px each button gets about 150px, and the old "Chat on WhatsApp" label
 * needed ~165px at the sizes above — measured, not guessed — so it wrapped to two
 * lines inside its own box. One more step down fits a label that long on one
 * line to 320px; the first button's label comes from the Customizer, so keep it.
 */
@media (max-width: 389px) {

	.hero-cta>a {
		gap: 4px;
		padding-left: 8px;
		padding-right: 8px;
		font-size: 11px;
	}
}

/*
 * The first button's label is set in the Customizer and can run long ("Explore
 * Our Courses"); with its book icon as well it would overrun the half-row a
 * narrow phone gives it. The icon is only decoration there; the WhatsApp glyph
 * on Live Support stays, as it names where the button goes.
 */
@media (max-width: 479px) {

	.hero-cta .hero-btn-icon {
		display: none;
	}
}

/*
 * Hero glow, home only.
 *
 * The shared .page-hero-glow (indigo, cyan, amber) also backs the inner page
 * banners and the dark cards further down, so this overrides it for the front
 * page hero alone. Coral #F04C50 takes the top-right wash behind the image and a
 * softer one along the bottom, where it shows between the department cards;
 * indigo keeps the top-left and cyan drops to a faint lower-left accent.
 */
.home-hero .page-hero-glow {
	background:
		radial-gradient(38rem 20rem at 15% 0%, rgb(79 70 229 / 0.45), transparent 65%),
		radial-gradient(36rem 22rem at 85% 15%, rgb(240 76 80 / 0.38), transparent 62%),
		radial-gradient(34rem 18rem at 55% 100%, rgb(240 76 80 / 0.24), transparent 60%),
		radial-gradient(26rem 16rem at 0% 75%, rgb(8 145 178 / 0.2), transparent 60%);
}

/*
 * Hero grid, home only.
 *
 * The shared .page-hero-grid draws its rules at 5% white and masks them to the
 * middle 60% of the banner. On the front page that left the upper band — above
 * the badge, left of the video — reading as flat navy: the mask has already
 * dropped the lines to about 60% up there, and 5% of 60% is nothing against
 * #0F172A.
 *
 * So: brighter rules, and a mask that holds near full strength across the whole
 * middle of the hero before falling away, with stops in between rather than one
 * straight ramp to transparent. The inner pages keep the quieter original —
 * this file only loads on the front page.
 */
.home-hero .page-hero-grid {
	background-image:
		linear-gradient(rgb(255 255 255 / 0.11) 1px, transparent 1px),
		linear-gradient(90deg, rgb(255 255 255 / 0.11) 1px, transparent 1px);
	background-size: 56px 56px;
	-webkit-mask-image: radial-gradient(75% 70% at 50% 35%, #000 0%, rgb(0 0 0 / 0.85) 45%, rgb(0 0 0 / 0.25) 80%, transparent 100%);
	mask-image: radial-gradient(75% 70% at 50% 35%, #000 0%, rgb(0 0 0 / 0.85) 45%, rgb(0 0 0 / 0.25) 80%, transparent 100%);
}

/* Hero pair: larger than the markup's px-6 py-3 text-sm. Tablet and up only: on
   a phone the rules at the top of this file size the pair to share one row. */
@media (min-width: 640px) {
	.hero-cta .hero-btn {
		padding: 1rem 2.25rem;
		border-radius: 0.625rem;
		font-size: 1rem;
		line-height: 1.5rem;
	}

	.hero-cta .hero-btn i {
		font-size: 1.125rem;
	}
}

/*
 * Department row, all widths.
 *
 * The cards straddle the hero's bottom edge: the section is pulled up by
 * --dept-overlap and paints its ground only below that line, so the top of each
 * card sits on the dark hero and the rest on the light page. .hero-main grows its
 * bottom padding by the same amount so the hero copy and image keep their room.
 *
 * Also carries the card lift, which never made it into the compiled main.css
 * (hover:-translate-y-1.5 is absent from it).
 */
.hero-main,
.home-dept {
	--dept-overlap: 5.5rem;
}

.hero-main {
	padding-bottom: calc(3rem + var(--dept-overlap));
}

@media (min-width: 768px) {
	.hero-main {
		padding-bottom: calc(4rem + var(--dept-overlap));
	}
}

@media (min-width: 1024px) {
	.hero-main {
		padding-bottom: calc(6rem + var(--dept-overlap));
	}
}

.home-dept {
	/* Room slick's overflow:hidden list needs for the hover lift and shadow. */
	--dept-pad-top: 0.75rem;
	--dept-pad-bottom: 2.5rem;
	/*
	 * The card silhouette, kept in variables because three places need to agree
	 * on it: the card, its icon tile at a third the size, and the reduced-motion
	 * block, which holds the shape still by pointing -flip back at the rest value.
	 */
	--dept-shape: 1.5rem 0.4rem 1.5rem 0.4rem;
	--dept-shape-flip: 0.4rem 1.5rem 0.4rem 1.5rem;
	--dept-icon-shape: 0.95rem 0.3rem 0.95rem 0.3rem;
	--dept-icon-shape-flip: 0.3rem 0.95rem 0.3rem 0.95rem;
	z-index: 1;
	margin-top: calc(-1 * var(--dept-overlap));
	/* Same #F8FAFC ground as the courses section below, with no padding between
	   the two, so the cards lead straight into the course heading. */
	background: linear-gradient(to bottom, transparent var(--dept-overlap), #F8FAFC var(--dept-overlap));
}

.home-courses {
	padding-top: 2.5rem;
}

@media (min-width: 768px) {
	.home-courses {
		padding-top: 3rem;
	}
}

.home-dept .slick-list {
	padding-top: var(--dept-pad-top);
	padding-bottom: var(--dept-pad-bottom);
}

/*
 * Slick lays slides out as floats, so a card with a two-line name ("Web
 * Development") leaves its neighbours short. A flex track lets every card in
 * the row take the tallest one's height.
 */
.home-dept .slick-track {
	display: flex;
	align-items: stretch;
}

.home-dept .slick-slide {
	height: auto;
}

.home-dept .slick-slide>div,
.home-dept .dept-cell {
	height: 100%;
}

/*
 * Department card.
 *
 * Each card carries its category's hue in --c (theitaid_course_color_vars in
 * inc/helper.php). At rest that hue is only the icon tile and the watermark
 * glyph behind it; on hover the whole card floods with it and the type flips to
 * white. Written as plain CSS rather than utilities because one hover restyles
 * four nested elements — and because the theme ships without node_modules, so
 * anything needing `npm run build:css` would render unstyled.
 */
.home-dept .dept-card {
	position: relative;
	display: flex;
	height: 100%;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	overflow: hidden;
	/* Keeps the flood layer's negative z-index inside the card. */
	isolation: isolate;
	padding: 1.75rem 1.125rem 1.5rem;
	/*
	 * Diagonal corner shape rather than an even radius: top-left and
	 * bottom-right round hard, the other two stay almost square. Hover swaps
	 * which pair is which, and because border-radius interpolates the card
	 * morphs across instead of snapping.
	 *
	 * The border is the category hue mixed down to a hairline tint, so a row of
	 * cards is faintly colour-coded even before anyone touches one. The flat
	 * grey above it is the fallback where color-mix is unsupported.
	 */
	border: 1px solid #E9EEF5;
	border: 1px solid color-mix(in srgb, var(--c) 22%, #E9EEF5);
	border-radius: var(--dept-shape);
	background: #FFFFFF;
	text-align: center;
	text-decoration: none;
	box-shadow: 0 10px 30px -12px rgb(15 23 42 / 0.18);
	transition: transform .35s cubic-bezier(.22, 1, .36, 1), box-shadow .35s ease, background-color .35s ease, border-color .35s ease, border-radius .45s cubic-bezier(.22, 1, .36, 1);
}

/*
 * The colour flood, as its own layer so it can fade in. A background-image swap
 * on the card itself would snap. color-mix darkens the far end of the gradient
 * from the same hue; where it is unsupported the declaration is dropped and the
 * flat background-color above it stands in.
 */
.home-dept .dept-card::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	opacity: 0;
	background-color: var(--c);
	background-image: linear-gradient(150deg, var(--c), color-mix(in srgb, var(--c) 70%, #0F172A));
	transition: opacity .35s ease;
}

/* Oversized ghost copy of the same glyph, bled off the bottom-right corner. */
.home-dept .dept-card__mark {
	position: absolute;
	right: -0.85rem;
	bottom: -1.1rem;
	font-size: 6.5rem;
	line-height: 1;
	color: var(--c);
	opacity: .07;
	pointer-events: none;
	transition: color .35s ease, opacity .35s ease, transform .5s cubic-bezier(.22, 1, .36, 1);
}

/*
 * Icon tile. The coloured fill is a layer of its own so it can fade out under
 * the flood; background-image is not an animatable property, so swapping it
 * directly would snap. The translucent white underneath is what it fades to.
 *
 * Both shadows are carried in every state, one of them transparent, because a
 * browser cannot interpolate an outer shadow into an inset one.
 */
.home-dept .dept-card__icon {
	position: relative;
	display: flex;
	width: 3.5rem;
	height: 3.5rem;
	margin-bottom: 1.125rem;
	align-items: center;
	justify-content: center;
	isolation: isolate;
	/* Same diagonal shape as the card, a third of the size. */
	border-radius: var(--dept-icon-shape);
	background-color: rgb(255 255 255 / 0.18);
	box-shadow: 0 12px 22px -10px var(--c-glow), inset 0 0 0 1px rgb(255 255 255 / 0);
	transition: box-shadow .35s ease, transform .45s cubic-bezier(.22, 1, .36, 1), border-radius .45s cubic-bezier(.22, 1, .36, 1);
}

.home-dept .dept-card__icon::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: inherit;
	background-color: var(--c);
	background-image: linear-gradient(140deg, color-mix(in srgb, var(--c) 78%, #FFFFFF), var(--c));
	transition: opacity .35s ease;
}

.home-dept .dept-card__icon .material-symbols-outlined {
	font-size: 1.75rem;
	color: #FFFFFF;
}

.home-dept .dept-card__title {
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.35;
	color: #0F172A;
	transition: color .35s ease;
}

.home-dept .dept-card__meta {
	margin-top: 0.4rem;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #94A3B8;
	transition: color .35s ease;
}

/* Keyboard focus gets the same treatment as hover — the flood is the only
   affordance the card has, so tabbing without it lands on a dead-looking tile. */
.home-dept .dept-card:hover,
.home-dept .dept-card:focus-visible {
	transform: translateY(-8px);
	/* The mirrored corner pair — the card morphs into its own reflection. */
	border-radius: var(--dept-shape-flip);
	/* The flood layer covers the padding box only, so the card background has to
	   take the hue as well or the transparent border leaves a white hairline. */
	background-color: var(--c);
	border-color: transparent;
	outline: none;
	box-shadow: 0 26px 45px -20px var(--c-glow), 0 12px 28px -16px rgb(15 23 42 / 0.25);
}

.home-dept .dept-card:hover::before,
.home-dept .dept-card:focus-visible::before {
	opacity: 1;
}

.home-dept .dept-card:hover .dept-card__mark,
.home-dept .dept-card:focus-visible .dept-card__mark {
	color: #FFFFFF;
	opacity: .16;
	transform: scale(1.08) rotate(-6deg);
}

.home-dept .dept-card:hover .dept-card__icon,
.home-dept .dept-card:focus-visible .dept-card__icon {
	box-shadow: 0 12px 22px -10px rgb(15 23 42 / 0), inset 0 0 0 1px rgb(255 255 255 / 0.35);
	border-radius: var(--dept-icon-shape-flip);
	transform: translateY(-2px) scale(1.04);
}

.home-dept .dept-card:hover .dept-card__icon::before,
.home-dept .dept-card:focus-visible .dept-card__icon::before {
	opacity: 0;
}

.home-dept .dept-card:hover .dept-card__title,
.home-dept .dept-card:focus-visible .dept-card__title {
	color: #FFFFFF;
}

.home-dept .dept-card:hover .dept-card__meta,
.home-dept .dept-card:focus-visible .dept-card__meta {
	color: rgb(255 255 255 / 0.78);
}

/* Narrow phones show two cards side by side; full-size padding leaves the
   two-word names no room to sit on two lines without the card looking stuffed. */
@media (max-width: 479px) {
	.home-dept {
		--dept-shape: 1.15rem 0.35rem 1.15rem 0.35rem;
		--dept-shape-flip: 0.35rem 1.15rem 0.35rem 1.15rem;
		--dept-icon-shape: 0.8rem 0.25rem 0.8rem 0.25rem;
		--dept-icon-shape-flip: 0.25rem 0.8rem 0.25rem 0.8rem;
	}

	.home-dept .dept-card {
		padding: 1.4rem 0.85rem 1.25rem;
	}

	.home-dept .dept-card__icon {
		width: 3rem;
		height: 3rem;
		margin-bottom: 0.9rem;
	}

	.home-dept .dept-card__icon .material-symbols-outlined {
		font-size: 1.5rem;
	}

	.home-dept .dept-card__title {
		font-size: 0.875rem;
	}
}

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

	/* A morphing silhouette is motion too — hold both shapes at their rest value. */
	.home-dept {
		--dept-shape-flip: var(--dept-shape);
		--dept-icon-shape-flip: var(--dept-icon-shape);
	}

	.home-dept .dept-card,
	.home-dept .dept-card__mark,
	.home-dept .dept-card__icon {
		transition-duration: .01ms;
		transform: none;
	}

	.home-dept .dept-card:hover,
	.home-dept .dept-card:focus-visible,
	.home-dept .dept-card:hover .dept-card__mark,
	.home-dept .dept-card:focus-visible .dept-card__mark,
	.home-dept .dept-card:hover .dept-card__icon,
	.home-dept .dept-card:focus-visible .dept-card__icon {
		transform: none;
	}
}
