/*
 * archive.css — hero, card grids, category tiles, archive headers.
 * Loaded on the homepage, archives, search and 404 only.
 */

/* ---------- Hero ---------- */

.hero {
	position: relative;
	isolation: isolate;
	background: linear-gradient(180deg, var(--fag-surface) 0%, var(--fag-bg) 100%);
	border-bottom: 1px solid var(--fag-border);
	padding: var(--fag-sp-8) 0;
}

/* Full-bleed background variant. */
.hero--bg {
	border-bottom: 0;
	padding-block: var(--fag-sp-7) calc(var(--fag-sp-7) + 44px);
	min-height: clamp(420px, 42vw, 560px);
	display: flex;
	align-items: center;
	overflow: hidden;
}

.hero__bg {
	position: absolute;
	inset: 0;
	z-index: -2;
}

.hero__bg-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 70% center;
}

/*
 * Contrast scrim. The heading is dark navy, so the scrim lightens the image
 * behind the text, then clears quickly so the photograph is actually visible.
 *
 * The text column ends at roughly half the hero width, so the fall-off starts
 * there. Carrying a heavy scrim further right only bleaches the picture: it
 * buys no readability, because there is no text over it.
 *
 * Worst case, against a pure black photograph, the composited background at the
 * text edge still gives about 5.7:1 against the navy heading — above the 4.5:1
 * WCAG AA threshold.
 */
.hero__scrim {
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		linear-gradient(
			100deg,
			rgba(255, 255, 255, 0.94) 0%,
			rgba(255, 255, 255, 0.90) 42%,
			rgba(255, 255, 255, 0.62) 52%,
			rgba(255, 255, 255, 0.18) 62%,
			rgba(255, 255, 255, 0) 70%
		);
}

/*
 * Lighter: clears the photograph sooner. It gets there by falling off faster
 * once the text ends, not by thinning the scrim under the text — that would
 * drop below the AA threshold on a dark image. Worst case here is about 5.2:1.
 */
.hero--scrim-light .hero__scrim {
	background:
		linear-gradient(
			100deg,
			rgba(255, 255, 255, 0.88) 0%,
			rgba(255, 255, 255, 0.80) 44%,
			rgba(255, 255, 255, 0.60) 52%,
			rgba(255, 255, 255, 0.14) 58%,
			rgba(255, 255, 255, 0) 64%
		);
}

/* Stronger: for a dark or busy photograph. */
.hero--scrim-strong .hero__scrim {
	background:
		linear-gradient(
			100deg,
			rgba(255, 255, 255, 0.97) 0%,
			rgba(255, 255, 255, 0.95) 46%,
			rgba(255, 255, 255, 0.78) 58%,
			rgba(255, 255, 255, 0.3) 70%,
			rgba(255, 255, 255, 0) 80%
		);
}

.hero__curve {
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	width: 100%;
	height: 60px;
	color: var(--fag-bg);
	display: block;
}

.hero__inner {
	position: relative;
	width: 100%;
}

.hero__content {
	max-width: 620px;
}

.hero__title {
	margin-bottom: var(--fag-sp-4);
	font-size: clamp(1.875rem, 1.2rem + 2.4vw, 3rem);
	max-width: 16ch;
}

.hero__text {
	max-width: 52ch;
	margin-bottom: var(--fag-sp-5);
	color: var(--fag-text);
	font-size: var(--fag-fs-md);
}

.hero--bg .hero__text {
	margin-bottom: var(--fag-sp-4);
}

.hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--fag-sp-3);
	margin-bottom: var(--fag-sp-5);
}

.hero__badges {
	display: flex;
	flex-wrap: wrap;
	gap: var(--fag-sp-3) var(--fag-sp-6);
	list-style: none;
	margin: 0;
	padding: 0;
}

.hero__badge {
	display: flex;
	align-items: center;
	gap: var(--fag-sp-2);
	margin: 0;
	color: var(--fag-navy);
	font-size: var(--fag-fs-sm);
	font-weight: 600;
	line-height: 1.3;
	/* Each item reads as one short phrase; wrapping mid-phrase looks broken. */
	white-space: nowrap;
}

.hero__badge-icon {
	flex: none;
	color: var(--fag-accent);
}

/* ---------- Category grid ---------- */

.category-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--fag-sp-4);
	list-style: none;
	margin: 0;
	padding: 0;
}

.category-grid > li {
	margin: 0;
}

.category-card__link {
	display: flex;
	align-items: flex-start;
	gap: var(--fag-sp-4);
	height: 100%;
	padding: var(--fag-sp-4);
	background: var(--fag-bg);
	border: 1px solid var(--fag-border);
	border-radius: var(--fag-radius);
	color: inherit;
	text-decoration: none;
	transition: border-color 0.12s ease, background-color 0.12s ease;
}

.category-card__link:hover,
.category-card__link:focus-visible {
	background: var(--fag-surface);
	border-color: var(--fag-accent);
}

.category-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 46px;
	height: 46px;
	background: var(--fag-accent-soft);
	border-radius: var(--fag-radius);
	color: var(--fag-accent);
}

.category-card__body {
	display: block;
	min-width: 0;
}

.category-card__name {
	display: block;
	color: var(--fag-navy);
	font-size: var(--fag-fs-md);
	font-weight: 700;
	line-height: 1.3;
}

.category-card__desc {
	display: block;
	margin-top: var(--fag-sp-1);
	color: var(--fag-muted);
	font-size: var(--fag-fs-sm);
	line-height: 1.5;
}

.category-card__count {
	display: block;
	margin-top: var(--fag-sp-2);
	color: var(--fag-muted);
	font-size: var(--fag-fs-xs);
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

/* ---------- Post cards ---------- */

.post-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--fag-sp-5);
}

.post-grid--archive {
	margin-top: var(--fag-sp-6);
}

.post-card {
	display: flex;
	flex-direction: column;
	background: var(--fag-bg);
	border: 1px solid var(--fag-border);
	border-radius: var(--fag-radius);
	overflow: hidden;
	transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.post-card:hover {
	border-color: var(--fag-border-strong);
	box-shadow: var(--fag-shadow);
}

.post-card__media {
	display: block;
	aspect-ratio: 8 / 5;
	background: var(--fag-surface);
	overflow: hidden;
}

.post-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.post-card__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	padding: var(--fag-sp-4);
}

.post-card__meta {
	margin-bottom: var(--fag-sp-2);
	min-height: 1.2em;
}

.entry__category {
	display: inline-block;
	color: var(--fag-accent);
	font-size: var(--fag-fs-xs);
	font-weight: 700;
	letter-spacing: 0.04em;
	text-decoration: none;
	text-transform: uppercase;
}

.entry__category:hover {
	text-decoration: underline;
}

.post-card__title {
	margin-bottom: var(--fag-sp-2);
	font-size: var(--fag-fs-md);
	line-height: 1.35;
}

.post-card__title a {
	color: var(--fag-navy);
	text-decoration: none;
}

.post-card__title a:hover {
	color: var(--fag-accent);
}

.post-card__excerpt {
	margin-bottom: var(--fag-sp-4);
	color: var(--fag-muted);
	font-size: var(--fag-fs-sm);
	line-height: 1.6;
}

.post-card__footer {
	margin-top: auto;
	color: var(--fag-muted);
	font-size: var(--fag-fs-xs);
}

.entry__updated {
	color: var(--fag-muted);
}

/* ---------- Topic chips ---------- */

.topic-grid {
	display: flex;
	flex-wrap: wrap;
	gap: var(--fag-sp-2);
	list-style: none;
	margin: 0;
	padding: 0;
}

.topic-grid > li {
	margin: 0;
}

.topic-chip a {
	display: inline-flex;
	align-items: center;
	gap: var(--fag-sp-2);
	padding: var(--fag-sp-2) var(--fag-sp-4);
	background: var(--fag-bg);
	border: 1px solid var(--fag-border);
	border-radius: 999px;
	color: var(--fag-navy);
	font-size: var(--fag-fs-sm);
	font-weight: 600;
	text-decoration: none;
}

.topic-chip a:hover {
	background: var(--fag-accent-soft);
	border-color: var(--fag-accent);
	color: var(--fag-accent);
}

.topic-chip__icon {
	color: var(--fag-muted);
}

/* ---------- How we help ---------- */

.help-section {
	padding-bottom: var(--fag-sp-8);
}

.steps-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--fag-sp-4);
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: none;
}

.steps-grid > li {
	margin: 0;
}

.step-card {
	position: relative;
	padding: var(--fag-sp-5) var(--fag-sp-4) var(--fag-sp-4);
	background: var(--fag-surface);
	border: 1px solid var(--fag-border);
	border-radius: var(--fag-radius);
}

.step-card__num {
	position: absolute;
	top: var(--fag-sp-3);
	right: var(--fag-sp-4);
	color: var(--fag-border-strong);
	font-size: var(--fag-fs-xl);
	font-weight: 800;
	line-height: 1;
}

.step-card__icon {
	display: inline-flex;
	color: var(--fag-accent);
	margin-bottom: var(--fag-sp-3);
}

.step-card__title {
	margin-bottom: var(--fag-sp-2);
	font-size: var(--fag-fs-md);
}

.step-card__text {
	margin: 0;
	color: var(--fag-muted);
	font-size: var(--fag-fs-sm);
	line-height: 1.6;
}

.help-section__note {
	display: flex;
	align-items: flex-start;
	gap: var(--fag-sp-3);
	margin-top: var(--fag-sp-5);
	padding: var(--fag-sp-4);
	background: var(--fag-warning-bg);
	border: 1px solid #e8d5a8;
	border-radius: var(--fag-radius);
	color: var(--fag-warning);
	font-size: var(--fag-fs-sm);
}

.help-section__note .icon {
	flex: none;
	margin-top: 0.15em;
}

/* ---------- Archive headers ---------- */

.archive-header {
	padding: var(--fag-sp-5) 0 var(--fag-sp-6);
	border-bottom: 1px solid var(--fag-border);
}

.archive-header__eyebrow {
	margin: 0 0 var(--fag-sp-2);
	color: var(--fag-accent);
	font-size: var(--fag-fs-xs);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.archive-header__title {
	max-width: 24ch;
	margin-bottom: var(--fag-sp-3);
	font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.375rem);
}

.archive-header__desc {
	max-width: 68ch;
	color: var(--fag-muted);
}

.archive-header__desc p:last-child {
	margin-bottom: 0;
}

.archive-header__count {
	margin: var(--fag-sp-3) 0 0;
	color: var(--fag-muted);
	font-size: var(--fag-fs-xs);
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.archive-header__search {
	max-width: 520px;
	margin-top: var(--fag-sp-4);
}

/* ---------- Related categories strip ---------- */

.related-categories {
	margin-top: var(--fag-sp-8);
	padding: var(--fag-sp-6) 0;
	background: var(--fag-surface);
	border-top: 1px solid var(--fag-border);
}

.related-categories__title {
	margin-bottom: var(--fag-sp-4);
	font-size: var(--fag-fs-lg);
}

.related-categories__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--fag-sp-2);
	list-style: none;
	margin: 0;
	padding: 0;
}

.related-categories__list li {
	margin: 0;
}

.related-categories__list a {
	display: inline-flex;
	align-items: center;
	gap: var(--fag-sp-2);
	padding: var(--fag-sp-2) var(--fag-sp-4);
	background: var(--fag-bg);
	border: 1px solid var(--fag-border);
	border-radius: var(--fag-radius);
	color: var(--fag-navy);
	font-size: var(--fag-fs-sm);
	font-weight: 600;
	text-decoration: none;
}

.related-categories__list a:hover {
	border-color: var(--fag-accent);
	color: var(--fag-accent);
}
