/**
 * Blog index — Figma node 695:4459 ("IPA/Blog").
 *
 * Loads after single-story.css (design tokens) and archive-story.css (the
 * stacked "Testimonial Card" rules, which the Latest Stories loop reuses
 * verbatim). Only what is unique to the blog lives here: hero, search bar,
 * featured card, section titles and the Trending band.
 */

.ipa-blog {
	--ipa-blog-ink: #000;
	--ipa-blog-grey: #f0f0f0;
	background: #fff;
}

/* ---------------------------------------------------------------- 1. Hero -- */

/*
 * Comp: 680px tall, photo bleeding right, a solid brand-blue wash over the left
 * ~47%, headline sitting inside the wash.
 */
.ipa-blog__hero {
	position: relative;
	min-height: clamp( 380px, 47vw, 680px );
	display: flex;
	align-items: flex-end;
	overflow: hidden;
	background: var( --ipa-story-blue );
}

.ipa-blog__hero-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 30%;
	display: block;
}

.ipa-blog__hero-wash {
	position: absolute;
	inset: 0;
	/*
	 * Mobile: wash the whole frame so the headline stays legible over the photo.
	 * Desktop (below): a hard-edged panel over the left half, as drawn.
	 */
	background: rgba( 59, 87, 149, 0.9 );
}

@media ( min-width: 860px ) {
	.ipa-blog__hero-wash {
		right: 52.76%; /* Comp: the wash covers the left 47.24%. */
		background: rgba( 59, 87, 149, 0.9 );
	}
}

.ipa-blog__hero.is-flat {
	background: linear-gradient( 135deg, var( --ipa-story-blue-deep ) 0%, var( --ipa-story-blue ) 100% );
}

.ipa-blog__hero-inner {
	position: relative; /* Above the wash. */
	width: 100%;
	max-width: 1440px;
	margin: 0 auto;
	padding: 0 var( --ipa-story-pad ) clamp( 40px, 7vw, 70px );
}

.ipa-blog__hero-title {
	margin: 0;
	max-width: 692px;
	font-family: var( --ipa-story-display );
	font-weight: 400;
	line-height: 1.04;
	color: #fff;
	/* 75px in the comp. */
	font-size: clamp( 2.6rem, 1.4rem + 3.8vw, 4.6875rem );
}

.ipa-blog__hero-title span {
	display: block;
}

/* -------------------------------------------------------------- 2. Search -- */

/*
 * Marker.io IP-131 — the search bar follows the reader down the page.
 *
 * --ipa-blog-sticky-top is published by blog.js from whatever Kadence has
 * pinned at the top (111px desktop, 41px tablet, and different again once the
 * header shrinks). The 0px fallback keeps this sane if the script never runs.
 *
 * The background and padding are on the wrapper rather than the pill so the
 * content scrolling underneath does not show through the gap.
 */
.ipa-blog__search-wrap {
	position: sticky;
	top: var( --ipa-blog-sticky-top, 0px );
	z-index: 20;
	max-width: 1300px;
	margin: 0 auto;
	padding: clamp( 28px, 4vw, 48px ) var( --ipa-story-pad ) 0;
}

/* Full-bleed backdrop so the pill never sits on top of moving text. */
.ipa-blog__search-wrap::before {
	content: "";
	position: absolute;
	inset: 0 50% -14px;
	z-index: -1;
	width: 100vw;
	margin-left: -50vw;
	background: #fff;
}

@media ( prefers-reduced-motion: no-preference ) {
	.ipa-blog__search-wrap {
		transition: padding 0.2s ease;
	}
}

/* Category dropdown sits inside the pill, to the left of the button. */
.ipa-blog__search-cat {
	flex: 0 0 auto;
	max-width: 190px;
	padding: 8px 30px 8px 12px;
	border: 0;
	border-left: 1px solid rgba( 0, 0, 0, 0.14 );
	border-radius: 0;
	background: transparent;
	font: inherit;
	font-size: 0.95rem;
	color: inherit;
	cursor: pointer;
	appearance: none;
	background-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E" );
	background-repeat: no-repeat;
	background-position: right 8px center;
	background-size: 16px 16px;
}

.ipa-blog__search-cat:focus-visible {
	outline: 2px solid var( --ipa-story-blue-deep, #1f3c76 );
	outline-offset: -2px;
}

@media ( max-width: 640px ) {
	/* Stack rather than squeeze four controls onto one line. */
	.ipa-blog__search {
		flex-wrap: wrap;
		border-radius: 24px;
	}

	.ipa-blog__search-cat {
		order: 3;
		flex: 1 1 100%;
		max-width: none;
		margin-top: 4px;
		border-left: 0;
		border-top: 1px solid rgba( 0, 0, 0, 0.14 );
	}
}

.ipa-blog__search {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 6px 6px 18px;
	border: 1px solid rgba( 0, 0, 0, 0.18 );
	border-radius: 50px;
	background: #fff;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ipa-blog__search:focus-within {
	border-color: var( --ipa-story-blue );
	box-shadow: 0 0 0 3px rgba( 59, 87, 149, 0.14 );
}

.ipa-blog__search-icon {
	display: inline-flex;
	flex: 0 0 auto;
	color: var( --ipa-story-muted );
}

.ipa-blog__search-input {
	flex: 1 1 auto;
	min-width: 0;
	border: 0;
	outline: 0;
	background: transparent;
	padding: 12px 0;
	font-size: 1rem;
	color: var( --ipa-blog-ink );
	/* Kill the UA "x" so the pill keeps its shape. */
	appearance: none;
}

.ipa-blog__search-input::-webkit-search-cancel-button {
	appearance: none;
}

.ipa-blog__search-input::placeholder {
	color: var( --ipa-story-muted );
}

.ipa-blog__search-submit {
	flex: 0 0 auto;
	border: 0;
	cursor: pointer;
	padding: 13px clamp( 24px, 3vw, 44px );
	border-radius: 50px;
	background: var( --ipa-story-blue );
	color: #fff;
	font-size: 0.9rem;
	font-weight: 600;
	letter-spacing: 0.9px;
	text-transform: uppercase;
	line-height: 1;
	transition: background 0.2s ease;
}

.ipa-blog__search-submit:hover,
.ipa-blog__search-submit:focus-visible {
	background: var( --ipa-story-blue-deep );
}

.ipa-blog__search-clear {
	flex: 0 0 auto;
	padding-right: 12px;
	font-size: 0.9rem;
	font-weight: 600;
	color: var( --ipa-story-muted );
	text-decoration: underline;
}

.ipa-blog__search-clear:hover,
.ipa-blog__search-clear:focus-visible {
	color: var( --ipa-story-blue-deep );
}

.ipa-blog__search-result {
	margin: 16px 0 0;
	font-size: 0.95rem;
	color: var( --ipa-story-muted );
}

/* ------------------------------------------------------- 3. Featured card -- */

.ipa-blog__body {
	max-width: 1300px;
	margin: 0 auto;
	padding: clamp( 32px, 4vw, 48px ) var( --ipa-story-pad ) clamp( 48px, 6vw, 80px );
}

/*
 * Comp: image across the full card width (518px tall), then a two-column body —
 * title/meta on the left, excerpt + CTA on the right.
 */
.ipa-blog__feature {
	background: var( --ipa-blog-grey );
	margin-bottom: 40px;
}

.ipa-blog__feature-media {
	display: block;
	position: relative;
	aspect-ratio: 1300 / 518;
	min-height: 220px;
	overflow: hidden;
	background: var( --ipa-story-line );
}

.ipa-blog__feature-media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.5s ease;
}

.ipa-blog__feature:hover .ipa-blog__feature-media img {
	transform: scale( 1.03 );
}

.ipa-blog__feature-body {
	display: grid;
	grid-template-columns: 1fr;
	gap: 20px;
	align-items: start;
	padding: clamp( 28px, 3vw, 40px ) clamp( 24px, 3.8vw, 50px );
}

@media ( min-width: 860px ) {
	.ipa-blog__feature-body {
		/* Comp: a 365px meta column beside a 793px copy column. */
		grid-template-columns: 365px 1fr;
		gap: 20px;
		min-height: 224px;
		align-items: center;
	}
}

.ipa-blog__feature-head,
.ipa-blog__feature-copy {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 16px;
}

.ipa-blog__feature-copy {
	gap: 20px;
}

/* The feature sits on grey, so its tag pills invert to white (as drawn). */
.ipa-blog__feature .ipa-archive__tag {
	background: #fff;
}

/* --------------------------------------------------------- 4. Section head -- */

.ipa-blog__section-title {
	margin: 0 0 24px;
	font-family: var( --ipa-story-display );
	font-weight: 500;
	font-size: clamp( 1.5rem, 1.15rem + 1vw, 2rem ); /* 32px */
	line-height: 1.2;
	color: var( --ipa-blog-ink );
}

/*
 * The Latest Stories loop reuses .ipa-archive__* from archive-story.css. Only
 * the ground differs: the stories archive sits on #f7f7f7, the blog on white.
 */
.ipa-blog .ipa-archive__grid {
	max-width: none;
}

.ipa-blog .ipa-archive__card {
	background: var( --ipa-blog-grey );
}

/* ------------------------------------------------------------ 6. Trending -- */

.ipa-blog__trending {
	background: rgba( 217, 217, 217, 0.4 );
	padding: clamp( 44px, 6vw, 76px ) var( --ipa-story-pad );
}

.ipa-blog__trending-inner {
	max-width: 1300px;
	margin: 0 auto;
}

.ipa-blog__trending-title {
	margin: 0 0 30px;
	font-family: var( --ipa-story-display );
	font-weight: 500;
	font-size: clamp( 1.5rem, 1.15rem + 1vw, 2rem );
	line-height: 1.2;
	color: var( --ipa-story-blue );
}

.ipa-blog__trending-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 40px;
	grid-template-columns: repeat( auto-fit, minmax( 280px, 1fr ) );
}

.ipa-blog__tcard {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #fff;
	overflow: hidden;
}

.ipa-blog__tcard-media {
	display: block;
	position: relative;
	aspect-ratio: 600 / 350;
	overflow: hidden;
	background: var( --ipa-story-line );
}

.ipa-blog__tcard-media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.5s ease;
}

.ipa-blog__tcard:hover .ipa-blog__tcard-media img {
	transform: scale( 1.05 );
}

.ipa-blog__tcard-body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 20px;
	padding: 20px clamp( 24px, 3vw, 50px );
	flex: 1 1 auto;
}

/* Push the CTA to the bottom so a row of cards lines up. */
.ipa-blog__tcard-body .ipa-archive__actions {
	margin-top: auto;
}
