/* Org Chart Members: front end.
   Themes can override any --ocm-* variable on .ocm-chart / .ocm-modal. */

.ocm-chart,
.ocm-modal {
	--ocm-accent: #f59e0b;
	--ocm-card-bg: #fff;
	--ocm-text: #1f2937;
	--ocm-muted: #6b7280;
	--ocm-line: #cbd5e1;
	--ocm-radius: 14px;
	--ocm-photo-radius: 50%;
	--ocm-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
	--ocm-shadow-hover: 0 14px 36px rgba(16, 24, 40, .12);
	--ocm-tint: color-mix(in srgb, var(--ocm-accent) 12%, #fff);
}

.ocm-shape-rounded { --ocm-photo-radius: 18%; }
.ocm-shape-square { --ocm-photo-radius: 4px; }

.ocm-chart {
	--ocm-columns: 3;
	--ocm-gap: 32px;
	container-type: inline-size;
	color: var(--ocm-text);
	margin: 0 auto 48px;
}

.ocm-chart *,
.ocm-chart *::before,
.ocm-chart *::after,
.ocm-modal *,
.ocm-modal *::before,
.ocm-modal *::after {
	box-sizing: border-box;
}

.ocm-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Headings ---------- */

.ocm-chart .ocm-header {
	text-align: center;
	margin: 0 0 36px;
}

.ocm-chart .ocm-eyebrow {
	color: var(--ocm-accent);
	font-weight: 600;
	font-size: 1rem;
	letter-spacing: .02em;
	margin: 0 0 .4em;
}

.ocm-chart .ocm-title {
	margin: 0;
	font-size: clamp(1.8rem, 4vw, 2.8rem);
	line-height: 1.15;
}

.ocm-section + .ocm-section {
	margin-top: 72px;
}

/* ---------- Shared bits ---------- */

.ocm-photo {
	position: relative;
	flex: none;
	width: 140px;
	aspect-ratio: 1;
	border-radius: var(--ocm-photo-radius);
	overflow: hidden;
	display: grid;
	place-items: center;
	background: var(--ocm-tint);
	color: color-mix(in srgb, var(--ocm-accent) 65%, #000);
}

.ocm-chart .ocm-photo img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border-radius: 0;
	object-fit: cover;
	transition: transform .35s ease;
}

.ocm-photo > .ocm-icon {
	width: 46%;
	height: 46%;
}

.ocm-bar {
	display: block;
	width: 44px;
	height: 4px;
	border-radius: 4px;
	background: var(--ocm-accent);
	opacity: .55;
	margin: 18px auto 0;
}

/* The name button stretches over its whole card so the card is one big click target. */
.ocm-chart .ocm-trigger {
	all: unset;
	cursor: pointer;
	font: inherit;
	color: inherit;
	text-align: inherit;
}

.ocm-chart .ocm-trigger::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: inherit;
}

.ocm-chart .ocm-trigger:focus-visible::after {
	outline: 3px solid var(--ocm-accent);
	outline-offset: 3px;
	border-radius: var(--ocm-radius);
}

/* ---------- Grid layout ---------- */

.ocm-grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--ocm-gap);
}

.ocm-grid > .ocm-card {
	flex: 0 0 calc((100% - (var(--ocm-columns) - 1) * var(--ocm-gap)) / var(--ocm-columns));
	min-width: 0;
}

@container (max-width: 860px) {
	.ocm-grid > .ocm-card { flex-basis: calc((100% - var(--ocm-gap)) / 2); }
}

@container (max-width: 560px) {
	.ocm-chart { --ocm-gap: 20px; }
	.ocm-grid > .ocm-card { flex-basis: 100%; }
}

.ocm-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 44px 28px 36px;
	background: var(--ocm-card-bg);
	border-radius: var(--ocm-radius);
	box-shadow: var(--ocm-shadow);
	transition: transform .25s ease, box-shadow .25s ease;
}

.ocm-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--ocm-shadow-hover);
}

.ocm-card:hover .ocm-photo img { transform: scale(1.05); }

.ocm-card .ocm-photo { margin-bottom: 26px; }

.ocm-chart .ocm-card__name {
	margin: 0 0 8px;
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.25;
}

.ocm-chart .ocm-card__position {
	margin: 0;
	color: var(--ocm-muted);
	font-weight: 600;
	font-size: 1rem;
}

.ocm-card .ocm-bar { transition: width .25s ease, opacity .25s ease; }
.ocm-card:hover .ocm-bar { width: 64px; opacity: 1; }

/* Contact details (on cards when enabled, and in the popup) */

.ocm-chart .ocm-details,
.ocm-modal .ocm-details {
	list-style: none;
	margin: 24px 0 0;
	padding: 0;
	display: grid;
	gap: 12px;
	text-align: left;
}

.ocm-card .ocm-details { width: 100%; max-width: 300px; }

.ocm-details li {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	color: var(--ocm-muted);
	font-size: .98rem;
	overflow-wrap: anywhere;
}

.ocm-details .ocm-icon {
	flex: none;
	width: 20px;
	height: 20px;
	color: var(--ocm-text);
}

.ocm-details a {
	position: relative;
	z-index: 2;
	color: inherit;
	text-decoration: none;
}

.ocm-details a:hover { color: var(--ocm-accent); }

.ocm-socials {
	position: relative;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	margin-top: 26px;
}

.ocm-social {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 7px;
	color: #fff !important;
	text-decoration: none !important;
	box-shadow: 0 4px 10px rgba(0, 0, 0, .12);
	transition: transform .2s ease;
}

.ocm-social:hover { transform: translateY(-2px); }
.ocm-social .ocm-icon { width: 18px; height: 18px; }
.ocm-social--facebook { background: #1877f2; }
.ocm-social--x { background: #000; }
.ocm-social--linkedin { background: #0a66c2; }
.ocm-social--youtube { background: #ff0000; }
.ocm-social--instagram { background: linear-gradient(45deg, #f09433, #dc2743 50%, #bc1888); }

/* ---------- Tree layout ---------- */

.ocm-tree {
	overflow-x: auto;
	padding: 8px 4px 20px;
}

.ocm-chart .ocm-tree__list {
	position: relative;
	display: flex;
	justify-content: center;
	margin: 0;
	padding: 24px 0 0;
	list-style: none;
}

.ocm-tree > .ocm-tree__list {
	width: max-content;
	min-width: 100%;
	padding-top: 0;
}

.ocm-chart .ocm-tree__item {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	margin: 0;
	padding: 24px 10px 0;
	list-style: none;
}

/* Connector lines: each item draws half of the horizontal rail plus its own drop line. */
.ocm-tree__item::before,
.ocm-tree__item::after {
	content: "";
	position: absolute;
	top: 0;
	right: 50%;
	width: 50%;
	height: 24px;
	border-top: 2px solid var(--ocm-line);
}

.ocm-tree__item::after {
	right: auto;
	left: 50%;
	border-left: 2px solid var(--ocm-line);
}

.ocm-tree__item:first-child::before,
.ocm-tree__item:last-child::after { border: 0; }

.ocm-tree__item:last-child::before {
	border-right: 2px solid var(--ocm-line);
	border-radius: 0 8px 0 0;
}

.ocm-tree__item:first-child::after { border-radius: 8px 0 0 0; }

.ocm-tree__item:only-child::before,
.ocm-tree__item:only-child::after { display: none; }

.ocm-chart .ocm-tree__item:only-child { padding-top: 0; }

.ocm-tree__list .ocm-tree__list::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	height: 24px;
	border-left: 2px solid var(--ocm-line);
}

/* Several top-level people: no rail above them. */
.ocm-tree > .ocm-tree__list > .ocm-tree__item::before,
.ocm-tree > .ocm-tree__list > .ocm-tree__item::after { display: none; }
.ocm-chart .ocm-tree > .ocm-tree__list > .ocm-tree__item { padding-top: 0; }

.ocm-node {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 200px;
	padding: 22px 16px 18px;
	text-align: center;
	background: var(--ocm-card-bg);
	border-radius: var(--ocm-radius);
	border-top: 4px solid var(--ocm-accent);
	box-shadow: var(--ocm-shadow);
	transition: transform .25s ease, box-shadow .25s ease;
}

.ocm-node:hover {
	transform: translateY(-3px);
	box-shadow: var(--ocm-shadow-hover);
}

.ocm-node:hover .ocm-photo img { transform: scale(1.05); }
.ocm-node .ocm-photo { width: 84px; margin-bottom: 14px; }

.ocm-chart .ocm-node__name {
	margin: 0 0 4px;
	font-size: 1.02rem;
	font-weight: 600;
	line-height: 1.3;
}

.ocm-chart .ocm-node__position {
	margin: 0;
	font-size: .85rem;
	color: var(--ocm-muted);
}

/* ---------- Popup ---------- */

html.ocm-modal-open { overflow: hidden; }

.ocm-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	color: var(--ocm-text);
}

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

.ocm-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, .6);
	backdrop-filter: blur(3px);
	opacity: 0;
	transition: opacity .2s ease;
}

.ocm-modal__dialog {
	position: relative;
	width: min(880px, 100%);
	max-height: calc(100vh - 48px);
	max-height: calc(100dvh - 48px);
	overflow-y: auto;
	background: var(--ocm-card-bg);
	border-radius: 18px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
	opacity: 0;
	transform: translateY(14px) scale(.98);
	transition: opacity .2s ease, transform .2s ease;
	outline: none;
}

.ocm-modal.is-open .ocm-modal__backdrop { opacity: 1; }
.ocm-modal.is-open .ocm-modal__dialog { opacity: 1; transform: none; }

.ocm-modal .ocm-modal__close {
	all: unset;
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 3;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .92);
	color: #111827;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
	cursor: pointer;
	transition: transform .2s ease;
}

.ocm-modal .ocm-modal__close:hover { transform: rotate(90deg); }
.ocm-modal .ocm-modal__close:focus-visible { outline: 3px solid var(--ocm-accent); outline-offset: 2px; }
.ocm-modal__close .ocm-icon { width: 20px; height: 20px; }

.ocm-modal__body {
	display: grid;
	grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
	min-height: 420px;
}

.ocm-modal__media {
	position: relative;
	display: grid;
	place-items: center;
	background: var(--ocm-tint);
	color: color-mix(in srgb, var(--ocm-accent) 65%, #000);
}

.ocm-modal .ocm-modal__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	object-position: center top;
}

.ocm-modal__media.is-empty .ocm-icon { width: 38%; height: 38%; }

.ocm-modal__content {
	padding: 44px 44px 40px;
	min-width: 0;
}

.ocm-modal .ocm-modal__eyebrow {
	margin: 0 0 8px;
	color: var(--ocm-accent);
	font-size: .85rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.ocm-modal .ocm-modal__name {
	margin: 0 44px 6px 0;
	font-size: clamp(1.5rem, 3.5vw, 2.1rem);
	line-height: 1.2;
	color: var(--ocm-text);
}

.ocm-modal .ocm-modal__position {
	margin: 0;
	color: var(--ocm-muted);
	font-weight: 600;
	font-size: 1.05rem;
}

.ocm-modal .ocm-bar { margin: 18px 0 0; opacity: 1; }
.ocm-modal .ocm-socials { justify-content: flex-start; }

.ocm-modal__bio {
	margin-top: 28px;
	padding-top: 24px;
	border-top: 1px solid #e5e7eb;
	color: #374151;
	line-height: 1.7;
}

.ocm-modal__bio > :first-child { margin-top: 0; }
.ocm-modal__bio > :last-child { margin-bottom: 0; }
.ocm-modal__bio p { margin: 0 0 1em; }

.ocm-modal__relations {
	display: grid;
	gap: 18px;
	margin-top: 28px;
	padding-top: 24px;
	border-top: 1px solid #e5e7eb;
}

.ocm-modal .ocm-modal__label {
	margin: 0 0 10px;
	color: var(--ocm-muted);
	font-size: .78rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.ocm-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.ocm-modal .ocm-chip {
	all: unset;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 4px 14px 4px 4px;
	border-radius: 999px;
	background: #f3f4f6;
	color: var(--ocm-text);
	font-size: .92rem;
	cursor: pointer;
	transition: background .2s ease;
}

.ocm-modal .ocm-chip:hover { background: var(--ocm-tint); }
.ocm-modal .ocm-chip:focus-visible { outline: 3px solid var(--ocm-accent); outline-offset: 2px; }

.ocm-chip__avatar {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	overflow: hidden;
	background: #fff;
	color: var(--ocm-muted);
}

.ocm-modal .ocm-chip__avatar img { width: 100%; height: 100%; max-width: none; margin: 0; object-fit: cover; }
.ocm-chip__avatar .ocm-icon { width: 60%; height: 60%; }

@media (max-width: 720px) {
	.ocm-modal { padding: 12px; align-items: flex-end; }
	.ocm-modal__dialog { max-height: calc(100dvh - 24px); border-radius: 18px; }
	.ocm-modal__body { grid-template-columns: 1fr; min-height: 0; }
	.ocm-modal__media { height: 300px; }
	.ocm-modal__content { padding: 28px 22px 30px; }
	.ocm-modal .ocm-modal__name { margin-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.ocm-card,
	.ocm-node,
	.ocm-photo img,
	.ocm-bar,
	.ocm-modal__backdrop,
	.ocm-modal__dialog,
	.ocm-modal__close { transition: none !important; }
	.ocm-card:hover,
	.ocm-node:hover { transform: none; }
}

.ocm-empty-notice {
	padding: 12px 16px;
	border-left: 4px solid #f59e0b;
	background: #fffbeb;
}
