/*
 * The grid is the platform's three build breakpoints (P-004 FR-056, FR-057): 1 column below 768,
 * 2 at 768–1023, 3 at 1024 and above. Stated once at the top of
 * `themes/bdental-base/assets/structure.css`; a pixel width in a media query is structure, not a
 * design value, which is one of that file's two stated exceptions to the no-px rule.
 *
 * **This replaces `repeat(auto-fill, minmax(180px, 1fr))`, and the removal is the point.** An
 * `auto-fill` grid reflows wherever its own track minimum happens to fall, so this block changed
 * column count at a width no other component on the platform did — 180px here, 240px in
 * `testimonials`, 600px in `treatment-cards`. Three components, three answers to the same question.
 * Do not reinstate it as a fallback: a fallback would be a fourth answer.
 */
.bdental-team-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr;
	/* P-003 FR-021: the grid gap is `sm` (24px), from the scale, not the extracted 1.5rem. */
	gap: var(--wp--preset--spacing--sm);
}

@media (min-width: 768px) {
	.bdental-team-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.bdental-team-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.bdental-team-grid--columns-4 {
		grid-template-columns: repeat(4, 1fr);
	}
}

.bdental-team-grid__member {
	position: relative;
	text-align: center;
	border-radius: var(--wp--custom--radius--card);
	box-shadow: var(--wp--custom--shadow--resting);
	overflow: hidden;
	background-color: var(--wp--preset--color--page-background);
	display: flex;
	flex-direction: column;
	height: 100%;
}

.bdental-team-grid__photo img {
	aspect-ratio: 4 / 5;
	object-fit: cover;
	object-position: center top;
	width: 100%;
	height: auto;
	display: block;
}

.bdental-team-grid__plate {
	align-items: center;
	background-color: var(--wp--preset--color--page-background);
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	padding: var(--wp--preset--spacing--sm);
}

.bdental-team-grid__name {
	margin: var(--wp--preset--spacing--xxs) 0 0;
	font-size: var(--wp--preset--font-size--h-4);
	font-weight: 600;
	color: var(--wp--preset--color--heading);
}

/*
 * One `<a>` per card, stretched over the whole `<li>` via `::after` rather than wrapping the
 * photo too — a screen reader would otherwise hear the same destination twice and a keyboard
 * user would tab through it twice. `color` is reset here so the link reads identically to the
 * plain-text name it replaces, and the underline is a `:hover`-only affordance — drawn
 * transparent at rest rather than absent, for the reason inside the rule.
 *
 * `:root` keeps the specificity structure.css's booking/registration links already need for the
 * same reason (see that file's comment): a bare class (0,1,0) loses to the `.wp-elements-<hash>
 * a` rule WordPress writes the moment an editor sets a link colour on any group or paragraph
 * wrapping this block (0,1,1), which would tint the name at rest and break Decision 2.
 */
:root .bdental-team-grid__link {
	color: inherit;
	/*
	 * P-004 FR-062, slice T5 — the underline is declared at **both** states with a transparent
	 * colour and coloured in on hover, rather than switched on with `text-decoration-line`.
	 *
	 * That is the platform's idiom, not a local invention: `structure.css` draws FR-052's
	 * navigation underline and FR-061's tertiary underline the same way, and the reason is the
	 * same. `text-decoration-line` is **not animatable**, so the only handle a fade has is
	 * `text-decoration-color`. It also means the underline occupies no layout at either state, so
	 * nothing under the name shifts when it appears.
	 *
	 * This block is the only one of the three card stylesheets whose hover changes anything at all:
	 * `team-grid` now carries a resting card surface and shadow (P-003 FR-040), with no hover
	 * change to either. The underline is the whole of its motion, and 200ms is
	 * the card duration slice T5 gives all three.
	 */
	text-decoration: underline;
	text-decoration-color: transparent;
	transition: text-decoration-color 200ms ease-out;
}

/*
 * `:focus-visible` alongside `:hover`, added on this ticket's review. Without it a mouse user got
 * the underline and a keyboard user got only the ring on `::after`, which is a quiet divergence
 * from the parity `treatment-cards` states two files away — `:hover` and `:focus-within` drawing
 * one state there. The ring is still the state that matters for keyboard; this just stops the two
 * input methods showing different things for the same intent.
 *
 * `:focus-visible`, not `:focus`: the rule below deliberately suppresses the theme's `:focus`
 * outline on a mouse click, and an underline appearing on every click would reintroduce exactly the
 * flash that suppression exists to stop.
 */
:root .bdental-team-grid__link:hover,
:root .bdental-team-grid__link:focus-visible {
	text-decoration-color: currentColor;
}

.bdental-team-grid__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

/*
 * The focus ring belongs on the card, not on the inline name text — with a stretched link, a
 * ring drawn around just the name would misrepresent what's actually clickable. Suppressed here
 * on plain `:focus`, not just `:focus-visible`: the child theme's own `elements.link` styles set
 * a `:focus` outline on every link site-wide, and a mouse click matches `:focus` without matching
 * `:focus-visible`, so scoping the suppression to `:focus-visible` alone left the theme's ring
 * flashing around the bare name on every mouse click — found in review. `:root` for the same
 * specificity reason as the rest/hover rules above.
 */
:root .bdental-team-grid__link:focus {
	outline: none;
}

.bdental-team-grid__link:focus-visible::after {
	outline: 2px solid var(--wp--preset--color--focus-ring);
	/*
	 * Inside the card, which clips anything outside it (P-003 FR-040): the offset is the ring's own
	 * width, and the radius follows the card's so the clipped corners leave no gap.
	 */
	outline-offset: -2px;
	border-radius: var(--wp--custom--radius--card);
}

/*
 * The 0.125rem top margin is **deleted**, not mapped — 2px has no preset and FR-021 prefers losing
 * it to inventing one. `margin: 0` rather than dropping the declaration, because the shorthand was
 * also zeroing the user agent's paragraph margins.
 */
.bdental-team-grid__role {
	margin: 0;
	color: var(--wp--preset--color--body-secondary);
	font-size: var(--wp--preset--font-size--body);
}

.bdental-team-grid__empty {
	color: var(--wp--preset--color--body-secondary);
}

/*
 * The foot line ("Meet Dr Atif" and an arrow), P-003 FR-091 item 3: decorative, not a second link, so the card keeps its
 * one stretched link. Its look is the `profile` card's (`profile.css` sets the same rules under its own class); a hover
 * on the card, or the keyboard on its name, draws the underline and moves the arrow 3px, three eighths of `xxs`. It sits at
 * the card's foot, so a row of cards with roles of different lengths keeps the lines level.
 */
.bdental-team-grid__more {
	align-items: center;
	color: var(--wp--preset--color--link);
	display: inline-flex;
	font-size: calc(var(--wp--preset--font-size--body) * 0.9375);
	font-weight: 600;
	gap: var(--wp--preset--spacing--xxs);
	margin-top: auto;
	padding-top: var(--wp--preset--spacing--xs);
	text-decoration: underline;
	text-decoration-color: transparent;
	transition: text-decoration-color 200ms ease-out;
}

.bdental-team-grid__more svg {
	height: calc(var(--wp--preset--spacing--xs) * 1.125);
	transition: transform 150ms ease;
	width: calc(var(--wp--preset--spacing--xs) * 1.125);
}

.bdental-team-grid__member:hover .bdental-team-grid__more,
.bdental-team-grid__member:has(.bdental-team-grid__link:focus-visible) .bdental-team-grid__more {
	text-decoration-color: currentColor;
}

.bdental-team-grid__member:hover .bdental-team-grid__more svg,
.bdental-team-grid__member:has(.bdental-team-grid__link:focus-visible) .bdental-team-grid__more svg {
	transform: translateX(calc(0.375 * var(--wp--preset--spacing--xxs)));
}

/*
 * ---------------------------------------------------------------------------------------------
 * Reduced motion (P-004 FR-062, slice T5). THE LAST BLOCK IN THIS FILE.
 * ---------------------------------------------------------------------------------------------
 *
 * Guards the underline fade above. `:root` on the selector to match the specificity the rule it
 * guards needs for its own reasons — a bare class here would be (0,1,0) against that rule's
 * (0,2,0) and the guard would lose.
 *
 * The name's underline and the foot line lose their transitions (the arrow's move is dropped altogether). The underline
 * still **appears** on hover, instantly: reduced motion means less movement, not a state a visitor can no longer see. The card has no lift, but its foot line's
 * arrow moves 3px on hover, and that is suppressed below. The FR-040 surface and shadow stay at rest.
 *
 * Last in the file. Add new motion above this block and add its selectors here.
 */
@media (prefers-reduced-motion: reduce) {
	:root .bdental-team-grid__link {
		transition-duration: 0.01ms;
	}

	.bdental-team-grid__more,
	.bdental-team-grid__more svg {
		transition: none;
	}

	.bdental-team-grid__member:hover .bdental-team-grid__more svg,
	.bdental-team-grid__member:has(.bdental-team-grid__link:focus-visible) .bdental-team-grid__more svg {
		transform: none;
	}
}
