/**
 * ExpertiseWP frontend styles.
 *
 * Built to look intentional no matter the theme or page builder:
 *
 *  1. Scoped defensive reset, every rule lives under the `.expertisewp` root, which
 *     normalises box-sizing, image sizing and list/heading/anchor bleed so hostile
 *     theme/builder CSS can't distort a component. No !important is used anywhere.
 *  2. Container queries, each component is its own container (`container-type:
 *     inline-size`), so a box reflows to fit a narrow Bricks/Elementor column or a
 *     full-width block based on ITS box width, not the viewport.
 *  3. Two modes, `.expertisewp--contained` brings a complete, self-styled look that
 *     holds up anywhere; `.expertisewp--inherit` blends into a well-styled theme.
 *
 * Sizes are in `em`, never `rem`: many builders (Bricks, Oxygen and others) set the
 * root font size to 62.5%, which would shrink every rem-based size to ~60%. `em` keeps
 * components in proportion to the surrounding body text instead.
 *
 * All visual values are CSS custom properties, so a theme can retune without fighting
 * specificity (e.g. set `--ewp-accent` on `.expertisewp`).
 */

/* ------------------------------------------------------------------ */
/* Scope root: tokens, containment and defensive reset                */
/* ------------------------------------------------------------------ */
.expertisewp {
	/*
	 * Accent colour: adopt the website's primary colour automatically. We cascade
	 * through the custom properties the major systems expose for their primary/brand
	 * colour (block-theme theme.json presets, Elementor), falling back to our own blue
	 * only when none is found. A site can hard-set this with `--ewp-accent`, and the
	 * plugin's "Accent colour" setting injects an explicit value when configured.
	 */
	--ewp-accent: var(
		--wp--preset--color--primary,
		var(
			--wp--preset--color--accent,
			var( --e-global-color-primary, #2563eb )
		)
	);
	--ewp-gap: 1em;
	--ewp-pad: 1.25em;
	--ewp-radius: 12px;
	--ewp-border-color: color-mix(in srgb, currentColor 16%, transparent);
	--ewp-muted: color-mix(in srgb, currentColor 62%, transparent);
	--ewp-surface: color-mix(in srgb, currentColor 4%, transparent);
	--ewp-link: inherit;
	--ewp-fs-name: inherit;
	--ewp-fs-title: inherit;
	--ewp-fs-h1: inherit;
	--ewp-fs-h2: inherit;

	box-sizing: border-box;
	container-type: inline-size;
	/*
	 * A size container has no intrinsic width, so as a flex/grid item that is not
	 * stretched (Bricks' content area is a flex column with align-items: flex-start) it
	 * would collapse to 0px wide. An explicit width keeps it filling its parent.
	 */
	width: 100%;
	color: inherit;
	line-height: 1.5;
}

.expertisewp *,
.expertisewp *::before,
.expertisewp *::after {
	box-sizing: inherit;
}

/* Normalise the properties themes/builders most often clobber. */
.expertisewp img {
	max-width: 100%;
	display: block;
}

.expertisewp ul,
.expertisewp ol {
	margin: 0;
	padding: 0;
	list-style: none;
}

.expertisewp li {
	margin: 0;
}

.expertisewp p {
	margin: 0;
}

.expertisewp h1,
.expertisewp h2,
.expertisewp h3 {
	margin: 0;
	line-height: 1.25;
	color: inherit;
}

.expertisewp a {
	color: var(--ewp-link);
}

/* ------------------------------------------------------------------ */
/* Mode tokens                                                        */
/* ------------------------------------------------------------------ */
.expertisewp--contained {
	/*
	 * Links keep the theme's own link colour so they stay readable whatever the brand
	 * accent is (a bright accent like yellow would fail contrast as link text). The
	 * accent is reserved for icons and other decorative touches.
	 */
	--ewp-fs-name: 1.0625em;
	--ewp-fs-title: 0.9375em;
	--ewp-fs-h1: clamp(1.6em, 5cqi, 2.25em);
	--ewp-fs-h2: 1.2em;
}

/* ------------------------------------------------------------------ */
/* Boxes (author / reviewer)                                          */
/* ------------------------------------------------------------------ */
.expertisewp-box {
	display: flex;
	gap: var(--ewp-gap);
	align-items: flex-start;
	margin: 1.5em 0;
}

.expertisewp-box__photo {
	flex: 0 0 auto;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	object-fit: cover;
}

.expertisewp-box--reviewer .expertisewp-box__photo {
	width: 52px;
	height: 52px;
}

.expertisewp-box__body {
	min-width: 0;
}

.expertisewp-box__eyebrow {
	margin: 0 0 0.35em;
	font-size: 0.72em;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ewp-muted);
}

.expertisewp-box__name {
	margin: 0;
	font-size: var(--ewp-fs-name);
	font-weight: 700;
	line-height: 1.3;
}

.expertisewp-box__title {
	margin: 0.25em 0 0;
	color: var(--ewp-muted);
	font-size: var(--ewp-fs-title);
}

.expertisewp-box__bio {
	margin: 0.65em 0 0;
	line-height: 1.5;
}

.expertisewp-box__link {
	margin: 0.8em 0 0;
	font-size: 0.9em;
}

/* ------------------------------------------------------------------ */
/* Specialist card                                                    */
/* ------------------------------------------------------------------ */
.expertisewp-card {
	margin: 1.5em 0;
}

.expertisewp-card__eyebrow {
	margin: 0 0 0.9em;
	font-size: 0.72em;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ewp-muted);
}

.expertisewp-card__inner {
	display: flex;
	gap: 1.1em;
	align-items: center;
}

.expertisewp-card__photo {
	flex: 0 0 auto;
	width: 88px;
	height: 88px;
	border-radius: 50%;
	object-fit: cover;
}

.expertisewp-card__body {
	min-width: 0;
}

.expertisewp-card__name {
	margin: 0;
	font-size: 1.15em;
	font-weight: 700;
	line-height: 1.3;
}

.expertisewp-card__meta {
	margin: 0.3em 0 0;
	color: var(--ewp-muted);
	font-size: 0.9em;
}

.expertisewp-card__bio {
	margin: 0.7em 0 0;
	line-height: 1.5;
}

.expertisewp-card__link {
	margin: 0.85em 0 0;
}

/* ------------------------------------------------------------------ */
/* Profile pages                                                      */
/* ------------------------------------------------------------------ */
.expertisewp-profile__header {
	display: flex;
	gap: 1.5em;
	align-items: flex-start;
	margin-bottom: 2em;
}

.expertisewp-profile__photo {
	flex: 0 0 auto;
	width: 150px;
	height: 150px;
	border-radius: var(--ewp-radius);
	object-fit: cover;
}

.expertisewp-profile__photo--round {
	border-radius: 50%;
}

.expertisewp-profile__name {
	font-size: var(--ewp-fs-h1);
}

.expertisewp-profile__title {
	margin: 0.35em 0 0;
	color: var(--ewp-muted);
	font-size: 1.05em;
}

.expertisewp-profile__experience,
.expertisewp-profile__intro {
	margin: 0.5em 0 0;
}

.expertisewp-profile__columns {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	gap: 2.5em;
	align-items: start;
}

/*
 * Related content runs full width below the two columns and flows into balanced
 * columns, so links sit on one line and a long list (e.g. many services) stays compact
 * instead of a single tall stack. Groups never break across a column.
 */
.expertisewp-profile__related--full {
	margin-top: 2.25em;
	padding-top: 1.75em;
	border-top: 1px solid var(--ewp-border-color);
}

.expertisewp-profile__related--full .expertisewp-related__group {
	margin: 0 0 1.5em;
}

.expertisewp-profile__related--full .expertisewp-related__list {
	columns: 17em;
	column-gap: 2.5em;
	padding-left: 0;
	list-style: none;
}

.expertisewp-profile__related--full .expertisewp-related__list li {
	break-inside: avoid;
	margin: 0 0 0.4em;
}

.expertisewp-profile__section {
	margin: 0 0 1.75em;
}

.expertisewp-profile__section h2 {
	font-size: var(--ewp-fs-h2);
	margin: 0 0 0.75em;
}

.expertisewp-profile__bio p {
	margin: 0 0 1em;
}

/* Lists, tags and credentials */
.expertisewp-taglist {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
}

.expertisewp-taglist li {
	padding: 0.2em 0.65em;
	border: 1px solid var(--ewp-border-color);
	border-radius: 999px;
	font-size: 0.85em;
}

.expertisewp-list li {
	margin: 0 0 0.4em;
}

.expertisewp-list--links li,
.expertisewp-credentials__item {
	margin: 0 0 0.6em;
}

.expertisewp-credentials__name {
	display: block;
	font-weight: 600;
}

.expertisewp-credentials__issuer {
	display: block;
	color: var(--ewp-muted);
	font-size: 0.9em;
}

/* Related content */
.expertisewp-related__group {
	margin: 0 0 1.25em;
}

.expertisewp-related__heading {
	font-size: 1em;
	margin: 0 0 0.5em;
}

.expertisewp-related__list {
	margin: 0;
	padding-left: 1.1em;
	list-style: disc;
}

.expertisewp-related__list li {
	margin: 0 0 0.3em;
}

/* ------------------------------------------------------------------ */
/* Icons, icon headings and section dividers                          */
/* ------------------------------------------------------------------ */
.expertisewp-icon {
	flex: 0 0 auto;
	width: 1.05em;
	height: 1.05em;
	color: var(--ewp-muted);
	/*
	 * Centre the icon on the FIRST line of text. Because labels can wrap to two lines,
	 * the row aligns to the top (align-items: flex-start) and the icon is nudged down by
	 * half the leading of a single line so it lines up with the first line rather than
	 * floating in the middle of a wrapped block. 1lh resolves to the line height; the
	 * max() keeps it from going negative, and older engines simply fall back to the top.
	 */
	margin-top: max(0px, calc((1lh - 1.05em) / 2));
}

.expertisewp-profile__heading,
.expertisewp-profile__title,
.expertisewp-profile__experience,
.expertisewp-related__heading,
.expertisewp-box__eyebrow,
.expertisewp-card__eyebrow {
	display: flex;
	align-items: flex-start;
	gap: 0.5em;
}

/* Eyebrow icons sit next to small uppercase labels, so give them a fixed size. */
.expertisewp-box__eyebrow .expertisewp-icon,
.expertisewp-card__eyebrow .expertisewp-icon {
	width: 0.95em;
	height: 0.95em;
	margin-top: max(0px, calc((1lh - 0.95em) / 2));
}

/* Accent the box/card eyebrow icons in contained mode. */
.expertisewp--contained .expertisewp-box__eyebrow .expertisewp-icon,
.expertisewp--contained .expertisewp-card__eyebrow .expertisewp-icon {
	color: var(--ewp-accent);
}

.expertisewp-profile__heading {
	font-size: var(--ewp-fs-h2);
	margin: 0 0 0.85em;
}

/* A hairline under the header and between sections, drawn in the inherited colour. */
.expertisewp-profile__header {
	border-bottom: 1px solid var(--ewp-border-color);
	padding-bottom: 1.75em;
}

.expertisewp-profile__section + .expertisewp-profile__section {
	border-top: 1px solid var(--ewp-border-color);
	padding-top: 1.5em;
}

.expertisewp-related__group + .expertisewp-related__group {
	margin-top: 1em;
}

/* Accent the section-heading icons in contained mode; stay quiet when inheriting. */
.expertisewp--contained .expertisewp-profile__heading .expertisewp-icon,
.expertisewp--contained .expertisewp-related__heading .expertisewp-icon {
	color: var(--ewp-accent);
}

/* ------------------------------------------------------------------ */
/* Contained mode: a complete, self-styled look                       */
/* ------------------------------------------------------------------ */
.expertisewp--contained.expertisewp-box,
.expertisewp--contained.expertisewp-card {
	padding: var(--ewp-pad);
	background: var(--ewp-surface);
	border: 1px solid var(--ewp-border-color);
	border-radius: var(--ewp-radius);
}

.expertisewp--contained .expertisewp-box__link a,
.expertisewp--contained .expertisewp-card__link a {
	font-weight: 600;
	text-decoration: none;
}

.expertisewp--contained .expertisewp-box__link a:hover,
.expertisewp--contained .expertisewp-card__link a:hover {
	text-decoration: underline;
}

/* ------------------------------------------------------------------ */
/* Dedicated page wrapper (plugin profile template)                   */
/* ------------------------------------------------------------------ */
.expertisewp-page__inner {
	/* Use the theme's WIDE width (profiles benefit from the two-column layout);
	   fall back to the content width, then a sensible default. */
	max-width: var(--wp--style--global--wide-size, var(--wp--style--global--content-size, 1140px));
	box-sizing: border-box;
	width: 100%;
	margin-inline: auto;
	padding: clamp(1.5em, 4vw, 3em) clamp(1em, 4vw, 2em);
}

/*
 * Bricks' default (non-builder) content area is an unpadded container, so a profile
 * injected straight into it would sit flush against the header and the screen edges.
 */
#brx-content.layout-default > .expertisewp-profile {
	padding: clamp(1.5em, 4vw, 3em) clamp(1em, 4vw, 2em);
}

/* ------------------------------------------------------------------ */
/* Container queries, reflow to the component's own width            */
/* ------------------------------------------------------------------ */
@container (max-width: 400px) {
	.expertisewp-box {
		flex-direction: column;
	}

	.expertisewp-card__inner {
		flex-direction: column;
		text-align: center;
	}
}

@container (max-width: 680px) {
	.expertisewp-profile__columns {
		grid-template-columns: 1fr;
		gap: 1.5em;
	}

	.expertisewp-profile__header {
		flex-direction: column;
	}
}

/* Viewport fallback for very old engines without container query support. */
@supports not (container-type: inline-size) {
	@media (max-width: 680px) {
		.expertisewp-profile__columns {
			grid-template-columns: 1fr;
		}

		.expertisewp-profile__header {
			flex-direction: column;
		}
	}
}
