/* ==========================================================================
   Project Related (neilkelly/project-related)
   Figma: project-profile-slabtown-kitchen / Related (764:569)
   Heading + 3-up project cards. Card design mirrors the Location Featured
   Projects block: a floating white→neutral gradient card with a photo, a body
   (title, Location·Service·Scope eyebrow, blurb, designer byline) and a grey
   "Featured Project" panel holding the project's testimonial + a "View Project"
   link. Cards align across the row via CSS subgrid. Token-driven.
   Wrapper: .wp-block-neilkelly-project-related.nk-project-related
   ========================================================================== */
.wp-block-neilkelly-project-related.nk-project-related {
	padding: var(--wp--preset--spacing--24) var(--wp--preset--spacing--gutter);
	background: var(--wp--preset--color--brand-white);
	font-family: var(--wp--preset--font-family--inter);
	box-sizing: border-box;
}

.wp-block-neilkelly-project-related .nk-project-related__container {
	max-width: var(--wp--custom--layout--content-width);
	margin-inline: auto;
}

.wp-block-neilkelly-project-related .nk-project-related__heading {
	/* Headline measure — three quarters of the content column, theme-wide (Shawn, 2026-08-18). */
	max-width: var(--wp--custom--layout--headline-measure);
	margin: 0 0 var(--wp--preset--spacing--10) 0;
	/* Size + case from the shared .nk-headline--structural class (mapped in render.php). */
	font-weight: var(--wp--custom--font-weight--extrabold);
	line-height: var(--wp--custom--line-height--xxl);
	letter-spacing: var(--wp--custom--letter-spacing--neg-102);
	color: var(--wp--preset--color--ink-primary);
}

/* --- Cards grid --- */
.wp-block-neilkelly-project-related .nk-project-related__grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	/* Three shared rows (media / body / featured) so the cards' inner sections
	   line up across the row via subgrid. Cards override the row gap to 0 so their
	   own inner rows stay seamless; the gap only separates wrapped card rows. */
	grid-template-rows: auto auto auto;
	column-gap: var(--wp--preset--spacing--6);
	row-gap: var(--wp--preset--spacing--6);
}

.wp-block-neilkelly-project-related .nk-project-related__card {
	position: relative;
	display: grid;
	grid-row: span 3;
	grid-template-rows: subgrid;
	row-gap: 0;
	background: linear-gradient(to bottom, var(--wp--preset--color--surface-card), var(--wp--preset--color--neutral-50));
	border: 1px solid var(--wp--preset--color--neutral-200);
	border-radius: var(--wp--custom--radius--card);
	box-shadow: var(--wp--custom--shadow--card-float);
	overflow: hidden;
}

/* --- Media --- */
.wp-block-neilkelly-project-related .nk-project-related__media {
	grid-row: 1;
	display: block;
	position: relative;
	width: 100%;
	height: var(--wp--custom--components--project--related-card-image-height);
	overflow: hidden;
}

.wp-block-neilkelly-project-related .nk-project-related__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.45s ease;
}

/* Cover image zooms on whole-card hover/focus (clipped by __media overflow) —
   the card's whole hover treatment, matching nk-person-featured-projects__card.
   `:focus-within` rather than `:focus-visible` because this card is an <li> and
   can't take focus itself; the links inside keep their own focus rings. */
.wp-block-neilkelly-project-related .nk-project-related__card:hover .nk-project-related__img,
.wp-block-neilkelly-project-related .nk-project-related__card:focus-within .nk-project-related__img {
	transform: scale(var(--wp--custom--components--team--card-hover-zoom));
}

/* --- Card body --- */
.wp-block-neilkelly-project-related .nk-project-related__body {
	grid-row: 2;
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--4);
	padding: var(--wp--preset--spacing--6-5) var(--wp--preset--spacing--6-5) var(--wp--preset--spacing--7);
}

.wp-block-neilkelly-project-related .nk-project-related__title {
	/* Case from the shared .nk-headline--structural class (mapped in render.php); the
	   block re-declares size at a higher specificity — card titles are 20px semibold,
	   not the 36px structural headline size. */
	margin: 0;
	font-size: var(--wp--preset--font-size--md);
	font-weight: var(--wp--custom--font-weight--semibold);
	line-height: var(--wp--custom--line-height--none);
	color: var(--wp--preset--color--ink-primary);
}

/* Uppercase, wide-tracked eyebrow — matches .nk-scope__featured-place.
   Two lines: "service • scope", then location. The lines are built in render.php,
   so this column takes however many it is given. */
.wp-block-neilkelly-project-related .nk-project-related__subtitle {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--1);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: var(--wp--custom--font-weight--regular);
	line-height: var(--wp--custom--line-height--none);
	letter-spacing: var(--wp--custom--letter-spacing--wide);
	text-transform: uppercase;
	color: var(--wp--preset--color--ink-primary);
}

.wp-block-neilkelly-project-related .nk-project-related__blurb {
	margin: 0;
	font-size: var(--wp--preset--font-size--ui-nav);
	line-height: var(--wp--custom--line-height--base);
	color: var(--wp--preset--color--ink-secondary);
}

/* Designer byline — avatar + name + role, mirrors .nk-cd-header__byline.
   Pinned to the foot of the body: the body stretches to the shared subgrid row
   height, so `margin-top: auto` pushes the byline down and the bylines line up
   across the row even when titles/blurbs run to different lengths. */
.wp-block-neilkelly-project-related .nk-project-related__designer {
	margin-top: auto;
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--3);
	text-decoration: none;
	color: inherit;
}
/* Renders as an anchor when the designer is a viewable People CPT record.
   Only the anchor variant is interactive; the span fallback stays static
   (matches nk-project-overview-strip__member-link). */
a.nk-project-related__designer:hover .nk-project-related__designer-name {
	text-decoration: underline;
}
a.nk-project-related__designer:focus-visible {
	outline: 2px solid var(--wp--preset--color--ink-primary);
	outline-offset: 2px;
	border-radius: var(--wp--custom--radius--default);
}

.wp-block-neilkelly-project-related .nk-project-related__designer-avatar {
	display: block;
	flex: 0 0 auto;
	width: var(--wp--custom--components--content-detail--avatar-size);
	height: var(--wp--custom--components--content-detail--avatar-size);
	border-radius: var(--wp--custom--radius--full);
	border: 1px solid var(--wp--preset--color--border-default);
	overflow: hidden;
}

.wp-block-neilkelly-project-related .nk-project-related__designer-avatar-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center top; /* keep the head in frame, not center-cropped */
}
/* Neil Kelly box-logo fallback (no active designer): the logo sits on the brand-red-logo
   disc (#d71921, the logo's own red) so there's no white gap inside the circle. */
.wp-block-neilkelly-project-related .nk-project-related__designer-avatar--logo .nk-project-related__designer-avatar-img {
	object-fit: contain;
	background: var(--wp--preset--color--brand-red-logo);
	padding: var(--wp--preset--spacing--0-5);
	box-sizing: border-box;
}

.wp-block-neilkelly-project-related .nk-project-related__designer-text {
	display: flex;
	flex-direction: column;
	text-align: left;
}

.wp-block-neilkelly-project-related .nk-project-related__designer-name {
	color: var(--wp--preset--color--ink-primary);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: var(--wp--custom--font-weight--bold);
}

.wp-block-neilkelly-project-related .nk-project-related__designer-role {
	color: var(--wp--preset--color--ink-secondary);
	font-size: var(--wp--preset--font-size--sm);
}

/* --- Featured Project panel (grey foot of the card) --- */
/* Deliberately unpositioned: the card is the containing block for the "View
   Project" link's whole-card overlay, so `inset: 0` must resolve against the card
   and not against this panel. */
.wp-block-neilkelly-project-related .nk-project-related__featured {
	grid-row: 3;
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--4);
	/* Top/bottom match .nk-project-related__body (6-5 / 7); sides stay 6-5. */
	padding: var(--wp--preset--spacing--6-5) var(--wp--preset--spacing--6-5) var(--wp--preset--spacing--7);
	background: var(--wp--preset--color--surface-subtle);
	border-top: 1px solid var(--wp--preset--color--neutral-200);
}

/* Testimonials toggled off (related_show_testimonial): the panel holds nothing but
   the "View Project" link, so it stops reading as a panel — drop the grey fill and
   the divider and let the link sit on the card's own gradient. Zero the top padding
   too: with no border to separate them, the body's bottom padding (7) is the whole
   gap, and the bottom padding evens out to 6-5 (the extra bottom space only existed
   to balance the testimonial sub-card sitting above it). */
.wp-block-neilkelly-project-related .nk-project-related__featured--bare {
	padding-top: 0;
	padding-bottom: var(--wp--preset--spacing--6-5);
	background: none;
	border-top: 0;
}

/* --- Testimonial sub-card ---
   Fills the panel's spare height (`flex: 1`) so the white sub-cards are equal
   height across the row and the "View Project" link sits directly beneath each
   one instead of after a ragged gap. Content stays top-aligned inside. */
.wp-block-neilkelly-project-related .nk-project-related__testimonial {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--1-75);
	padding: var(--wp--preset--spacing--3) var(--wp--preset--spacing--5);
	background: var(--wp--preset--color--surface-card);
	border: 1px solid var(--wp--preset--color--border-subtle);
	border-radius: var(--wp--custom--radius--card);
	margin: 0;
}

.wp-block-neilkelly-project-related .nk-project-related__testimonial-mark {
	height: var(--wp--custom--components--kitchen-remodel--tier-testimonial-mark-height);
	font-size: var(--wp--preset--font-size--xxl);
	font-weight: var(--wp--custom--font-weight--extrabold);
	line-height: var(--wp--custom--line-height--none);
	color: var(--wp--preset--color--brand-red);
}

.wp-block-neilkelly-project-related .nk-project-related__testimonial-quote {
	font-size: var(--wp--preset--font-size--base);
	font-weight: var(--wp--custom--font-weight--medium);
	line-height: var(--wp--custom--line-height--md-tight);
	color: var(--wp--preset--color--ink-primary);
	margin: 0;
}

/* Pinned to the foot of the sub-card, which now stretches (`flex: 1` above), so
   the attributions sit on a common line across the row under quotes of differing
   length. */
.wp-block-neilkelly-project-related .nk-project-related__testimonial-cite {
	margin-top: auto;
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--0-5);
}

.wp-block-neilkelly-project-related .nk-project-related__testimonial-name {
	font-size: var(--wp--preset--font-size--sm-md);
	font-weight: var(--wp--custom--font-weight--bold);
	color: var(--wp--preset--color--ink-primary);
}

.wp-block-neilkelly-project-related .nk-project-related__testimonial-place {
	font-size: var(--wp--preset--font-size--xs);
	font-weight: var(--wp--custom--font-weight--regular);
	color: var(--wp--preset--color--ink-secondary);
}

/* --- "View Project" link — red arrow link --- */
/* Pinned to the foot of the grey panel — same trick as the designer byline: the
   panel stretches to the shared subgrid row, so `margin-top: auto` lines the
   "View Project" links up across the row despite uneven testimonial lengths. */
.wp-block-neilkelly-project-related .nk-project-related__view {
	margin-top: auto;
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	gap: var(--wp--preset--spacing--1);
	font-size: var(--wp--preset--font-size--ui-nav);
	font-weight: var(--wp--custom--font-weight--medium);
	text-decoration: none;
	color: var(--wp--preset--color--brand-red);
}

.wp-block-neilkelly-project-related .nk-project-related__view:focus-visible {
	outline: 2px solid var(--wp--preset--color--brand-red);
	outline-offset: 2px;
}

/* --- Whole-card click target ---
   The "View Project" link stretches an invisible overlay over the entire card, so
   clicking anywhere on the card opens the project. One anchor, one tab stop, no JS —
   and because a pseudo-element's hover counts as hovering its owner, the arrow
   nudge below now answers to the whole card. Trade-off: the overlay also suppresses
   text selection inside the card. */
.wp-block-neilkelly-project-related .nk-project-related__view::after {
	content: "";
	position: absolute;
	inset: 0;
}

/* The designer byline keeps its own destination: only the anchor variant lifts
   above the card overlay. The non-linked <span> variant stays under it, so that
   part of the card still opens the project. */
a.nk-project-related__designer {
	position: relative;
	z-index: 1;
}

.wp-block-neilkelly-project-related .nk-project-related__arrow {
	display: inline-block;
	transition: transform 200ms ease;
}

.wp-block-neilkelly-project-related .nk-project-related__view:hover .nk-project-related__arrow,
.wp-block-neilkelly-project-related .nk-project-related__view:focus-visible .nk-project-related__arrow {
	transform: translateX(var(--wp--preset--spacing--1-5));
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-neilkelly-project-related .nk-project-related__arrow,
	.wp-block-neilkelly-project-related .nk-project-related__img { transition: none; }

	.wp-block-neilkelly-project-related .nk-project-related__card:hover .nk-project-related__img,
	.wp-block-neilkelly-project-related .nk-project-related__card:focus-within .nk-project-related__img,
	.wp-block-neilkelly-project-related .nk-project-related__view:hover .nk-project-related__arrow,
	.wp-block-neilkelly-project-related .nk-project-related__view:focus-visible .nk-project-related__arrow { transform: none; }
}

/* --- Responsive --- */
@media (max-width: 1023px) {
	.wp-block-neilkelly-project-related.nk-project-related {
		padding: var(--wp--preset--spacing--16) var(--wp--preset--spacing--12);
	}
	/* Two columns; cards keep the subgrid so media/body/featured still align per row. */
	.wp-block-neilkelly-project-related .nk-project-related__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 767px) {
	.wp-block-neilkelly-project-related.nk-project-related {
		padding: var(--wp--preset--spacing--12) var(--wp--preset--spacing--6);
	}
	/* Single column: drop the subgrid (nothing to align across) and restore the
	   vertical gap between stacked cards; cards revert to a plain flex column. */
	.wp-block-neilkelly-project-related .nk-project-related__grid {
		grid-template-columns: 1fr;
		grid-template-rows: none;
		row-gap: var(--wp--preset--spacing--6);
	}
	.wp-block-neilkelly-project-related .nk-project-related__card {
		display: flex;
		flex-direction: column;
		grid-row: auto;
	}
}

/* No block-gap seam between full-bleed sections. */
.wp-block-neilkelly-project-related { margin-block: 0; }

/* Last section in <main> (CTA Close smart-hid): pull the footer up 24px to close
   the seam above it — see the same rule in project-materials. */
.wp-block-neilkelly-project-related:last-child {
	margin-bottom: calc(-1 * var(--wp--preset--spacing--6));
}
