/*
 * The Index — /archive/
 *
 * House rules this file obeys, so it does not have to fight anything already
 * loaded: the band is 90% of the viewport and the band lives on the inner
 * wrappers, never on <main>, so the full-bleed sections stay full bleed. All
 * colour comes through rfd-tokens.css aliases.
 */

.rfx {
	--rfx-band: min(90vw, 1680px);
	--rfx-ink: var(--rfd-c-ink, #061424);
	--rfx-paper: var(--rfd-c-paper, #FAF4EB);
	--rfx-paper-hi: var(--rfd-c-paper-hi, #FFFDFC);
	--rfx-linen: var(--rfd-c-linen, #E9E0D3);
	--rfx-brass: var(--rfd-c-brass, #D4B16A);
	--rfx-brass-hi: var(--rfd-c-brass-hi, #E2C885);
	--rfx-plum: var(--rfd-c-plum, #602437);
	--rfx-rust: var(--rfd-c-rust, #A83D29);
	--rfx-soft: var(--rfd-c-ink-soft, #263A34);

	--rfx-ui: "Inter Tight", ui-sans-serif, system-ui, sans-serif;
	--rfx-display: "Playfair Display", Georgia, serif;
	--rfx-serif: "Cormorant Garamond", Georgia, serif;
	--rfx-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

	background: var(--rfx-paper);
}

/* ── Hero ─────────────────────────────────────────────────────────────────
 * Full bleed by contract. The type sits on the band inside it.
 */
.rfx-hero {
	width: 100%;
	background:
		radial-gradient(120% 90% at 12% 0%, rgba(212, 177, 106, .20), rgba(212, 177, 106, 0) 58%),
		radial-gradient(100% 80% at 92% 100%, rgba(96, 36, 55, .40), rgba(96, 36, 55, 0) 66%),
		var(--rfx-ink);
	color: var(--rfx-paper-hi);
	padding: clamp(3.25rem, 7vw, 6.5rem) 0 clamp(2.75rem, 5vw, 4.5rem);
	position: relative;
	isolation: isolate;
}

/* Paper tooth, the same one the empty cover plates use. Almost subliminal. */
.rfx-hero::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	opacity: .55;
	background-image:
		repeating-linear-gradient(38deg, rgba(255, 253, 248, .045) 0 1px, rgba(255, 253, 248, 0) 1px 7px),
		repeating-linear-gradient(-38deg, rgba(6, 20, 36, .05) 0 1px, rgba(6, 20, 36, 0) 1px 9px);
}

.rfx-hero__inner {
	position: relative;
	z-index: 1;
	width: var(--rfx-band);
	margin-inline: auto;
}

.rfx-hero__eyebrow {
	display: flex;
	align-items: center;
	gap: .75rem;
	margin: 0 0 1.25rem;
	font-family: var(--rfx-mono);
	font-size: .7rem;
	letter-spacing: .22em;
	text-transform: uppercase;
	color: var(--rfx-brass);
}

.rfx-hero__eyebrow .rule {
	display: block;
	width: clamp(2rem, 5vw, 4rem);
	height: 1px;
	background: currentColor;
	opacity: .6;
}

.rfx-hero__title {
	margin: 0;
	font-family: var(--rfx-display);
	font-weight: 400;
	line-height: 1.04;
	letter-spacing: -.015em;
	font-size: clamp(2.35rem, 6.2vw, 5rem);
	max-width: 22ch;
	color: var(--rfx-paper-hi);
}

.rfx-hero__title em {
	font-style: italic;
	color: var(--rfx-brass-hi);
}

.rfx-hero__deck {
	margin: 1.5rem 0 0;
	max-width: 62ch;
	font-family: var(--rfx-serif);
	font-size: clamp(1.05rem, 1.5vw, 1.35rem);
	line-height: 1.6;
	color: color-mix(in srgb, var(--rfx-paper-hi) 80%, transparent);
}

/* ── Controls ─────────────────────────────────────────────────────────────
 * Sticky, because a filter you have to scroll back up to reach is a filter
 * people use once.
 */
/* The publication header is itself sticky at z-index 200 and changes height
 * when it compacts on scroll, so this bar parks underneath it rather than
 * behind it. --rfx-stick is measured and kept current in index.js; the 0px
 * fallback is only ever used for the instant before that script runs. */
.rfx-controls {
	position: sticky;
	top: var(--rfx-stick, 0px);
	z-index: 30;
	background: color-mix(in srgb, var(--rfx-paper) 94%, transparent);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--rfx-linen);
	padding: 1.25rem 0 0;
	margin: 0;
}

.rfx-controls__inner {
	width: var(--rfx-band);
	margin-inline: auto;
}

.rfx-search {
	display: flex;
	align-items: center;
	gap: .65rem;
	border: 1px solid var(--rfx-linen);
	background: var(--rfx-paper-hi);
	border-radius: 2px;
	padding: .7rem .95rem;
	margin-bottom: 1.1rem;
	color: var(--rfx-soft);
	transition: border-color .18s ease, box-shadow .18s ease;
}

.rfx-search:focus-within {
	border-color: var(--rfx-brass);
	box-shadow: 0 0 0 3px rgba(212, 177, 106, .22);
}

.rfx-search input {
	flex: 1;
	border: 0;
	background: none;
	outline: none;
	font-family: var(--rfx-ui);
	font-size: 1rem;
	color: var(--rfx-ink);
	min-width: 0;
}

.rfx-search input::placeholder {
	color: color-mix(in srgb, var(--rfx-soft) 55%, transparent);
}

.rfx-facet {
	border: 0;
	margin: 0 0 .9rem;
	padding: 0;
}

.rfx-facet legend {
	display: flex;
	align-items: baseline;
	gap: .6rem;
	flex-wrap: wrap;
	padding: 0;
	margin-bottom: .45rem;
}

.rfx-facet__label {
	font-family: var(--rfx-mono);
	font-size: .66rem;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--rfx-ink);
}

.rfx-facet__hint {
	font-family: var(--rfx-serif);
	font-style: italic;
	font-size: .92rem;
	color: color-mix(in srgb, var(--rfx-soft) 72%, transparent);
}

.rfx-chips {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
}

.rfx-chip {
	display: inline-flex;
	align-items: center;
	gap: .45rem;
	border: 1px solid var(--rfx-linen);
	background: var(--rfx-paper-hi);
	color: var(--rfx-ink);
	font-family: var(--rfx-ui);
	font-size: .875rem;
	line-height: 1;
	padding: .5rem .7rem;
	border-radius: 999px;
	cursor: pointer;
	transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.rfx-chip:hover {
	border-color: var(--rfx-brass);
	transform: translateY(-1px);
}

.rfx-chip b {
	font-family: var(--rfx-mono);
	font-size: .68rem;
	font-weight: 500;
	letter-spacing: .04em;
	color: color-mix(in srgb, var(--rfx-soft) 60%, transparent);
}

.rfx-chip[aria-pressed="true"] {
	background: var(--rfx-ink);
	border-color: var(--rfx-ink);
	color: var(--rfx-paper-hi);
}

.rfx-chip[aria-pressed="true"] b {
	color: var(--rfx-brass);
}

/* A chip that would empty the grid says so quietly instead of lying. */
.rfx-chip[data-empty="1"] {
	opacity: .35;
}

.rfx-chip:focus-visible {
	outline: 2px solid var(--rfx-brass);
	outline-offset: 2px;
}

/* Group tint, so the four axes read as four axes and not one long soup. */
.rfx-facet[data-rfx-group="trouble"] .rfx-chip[aria-pressed="true"] {
	background: var(--rfx-plum);
	border-color: var(--rfx-plum);
}

.rfx-facet[data-rfx-group="reach"] .rfx-chip[aria-pressed="true"] {
	background: var(--rfx-rust);
	border-color: var(--rfx-rust);
}

.rfx-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	padding: .7rem 0 .85rem;
	border-top: 1px solid var(--rfx-linen);
	margin-top: .3rem;
}

.rfx-bar__count {
	margin: 0;
	font-family: var(--rfx-mono);
	font-size: .74rem;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--rfx-soft);
}

.rfx-bar__count strong {
	color: var(--rfx-ink);
	font-size: 1.05rem;
	letter-spacing: 0;
}

.rfx-bar__acts {
	display: flex;
	gap: .45rem;
	flex-wrap: wrap;
}

.rfx-act {
	border: 1px solid var(--rfx-ink);
	background: none;
	color: var(--rfx-ink);
	font-family: var(--rfx-mono);
	font-size: .68rem;
	letter-spacing: .14em;
	text-transform: uppercase;
	padding: .5rem .8rem;
	border-radius: 2px;
	cursor: pointer;
	transition: background .16s ease, color .16s ease;
}

.rfx-act:hover {
	background: var(--rfx-ink);
	color: var(--rfx-paper-hi);
}

.rfx-act--quiet {
	border-color: var(--rfx-linen);
	color: var(--rfx-soft);
}

.rfx-act:focus-visible {
	outline: 2px solid var(--rfx-brass);
	outline-offset: 2px;
}

/* ── Grid ─────────────────────────────────────────────────────────────────── */
.rfx-results {
	width: var(--rfx-band);
	margin-inline: auto;
	padding: clamp(1.75rem, 3vw, 3rem) 0 clamp(2.5rem, 5vw, 4.5rem);
}

.rfx-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
	gap: clamp(1rem, 1.8vw, 1.9rem);
	align-items: start;
}

.rfx-card {
	margin: 0;
	min-width: 0;
}

/* Held cards keep their markup for crawlers and for the filter, and lose
 * nothing but their turn. Their images have not been requested yet. */
.rfx-card.is-held,
.rfx-card.is-out {
	display: none;
}

.rfx-card > a {
	display: block;
	text-decoration: none;
	color: inherit;
	height: 100%;
}

.rfx-card__frame {
	display: block;
	position: relative;
	overflow: hidden;
	background: var(--rfx-linen);
	aspect-ratio: 4 / 5;
	border-radius: 2px;
}

.rfx-card__frame img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .6s cubic-bezier(.22, .61, .36, 1), filter .4s ease;
}

.rfx-card > a:hover .rfx-card__frame img {
	transform: scale(1.045);
	filter: saturate(1.06);
}

.rfx-card__body {
	display: block;
	padding-top: .85rem;
}

.rfx-card__kicker {
	display: block;
	font-family: var(--rfx-mono);
	font-size: .62rem;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--rfx-rust);
	margin-bottom: .45rem;
}

/* A brass hairline draws itself under the headline on hover. The only motion
 * on the card that is not the photograph. */
.rfx-card__title {
	display: block;
	font-family: var(--rfx-display);
	font-weight: 400;
	font-size: clamp(1.06rem, 1.35vw, 1.3rem);
	line-height: 1.24;
	letter-spacing: -.005em;
	color: var(--rfx-ink);
	background-image: linear-gradient(var(--rfx-brass), var(--rfx-brass));
	background-repeat: no-repeat;
	background-size: 0 1px;
	background-position: 0 100%;
	transition: background-size .45s cubic-bezier(.22, .61, .36, 1);
}

.rfx-card > a:hover .rfx-card__title {
	background-size: 100% 1px;
}

.rfx-card__dek {
	display: block;
	margin-top: .5rem;
	font-family: var(--rfx-serif);
	font-size: 1rem;
	line-height: 1.5;
	color: color-mix(in srgb, var(--rfx-soft) 82%, transparent);
}

/* Every seventh visible card runs wide with a landscape crop, so the grid has
 * a pulse instead of behaving like a spreadsheet. Recomputed after each
 * filter, which is why it is a class and not an :nth-child. */
@media (min-width: 760px) {
	.rfx-card.is-wide {
		grid-column: span 2;
	}

	.rfx-card.is-wide .rfx-card__frame {
		aspect-ratio: 16 / 9;
	}

	.rfx-card.is-wide .rfx-card__title {
		font-size: clamp(1.3rem, 1.9vw, 1.75rem);
	}
}

.rfx-empty {
	margin: 0 0 2rem;
	max-width: 56ch;
	font-family: var(--rfx-serif);
	font-size: 1.15rem;
	line-height: 1.6;
	color: var(--rfx-soft);
	border-left: 2px solid var(--rfx-brass);
	padding-left: 1.1rem;
}

.rfx-more {
	display: flex;
	justify-content: center;
	padding-top: clamp(2rem, 4vw, 3.25rem);
}

.rfx-more__btn {
	border: 1px solid var(--rfx-ink);
	background: none;
	color: var(--rfx-ink);
	font-family: var(--rfx-mono);
	font-size: .72rem;
	letter-spacing: .18em;
	text-transform: uppercase;
	padding: .95rem 2.4rem;
	border-radius: 2px;
	cursor: pointer;
	transition: background .18s ease, color .18s ease;
}

.rfx-more__btn:hover {
	background: var(--rfx-ink);
	color: var(--rfx-paper-hi);
}

.rfx-more[hidden] {
	display: none;
}

/* ── Reading block on hub pages ───────────────────────────────────────────
 * Appended to the long problem-door pages, inside the page's own measure, so
 * it inherits whatever width the article shell is using rather than opening a
 * second band down the middle of the page.
 */
.rfd-hubread {
	margin-top: clamp(2.5rem, 5vw, 4rem);
	padding-top: clamp(1.75rem, 3vw, 2.5rem);
	border-top: 1px solid var(--rfx-linen);
	background: none;
}

.rfd-hubread__eyebrow {
	margin: 0 0 .7rem;
	font-family: var(--rfx-mono);
	font-size: .66rem;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--rfx-rust);
}

.rfd-hubread__title {
	margin: 0 0 .6rem;
	font-family: var(--rfx-display);
	font-weight: 400;
	font-size: clamp(1.45rem, 3vw, 2.15rem);
	line-height: 1.14;
	letter-spacing: -.012em;
	color: var(--rfx-ink);
	max-width: 26ch;
}

.rfd-hubread__line {
	margin: 0 0 clamp(1.4rem, 2.5vw, 2rem);
	max-width: 62ch;
	font-family: var(--rfx-serif);
	font-size: clamp(1.02rem, 1.4vw, 1.2rem);
	line-height: 1.55;
	color: color-mix(in srgb, var(--rfx-soft) 85%, transparent);
}

.rfd-hubread__grid {
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.rfd-hubread__more {
	margin: clamp(1.6rem, 3vw, 2.4rem) 0 0;
}

.rfd-hubread__more a {
	font-family: var(--rfx-mono);
	font-size: .7rem;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--rfx-ink);
	text-decoration: none;
	border-bottom: 1px solid var(--rfx-brass);
	padding-bottom: .25rem;
}

.rfd-hubread__more a:hover {
	color: var(--rfx-rust);
}

@media (max-width: 900px) {
	.rfd-hubread__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* ── Closing band ─────────────────────────────────────────────────────────── */
.rfx-close {
	width: 100%;
	background: var(--rfx-ink);
	color: var(--rfx-paper-hi);
	padding: clamp(3rem, 6vw, 5.5rem) 0;
}

.rfx-close__inner {
	width: var(--rfx-band);
	margin-inline: auto;
}

.rfx-close__eyebrow {
	margin: 0 0 .9rem;
	font-family: var(--rfx-mono);
	font-size: .68rem;
	letter-spacing: .22em;
	text-transform: uppercase;
	color: var(--rfx-brass);
}

.rfx-close h2 {
	margin: 0 0 1rem;
	font-family: var(--rfx-display);
	font-weight: 400;
	font-size: clamp(1.7rem, 3.4vw, 2.9rem);
	line-height: 1.12;
	max-width: 24ch;
	color: var(--rfx-paper-hi);
}

.rfx-close p:not([class]) {
	margin: 0 0 1.5rem;
	max-width: 62ch;
	font-family: var(--rfx-serif);
	font-size: clamp(1.02rem, 1.4vw, 1.22rem);
	line-height: 1.62;
	color: color-mix(in srgb, var(--rfx-paper-hi) 78%, transparent);
}

.rfx-close__acts {
	display: flex;
	gap: .6rem;
	flex-wrap: wrap;
	margin: 0;
}

.rfx-btn {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--rfx-brass);
	color: var(--rfx-brass-hi);
	text-decoration: none;
	font-family: var(--rfx-mono);
	font-size: .7rem;
	letter-spacing: .16em;
	text-transform: uppercase;
	padding: .85rem 1.5rem;
	border-radius: 2px;
	transition: background .18s ease, color .18s ease;
}

.rfx-btn:hover {
	background: var(--rfx-brass);
	color: var(--rfx-ink);
}

.rfx-btn--solid {
	background: var(--rfx-brass);
	color: var(--rfx-ink);
}

.rfx-btn--solid:hover {
	background: var(--rfx-brass-hi);
}

.rfx-btn--text {
	border-color: transparent;
	padding-inline: .4rem;
	color: color-mix(in srgb, var(--rfx-paper-hi) 70%, transparent);
}

.rfx-btn--text:hover {
	background: none;
	color: var(--rfx-brass-hi);
}

/* ── Mobile ───────────────────────────────────────────────────────────────
 * The layout adapts rather than shrinking: the facets collapse to a scrolling
 * row per axis, which is the one place a horizontal scroller genuinely beats a
 * wrap, and the grid holds two columns so a phone still gets to browse
 * pictures rather than read a list.
 */
@media (max-width: 900px) {
	.rfx {
		--rfx-band: 92vw;
	}

	.rfx-controls {
		padding-top: .9rem;
	}

	.rfx-chips {
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
		padding-bottom: .35rem;
		-webkit-overflow-scrolling: touch;
	}

	.rfx-chips::-webkit-scrollbar {
		display: none;
	}

	.rfx-chip {
		flex: 0 0 auto;
	}

	.rfx-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 1rem;
	}

	.rfx-card__dek {
		display: none;
	}

	.rfx-card__title {
		font-size: 1rem;
	}
}

@media (max-width: 420px) {
	.rfx-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.rfx-card__dek {
		display: block;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rfx-card__frame img,
	.rfx-card__title {
		transition: none;
	}

	.rfx-card > a:hover .rfx-card__frame img {
		transform: none;
	}
}
