/*
 * 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 book icon stays on a phone too. "Our Courses" and its icon fit the
 * half-row down to 320px; a longer Customizer label wraps onto a second line
 * inside the button, and the icon keeps its size instead of being squeezed.
 */
.hero-cta .hero-btn-icon {
	flex-shrink: 0;
}

/*
 * 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 texture (the footer's .page-hero-grid). From lg up the photo
   covers the right half, so the grid's fade is centred on the copy instead. */
@media (min-width: 1024px) {
	.home-hero .page-hero-grid {
		-webkit-mask-image: radial-gradient(55% 75% at 25% 45%, #000, transparent);
		mask-image: radial-gradient(55% 75% at 25% 45%, #000, transparent);
	}
}

/* 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;
	}
}

/* Hero badge above the heading, in two lines beside the Google "G" (like the
   BTEB line under the buttons): score, stars and review count from
   Customizer → Google Reviews, then the trust line. Two lines on purpose: the
   copy column is too narrow to hold both on one at any width. */
.hero-rating {
	display: flex;
	width: fit-content;
	max-width: 100%;
	align-items: center;
	gap: 0.7rem;
	padding: 0.5rem 1.25rem 0.5rem 0.5rem;
	border: 1px solid rgb(255 255 255 / 0.14);
	border-radius: 1.75rem;
	background: rgb(255 255 255 / 0.06);
	box-shadow: 0 10px 24px -14px rgb(0 0 0 / 0.6);
	color: #CBD5E1;
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	transition: border-color .2s ease, background-color .2s ease;
}

a.hero-rating:hover,
a.hero-rating:focus-visible {
	border-color: rgb(255 255 255 / 0.3);
	background: rgb(255 255 255 / 0.1);
}

.hero-rating__g {
	display: flex;
	width: 2.4rem;
	height: 2.4rem;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	background: #FFFFFF;
}

.hero-rating__g svg {
	display: block;
	width: 1.3rem;
	height: 1.3rem;
}

.hero-rating__body {
	display: flex;
	min-width: 0;
	flex-direction: column;
	gap: 0.2rem;
}

.hero-rating__line {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.2rem 0.45rem;
}

.hero-rating__score {
	color: #FFFFFF;
	font-weight: 800;
}

.hero-rating__stars {
	display: flex;
	color: #FBBC05;
}

.hero-rating__stars .material-icons {
	font-size: 1rem;
}

.hero-rating__trust {
	color: #F59E0B;
}

/* No rating set: the trust line alone, as the plain pill it used to be. */
.hero-rating__body:first-child {
	padding-left: 0.75rem;
}

@media (min-width: 640px) {
	.hero-rating {
		font-size: 0.875rem;
	}
}

/*
 * Hero image: a bordered 16:9 box in the grid's right column (under the copy
 * below lg). 16:9 matches the intro-video thumbnail, so its text isn't cropped.
 * Plain CSS because the frozen Tailwind build lacks these arbitrary values.
 */
.hero-frame {
	border: 3px solid rgba(255, 255, 255, 0.22);
	border-radius: 1.25rem;
}

.hero-media__box {
	aspect-ratio: 16 / 9;
}

/* A little taller beside the copy on desktop, closer to the copy's height. */
@media (min-width: 1024px) {
	.hero-media__box {
		aspect-ratio: 3 / 2;
	}
}

/*
 * Course slider. Same treatment as the category row: the list gets room for
 * the card's hover lift and shadow, and a flex track keeps every card the
 * height of the tallest.
 */
.course-slider .slick-list {
	padding-top: 0.75rem;
	padding-bottom: 2rem;
}

.course-slider .slick-track {
	display: flex;
	align-items: stretch;
}

/* Slick makes each .course-cell the slide itself, so the cell must keep an
   auto height: a set height (even 100%) stops a flex item stretching, and
   every card would stay as tall as its own text. The extra class outranks
   the height: 100% below, which is for a cell Slick wraps in its own div. */
.course-slider .slick-slide,
.course-slider .slick-slide.course-cell {
	height: auto;
}

.course-slider .slick-slide>div,
.course-slider .course-cell {
	height: 100%;
}

/*
 * Prev/next arrows on either side of the course row, centred on the cards
 * (the list's padding is 0.75rem above and 2rem below, hence the offset).
 * They sit just over the card edges until the viewport has room to put
 * them fully outside the row.
 */
.course-rail .course-arrow {
	position: absolute;
	top: calc(50% - 0.625rem);
	z-index: 2;
	transform: translateY(-50%);
}

.course-rail .course-prev {
	left: -1.25rem;
}

.course-rail .course-next {
	right: -1.25rem;
}

@media (min-width: 1440px) {
	.course-rail .course-prev {
		left: -4.5rem;
	}

	.course-rail .course-next {
		right: -4.5rem;
	}
}

/*
 * Course category section — a rotating drum.
 *
 * Runs on the same js/curve-gallery.js as the feedback rows, in its "drum"
 * mode: seen from outside the cylinder, so the centre card faces the viewer and
 * the ones either side turn and fall away. Stage basics (perspective, mask,
 * drag cursor) come from assets/css/feedback-curve.css; this block sizes the
 * stage and draws the category card. Each card carries its category hue in --c
 * (theitaid_course_color_vars in inc/helper.php).
 *
 * The drum straddles the hero's bottom edge: the section is pulled up by the
 * stage's top padding plus half a card (--dept-card-h), so the middle of the
 * cards sits on that edge, and its ground starts there.
 * The hero's bottom padding grows by the same half card, so its copy and image
 * clear the cards.
 */
.home-hero,
.home-dept {
	--dept-stage-top: 2.5rem;
	--dept-card-h: 12.5rem;
	--dept-half: calc(var(--dept-card-h) / 2);
}

.home-hero .hero-main {
	padding-bottom: calc(var(--dept-half) + 2.5rem);
}

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

.home-dept {
	z-index: 2;
	margin-top: calc(-1 * (var(--dept-stage-top) + var(--dept-half)));
	/* #F8FAFC is bg-background-alt, the courses section's ground, so the two
	   read as one band. */
	background: linear-gradient(to bottom, transparent calc(var(--dept-stage-top) + var(--dept-half)), #F8FAFC 0);
}

/* No gap under the drum: the courses section follows straight on, with only
   the stage's bottom padding left so the card shadows aren't clipped. */
.home-dept .fb-curve {
	--fb-w: 11.5rem;
	--fb-gap: 0.5rem;
	padding: var(--dept-stage-top) 0 1.5rem;
	perspective: 1400px;
}

@media (min-width: 640px) {
	.home-dept .fb-curve {
		--fb-w: 13rem;
	}
}

@media (min-width: 1024px) {
	.home-dept .fb-curve {
		--fb-w: 15rem;
		--fb-gap: 0.75rem;
	}
}

/*
 * The category card — the original design, now riding the drum: white card,
 * gradient icon tile and name, and an oversized ghost of the same glyph bled
 * off the bottom-right corner. Hovering floods the card with its hue and flips
 * the type to white. One fixed height, centred, so a two-line name doesn't
 * make its card taller than the rest.
 */
.home-dept .dept-card {
	display: flex;
	aspect-ratio: auto;
	min-height: var(--dept-card-h);
	flex-direction: column;
	align-items: center;
	justify-content: center;
	isolation: isolate;
	padding: 1.75rem 1.125rem 1.5rem;
	border-radius: 10px;
	background: #FFFFFF;
	text-align: center;
	text-decoration: none;
	box-shadow: 0 14px 34px -14px rgb(15 23 42 / 0.22);
	transition: background-color .35s ease, box-shadow .35s ease;
}

/* The colour flood, its own layer so it fades in rather than snapping. */
.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;
}

.home-dept .dept-card__mark {
	position: absolute;
	right: -1.25rem;
	bottom: -1.5rem;
	z-index: -1;
	color: var(--c);
	font-size: 6.5rem;
	line-height: 1;
	opacity: 0.08;
	pointer-events: none;
	transition: opacity .35s ease, transform .45s cubic-bezier(.22, 1, .36, 1), color .35s ease;
}

.home-dept .dept-card__icon {
	position: relative;
	display: flex;
	width: 3.5rem;
	height: 3.5rem;
	align-items: center;
	justify-content: center;
	margin-bottom: 1rem;
	overflow: hidden;
	border-radius: 0.95rem 0.3rem 0.95rem 0.3rem;
	background-color: var(--c);
	background-image: linear-gradient(150deg, color-mix(in srgb, var(--c) 80%, #FFFFFF), var(--c));
	box-shadow: 0 10px 20px -10px var(--c-glow);
	transition: background-color .35s ease, border-radius .45s cubic-bezier(.22, 1, .36, 1), transform .35s ease;
}

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

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

.home-dept .dept-card:hover,
.home-dept .dept-card:focus-visible {
	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: 0.16;
	transform: rotate(-8deg) scale(1.08);
}

.home-dept .dept-card:hover .dept-card__icon,
.home-dept .dept-card:focus-visible .dept-card__icon {
	border-radius: 0.3rem 0.95rem 0.3rem 0.95rem;
	background: rgb(255 255 255 / 0.2);
	box-shadow: none;
}

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

@media (prefers-reduced-motion: reduce) {
	.home-dept .dept-card,
	.home-dept .dept-card::before,
	.home-dept .dept-card__mark,
	.home-dept .dept-card__icon {
		transition: none;
	}

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