/**
 * Bolts staff directory.
 *
 * The card is the photo: the portrait fills a square, the name sits over it,
 * and role, region and bio come up on hover. Layout, motion and shape only —
 * type, colour and ratio come from custom properties so the cards inherit the
 * site's look rather than imposing one. Set these on .bolts-staff (or :root):
 *
 *   --bolts-ratio         card aspect ratio (square by default)
 *   --bolts-bg            card background, seen behind photos and initials
 *   --bolts-fg            text over the photo
 *   --bolts-accent        stat rules, CTA underline, focus ring
 *   --bolts-detail-bg     hover panel wash
 *   --bolts-stagger-step  how far the offset column drops
 */

.bolts-staff {
	--bolts-cols: 4;
	--bolts-gap: 1.5rem;
	--bolts-ratio: 1 / 1;
	--bolts-radius: 12px;
	--bolts-bg: #0d0d0d;
	--bolts-fg: #fff;
	--bolts-accent: currentColor;
	--bolts-detail-bg: rgba(8, 8, 8, 0.88);
	--bolts-stagger-step: 3rem;
	--bolts-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.bolts-staff__heading {
	margin: 0 0 1.5rem;
}

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

.bolts-staff__grid {
	display: grid;
	grid-template-columns: repeat(var(--bolts-cols), minmax(0, 1fr));
	gap: var(--bolts-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (max-width: 1200px) {
	.bolts-staff__grid {
		grid-template-columns: repeat(min(var(--bolts-cols), 3), minmax(0, 1fr));
	}
}

@media (max-width: 860px) {
	.bolts-staff__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		--bolts-gap: 1rem;
	}
}

@media (max-width: 420px) {
	.bolts-staff__grid {
		grid-template-columns: 1fr;
	}
}

.bolts-staff__item {
	margin: 0;
	min-width: 0;
}

/*
 * Dropping every other card breaks the grid's hard horizontal line, which is
 * what keeps a wall of headshots from reading like a spreadsheet. It's a
 * static offset rather than scroll-linked parallax: same effect at a fraction
 * of the cost, and nothing to recalculate on resize.
 */
.bolts-staff--stagger .bolts-staff__grid {
	padding-bottom: var(--bolts-stagger-step);
}

.bolts-staff--stagger .bolts-staff__item:nth-child(even) {
	transform: translateY(var(--bolts-stagger-step));
}

@media (max-width: 420px) {
	.bolts-staff--stagger .bolts-staff__grid {
		padding-bottom: 0;
	}

	.bolts-staff--stagger .bolts-staff__item:nth-child(even) {
		transform: none;
	}
}

/* -- frame --------------------------------------------------------------- */

/*
 * The frame holds the ratio and the reveal; the card inside it is absolutely
 * positioned so the clip path always has a box of known proportions to cut.
 * Cards show unconditionally when the script can't run — a directory that
 * never appears is far worse than one that appears without ceremony.
 */
.bolts-card-frame {
	position: relative;
	aspect-ratio: var(--bolts-ratio);
	opacity: 0;
	transform: translateY(2rem);
	transition:
		opacity 800ms var(--bolts-ease),
		transform 800ms var(--bolts-ease);
	transition-delay: calc(var(--bolts-index, 0) * 70ms);
}

.bolts-card-frame.is-revealed,
.no-js .bolts-card-frame {
	opacity: 1;
	transform: none;
}

.bolts-card {
	position: absolute;
	inset: 0;
	overflow: hidden;
	background: var(--bolts-bg);
	color: var(--bolts-fg);
	isolation: isolate;
	clip-path: url(#bolts-card-shape-step);
}

/* Rounded rectangle, for directories that don't want the notch. */
.bolts-staff--plain .bolts-card {
	clip-path: none;
	border-radius: var(--bolts-radius);
}

/* -- trigger ------------------------------------------------------------- */

/*
 * The whole card is one button. It's transparent by design, so the !important
 * is doing real work: themes commonly style every button on the site on hover
 * and focus, and here that paints an accent block over the portrait.
 */
.bolts-card__trigger {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	background: none;
	cursor: pointer;
	appearance: none;
}

.bolts-card__trigger,
.bolts-card__trigger:hover,
.bolts-card__trigger:focus,
.bolts-card__trigger:active {
	background: none !important;
	background-color: transparent !important;
	border-color: transparent !important;
	box-shadow: none !important;
	color: inherit !important;
}

/*
 * The ring goes on the frame, which isn't clipped — drawn on the trigger it
 * would be cut in half by the notch. The inset ring is the fallback for
 * browsers without :has().
 */
.bolts-card__trigger:focus-visible {
	outline: 2px solid var(--bolts-accent);
	outline-offset: -4px;
}

@supports selector(:has(*)) {
	.bolts-card__trigger:focus-visible {
		outline: none;
	}

	.bolts-card-frame:has(:focus-visible) {
		outline: 2px solid var(--bolts-accent);
		outline-offset: 3px;
	}
}

.bolts-staff .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* -- media --------------------------------------------------------------- */

.bolts-card__media {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: var(--bolts-bg);
}

.bolts-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* Headshots crop from the top so faces stay in frame when the upload isn't
	   square. */
	object-position: center top;
	display: block;
	/* A hair over 1 hides the sub-pixel seam the clip path can leave. */
	transform: scale(1.01);
	transition:
		transform 1200ms var(--bolts-ease),
		filter 700ms var(--bolts-ease);
}

.bolts-card__initials {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: clamp(2.5rem, 6vw, 4rem);
	font-weight: 800;
	line-height: 1;
	opacity: 0.16;
}

/* The wash that keeps the name legible over a light photo. */
.bolts-card__scrim {
	position: absolute;
	inset: 0;
	z-index: 2;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.85) 0%,
		rgba(0, 0, 0, 0.45) 28%,
		rgba(0, 0, 0, 0) 55%
	);
	transition: opacity 700ms var(--bolts-ease);
}

.bolts-card.has-no-photo .bolts-card__scrim {
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.6) 0%,
		rgba(0, 0, 0, 0.2) 30%,
		rgba(0, 0, 0, 0) 55%
	);
}

/* -- front --------------------------------------------------------------- */

/*
 * Anchored to the foot of the card and allowed to grow upward, because staff
 * titles run long ("Development & Community Partnerships Manager") where a
 * roster's meta line never does.
 */
.bolts-card__front {
	position: absolute;
	z-index: 3;
	left: 1.25rem;
	right: 1.25rem;
	bottom: 1.1rem;
	transition:
		transform 700ms var(--bolts-ease),
		opacity 450ms var(--bolts-ease);
}

.bolts-card__name {
	margin: 0;
	line-height: 0.92;
	text-transform: uppercase;
}

.bolts-card__first {
	display: block;
	font-size: clamp(0.75rem, 1vw, 0.95rem);
	font-weight: 500;
	letter-spacing: 0.06em;
}

.bolts-card__last {
	display: block;
	font-size: clamp(1.35rem, 2.1vw, 2.15rem);
	font-weight: 800;
	letter-spacing: -0.01em;
}

.bolts-card__footer {
	position: relative;
	margin: 0.85rem 0 0;
	padding-top: 0.7rem;
}

/*
 * Role and region stack rather than sharing a line with a divider between
 * them: "Development & Community Partnerships Manager" wraps at card width,
 * and a wrapped flex row leaves the divider stranded at the start of a line.
 * Two lines at most, so one long title can't push the name off the card.
 */
.bolts-card__role {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0;
	font-size: clamp(0.62rem, 0.8vw, 0.75rem);
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.35;
	text-transform: uppercase;
}

.bolts-card__terms {
	display: flex;
	flex-wrap: wrap;
	gap: 0.1rem 0.75rem;
	margin: 0.3rem 0 0;
	font-size: clamp(0.6rem, 0.75vw, 0.72rem);
	font-weight: 600;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	opacity: 0.7;
}

/* The hairline draws itself in once the card has arrived. */
.bolts-card__footer::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 1px;
	background: rgba(255, 255, 255, 0.55);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 900ms var(--bolts-ease);
	transition-delay: calc(var(--bolts-index, 0) * 70ms + 250ms);
}

.bolts-card-frame.is-revealed .bolts-card__footer::before {
	transform: scaleX(1);
}

.bolts-card__terms span + span {
	position: relative;
	padding-left: 0.75rem;
}

.bolts-card__terms span + span::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	width: 1px;
	height: 0.9em;
	background: currentColor;
	opacity: 0.45;
	transform: translateY(-50%);
}

/* -- detail -------------------------------------------------------------- */

/*
 * Above the trigger so its links are reachable, but transparent to the pointer
 * so everything except those links still toggles the card.
 */
.bolts-card__detail {
	position: absolute;
	inset: 0;
	z-index: 6;
	pointer-events: none;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.9rem;
	padding: 1.5rem 1.25rem;
	background: var(--bolts-detail-bg);
	backdrop-filter: blur(2px);
	opacity: 0;
	visibility: hidden;
	transition:
		opacity 550ms var(--bolts-ease),
		visibility 0s linear 550ms;
}

.bolts-card__detail-name {
	margin: 0;
	line-height: 0.92;
	text-transform: uppercase;
}

.bolts-card__detail-role {
	margin: -0.4rem 0 0;
	font-size: clamp(0.62rem, 0.8vw, 0.75rem);
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.35;
	text-transform: uppercase;
	opacity: 0;
	transform: translateY(0.5rem);
	transition:
		opacity 500ms var(--bolts-ease),
		transform 500ms var(--bolts-ease);
}

.bolts-card__rows {
	margin: 0;
	display: grid;
	gap: 0.45rem;
}

.bolts-card__row {
	display: grid;
	grid-template-columns: 4.25rem 1fr;
	align-items: baseline;
	gap: 0.75rem;
	font-size: clamp(0.65rem, 0.85vw, 0.78rem);
	letter-spacing: 0.07em;
	text-transform: uppercase;
	opacity: 0;
	transform: translateY(0.5rem);
	transition:
		opacity 500ms var(--bolts-ease),
		transform 500ms var(--bolts-ease);
}

.bolts-card__row dt {
	margin: 0;
	opacity: 0.6;
	font-weight: 500;
}

.bolts-card__row dd {
	position: relative;
	margin: 0;
	padding-left: 0.75rem;
	font-weight: 700;
}

.bolts-card__row dd::before {
	content: "";
	position: absolute;
	left: 0;
	top: -0.1em;
	bottom: -0.1em;
	width: 1px;
	background: var(--bolts-accent);
	opacity: 0.8;
}

.bolts-card__excerpt,
.bolts-card__actions {
	margin: 0;
	font-size: 0.8rem;
	opacity: 0;
	transform: translateY(0.5rem);
	transition:
		opacity 500ms var(--bolts-ease) 220ms,
		transform 500ms var(--bolts-ease) 220ms;
}

/*
 * Clamped rather than scrolled. A bio that scrolls inside a hover panel is a
 * bio nobody finishes — the long version lives on the profile page, which is
 * what the link below is for.
 */
.bolts-card__excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 4;
	line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
	line-height: 1.5;
	opacity: 0;
}

.bolts-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.9rem;
}

/* The only part of the panel that takes a click. */
.bolts-card__mail,
.bolts-card__link {
	position: relative;
	z-index: 7;
	pointer-events: auto;
	padding-bottom: 2px;
	border-bottom: 1px solid var(--bolts-accent);
	color: inherit;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
}

/* -- open ---------------------------------------------------------------- */

@media (hover: hover) and (pointer: fine) {
	.bolts-card-frame:hover .bolts-card__img {
		transform: scale(1.06);
		filter: saturate(0.85);
	}

	.bolts-card-frame:hover .bolts-card__front {
		opacity: 0;
		transform: translateY(0.75rem);
	}

	.bolts-card-frame:hover .bolts-card__scrim {
		opacity: 0;
	}

	.bolts-card-frame:hover .bolts-card__detail {
		opacity: 1;
		visibility: visible;
		transition-delay: 0s, 0s;
	}

	.bolts-card-frame:hover .bolts-card__detail-role,
	.bolts-card-frame:hover .bolts-card__row,
	.bolts-card-frame:hover .bolts-card__excerpt,
	.bolts-card-frame:hover .bolts-card__actions {
		opacity: 1;
		transform: none;
	}

	.bolts-card-frame:hover .bolts-card__excerpt {
		opacity: 0.85;
	}

	.bolts-card-frame:hover .bolts-card__row:nth-child(2) {
		transition-delay: 55ms;
	}

	.bolts-card-frame:hover .bolts-card__row:nth-child(3) {
		transition-delay: 110ms;
	}

	.bolts-card-frame:hover .bolts-card__row:nth-child(4) {
		transition-delay: 165ms;
	}
}

/* Keyboard and touch reach the same state the pointer does. */
.bolts-card-frame:focus-within .bolts-card__img,
.bolts-card-frame.is-open .bolts-card__img {
	transform: scale(1.06);
	filter: saturate(0.85);
}

.bolts-card-frame:focus-within .bolts-card__front,
.bolts-card-frame.is-open .bolts-card__front {
	opacity: 0;
	transform: translateY(0.75rem);
}

.bolts-card-frame:focus-within .bolts-card__scrim,
.bolts-card-frame.is-open .bolts-card__scrim {
	opacity: 0;
}

.bolts-card-frame:focus-within .bolts-card__detail,
.bolts-card-frame.is-open .bolts-card__detail {
	opacity: 1;
	visibility: visible;
	transition-delay: 0s, 0s;
}

.bolts-card-frame:focus-within .bolts-card__detail-role,
.bolts-card-frame:focus-within .bolts-card__row,
.bolts-card-frame:focus-within .bolts-card__actions,
.bolts-card-frame.is-open .bolts-card__detail-role,
.bolts-card-frame.is-open .bolts-card__row,
.bolts-card-frame.is-open .bolts-card__actions {
	opacity: 1;
	transform: none;
}

.bolts-card-frame:focus-within .bolts-card__excerpt,
.bolts-card-frame.is-open .bolts-card__excerpt {
	opacity: 0.85;
	transform: none;
}

/* -- reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.bolts-card-frame,
	.bolts-card__img,
	.bolts-card__front,
	.bolts-card__footer::before,
	.bolts-card__scrim,
	.bolts-card__detail,
	.bolts-card__detail-role,
	.bolts-card__row,
	.bolts-card__excerpt,
	.bolts-card__actions {
		transition-duration: 1ms !important;
		transition-delay: 0ms !important;
		transform: none !important;
	}

	.bolts-card-frame {
		opacity: 1;
	}
}

.bolts-card-clip {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
}

.bolts-notice {
	padding: 0.75rem 1rem;
	border-left: 3px solid currentColor;
	opacity: 0.7;
	font-size: 0.9rem;
}
