/**
 * CaseTheme homepage.
 *
 * Loaded on the front page only. Depends on the tokens declared in style.css.
 *
 * Two rules shape everything here:
 *   1. Every section is centred, at both desktop and mobile widths.
 *   2. Nothing requires JavaScript. Scroll animations are "armed" by JS, so
 *      with JS off every element renders in its final, readable state.
 */

/* ==========================================================================
   1. Shell
   ========================================================================== */

html {
	scroll-padding-top: calc(var(--ct-header-h, 72px) + 16px);
}

.ct-home {
	--ct-home-max: 1440px;
	--ct-measure: 62ch;
	text-align: center;
	overflow-x: clip;
}

.ct-home .ct-wrap {
	width: 100%;
	max-width: var(--ct-home-max);
	margin-inline: auto;
	padding-inline: clamp(20px, 4vw, 48px);
	box-sizing: border-box;
}

/* Centred measure for any run of prose. Keeps line length readable without
   ever left-aligning the text. */
.ct-home p,
.ct-home .ct-lede,
.ct-home .ct-eyebrow {
	margin-inline: auto;
	max-width: var(--ct-measure);
	text-wrap: pretty;
}

.ct-home h1,
.ct-home h2,
.ct-home h3 {
	margin-inline: auto;
	font-family: var(--ct-font-head);
	font-weight: 800;
	letter-spacing: -.03em;
	line-height: 1.08;
	color: var(--ct-ink);
	text-wrap: balance;
}

.ct-home h1 {
	max-width: 18ch;
	font-size: clamp(2rem, 1.25rem + 3.4vw, 4.25rem);
}

.ct-home h2 {
	max-width: 20ch;
	font-size: clamp(1.6rem, 1.15rem + 2.1vw, 2.9rem);
}

.ct-home h3 {
	font-size: clamp(1.05rem, .98rem + .35vw, 1.3rem);
	font-weight: 700;
	letter-spacing: -.015em;
	line-height: 1.3;
}

.ct-home .ct-lede {
	margin-top: 20px;
	color: var(--ct-muted);
	font-size: clamp(1rem, .95rem + .35vw, 1.2rem);
	line-height: 1.7;
}

.ct-eyebrow {
	display: block;
	margin-bottom: 14px;
	color: var(--ct-brand);
	font-family: var(--ct-font-head);
	font-size: .8125rem;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
}

.ct-section {
	padding-block: clamp(56px, 7vw, 112px);
}

.ct-section--wash {
	background: var(--ct-wash);
}

.ct-section--deep {
	background: var(--ct-deep);
}

.ct-section--deep h2,
.ct-section--deep h3 {
	color: var(--ct-white);
}

.ct-section--deep .ct-lede {
	color: #B9D6D4;
}

.ct-section--deep .ct-eyebrow {
	color: var(--ct-accent);
}

.ct-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin-top: 32px;
}

.ct-btn--ghost {
	background: transparent;
	color: var(--ct-brand);
	box-shadow: inset 0 0 0 1.5px var(--ct-brand);
}

.ct-btn--ghost:hover,
.ct-btn--ghost:focus {
	background: var(--ct-tint);
	color: var(--ct-brand-dark);
	box-shadow: inset 0 0 0 1.5px var(--ct-brand-dark);
}

/* ==========================================================================
   2. Hero
   ========================================================================== */

.ct-hero {
	position: relative;
	display: grid;
	place-items: center;
	min-height: clamp(460px, 62vh, 660px);
	padding-block: clamp(56px, 8vw, 104px);
	background: var(--ct-white);
	isolation: isolate;
}

/* The banner is a real <img> rather than a CSS background so it can be
   preloaded, sized, and given fetchpriority. That makes it a predictable LCP
   element instead of a late discovery. */
.ct-hero__media {
	position: absolute;
	inset: 0;
	z-index: -2;
	overflow: hidden;
}

.ct-hero__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
}

/* A centred veil, not a full scrim. The artwork keeps its colour at the edges
   while the headline sits on near-solid white. Guarantees the 15.7:1 ink
   contrast no matter how the image crops at a given viewport. */
.ct-hero__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse 80% 70% at 50% 50%, rgba(254, 255, 255, .94) 0%, rgba(254, 255, 255, .72) 45%, rgba(254, 255, 255, 0) 78%);
}

@media (max-width: 699px) {

	.ct-hero__media::after {
		background:
			radial-gradient(ellipse 120% 80% at 50% 50%, rgba(254, 255, 255, .97) 0%, rgba(254, 255, 255, .88) 55%, rgba(254, 255, 255, .45) 100%);
	}
}

.ct-hero__inner {
	position: relative;
	z-index: 1;
}

.ct-hero .ct-lede {
	max-width: 54ch;
}

.ct-hero__meta {
	margin-top: 28px;
	color: var(--ct-muted);
	font-size: .875rem;
}

.ct-hero__meta strong {
	color: var(--ct-ink);
	font-weight: 700;
}

/* ==========================================================================
   3. Video sections
   ========================================================================== */

.ct-video {
	position: relative;
	width: 100%;
	max-width: 1040px;
	margin: clamp(32px, 4vw, 52px) auto 0;
	aspect-ratio: 16 / 9;      /* reserves space, so CLS stays at 0 */
	border-radius: var(--ct-radius);
	overflow: hidden;
	background: var(--ct-tint);
	box-shadow: var(--ct-shadow);
}

.ct-section--deep .ct-video {
	background: #0E1A1E;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.ct-video video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ct-video__caption {
	margin-top: 18px;
	color: var(--ct-muted);
	font-size: .9375rem;
}

.ct-section--deep .ct-video__caption {
	color: #9FC4C2;
}

/* ==========================================================================
   4. Category grid
   ========================================================================== */

.ct-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(16px, 2vw, 24px);
	margin-top: clamp(32px, 4vw, 52px);
	text-align: center;
}

@media (min-width: 560px) {

	.ct-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 980px) {

	.ct-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.ct-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: clamp(24px, 3vw, 36px) 24px;
	background: var(--ct-white);
	border: 1px solid var(--ct-wire);
	border-radius: var(--ct-radius);
	text-decoration: none;
	transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.ct-card:hover,
.ct-card:focus-visible {
	border-color: var(--ct-accent);
	box-shadow: var(--ct-shadow);
	transform: translateY(-3px);
}

.ct-card__icon {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	margin-bottom: 18px;
	border-radius: var(--ct-radius-sm);
	background: var(--ct-tint);
	color: var(--ct-brand);
}

.ct-card__icon svg {
	width: 24px;
	height: 24px;
}

.ct-card p {
	margin-top: 10px;
	color: var(--ct-muted);
	font-size: .9375rem;
	line-height: 1.6;
}

.ct-card__more {
	margin-top: 16px;
	color: var(--ct-brand);
	font-family: var(--ct-font-head);
	font-size: .875rem;
	font-weight: 700;
}

/* ==========================================================================
   5. Latest posts
   ========================================================================== */

.ct-posts {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(20px, 2.4vw, 28px);
	margin-top: clamp(32px, 4vw, 52px);
	text-align: center;
}

@media (min-width: 620px) {

	.ct-posts {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1000px) {

	/* Three across, so six posts fill two complete rows. */
	.ct-posts {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.ct-post {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--ct-white);
	border: 1px solid var(--ct-wire);
	border-radius: var(--ct-radius);
	transition: transform .22s ease, box-shadow .22s ease;
}

.ct-post:hover,
.ct-post:focus-within {
	box-shadow: var(--ct-shadow);
	transform: translateY(-3px);
}

.ct-post__thumb {
	display: block;
	aspect-ratio: 16 / 9;
	background: var(--ct-tint);
	overflow: hidden;
}

.ct-post__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ct-post__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	align-items: center;
	padding: 22px 20px 26px;
}

.ct-post__cat {
	margin-bottom: 10px;
	color: var(--ct-brand);
	font-family: var(--ct-font-head);
	font-size: .75rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.ct-post__title {
	margin: 0;
	font-family: var(--ct-font-head);
	font-size: 1.0625rem;
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: -.01em;
}

.ct-post__title a {
	color: var(--ct-ink);
	text-decoration: none;
}

.ct-post__title a:hover,
.ct-post__title a:focus {
	color: var(--ct-brand);
}

.ct-post__meta {
	margin-top: auto;
	padding-top: 14px;
	color: var(--ct-muted);
	font-size: .8125rem;
}

.ct-empty {
	max-width: 46ch;
	margin: 32px auto 0;
	padding: 32px 24px;
	background: var(--ct-tint);
	border-radius: var(--ct-radius);
	color: var(--ct-ink);
}

/* ==========================================================================
   6. Subscribe band
   ========================================================================== */

.ct-cta__form {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	max-width: 460px;
	margin: 28px auto 0;
}

.ct-cta__form input[type="email"] {
	flex: 1 1 220px;
	min-width: 0;
	padding: 13px 16px;
	border: 1px solid rgba(255, 255, 255, .22);
	border-radius: var(--ct-radius-sm);
	background: rgba(255, 255, 255, .08);
	color: var(--ct-white);
	font-family: var(--ct-font-body);
	font-size: 1rem;      /* 16px, so iOS does not zoom on focus */
	text-align: center;
}

.ct-cta__form input[type="email"]::placeholder {
	color: #9FC4C2;
}

.ct-cta__form input[type="email"]:focus {
	border-color: var(--ct-accent);
	background: rgba(255, 255, 255, .12);
	outline: none;
}

.ct-cta__note {
	margin-top: 14px;
	color: #9FC4C2;
	font-size: .8125rem;
}

/* ==========================================================================
   7. Motion
   ========================================================================== */

/* Default state is the FINAL state. home.js adds .ct-js to <html>, which is
   what arms the hidden start state. No JS means no arming, so content is
   simply visible. */
.ct-js .ct-reveal {
	opacity: 0;
	transform: translateY(18px);
	transition: opacity .55s cubic-bezier(.22, .61, .36, 1),
	            transform .55s cubic-bezier(.22, .61, .36, 1);
}

.ct-js .ct-reveal.is-in {
	opacity: 1;
	transform: none;
}

/* Stagger children by index, set as a custom property on the parent. */
.ct-js .ct-reveal[data-delay="1"] { transition-delay: .07s; }
.ct-js .ct-reveal[data-delay="2"] { transition-delay: .14s; }
.ct-js .ct-reveal[data-delay="3"] { transition-delay: .21s; }
.ct-js .ct-reveal[data-delay="4"] { transition-delay: .28s; }

/* The hero animates on load, with plain CSS, so it never waits for JS and
   never delays the LCP paint. */
@keyframes ct-rise {
	from { opacity: 0; transform: translateY(16px); }
	to   { opacity: 1; transform: none; }
}

.ct-hero__inner > * {
	animation: ct-rise .6s cubic-bezier(.22, .61, .36, 1) both;
}

.ct-hero__inner > :nth-child(1) { animation-delay: .04s; }
.ct-hero__inner > :nth-child(2) { animation-delay: .11s; }
.ct-hero__inner > :nth-child(3) { animation-delay: .18s; }
.ct-hero__inner > :nth-child(4) { animation-delay: .25s; }
.ct-hero__inner > :nth-child(5) { animation-delay: .32s; }

@media (prefers-reduced-motion: reduce) {

	.ct-js .ct-reveal,
	.ct-js .ct-reveal.is-in {
		opacity: 1;
		transform: none;
		transition: none;
	}

	.ct-hero__inner > * {
		animation: none;
	}

	.ct-card:hover,
	.ct-post:hover {
		transform: none;
	}
}

/* ==========================================================================
   8. Neutralise GeneratePress wrappers on the front page
   --------------------------------------------------------------------------
   front-page.php renders its own full-bleed sections, so the parent theme's
   container width, flex layout and separate-container padding all have to be
   stood down. Scoped to .home so every other template keeps GP's layout.
   ========================================================================== */

.home .site.grid-container,
.home .site {
	max-width: none;
	padding: 0;
	margin: 0;
}

.home .site-content {
	display: block;
	max-width: none;
	padding: 0;
	margin: 0;
	gap: 0;
}

.home.separate-containers .site-content,
.home.separate-containers .site-main {
	padding: 0;
	margin: 0;
}

/* The homepage supplies its own headings, so the generic archive title and
   any stray sidebar are not wanted here. */
.home .page-header,
.home .widget-area.sidebar {
	display: none;
}

/* Screen reader only, for the subscribe label. GP ships .screen-reader-text
   but we repeat it so the section works in the standalone preview too. */
.ct-home .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
