/**
 * TeamGraph — front-end styles.
 *
 * The org chart is plain nested lists laid out with CSS: flex rows plus
 * border pseudo-elements draw the connectors, so the chart needs no
 * JavaScript to render. Wide charts scroll inside .teamgraph-scroll (the
 * page itself never scrolls horizontally); small screens fall back to an
 * indented list via media query.
 *
 * Every element is explicitly reset so theme CSS (margins, list styles,
 * link decorations, box-sizing) can't distort the layout or connector math.
 */

.teamgraph,
.teamgraph * {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	line-height: 1.35;
}

.teamgraph {
	width: 100%;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	color: #1e2430;
}

.teamgraph ul {
	list-style: none;
}

.teamgraph-scroll {
	overflow-x: auto;
	padding: 4px 2px 12px;
	-webkit-overflow-scrolling: touch;
}

.teamgraph-empty {
	padding: 24px;
	text-align: center;
	color: #5a6880;
	background: #f5f7fa;
	border: 1px dashed #c6cfdd;
	border-radius: 10px;
}

/* Visible keyboard focus everywhere. currentColor keeps the ring visible
   on any color-guide card background. */
.teamgraph a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	border-radius: 2px;
	text-decoration: underline;
}

/* Screen-reader-only text (filter label, live region). */
.teamgraph-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Tree view: the nested list IS the org chart                         */
/* ------------------------------------------------------------------ */

.teamgraph-tree {
	display: flex;
	width: max-content;
	min-width: 100%;
}

/* Auto margins center the chart when it's narrower than the container but
   collapse to zero when it overflows, so nothing gets clipped off-screen
   ("safe" centering without the safe keyword). */
.teamgraph-tree > .teamgraph-node:first-child {
	margin-left: auto;
}

.teamgraph-tree > .teamgraph-node:last-child {
	margin-right: auto;
}

.teamgraph-view-tree .teamgraph-reports {
	display: flex;
	position: relative;
	padding-top: 28px;
}

/* Drop line from a parent card down to its reports' rail. */
.teamgraph-view-tree .teamgraph-reports::before {
	content: "";
	position: absolute;
	top: 11px;
	left: 50%;
	width: 0;
	height: 16px;
	border-left: 2px solid #b9c4d4;
}

.teamgraph-view-tree .teamgraph-node {
	display: flex;
	flex-direction: column;
	align-items: center;
	position: relative;
	padding: 28px 10px 0;
}

/* Roots hang from nothing. */
.teamgraph-tree > .teamgraph-node {
	padding-top: 0;
}

/* Connectors: ::before is the left half of the sibling rail, ::after is
   the right half plus the vertical stub down to this node. */
.teamgraph-view-tree .teamgraph-reports > .teamgraph-node::before,
.teamgraph-view-tree .teamgraph-reports > .teamgraph-node::after {
	content: "";
	position: absolute;
	top: -2px;
	right: 50%;
	width: 50%;
	height: 28px;
	border-top: 2px solid #b9c4d4;
}

.teamgraph-view-tree .teamgraph-reports > .teamgraph-node::after {
	right: auto;
	left: 50%;
	border-left: 2px solid #b9c4d4;
}

/* Trim the rail at the ends of a sibling row. */
.teamgraph-view-tree .teamgraph-reports > .teamgraph-node:first-child::before {
	border: 0 none;
}

/* The last sibling's stub is drawn by ::before's right border instead, so
   ::after (top + left borders) disappears entirely. */
.teamgraph-view-tree .teamgraph-reports > .teamgraph-node:last-child::after {
	border: 0 none;
}

.teamgraph-view-tree .teamgraph-reports > .teamgraph-node:last-child::before {
	border-right: 2px solid #b9c4d4;
	border-radius: 0 8px 0 0;
}

.teamgraph-view-tree .teamgraph-reports > .teamgraph-node:first-child::after {
	border-radius: 8px 0 0 0;
}

/* An only child needs just the straight drop line. */
.teamgraph-view-tree .teamgraph-reports > .teamgraph-node:only-child {
	padding-top: 0;
}

.teamgraph-view-tree .teamgraph-reports > .teamgraph-node:only-child::before,
.teamgraph-view-tree .teamgraph-reports > .teamgraph-node:only-child::after {
	display: none;
}

/* Collapse/expand (JS adds the class and the toggle button). */
.teamgraph-collapsed > .teamgraph-reports {
	display: none !important;
}

.teamgraph-anchor {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
}

/* ------------------------------------------------------------------ */
/* Pills                                                               */
/* ------------------------------------------------------------------ */

.teamgraph-pills {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

.teamgraph-pill {
	display: inline-block;
	padding: 3px 12px;
	border-radius: 999px;
	background: #344563;
	color: #ffffff;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Cards (tree + grid)                                                 */
/* ------------------------------------------------------------------ */

.teamgraph-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 200px;
	padding: 18px 14px 20px;
	background: #ffffff;
	border: 1px solid #dde3ec;
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(20, 32, 55, 0.08);
	text-align: center;
}

.teamgraph-has-reports > .teamgraph-anchor .teamgraph-card {
	padding-bottom: 24px; /* Room for the toggle button JS may add. */
}

.teamgraph-photo {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid rgba(255, 255, 255, 0.85);
	box-shadow: 0 1px 4px rgba(20, 32, 55, 0.18);
	background: #e8edf4;
}

.teamgraph-initials {
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 20px;
	color: #435068;
}

.teamgraph-card-body {
	display: flex;
	flex-direction: column;
	margin-top: 10px;
	min-width: 0;
	max-width: 100%;
}

.teamgraph-name,
a.teamgraph-name {
	display: block;
	font-size: 15px;
	font-weight: 700;
	color: inherit;
	text-decoration: none;
	overflow-wrap: break-word;
}

/* A comfortable tap target on the linked name (WCAG 2.5.8). */
a.teamgraph-name {
	min-height: 24px;
}

a.teamgraph-name:hover,
a.teamgraph-name:focus-visible {
	text-decoration: underline;
}

a.teamgraph-name:focus-visible,
.teamgraph-contact a:focus-visible,
.teamgraph-row-contact a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	border-radius: 3px;
}

.teamgraph-title {
	margin-top: 2px;
	font-size: 12.5px;
	opacity: 0.85;
}

.teamgraph-tag {
	margin-top: 4px;
	font-size: 12px;
	opacity: 0.75;
}

.teamgraph-contact {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-top: 8px;
	gap: 4px;
}

/* Contact links are standalone tap targets, so they get a full 28px height
   and clear spacing rather than the tight 12px inline links they used to be
   (WCAG 2.5.8 target size). */
.teamgraph-contact a {
	display: inline-flex;
	align-items: center;
	min-height: 28px;
	padding: 2px 0;
	font-size: 12px;
	color: inherit;
	opacity: 0.85;
	text-decoration: none;
	overflow-wrap: anywhere;
}

.teamgraph-contact a:hover,
.teamgraph-contact a:focus-visible {
	opacity: 1;
	text-decoration: underline;
}

/* Collapse/expand toggle (inserted by JS). */
.teamgraph-toggle {
	position: absolute;
	bottom: -13px;
	left: 50%;
	transform: translateX(-50%);
	min-width: 26px;
	height: 26px;
	padding: 0 7px;
	border: 1px solid #c6cfdd;
	border-radius: 999px;
	background: #ffffff;
	color: #35405a;
	font-size: 12px;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
	box-shadow: 0 1px 3px rgba(20, 32, 55, 0.15);
}

.teamgraph-toggle:hover {
	background: #eef2f8;
}

.teamgraph-toggle:focus-visible {
	outline: 2px solid #2f6fed;
	outline-offset: 2px;
}

.teamgraph-collapsed .teamgraph-toggle {
	background: #35405a;
	color: #ffffff;
	border-color: #35405a;
}

/* ------------------------------------------------------------------ */
/* List view: the same hierarchy as an indented directory              */
/* ------------------------------------------------------------------ */

.teamgraph-view-list .teamgraph-anchor {
	align-items: stretch;
}

.teamgraph-view-list .teamgraph-node {
	margin: 8px 0;
}

.teamgraph-view-list .teamgraph-reports {
	margin-left: 18px;
	padding-left: 14px;
	border-left: 2px solid #dde3ec;
}

.teamgraph-row {
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: 560px;
	padding: 8px 12px;
	background: #ffffff;
	border: 1px solid #dde3ec;
	border-radius: 8px;
}

.teamgraph-row-photo {
	flex: none;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
	background: #e8edf4;
}

.teamgraph-row-photo.teamgraph-initials {
	font-size: 13px;
}

.teamgraph-row-text {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 10px;
	row-gap: 2px;
	min-width: 0;
}

.teamgraph-row-text .teamgraph-name {
	display: inline;
	font-size: 14px;
}

.teamgraph-row-text .teamgraph-title {
	margin-top: 0;
}

.teamgraph-row-contact {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	font-size: 12px;
}

.teamgraph-row-contact a {
	display: inline-flex;
	align-items: center;
	min-height: 28px;
	color: inherit;
	opacity: 0.85;
	overflow-wrap: anywhere;
}

.teamgraph-view-list .teamgraph-pills {
	flex-direction: row;
	margin: 2px 0 4px;
}

.teamgraph-view-list .teamgraph-pill {
	padding: 1px 8px;
	background: #eef2f8;
	color: #35405a;
	font-size: 10.5px;
}

/* The list view's toggle sits inline, not floating off a card. */
.teamgraph-view-list .teamgraph-toggle {
	position: static;
	transform: none;
	margin: 4px 0 0;
	align-self: flex-start;
}

/* ------------------------------------------------------------------ */
/* Grid view                                                           */
/* ------------------------------------------------------------------ */

.teamgraph-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 16px;
}

.teamgraph-grid .teamgraph-card {
	width: 100%;
	height: 100%;
}

/* ------------------------------------------------------------------ */
/* Filter bar (inserted by JS on grid and list views)                  */
/* ------------------------------------------------------------------ */

.teamgraph-filter {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
}

.teamgraph-filter input {
	flex: 0 1 320px;
	padding: 7px 12px;
	border: 1px solid #c6cfdd;
	border-radius: 8px;
	background: #ffffff;
	color: inherit;
	font: inherit;
	font-size: 13.5px;
}

.teamgraph-filter input:focus-visible {
	outline: 2px solid #2f6fed;
	outline-offset: 1px;
}

.teamgraph-filter-count {
	font-size: 12.5px;
	color: #5a6880;
}

.teamgraph-filtered-out {
	display: none !important;
}

/* ------------------------------------------------------------------ */
/* Small screens: the tree flattens into the indented list             */
/* ------------------------------------------------------------------ */

@media (max-width: 640px) {
	.teamgraph-view-tree .teamgraph-tree,
	.teamgraph-view-tree .teamgraph-reports {
		display: block;
		width: auto;
		min-width: 0;
		padding-top: 0;
	}

	.teamgraph-view-tree .teamgraph-reports {
		margin-left: 18px;
		padding-left: 14px;
		border-left: 2px solid #dde3ec;
	}

	.teamgraph-view-tree .teamgraph-reports::before,
	.teamgraph-view-tree .teamgraph-reports > .teamgraph-node::before,
	.teamgraph-view-tree .teamgraph-reports > .teamgraph-node::after {
		display: none;
	}

	.teamgraph-view-tree .teamgraph-node {
		display: block;
		margin: 8px 0;
		padding: 0;
	}

	.teamgraph-view-tree .teamgraph-anchor {
		align-items: flex-start;
	}

	.teamgraph-view-tree .teamgraph-pills {
		flex-direction: row;
	}

	.teamgraph-view-tree .teamgraph-card,
	.teamgraph-has-reports > .teamgraph-anchor .teamgraph-card {
		flex-direction: row;
		align-items: center;
		width: 100%;
		max-width: 560px;
		gap: 12px;
		padding: 10px 12px;
		text-align: left;
	}

	.teamgraph-view-tree .teamgraph-photo {
		width: 44px;
		height: 44px;
		flex: none;
	}

	.teamgraph-view-tree .teamgraph-card-body {
		margin-top: 0;
		align-items: flex-start;
	}

	.teamgraph-view-tree .teamgraph-contact {
		margin-top: 4px;
	}

	.teamgraph-view-tree .teamgraph-toggle {
		position: static;
		transform: none;
		margin-left: auto;
		flex: none;
	}
}

/* ------------------------------------------------------------------ */
/* Toolbar (showtools="true") — injected by JS, so it never appears    */
/* as a dead control for no-JS visitors.                               */
/* ------------------------------------------------------------------ */

.teamgraph-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
}

.teamgraph-tool-group {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid #c6cfdd;
	border-radius: 8px;
	background: #ffffff;
	overflow: hidden;
}

/* An explicit display value outranks the UA's [hidden] rule, so restate it —
   syncToolbar() hides the tree-only controls with the hidden property. */
.teamgraph-tool-group[hidden],
.teamgraph-tool[hidden] {
	display: none;
}

.teamgraph-tool {
	appearance: none;
	border: 0;
	background: none;
	margin: 0;
	padding: 8px 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 38px;
	font: inherit;
	font-size: 13px;
	line-height: 1.4;
	color: inherit;
	cursor: pointer;
}

/* Icon-only controls keep a comfortable square tap target. */
.teamgraph-tool--icon {
	padding: 8px 10px;
	min-width: 38px;
}

.teamgraph-tool-icon {
	display: block;
	flex: none;
}

.teamgraph-tool--view .teamgraph-tool-label {
	font-weight: 500;
}

.teamgraph-tool + .teamgraph-tool {
	border-left: 1px solid #dde3ec;
}

.teamgraph-tool:hover {
	background: #f1f5fb;
}

.teamgraph-tool:focus-visible {
	outline: 2px solid #2f6fed;
	outline-offset: -2px;
}

.teamgraph-tool[aria-pressed='true'],
.teamgraph-tool.is-active {
	background: #1e2430;
	color: #ffffff;
}

/* Fixed width and lining figures stop the bar reflowing as the number
   changes between e.g. 80% and 100%. */
.teamgraph-zoom-level {
	min-width: 56px;
	font-variant-numeric: tabular-nums;
	text-align: center;
}

.teamgraph-tool-status:not(:empty) {
	font-size: 12.5px;
	color: #b3261e;
}

.teamgraph.is-loading .teamgraph-body {
	opacity: 0.55;
	transition: opacity 0.15s ease;
}

/* ------------------------------------------------------------------ */
/* Zoom + drag-to-pan (tree)                                           */
/* ------------------------------------------------------------------ */

/* Matches .teamgraph-tree's sizing so scaling this layer reports the
   correct scrollable extent. */
.teamgraph-zoom {
	width: max-content;
	min-width: 100%;
	transform-origin: top left;
}

.teamgraph-view-tree .teamgraph-scroll {
	cursor: grab;
}

.teamgraph-view-tree .teamgraph-scroll.is-grabbing {
	cursor: grabbing;
	user-select: none;
}

@media (prefers-reduced-motion: reduce) {
	.teamgraph.is-loading .teamgraph-body {
		transition: none;
	}
}

/* ------------------------------------------------------------------ */
/* Fullscreen — native where supported, fixed overlay as fallback      */
/* ------------------------------------------------------------------ */

/* Doubled class on the fallback is deliberate: block themes cap content width
   with `.is-layout-constrained > :where(…)`, which is also (0,1,0), and their
   global styles are printed inline after this file — so a single-class
   selector loses the tie and the overlay stays the width of the article
   column with the page showing through beside it. `.teamgraph:fullscreen` is
   already (0,2,0) and wins on its own. */
.teamgraph:fullscreen,
.teamgraph.teamgraph-fauxscreen {
	display: flex;
	flex-direction: column;
	background: #ffffff;
	padding: 20px;
	overflow: hidden;
	max-width: none;
	width: auto;
	margin: 0;
}

.teamgraph.teamgraph-fauxscreen {
	position: fixed;
	inset: 0;
	z-index: 99999;
}

.teamgraph-fauxscreen-lock,
.teamgraph-fauxscreen-lock body {
	overflow: hidden;
}

.teamgraph:fullscreen .teamgraph-body,
.teamgraph-fauxscreen .teamgraph-body {
	flex: 1;
	min-height: 0;
}

/* Both axes scroll inside the panel, so panning drives the container
   rather than the (now locked) page. */
.teamgraph:fullscreen .teamgraph-scroll,
.teamgraph-fauxscreen .teamgraph-scroll {
	height: 100%;
	overflow: auto;
}

/* ------------------------------------------------------------------ */
/* Print: show everything, no scroll clipping                          */
/* ------------------------------------------------------------------ */

@media print {
	.teamgraph-toolbar {
		display: none;
	}

	/* Never print a zoomed chart. */
	.teamgraph-zoom {
		transform: none !important;
		margin-right: 0 !important;
		margin-bottom: 0 !important;
	}

	.teamgraph-scroll {
		overflow: visible;
	}

	.teamgraph-filter,
	.teamgraph-toggle {
		display: none;
	}

	.teamgraph-view-tree .teamgraph-collapsed > .teamgraph-reports {
		display: flex !important;
	}

	.teamgraph-view-list .teamgraph-collapsed > .teamgraph-reports {
		display: block !important;
	}

	.teamgraph-card,
	.teamgraph-row {
		box-shadow: none;
	}
}
