/*
 * 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 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 image frame. rounded-[10px] is not in the frozen Tailwind build. */
.hero-frame {
	border-radius: 10px;
}

/*
 * Hero image, desktop: out of the grid and into the right half of the hero,
 * flush with its top, bottom and right edges, left side cut to a curve by the
 * #hero-curve clipPath in the markup. The grid keeps its empty right column,
 * so the copy stays on the left and never runs under the image.
 *
 * .hero-main drops to static so the image positions against the section
 * instead of the max-w-7xl container; the copy then needs its own stacking
 * context to stay above the absolutely positioned glow and grid layers.
 */
@media (min-width: 1024px) {
	.home-hero .hero-main {
		position: static;
	}

	.home-hero .hero-copy {
		position: relative;
		z-index: 1;
	}

	.home-hero .hero-media {
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		z-index: 1;
		width: 52%;
	}

	.home-hero .hero-frame {
		height: 100%;
		border-radius: 0;
		box-shadow: none;
		-webkit-clip-path: url(#hero-curve);
		clip-path: url(#hero-curve);
	}

	.home-hero .hero-media__box {
		height: 100%;
		aspect-ratio: auto;
	}

	/* Nudge the play button right, into the middle of the part left visible. */
	.home-hero .hero-media .play-video-btn {
		padding-left: 8%;
	}
}

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

.course-slider .slick-slide {
	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).
 */
.home-dept {
	padding-top: 5rem;
	padding-bottom: 3.5rem;
}

@media (min-width: 768px) {
	.home-dept {
		padding-top: 6rem;
		padding-bottom: 4.5rem;
	}
}

.home-dept .fb-curve {
	--fb-w: 11.5rem;
	--fb-gap: 0.5rem;
	padding: 2.5rem 0 3rem;
	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, name and course count, 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.
 */
.home-dept .dept-card {
	display: flex;
	aspect-ratio: auto;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	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__meta {
	margin-top: 0.4rem;
	color: #94A3B8;
	font-size: 0.65rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	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;
}

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

@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;
	}
}
