/*!
 * Bhoo Agrocare — Knowledge Center listings (the posts index and every post
 * archive). Loads after main.css on those two templates only.
 *
 * Source order: page shell -> banner -> article search -> filter row ->
 * category tags -> lead article -> article list -> responsive.
 *
 * House rules, the same in every stylesheet here:
 *  - Tabs for indentation; one banner per section, in render order.
 *  - Each @media condition appears once, in the "Responsive" block at the end
 *    (widest first). Everything above it is the desktop default.
 *  - Colours, radii, shadows and the page gutter come from the :root tokens.
 */

/* ==========================================================================
   Page shell
   ========================================================================== */

.blogpage {
	--bhero-wash: 246, 250, 244; /* --g-025 as components, so the wash can fade */
	position: relative;
	background: var(--white);
}

/* ==========================================================================
   Banner — the photograph keeps its daylight and the copy sits on a wash over
   its bright left, rather than on a dark scrim. The picture is a 16:9 field
   shot with the farmer hard right, so the crop only ever trims sky and soil.
   ========================================================================== */

.bhero {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	background: linear-gradient(158deg, var(--g-050) 0%, var(--g-025) 56%, var(--white) 100%);
}

.bhero__bg {
	position: absolute;
	inset: 0;
	z-index: -2;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 76% 42%;
}

/* A wash, not a scrim: the sky on the left is already near white, so this only
   steadies the copy over the crop rows and has faded out before the farmer. */
.bhero__wash {
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		linear-gradient(101deg,
			rgba(var(--bhero-wash), .97) 0%,
			rgba(var(--bhero-wash), .94) 34%,
			rgba(var(--bhero-wash), .7) 50%,
			rgba(var(--bhero-wash), .22) 64%,
			rgba(var(--bhero-wash), 0) 78%),
		linear-gradient(180deg,
			rgba(255, 255, 255, .35) 0%,
			rgba(255, 255, 255, 0) 32%);
}

/* The handwritten note over the sky. Decoration, so it never takes space from
   the copy and goes away as soon as the picture is cropped tight. */
.bhero__script {
	position: absolute;
	top: clamp(26px, 4vw, 62px);
	right: clamp(28px, 5vw, 86px);
	z-index: 1;
	margin: 0;
	color: var(--g-800);
	font-family: "Caveat", "Segoe Script", cursive;
	font-size: clamp(22px, 2.5vw, 38px);
	font-weight: 600;
	line-height: 1.12;
	text-align: center;
	transform: rotate(-5deg);
	pointer-events: none;
}
.bhero__script span { display: block; }

.bhero__inner {
	position: relative;
	padding-block: clamp(26px, 3.4vw, 48px) clamp(34px, 4.4vw, 62px);
	padding-right: 27%;
}
/* Room for the lead article to ride up into. */
.bhero--overlap .bhero__inner { padding-bottom: clamp(92px, 9vw, 142px); }

.bhero .crumbs {
	margin-bottom: clamp(10px, 1.4vw, 18px);
	color: var(--muted);
	font-size: clamp(13px, 1vw, 15px);
}
.bhero .crumbs a { color: var(--g-700); }
.bhero .crumbs__sep { color: rgba(61, 76, 66, .38); }

.bhero__title {
	display: flex;
	align-items: center;
	gap: clamp(10px, 1.2vw, 20px);
	margin: 0;
	color: var(--g-900);
	font-size: clamp(36px, 5.4vw, 76px);
	font-weight: 700;
	line-height: 1.02;
	letter-spacing: -.03em;
}
.bhero__leaf {
	display: inline-flex;
	color: var(--g-500);
	transform: translateY(-.12em) rotate(-8deg);
}
.bhero__leaf .bhoo-icon { width: clamp(28px, 3.3vw, 50px); height: clamp(28px, 3.3vw, 50px); }

.bhero__lead {
	max-width: 46ch;
	margin: clamp(12px, 1.4vw, 20px) 0 0;
	color: var(--ink-2);
	font-size: clamp(14.5px, 1.2vw, 17px);
	line-height: 1.62;
	text-wrap: pretty;
}

/* ==========================================================================
   Article search — the articles only, so it is a form of its own rather than
   the site-wide one in searchform.php, which also returns products.
   ========================================================================== */

.bsearch {
	position: relative;
	display: flex;
	align-items: center;
	max-width: 620px;
	margin-top: clamp(18px, 2.2vw, 30px);
	padding: 6px 6px 6px 18px;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--r-pill);
	box-shadow: var(--sh-1);
	transition: border-color .18s, box-shadow .18s;
}
.bsearch:focus-within { border-color: var(--g-300); box-shadow: var(--sh-2); }

.bsearch__icon { display: inline-flex; color: var(--muted); }

.bsearch__input {
	flex: 1;
	min-width: 0;
	padding: 12px 14px;
	border: 0;
	background: none;
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 15px;
}
.bsearch__input::placeholder { color: var(--muted); }
.bsearch__input:focus { outline: none; }
.bsearch__input::-webkit-search-cancel-button { cursor: pointer; }

.bsearch__submit {
	flex: none;
	padding: 13px 26px;
	border: 0;
	border-radius: var(--r-pill);
	background: var(--g-600);
	color: #fff;
	font-family: var(--font-head);
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: background-color .18s, transform .18s var(--ease);
}
.bsearch__submit:hover { background: var(--g-700); transform: translateY(-1px); }

/* ==========================================================================
   Filter row — links to the category archives, so a chosen topic is a real
   page with its own address rather than a state only this screen knows about.
   ========================================================================== */

.bfilter {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: clamp(18px, 2.2vw, 28px);
}

.bfilter__pill {
	--pill-a: var(--g-600);
	--pill-b: var(--g-500);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 18px;
	border: 1px solid var(--line);
	border-radius: var(--r-pill);
	background: rgba(255, 255, 255, .92);
	color: var(--ink-2);
	font-family: var(--font-head);
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	box-shadow: var(--sh-1);
	transition: transform .18s var(--ease), background-color .18s, border-color .18s, color .18s;
}
.bfilter__pill .bhoo-icon { color: var(--pill-a); transition: color .18s; }
.bfilter__pill:hover {
	transform: translateY(-2px);
	border-color: var(--pill-a);
	background: var(--white);
	color: var(--g-900);
}

.bfilter__pill.is-on {
	border-color: transparent;
	background: linear-gradient(135deg, var(--pill-a), var(--pill-b));
	color: #fff;
}
.bfilter__pill.is-on .bhoo-icon { color: rgba(255, 255, 255, .92); }
.bfilter__pill.is-on:hover { color: #fff; }

/* The same four tones the badges wear, on the pill that leads to each topic.
   .cat-tag itself lives in main.css — the cards it rides on are shared. */
.bfilter__pill.is-leaf { --pill-a: #23803f; --pill-b: #39a553; }
.bfilter__pill.is-forest { --pill-a: #1c6134; --pill-b: #2b7a43; }
.bfilter__pill.is-soil { --pill-a: #8a5a2b; --pill-b: #b98340; }
.bfilter__pill.is-sky { --pill-a: #1f5fa8; --pill-b: #3b86d0; }

/* ==========================================================================
   Lead article — the newest post, once, at the top of the first page. It rides
   up over the foot of the banner, which is why it sits in a lane of its own
   rather than at the head of the grid.
   ========================================================================== */

.blogpage__lead { position: relative; z-index: 2; margin-top: clamp(-104px, -7.4vw, -62px); }

.bfeature {
	display: grid;
	grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
	align-items: stretch;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: clamp(18px, 1.8vw, 26px);
	overflow: hidden;
	box-shadow: var(--sh-3);
}

.bfeature__media { position: relative; display: block; min-height: 300px; background: var(--g-050); }
.bfeature__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bfeature__ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--g-300); }

.bfeature__cat {
	position: absolute;
	top: clamp(14px, 1.4vw, 20px);
	left: clamp(14px, 1.4vw, 20px);
	padding: 7px 15px;
	font-size: 12.5px;
}

.bfeature__body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: clamp(22px, 2.8vw, 42px);
}

.bfeature__flag {
	align-self: flex-end;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 0 0 clamp(12px, 1.4vw, 18px);
	padding: 7px 15px;
	background: var(--g-050);
	border: 1px solid var(--g-100);
	border-radius: var(--r-pill);
	color: var(--g-700);
	font-family: var(--font-head);
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1;
}
.bfeature__flag .bhoo-icon { color: var(--c-gold); }

.bfeature__meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 7px 18px;
	margin: 0 0 12px;
	color: var(--muted);
	font-size: 13px;
}
.bfeature__meta span { display: inline-flex; align-items: center; gap: 7px; }
.bfeature__meta .bhoo-icon { color: var(--g-500); }

.bfeature__title { margin: 0 0 12px; font-size: clamp(21px, 2.3vw, 31px); line-height: 1.26; }
.bfeature__title a { color: var(--g-900); }
.bfeature__title a:hover { color: var(--g-600); }

.bfeature__excerpt {
	margin: 0 0 clamp(16px, 1.8vw, 22px);
	color: var(--ink-2);
	font-size: 15px;
	line-height: 1.62;
}

.bfeature__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: clamp(14px, 2vw, 28px);
}
.bfeature__cta { flex: none; }

.bfeature__perks { display: grid; gap: 8px; }
.bfeature__perk {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 5px 14px 5px 5px;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--r-pill);
	color: var(--ink-2);
	font-family: var(--font-head);
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1;
	box-shadow: var(--sh-1);
}
.bfeature__perk-disk {
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--g-mint);
	color: var(--g-700);
}

/* ==========================================================================
   Article list — the grid, under a heading that reads across the full width:
   the kicker and title on the left, the standing explanation on the right.
   ========================================================================== */

.blist {
	position: relative;
	overflow: hidden;
	padding-block: clamp(36px, 5vw, 72px) var(--section-y);
	background: linear-gradient(180deg, var(--white) 0%, var(--g-025) 26%, var(--g-050) 100%);
}
.blist--top { padding-top: clamp(34px, 4.4vw, 64px); }

.blist__leaf {
	position: absolute;
	top: clamp(40px, 7vw, 120px);
	z-index: 0;
	color: var(--g-300);
	opacity: .18;
	pointer-events: none;
}
.blist__leaf--l { left: -56px; transform: rotate(-16deg); }
.blist__leaf--r { right: -56px; transform: scaleX(-1) rotate(-16deg); }

.blist > .container { position: relative; z-index: 1; }

.blist__head {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	align-items: end;
	gap: clamp(16px, 3vw, 48px);
	margin-bottom: clamp(26px, 3.4vw, 44px);
}

.blist__eyebrow {
	margin: 0 0 10px;
	color: var(--g-600);
	font-family: var(--font-head);
	font-size: 12.5px;
	font-weight: 600;
	letter-spacing: .16em;
	text-transform: uppercase;
}

.blist__title {
	position: relative;
	margin: 0;
	padding-bottom: 14px;
	font-size: clamp(26px, 3.4vw, 42px);
	line-height: 1.16;
}
.blist__title::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 72px;
	height: 4px;
	border-radius: var(--r-pill);
	background: linear-gradient(90deg, var(--g-700), var(--g-400));
}

.blist__text {
	margin: 0;
	color: var(--ink-2);
	font-size: clamp(14.5px, 1.15vw, 16px);
	line-height: 1.68;
	text-wrap: pretty;
}

/* Three to a row on this page, where every card is an article of the same
   shape — the shared auto-fill grid would drop to four on a wide screen. */
.blist .postgrid {
	grid-template-columns: repeat(3, 1fr);
	padding-bottom: 0;
}
.blist .postgrid > [data-reveal] { display: flex; transition-delay: var(--d, 0ms); }
.blist .postgrid > [data-reveal] > .postcard { flex: 1; }

.blist .pagination { padding-bottom: 0; }
.blist .pagination .nav-links { margin-top: clamp(28px, 3.6vw, 44px); }

/* ==========================================================================
   Responsive — one block per condition, widest first
   ========================================================================== */

@media (max-width: 1180px) {
	.bhero__inner { padding-right: 22%; }
	.bfeature__perks { display: none; }
	.bfeature__foot { justify-content: flex-start; }
}

@media (max-width: 1024px) {
	.bhero__bg { object-position: 72% 46%; }
	.bhero__inner { padding-right: 16%; }
	.bhero__script { font-size: clamp(20px, 3vw, 28px); }
	.blist .postgrid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
	.blogpage { --bhero-wash: 248, 252, 247; }
	/* The copy now runs the full width, so the wash has to cover more of the
	   picture — but not all of it, or the banner is a plain tinted box. */
	.bhero__wash {
		background:
			linear-gradient(104deg,
				rgba(var(--bhero-wash), .96) 0%,
				rgba(var(--bhero-wash), .9) 44%,
				rgba(var(--bhero-wash), .62) 64%,
				rgba(var(--bhero-wash), .24) 84%,
				rgba(var(--bhero-wash), .06) 100%);
	}
	.bhero__inner { padding-right: 0; }
	.bhero__script { display: none; }
	.bhero__lead { max-width: 56ch; }

	.bfeature { grid-template-columns: 1fr; }
	.bfeature__media { min-height: 0; aspect-ratio: 16 / 9; }
	.bfeature__flag { align-self: flex-start; }

	.blist__head { grid-template-columns: 1fr; align-items: start; }
}

@media (max-width: 760px) {
	.blogpage__lead { margin-top: clamp(-60px, -6vw, -40px); }
	.bhero__inner { padding-block: clamp(20px, 3vw, 30px) clamp(56px, 9vw, 80px); }
	.bhero__bg { object-position: 68% 50%; }
}

@media (max-width: 620px) {
	.blist .postgrid { grid-template-columns: 1fr; }
	.bsearch { padding-left: 14px; }
	.bsearch__submit { padding: 13px 18px; }

	/* Four or five topics would wrap into a block three rows deep, so on a phone
	   the row scrolls sideways instead and the grid starts where it should. */
	.bfilter {
		flex-wrap: nowrap;
		margin-inline: calc(var(--gutter) * -1);
		padding-inline: var(--gutter);
		overflow-x: auto;
		scrollbar-width: none;
		scroll-snap-type: x proximity;
	}
	.bfilter::-webkit-scrollbar { display: none; }
	.bfilter__pill { scroll-snap-align: start; }
}

@media (max-width: 480px) {
	.bhero__title { font-size: clamp(32px, 11vw, 44px); }
	.bfeature__foot { flex-wrap: wrap; }
	.bfeature__cta { width: 100%; }
	.blist__leaf { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.bfilter__pill,
	.bsearch__submit { transition: none; }
	.bfilter__pill:hover,
	.bsearch__submit:hover { transform: none; }
}
