/**
 * Circadian Risk — Team Bio Modal
 *
 * The custom properties below are the styling hooks. Override them in
 * Elementor's Custom CSS rather than editing this file, so plugin updates
 * do not wipe your changes:
 *
 *   :root { --cr-team-modal-accent: #007CF4; }
 */

:root {
	--cr-team-modal-bg: #ffffff;
	--cr-team-modal-radius: 12px;
	--cr-team-modal-max-width: 820px;
	--cr-team-modal-overlay: rgba(0, 0, 0, 0.4);

	/* Circadian Risk brand blue. */
	--cr-team-modal-accent: #007CF4;
}

/* -------------------------------------------------------------------------
 * Card — the stretched trigger
 *
 * Elementor gives every .elementor-widget position: relative, which would
 * make the Shortcode widget the containing block for the absolutely
 * positioned trigger — the button then covers only the widget, sitting as a
 * strip at the bottom of the card. display: contents removes those wrapper
 * boxes from layout entirely, so the trigger anchors to .cr-team-card and
 * the widget stops consuming a flex gap.
 *
 * Skipped inside the Elementor editor, where a widget with no box cannot be
 * selected or deleted.
 * ---------------------------------------------------------------------- */

.cr-team-card {
	position: relative;
}

body:not(.elementor-editor-active) .cr-team-card .elementor-widget-shortcode,
body:not(.elementor-editor-active) .cr-team-card .elementor-widget-shortcode > .elementor-widget-container {
	display: contents;
}

.cr-team-card__trigger {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 100%;
	height: 100%;
	border-radius: inherit;
	font: inherit;
	color: inherit;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

/**
 * Neutralise theme and Elementor Kit button styling.
 *
 * This element is an invisible hit area stretched over the card. Themes and
 * Elementor's global Buttons settings both style bare <button> elements, and
 * those selectors routinely out-specify a single class — the result is an
 * opaque panel painted over the card, which reads as "the card went blank".
 *
 * !important is deliberate here, and so is the redundant-looking
 * `.cr-team-card button.cr-team-card__trigger` selector. Among competing
 * !important declarations the more specific one wins, so a theme rule like
 * `.e-con button { background: #02122d !important }` would beat a single
 * class. This selector scores higher than anything a theme is likely to
 * aim at a bare button, and it targets only this element.
 */
.cr-team-card button.cr-team-card__trigger,
.cr-team-card button.cr-team-card__trigger:hover,
.cr-team-card button.cr-team-card__trigger:focus,
.cr-team-card button.cr-team-card__trigger:active,
.cr-team-card button.cr-team-card__trigger:visited {
	margin: 0 !important;
	padding: 0 !important;
	min-width: 0 !important;
	min-height: 0 !important;
	background: transparent !important;
	background-image: none !important;
	border: 0 !important;
	box-shadow: none !important;
	text-shadow: none !important;
	filter: none !important;
	transform: none !important;
	transition: none !important;
}

.cr-team-card__trigger:focus-visible {
	outline: 2px solid var(--cr-team-modal-accent);
	outline-offset: 3px;
}

/* Links and buttons on the card face stay clickable above the trigger. */
.cr-team-card a,
.cr-team-card button:not(.cr-team-card__trigger) {
	position: relative;
	z-index: 3;
}

/* The payload is never shown on the card — modal only. */
.cr-team-card__data {
	display: none !important;
}

/* -------------------------------------------------------------------------
 * Modal
 * ---------------------------------------------------------------------- */

.cr-team-modal[hidden] {
	display: none;
}

.cr-team-modal {
	position: fixed;
	inset: 0;
	z-index: 99999; /* Above Elementor's sticky header (z-index 9999). */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
}

.cr-team-modal__overlay {
	position: absolute;
	inset: 0;
	background: var(--cr-team-modal-overlay);
	opacity: 0;
	transition: opacity 180ms ease;
}

.cr-team-modal.is-open .cr-team-modal__overlay {
	opacity: 1;
}

.cr-team-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: var(--cr-team-modal-max-width);
	max-height: calc(100vh - 48px);
	max-height: calc(100dvh - 48px);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	padding: 48px;
	background: var(--cr-team-modal-bg);
	border-radius: var(--cr-team-modal-radius);
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	transition: opacity 180ms ease, transform 180ms ease;
}

.cr-team-modal.is-open .cr-team-modal__dialog {
	opacity: 1;
	transform: none;
}

.cr-team-modal__dialog:focus {
	outline: none;
}

.cr-team-modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 50%;
	font-size: 30px;
	line-height: 1;
	color: var(--cr-team-modal-accent);
	cursor: pointer;
	transition: background-color 150ms ease, transform 150ms ease;
}

.cr-team-modal__close:hover {
	background: color-mix(in srgb, var(--cr-team-modal-accent) 12%, transparent);
}

.cr-team-modal__close:focus-visible {
	outline: 2px solid var(--cr-team-modal-accent);
	outline-offset: 2px;
}

/* -------------------------------------------------------------------------
 * Modal content
 * ---------------------------------------------------------------------- */

.cr-team-modal__photo {
	margin: 0 0 20px;
}

.cr-team-modal__photo img {
	display: block;
	width: 120px;
	height: 120px;
	object-fit: cover;
	border-radius: 50%;
}

.cr-team-modal__name {
	margin: 0 0 4px;
	font-size: 1.6em;
	line-height: 1.2;
}

.cr-team-modal__job {
	margin: 0 0 16px;
	opacity: 0.75;
}

.cr-team-modal__links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin: 0 0 24px;
}

.cr-team-modal__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--cr-team-modal-accent);
	text-decoration: none;
	transition: opacity 150ms ease, transform 150ms ease;
}

.cr-team-modal__link:hover,
.cr-team-modal__link:focus-visible {
	color: var(--cr-team-modal-accent);
	opacity: 0.75;
}

.cr-team-modal__link:focus-visible {
	outline: 2px solid var(--cr-team-modal-accent);
	outline-offset: 4px;
	border-radius: 4px;
}

.cr-team-modal__links--icons {
	gap: 18px;
}

.cr-team-modal__links--icons .cr-team-modal__link {
	width: 22px;
	height: 22px;
}

.cr-team-modal__icon {
	display: block;
	width: 100%;
	height: 100%;
	fill: currentColor;
}

.cr-team-modal__bio > *:first-child {
	margin-top: 0;
}

.cr-team-modal__bio > *:last-child {
	margin-bottom: 0;
}

/* -------------------------------------------------------------------------
 * Page state while open
 * ---------------------------------------------------------------------- */

body.cr-team-modal-open {
	overflow: hidden;
	/* Compensate for the removed scrollbar so the layout does not jump. */
	padding-right: var(--cr-scrollbar, 0px);
}

/* -------------------------------------------------------------------------
 * Utilities — defined locally in case the theme does not provide them.
 * ---------------------------------------------------------------------- */

.cr-team-modal .screen-reader-text,
.cr-team-card__trigger .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* -------------------------------------------------------------------------
 * Small screens
 * ---------------------------------------------------------------------- */

@media (max-width: 782px) {
	.cr-team-modal {
		padding: 0;
		align-items: flex-end;
	}

	.cr-team-modal__dialog {
		max-width: none;
		max-height: 92vh;
		max-height: 92dvh;
		padding: 32px 24px;
		border-radius: var(--cr-team-modal-radius) var(--cr-team-modal-radius) 0 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cr-team-modal__overlay,
	.cr-team-modal__dialog {
		transition: none;
	}
}
