/**
 * RPA Digital Headquarters 0.20.0 (D34): the homepage's "Life in the Bond" photo mosaic,
 * "Meet the Brothers" spotlight rail and "Our legacy" milestones (views/public/home/gallery.php,
 * brothers.php, legacy.php). Loaded on the plugin homepage only, after public.css (whose size
 * budget it would break). The bands themselves (.rpa-band--night, --white, --crimson: colours,
 * padding, link and focus colours) and the head row (.rpahq-join__head) are shared; these
 * rules lay out what's inside. minmax(0, 1fr) and the rail's own scrolling keep a 390px page
 * free of sideways scroll; motion only without prefers-reduced-motion.
 */

/* Life in the Bond (night band): two columns on phones with the first photo across both and
   only the first five shown; from 600px four square columns with the first photo 2×2. */
.rpahq-mosaic {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rpahq-mosaic__item {
	position: relative;
	min-width: 0;
	margin: 0;
	aspect-ratio: 1;
}

.rpahq-mosaic__item:first-child {
	grid-column: span 2;
	aspect-ratio: 3 / 2;
}

.rpahq-mosaic__item:nth-child(n + 6) {
	display: none;
}

.rpahq-mosaic__link,
a.rpahq-mosaic__link:hover {
	position: absolute;
	inset: 0;
	display: block;
	overflow: hidden;
	background: var(--rpa-red-dark, #4a0002);
	color: #fff;
	text-decoration: none;
}

.rpahq-public .rpahq-mosaic__link img,
.rpahq-mosaic__link img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	object-fit: cover;
}

/* The story title over the photo's foot, shown on hover and focus (white on 85% black). */
.rpahq-mosaic__caption {
	position: absolute;
	inset: auto 0 0;
	padding: 36px 12px 10px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0, rgba(0, 0, 0, 0.85) 45%, rgba(0, 0, 0, 0) 100%);
	color: #fff;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: anywhere;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.rpahq-mosaic__link:hover .rpahq-mosaic__caption,
.rpahq-mosaic__link:focus-visible .rpahq-mosaic__caption {
	opacity: 1;
}

@media (min-width: 600px) {
	.rpahq-mosaic {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.rpahq-mosaic__item:first-child {
		grid-row: span 2;
		aspect-ratio: 1;
	}

	.rpahq-mosaic__item:nth-child(n + 6) {
		display: block;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.rpahq-mosaic__link img {
		transition: transform 0.4s ease;
	}

	.rpahq-mosaic__link:hover img {
		transform: scale(1.04);
	}
}

@media (prefers-reduced-motion: reduce) {
	.rpahq-mosaic__caption {
		transition: none;
	}
}

/* Meet the Brothers (white band): the head's text and tools, then a rail that scrolls
   sideways inside the page (cards 78vw on phones, 260px from 480px). */
.rpahq-brothers__intro {
	min-width: 0;
	max-width: 40rem;
}

.rpahq-brothers__text {
	margin: 8px 0 0;
}

.rpahq-brothers__tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
}

.rpahq-brothers__tools .rpa-link-arrow {
	margin-right: 8px;
}

.rpahq-brothers__steps {
	display: inline-flex;
	gap: 8px;
}

.rpahq-brothers__step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 2px solid var(--rpa-red-text, #a41722);
	border-radius: 50%;
	background: var(--rpa-surface, #fff);
	color: var(--rpa-red-text, #a41722);
	cursor: pointer;
}

.rpahq-brothers__step[hidden] {
	display: none;
}

.rpahq-brothers__step:hover:not(:disabled) {
	background: var(--rpa-red-text, #a41722);
	color: #fff;
}

.rpahq-brothers__step:disabled {
	opacity: 0.4;
	cursor: default;
}

.rpahq-brothers__step svg {
	width: 20px;
	height: 20px;
}

.rpahq-brothers__step--prev svg {
	transform: scaleX(-1);
}

.rpahq-brothers__rail {
	display: grid;
	grid-auto-columns: 78vw;
	grid-auto-flow: column;
	gap: 20px;
	margin: 0;
	padding: 4px 4px 20px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	list-style: none;
	scroll-padding-inline: 4px;
	scroll-snap-type: x mandatory;
}

.rpahq-brothers__item {
	display: flex;
	min-width: 0;
	margin: 0;
	scroll-snap-align: start;
}

.rpahq-brother {
	position: relative;
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
	background: var(--rpa-surface, #fff);
	box-shadow: var(--rpa-shadow-card, 0 8px 24px rgba(74, 0, 2, 0.15));
}

.rpahq-public .rpahq-brother__photo img,
.rpahq-brother__photo img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	aspect-ratio: 4 / 5;
	object-fit: cover;
	object-position: top center;
}

.rpahq-brother__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: 16px 18px 18px;
}

.rpahq-brother__name {
	margin: 0 0 8px;
	font-family: var(--rpa-font-heading);
	font-size: var(--rpa-step-1, 1.25rem);
	font-weight: 600;
	line-height: 1.2;
	text-transform: uppercase;
	overflow-wrap: anywhere;
}

/* Over the band's link colour (:where(.rpa-band) a); the link is stretched over the card. */
.rpahq-brother__name .rpahq-brother__link {
	color: var(--rpa-ink, #111);
	text-decoration: none;
}

.rpahq-brother__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.rpahq-brother__name .rpahq-brother__link:hover {
	color: var(--rpa-red-text, #a41722);
	text-decoration: underline;
}

.rpahq-brother__link:focus-visible {
	outline: none;
}

.rpahq-brother:focus-within {
	outline: 3px solid var(--rpa-red-text, #a41722);
	outline-offset: -3px;
}

.rpahq-brother__teaser {
	margin: 0 0 12px;
	color: var(--rpa-text, #393939);
	font-size: 0.9375rem;
	line-height: 1.5;
}

.rpahq-brother__more {
	margin: auto 0 0;
	color: var(--rpa-red-text, #a41722);
	font-family: var(--rpa-font-heading);
	font-size: 0.875rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

@media (min-width: 480px) {
	.rpahq-brothers__rail {
		grid-auto-columns: 260px;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.rpahq-brothers__rail {
		scroll-behavior: smooth;
	}
}

/* Our legacy (crimson band): down the page with the gold line on the left; from 960px
   across it, a dot per milestone. Years in gold-soft (4.6:1 or more on the crimson, large
   text), texts in --rpa-text-on-dark (5.8:1 or more). */
.rpahq-legacy__list {
	position: relative;
	display: grid;
	gap: 28px;
	margin: 32px 0 0;
	padding: 0;
	list-style: none;
}

.rpahq-legacy__list::before {
	content: "";
	position: absolute;
	top: 8px;
	bottom: 8px;
	left: 7px;
	width: 2px;
	background: var(--rpa-gold, #c9a227);
}

.rpahq-legacy__item {
	position: relative;
	min-width: 0;
	margin: 0;
	padding-left: 36px;
}

.rpahq-legacy__item::before {
	content: "";
	position: absolute;
	top: 10px;
	left: 0;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--rpa-gold, #c9a227);
	box-shadow: 0 0 0 4px var(--rpa-red-deep, #7a0103);
}

.rpahq-legacy .rpahq-legacy__year {
	margin: 0 0 6px;
	color: var(--rpa-gold-soft, #e7cf7a);
	font-family: var(--rpa-font-heading);
	font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem);
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.02em;
}

.rpahq-legacy__text {
	max-width: 40ch;
	margin: 0;
	color: var(--rpa-text-on-dark, #f3e6e6);
	font-size: 1rem;
	line-height: 1.5;
	overflow-wrap: anywhere;
}

.rpahq-legacy__actions {
	margin: 36px 0 0;
}

@media (min-width: 960px) {
	.rpahq-legacy__list {
		grid-auto-columns: minmax(0, 1fr);
		grid-auto-flow: column;
		gap: 24px;
		margin-top: 40px;
	}

	.rpahq-legacy__list::before {
		top: 7px;
		right: 0;
		bottom: auto;
		left: 0;
		width: auto;
		height: 2px;
	}

	.rpahq-legacy__item {
		padding: 36px 0 0;
	}

	.rpahq-legacy__item::before {
		top: 0;
	}

	.rpahq-legacy__text {
		font-size: 0.9375rem;
	}
}

/* Touch: the head links reach 44px. */
@media (pointer: coarse) {
	.rpahq-mosaic-band .rpahq-join__head .rpa-link-arrow,
	.rpahq-brothers__tools .rpa-link-arrow {
		min-height: 44px;
	}
}

@media print {
	.rpahq-brothers__step {
		display: none;
	}

	.rpahq-brothers__rail {
		grid-auto-flow: row;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		overflow: visible;
	}

	.rpahq-mosaic__caption {
		opacity: 1;
	}
}
