/* ===========================================================================
   WW2 Visual Archive — ww2visualarchive
   related.css

   The automatic related-content surfaces. Three components:

     .rel-rail    the ranked list in the sidebar
     .rel-deck    the editorial grid under an article
     .cat-deck    the per-category showcase bands on the front page

   Design intent: this is the archive's "keep reading" machinery, so it has to
   look like the best thing on the page rather than an afterthought. That means
   real hierarchy — outline numerals, brass hairlines, gradient scrims, a
   deliberate hover state — built entirely from the design system's own tokens.

   Load order: fonts → design-system → theme-extras → THIS → style.css
   =========================================================================== */

/* ===========================================================================
   01 · SHARED — the card
   =========================================================================== */

.rel-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: linear-gradient(168deg, rgba(28, 22, 13, 0.9), rgba(11, 9, 6, 0.94));
	border: 1px solid rgba(201, 150, 43, 0.2);
	border-radius: var(--radius);
	overflow: hidden;
	transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1),
		border-color 0.45s, box-shadow 0.45s;
}

.rel-card:hover {
	transform: translateY(-5px);
	border-color: rgba(242, 206, 107, 0.5);
	box-shadow: 0 26px 60px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(255, 233, 168, 0.1);
}

/* ---- Media ------------------------------------------------------------- */
.rel-card__media {
	position: relative;
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #0a0906;
	flex: none;
}

.rel-card--feature .rel-card__media {
	aspect-ratio: 16 / 10;
}

.rel-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.rel-card:hover .rel-card__media img {
	transform: scale(1.07);
}

.rel-card__scrim {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(
		180deg,
		rgba(6, 5, 4, 0.34) 0%,
		rgba(6, 5, 4, 0.06) 34%,
		rgba(6, 5, 4, 0.72) 100%
	);
}

.rel-card__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(160deg, rgba(28, 22, 13, 0.92), rgba(8, 7, 6, 0.96));
}

.rel-card__seal {
	width: 62px;
	height: 62px;
	border-radius: 50%;
	border: 1px solid rgba(201, 150, 43, 0.3);
	opacity: 0.62;
}

/* ---- The outline numeral ---------------------------------------------- */
.rel-card__idx {
	position: absolute;
	top: 14px;
	left: 16px;
	font-family: Anton, sans-serif;
	font-size: clamp(1.7rem, 3.4vw, 2.5rem);
	line-height: 1;
	letter-spacing: 0.02em;
	color: transparent;
	-webkit-text-stroke: 1.4px rgba(255, 233, 168, 0.72);
	text-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
	transition: -webkit-text-stroke-color 0.4s, transform 0.4s;
	pointer-events: none;
}

.rel-card:hover .rel-card__idx {
	-webkit-text-stroke-color: var(--gold);
	transform: translateY(-2px);
}

/* ---- Category chip ----------------------------------------------------- */
.rel-card__cat {
	position: absolute;
	bottom: 14px;
	left: 16px;
	padding: 5px 12px;
	border-radius: 999px;
	font-family: 'IBM Plex Mono', monospace;
	font-size: 9px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--gold-lt);
	background: rgba(6, 5, 4, 0.82);
	border: 1px solid rgba(242, 206, 107, 0.36);
	backdrop-filter: none; /* see the header note: never inside a clipped layer */
}

/* ---- Body -------------------------------------------------------------- */
.rel-card__body {
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 11px;
	flex: 1;
}

.rel-card__title {
	font-family: Anton, sans-serif;
	font-weight: 400;
	font-size: 1.16rem;
	line-height: 1.18;
	margin: 0;
	color: var(--bone);
}

.rel-card--feature .rel-card__title {
	font-size: clamp(1.3rem, 2.6vw, 1.75rem);
	line-height: 1.1;
}

.rel-card__title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.3s;
}

.rel-card:hover .rel-card__title a {
	color: var(--gold);
}

.rel-card__excerpt {
	margin: 0;
	font-size: 13px;
	line-height: 1.62;
	color: var(--muted);
}

.rel-card__foot {
	margin-top: auto;
	padding-top: 13px;
	border-top: 1px solid rgba(201, 150, 43, 0.14);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.rel-card__meta {
	font-size: 9.5px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--faint);
}

.rel-card__arrow {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-family: 'IBM Plex Mono', monospace;
	font-size: 9px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--brass);
	transition: color 0.3s, transform 0.3s;
}

.rel-card:hover .rel-card__arrow {
	color: var(--gold-lt);
	transform: translateX(4px);
}

/* ===========================================================================
   02 · THE SIDEBAR RAIL
   =========================================================================== */

.rel-rail {
	position: relative;
	padding: 22px 20px 20px;
	background: linear-gradient(168deg, rgba(28, 22, 13, 0.86), rgba(11, 9, 6, 0.9));
	border: 1px solid rgba(201, 150, 43, 0.22);
	border-radius: var(--radius);
	overflow: hidden;
}

/* A brass hairline down the left edge — the archive's spine. */
.rel-rail::before {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 2px;
	background: linear-gradient(180deg, var(--gold), rgba(201, 150, 43, 0.06));
}

.rel-rail__head {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 16px;
}

.rel-rail__title {
	font-family: Anton, sans-serif;
	font-weight: 400;
	font-size: 1.16rem;
	line-height: 1.1;
	margin: 0;
	color: var(--bone);
}

.rel-rail__rule {
	display: block;
	height: 1px;
	margin-top: 12px;
	background: linear-gradient(90deg, rgba(201, 150, 43, 0.46), transparent);
}

.rel-rail__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.rel-rail__item {
	border-bottom: 1px solid rgba(201, 150, 43, 0.11);
}

.rel-rail__item:last-child {
	border-bottom: 0;
}

.rel-rail__link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 13px 0;
	text-decoration: none;
	position: relative;
	transition: padding-left 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.rel-rail__link::before {
	content: '';
	position: absolute;
	left: 0;
	top: 50%;
	width: 0;
	height: 1px;
	background: var(--gold);
	transform: translateY(-50%);
	transition: width 0.32s;
}

.rel-rail__link:hover {
	padding-left: 10px;
}

.rel-rail__link:hover::before {
	width: 6px;
}

/* The numeral — outline by default, solid on hover. */
.rel-rail__num {
	flex: none;
	width: 26px;
	font-family: Anton, sans-serif;
	font-size: 1.28rem;
	line-height: 1;
	color: transparent;
	-webkit-text-stroke: 1px rgba(201, 150, 43, 0.62);
	transition: color 0.32s, -webkit-text-stroke-color 0.32s;
}

.rel-rail__link:hover .rel-rail__num {
	color: var(--gold);
	-webkit-text-stroke-color: var(--gold);
}

.rel-rail__thumb {
	flex: none;
	width: 52px;
	aspect-ratio: 4 / 5;
	overflow: hidden;
	border-radius: 8px;
	border: 1px solid rgba(201, 150, 43, 0.26);
	background: #0a0906;
}

.rel-rail__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.rel-rail__link:hover .rel-rail__thumb img {
	transform: scale(1.1);
}

.rel-rail__text {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.rel-rail__cat {
	font-family: 'IBM Plex Mono', monospace;
	font-size: 8.5px;
	letter-spacing: 0.24em;
	text-transform: uppercase;
	color: var(--brass);
}

.rel-rail__title {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.38;
	color: var(--bone);
	transition: color 0.3s;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.rel-rail__link:hover .rel-rail__title {
	color: var(--gold);
}

.rel-rail__meta {
	font-family: 'IBM Plex Mono', monospace;
	font-size: 9px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--faint);
}

.rel-rail__all {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid rgba(201, 150, 43, 0.16);
	width: 100%;
	font-family: 'IBM Plex Mono', monospace;
	font-size: 9.5px;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--brass);
	text-decoration: none;
	transition: color 0.3s, gap 0.3s;
}

.rel-rail__all:hover {
	color: var(--gold-lt);
	gap: 12px;
}

/* Inside a widget the rail is already framed by the widget plate. */
.rel-rail__list--widget .rel-rail__item:first-child .rel-rail__link {
	padding-top: 0;
}

/* ===========================================================================
   03 · THE DECK UNDER AN ARTICLE
   =========================================================================== */

.rel-deck {
	margin-top: clamp(48px, 5.4vw, 84px);
	padding-top: clamp(34px, 4vw, 56px);
	border-top: 1px solid rgba(201, 150, 43, 0.22);
}

.rel-deck__head {
	margin-bottom: clamp(26px, 3.2vw, 42px);
}

.rel-deck__title {
	font-family: Anton, sans-serif;
	font-weight: 400;
	font-size: clamp(1.5rem, 3.4vw, 2.4rem);
	line-height: 1.04;
	margin: 12px 0 0;
	color: var(--bone);
}

.rel-deck__grid {
	display: grid;
	gap: var(--gap-md);
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Three cards: the first takes the wide slot and reads as the lead. */
.rel-deck__grid--3 {
	grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
}

.rel-deck__grid--3 .rel-card--feature {
	grid-row: span 2;
}

.rel-deck__grid--3 .rel-card--feature .rel-card__media {
	aspect-ratio: 16 / 11;
}

/* Four or more: a straight multi-column run. */
.rel-deck__grid--4,
.rel-deck__grid--5,
.rel-deck__grid--6 {
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

/* ===========================================================================
   04 · THE CATEGORY SHOWCASE
   =========================================================================== */

.cat-deck {
	position: relative;
	padding: var(--sec-pad) 0;
	background: rgba(28, 22, 13, 0.42);
	border-top: 1px solid rgba(201, 150, 43, 0.14);
	border-bottom: 1px solid rgba(201, 150, 43, 0.14);
	overflow: hidden;
}

.cat-deck__head {
	margin-bottom: clamp(34px, 4.4vw, 62px);
}

.cat-deck__title {
	margin-top: 14px;
}

.cat-band {
	position: relative;
	padding: clamp(28px, 3.6vw, 52px) 0 clamp(40px, 5vw, 70px);
	border-top: 1px solid rgba(201, 150, 43, 0.16);
}

.cat-band:first-of-type {
	border-top: 0;
	padding-top: 0;
}

.cat-band:last-of-type {
	padding-bottom: 0;
}

/* The huge ghost numeral behind each band. */
.cat-band__ghost {
	position: absolute;
	top: -10px;
	right: -8px;
	z-index: 0;
	font-family: Anton, sans-serif;
	font-size: clamp(6rem, 18vw, 15rem);
	line-height: 0.8;
	color: transparent;
	-webkit-text-stroke: 1.5px rgba(201, 150, 43, 0.11);
	pointer-events: none;
	user-select: none;
}

.cat-band--flip .cat-band__ghost {
	right: auto;
	left: -8px;
}

.cat-band__head {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 22px;
	flex-wrap: wrap;
	margin-bottom: clamp(22px, 2.8vw, 38px);
}

.cat-band__titles {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.cat-band__name {
	font-family: Anton, sans-serif;
	font-weight: 400;
	font-size: clamp(1.6rem, 4vw, 2.9rem);
	line-height: 1;
	margin: 0;
	color: var(--bone);
	text-transform: uppercase;
}

.cat-band__count {
	font-size: 10px;
	letter-spacing: 0.24em;
	text-transform: uppercase;
	color: var(--brass);
}

.cat-band__all {
	white-space: nowrap;
	padding: 12px 22px;
	font-size: 12.5px;
}

/* ---- The mosaic -------------------------------------------------------- */
.cat-band__mosaic {
	position: relative;
	z-index: 2;
	display: grid;
	grid-template-columns: minmax(0, 1.28fr) minmax(0, 1fr);
	gap: var(--gap-md);
	align-items: start;
}

.cat-band--flip .cat-band__mosaic {
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.28fr);
}

.cat-band--flip .cat-band__feature {
	order: 2;
}

.cat-band__stack {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* In the stack the cards go horizontal: thumbnail left, text right. */
.cat-band__stack .rel-card {
	flex-direction: row;
	align-items: stretch;
}

.cat-band__stack .rel-card__media {
	width: 40%;
	max-width: 190px;
	aspect-ratio: 4 / 3;
	flex: none;
}

.cat-band__stack .rel-card__body {
	padding: 15px 17px;
	gap: 8px;
}

.cat-band__stack .rel-card__title {
	font-size: 1rem;
	line-height: 1.24;
}

.cat-band__stack .rel-card__excerpt {
	display: none;
}

.cat-band__stack .rel-card__idx {
	font-size: 1.3rem;
	top: 9px;
	left: 10px;
}

.cat-band__stack .rel-card__cat {
	bottom: 9px;
	left: 10px;
	padding: 4px 9px;
	font-size: 8px;
	letter-spacing: 0.16em;
}

.cat-band__stack .rel-card__arrow {
	display: none;
}

/* ===========================================================================
   05 · THE WING INDEX
   =========================================================================== */

.cat-index {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 10px;
}

.cat-index__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: var(--touch);
	padding: 12px 16px;
	border: 1px solid rgba(201, 150, 43, 0.2);
	border-radius: 11px;
	background: rgba(28, 22, 13, 0.5);
	text-decoration: none;
	transition: border-color 0.28s, background 0.28s, transform 0.28s;
}

.cat-index__item:hover {
	border-color: rgba(242, 206, 107, 0.55);
	background: rgba(201, 150, 43, 0.1);
	transform: translateY(-2px);
}

.cat-index__name {
	font-family: 'IBM Plex Mono', monospace;
	font-size: 11px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
	transition: color 0.28s;
}

.cat-index__item:hover .cat-index__name {
	color: var(--gold-lt);
}

.cat-index__count {
	font-family: Anton, sans-serif;
	font-size: 0.95rem;
	color: var(--brass);
	flex: none;
}

/* ===========================================================================
   06 · RESPONSIVE
   =========================================================================== */

/* ---- Tablet ------------------------------------------------------------ */
@media (max-width: 1024px) {
	.rel-deck__grid--3 {
		grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	}

	.rel-deck__grid--3 .rel-card--feature {
		grid-row: auto;
	}

	.cat-band__mosaic,
	.cat-band--flip .cat-band__mosaic {
		grid-template-columns: minmax(0, 1fr);
	}

	.cat-band--flip .cat-band__feature {
		order: 0;
	}

	.cat-band__stack {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	}

	.cat-band__ghost {
		font-size: clamp(5rem, 16vw, 9rem);
		opacity: 0.7;
	}
}

/* ---- Mobile ------------------------------------------------------------ */
@media (max-width: 900px) {
	.rel-rail {
		padding: 20px 17px;
	}

	.cat-band__head {
		align-items: flex-start;
	}

	.cat-band__all {
		padding: 11px 18px;
		font-size: 12px;
	}
}

@media (max-width: 640px) {
	.rel-deck__grid,
	.rel-deck__grid--3,
	.rel-deck__grid--4,
	.rel-deck__grid--5,
	.rel-deck__grid--6 {
		grid-template-columns: minmax(0, 1fr);
	}

	.cat-band__stack {
		grid-template-columns: minmax(0, 1fr);
	}

	/* The stacked cards go back to vertical so the image keeps its presence. */
	.cat-band__stack .rel-card {
		flex-direction: column;
	}

	.cat-band__stack .rel-card__media {
		width: 100%;
		max-width: none;
		aspect-ratio: 16 / 10;
	}

	.cat-band__stack .rel-card__excerpt {
		display: block;
	}

	.cat-band__ghost {
		display: none;
	}

	.cat-index {
		grid-template-columns: minmax(0, 1fr);
	}

	.rel-card__idx {
		font-size: 1.6rem;
	}
}

/* ---- Reduced motion ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.rel-card,
	.rel-card__media img,
	.rel-rail__link,
	.rel-rail__num,
	.rel-rail__thumb img,
	.cat-index__item,
	.rel-card__arrow {
		transition: none !important;
	}

	.rel-card:hover,
	.cat-index__item:hover {
		transform: none;
	}

	.rel-card:hover .rel-card__media img,
	.rel-rail__link:hover .rel-rail__thumb img {
		transform: none;
	}
}
