/**
 * TeamGraphED — 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 .teamgraphed-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.
 *
 * Direction: the wrapper carries dir="ltr|rtl". Layout uses logical
 * properties (inline-start/end) so the same rules serve both directions;
 * only a few things need an explicit [dir="rtl"] rule (zoom origin, toolbar
 * icons, pill typography). The manual diagram is the exception: it is an
 * absolutely positioned coordinate canvas, so it stays left-to-right
 * internally and the server mirrors its layout for RTL.
 */

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

.teamgraphed {
	/* Collapse/expand toggle geometry. The button is centred on the card's
	   bottom edge, so half of it overlaps the card; everything that has to
	   keep clear of it derives from these two values. */
	--teamgraphed-toggle-size: 26px;
	--teamgraphed-toggle-overlap: calc(var(--teamgraphed-toggle-size) / 2);

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

.teamgraphed ul {
	list-style: none;
}

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

.teamgraphed-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. */
.teamgraphed a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	border-radius: 2px;
	text-decoration: underline;
}

/* Screen-reader-only text (filter label, live region). */
.teamgraphed-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                         */
/* ------------------------------------------------------------------ */

.teamgraphed-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). */
.teamgraphed-tree > .teamgraphed-node:first-child {
	margin-inline-start: auto;
}

.teamgraphed-tree > .teamgraphed-node:last-child {
	margin-inline-end: auto;
}

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

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

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

/* Roots hang from nothing. */
.teamgraphed-tree > .teamgraphed-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. */
.teamgraphed-view-tree .teamgraphed-reports > .teamgraphed-node::before,
.teamgraphed-view-tree .teamgraphed-reports > .teamgraphed-node::after {
	content: "";
	position: absolute;
	top: -2px;
	inset-inline-end: 50%;
	width: 50%;
	height: 28px;
	border-top: 2px solid #b9c4d4;
}

.teamgraphed-view-tree .teamgraphed-reports > .teamgraphed-node::after {
	inset-inline-end: auto;
	inset-inline-start: 50%;
	border-inline-start: 2px solid #b9c4d4;
}

/* Trim the rail at the ends of a sibling row. */
.teamgraphed-view-tree .teamgraphed-reports > .teamgraphed-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. */
.teamgraphed-view-tree .teamgraphed-reports > .teamgraphed-node:last-child::after {
	border: 0 none;
}

.teamgraphed-view-tree .teamgraphed-reports > .teamgraphed-node:last-child::before {
	border-inline-end: 2px solid #b9c4d4;
	border-start-end-radius: 8px;
}

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

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

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

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

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

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

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

.teamgraphed-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;
}

/* A phone number is shown left to right, as written, inside RTL text.
   isolate-override (not plain isolate) because Arabic-Indic digits would
   otherwise reorder their groups and push the leading + to the end. */
.teamgraphed[dir="rtl"] a[href^="tel:"] {
	direction: ltr;
	unicode-bidi: isolate-override;
}

/* Arabic and other RTL scripts have no letter case, and letter-spacing
   breaks the joining between letters, so both are switched off. */
.teamgraphed[dir="rtl"] .teamgraphed-pill {
	letter-spacing: 0;
	text-transform: none;
}

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

.teamgraphed-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;
}

.teamgraphed-has-reports > .teamgraphed-anchor .teamgraphed-card {
	/* Room for the toggle JS may add: the half that overlaps the card, plus
	   the same again so the text keeps a visible margin above the button. */
	padding-bottom: calc(var(--teamgraphed-toggle-overlap) * 2);
}

.teamgraphed-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;
}

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

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

.teamgraphed-name,
a.teamgraphed-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.teamgraphed-name {
	min-height: 24px;
}

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

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

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

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

.teamgraphed-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). */
.teamgraphed-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;
}

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

/* Collapse/expand toggle (inserted by JS).

   The button is --teamgraphed-toggle-size tall and is centred on the card's
   bottom edge, so exactly half of it — --teamgraphed-toggle-overlap — sits
   inside the card. Cards that own a toggle reserve twice that overlap as
   bottom padding, which leaves the text one full overlap of clearance above
   the button instead of letting a wrapped last line run underneath it. */
.teamgraphed-toggle {
	position: absolute;
	bottom: calc(var(--teamgraphed-toggle-overlap) * -1);
	left: 50%;
	transform: translateX(-50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--teamgraphed-toggle-size);
	min-width: var(--teamgraphed-toggle-size);
	height: var(--teamgraphed-toggle-size);
	padding: 0;
	border: 1px solid #c6cfdd;
	border-radius: 999px;
	background: #ffffff;
	color: #35405a;
	font-size: 12px;
	font-weight: 700;
	font-family: inherit;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 1px 3px rgba(20, 32, 55, 0.15);
}

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

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

/* +/- glyph. The child count stays in aria-label for assistive tech,
   but is intentionally hidden visually to keep cards clean. */
.teamgraphed-toggle::before {
	content: "\2212"; /* minus sign */
}

.teamgraphed-toggle[aria-expanded="false"]::before {
	content: "+";
}

/* Optional: hide the letter avatars used when a member has no photo
   (initials="false"), and close the gap they leave behind. */
.teamgraphed[data-initials="off"] .teamgraphed-initials {
	display: none;
}

.teamgraphed[data-initials="off"] .teamgraphed-card-body {
	margin-top: 0;
}

/* Optional: hide the automatic department pills (pills="false"). */
.teamgraphed[data-pills="off"] .teamgraphed-pills {
	display: none;
}

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

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

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

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

.teamgraphed-view-list .teamgraphed-reports {
	margin-inline-start: 18px;
	padding-inline-start: 14px;
	border-inline-start: 2px solid #dde3ec;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* ------------------------------------------------------------------ */
/* Manual diagram view                                                  */
/* ------------------------------------------------------------------ */

.teamgraphed-view-diagram .teamgraphed-scroll {
	overflow: auto;
	box-sizing: border-box;
	width: 100%;
	height: clamp(420px, 70vh, 760px);
	max-height: calc(100vh - 140px);
	padding: 10px;
	border: var(--teamgraphed-canvas-border-width, 0) solid var(--teamgraphed-canvas-border-color, #c6cfdd);
	background: var(--teamgraphed-canvas-bg, transparent);
	cursor: grab;
	touch-action: none;
	overscroll-behavior: contain;
}

.teamgraphed-diagram-scroll {
	direction: ltr;
}

/* The canvas is a left-to-right coordinate system; the card text inside it
   follows the chart's own direction again. */
.teamgraphed[dir="rtl"] .teamgraphed-diagram-node {
	direction: rtl;
}

.teamgraphed-view-diagram .teamgraphed-scroll.is-grabbing {
	cursor: grabbing;
	user-select: none;
}

.teamgraphed[data-fit="1"].teamgraphed-view-diagram .teamgraphed-scroll {
	scrollbar-width: none;
}

.teamgraphed[data-fit="1"].teamgraphed-view-diagram .teamgraphed-scroll::-webkit-scrollbar {
	display: none;
}

/*
 * No dotted grid out here. The dots are a drafting aid for positioning cards,
 * so they belong to the Visual Layout editor in wp-admin and nowhere else; a
 * published page shows the chart on plain paper, over whatever canvas colour
 * the theme settings ask for.
 */
.teamgraphed-diagram-canvas {
	position: relative;
	z-index: 0;
	min-width: 100%;
	min-height: 460px;
	background-color: var(--teamgraphed-canvas-bg, transparent);
	border-radius: 12px;
}

.teamgraphed-diagram-connectors {
	position: absolute;
	z-index: 1;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
	pointer-events: none;
	fill: none;
}

.teamgraphed-diagram-connectors marker path {
	fill: #8fa0ba;
}

.teamgraphed-diagram-path {
	fill: none;
	stroke: #8fa0ba;
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.teamgraphed-diagram-path.is-dashed {
	stroke-dasharray: 8 7;
}

.teamgraphed-diagram-node {
	position: absolute;
	z-index: 2;
	width: 200px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	border: 0 none;
	background: transparent;
	box-shadow: none;
	outline: 0;
}

.teamgraphed-diagram-node .teamgraphed-card {
	box-sizing: border-box;
	width: 200px;
	border-style: solid;
}

.teamgraphed-diagram-node.has-custom-card-size {
	width: var(--teamgraphed-card-width, 200px);
}

.teamgraphed-diagram-node.has-custom-card-size .teamgraphed-card {
	width: var(--teamgraphed-card-width, 200px);
	/* A saved layout height is a floor, not a ceiling. Translated text wraps
	   to more lines than the English it was sized against, and a hard height
	   made those lines spill past the card and under the toggle. The JS
	   re-routes connectors from the live offsetHeight, so a grown card keeps
	   its arrows. */
	min-height: var(--teamgraphed-card-height, auto);
	height: auto;
}

.teamgraphed-diagram-node.teamgraphed-diagram-has-children .teamgraphed-card {
	padding-bottom: calc(var(--teamgraphed-toggle-overlap) * 2);
}

.teamgraphed-diagram-node.teamgraphed-diagram-hidden {
	display: none !important;
}

.teamgraphed-diagram-node .teamgraphed-diagram-toggle {
	z-index: 3;
}

.teamgraphed-diagram-node .teamgraphed-diagram-toggle.is-side-top {
	top: calc(var(--teamgraphed-toggle-overlap) * -1);
	right: auto;
	bottom: auto;
	left: 50%;
	transform: translateX(-50%);
}

.teamgraphed-diagram-node .teamgraphed-diagram-toggle.is-side-right {
	top: 50%;
	right: calc(var(--teamgraphed-toggle-overlap) * -1);
	bottom: auto;
	left: auto;
	transform: translateY(-50%);
}

.teamgraphed-diagram-node .teamgraphed-diagram-toggle.is-side-bottom {
	top: auto;
	right: auto;
	bottom: calc(var(--teamgraphed-toggle-overlap) * -1);
	left: 50%;
	transform: translateX(-50%);
}

.teamgraphed-diagram-node .teamgraphed-diagram-toggle.is-side-left {
	top: 50%;
	right: auto;
	bottom: auto;
	left: calc(var(--teamgraphed-toggle-overlap) * -1);
	transform: translateY(-50%);
}

.teamgraphed-diagram-node.has-custom-card-background .teamgraphed-card {
	background: var(--teamgraphed-card-bg) !important;
}

.teamgraphed-diagram-node.has-custom-card-border .teamgraphed-card {
	border: var(--teamgraphed-card-border-width, 1px) solid var(--teamgraphed-card-border-color, #dde3ec) !important;
	outline: 0;
}

/* Per-card typography. Each property is opt-in through its own class, so a
   card only overrides what the author actually set and inherits the theme
   for the rest. */
.teamgraphed-diagram-node.has-custom-card-font-family .teamgraphed-card,
.teamgraphed-diagram-node.has-custom-card-font-family .teamgraphed-card .teamgraphed-name,
.teamgraphed-diagram-node.has-custom-card-font-family .teamgraphed-card .teamgraphed-title {
	font-family: var(--teamgraphed-card-font-family) !important;
}

.teamgraphed-diagram-node.has-custom-card-name-size .teamgraphed-card .teamgraphed-name {
	font-size: var(--teamgraphed-card-name-size) !important;
	line-height: 1.25;
}

.teamgraphed-diagram-node.has-custom-card-title-size .teamgraphed-card .teamgraphed-title {
	font-size: var(--teamgraphed-card-title-size) !important;
	line-height: 1.3;
}

.teamgraphed-diagram-node.has-custom-card-text-color .teamgraphed-card,
.teamgraphed-diagram-node.has-custom-card-text-color .teamgraphed-card .teamgraphed-name,
.teamgraphed-diagram-node.has-custom-card-text-color .teamgraphed-card .teamgraphed-title {
	color: var(--teamgraphed-card-text-color) !important;
}

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

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

.teamgraphed-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;
}

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

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

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

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

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

	.teamgraphed-view-tree .teamgraphed-reports {
		margin-inline-start: 18px;
		padding-inline-start: 14px;
		border-inline-start: 2px solid #dde3ec;
	}

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

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

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

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

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

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

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

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

	.teamgraphed-view-tree .teamgraphed-toggle {
		position: static;
		transform: none;
		margin-inline-start: auto;
		flex: none;
	}
}

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

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

.teamgraphed-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. */
.teamgraphed-tool-group[hidden],
.teamgraphed-tool[hidden] {
	display: none;
}

.teamgraphed-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. */
.teamgraphed-tool--icon {
	padding: 8px 10px;
	min-width: 38px;
}

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

/* Icons with a leading side (list bullets, the diagram's flow line) flip. */
.teamgraphed[dir="rtl"] .teamgraphed-tool-icon[data-icon="view-list"],
.teamgraphed[dir="rtl"] .teamgraphed-tool-icon[data-icon="view-diagram"] {
	transform: scaleX(-1);
}

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

.teamgraphed-tool + .teamgraphed-tool {
	border-inline-start: 1px solid #dde3ec;
}

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

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

.teamgraphed-tool[aria-pressed='true'],
.teamgraphed-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%. */
.teamgraphed-zoom-level {
	min-width: 56px;
	font-variant-numeric: tabular-nums;
	text-align: center;
}

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

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

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

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

/* The tree scales from its reading-start corner, which is the right one in
   RTL. (The diagram canvas stays left-to-right, so it keeps top left.) */
.teamgraphed[dir="rtl"] .teamgraphed-zoom:not(.teamgraphed-diagram-canvas) {
	transform-origin: top right;
}

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

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

@media (prefers-reduced-motion: reduce) {
	.teamgraphed.is-loading .teamgraphed-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. `.teamgraphed:fullscreen` is
   already (0,2,0) and wins on its own. */
.teamgraphed:fullscreen,
.teamgraphed.teamgraphed-fauxscreen {
	display: flex;
	flex-direction: column;
	background: #ffffff;
	padding: 20px;
	overflow: hidden;
	max-width: none;
	width: auto;
	margin: 0;
}

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

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

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

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

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

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

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

	/* The diagram sizes its own box at runtime with inline styles, which beat
	   a plain rule here; !important is what keeps the printed chart from
	   being clipped to the on-screen box. */
	.teamgraphed-scroll {
		overflow: visible !important;
		height: auto !important;
		max-height: none !important;
	}

	/*
	 * Fit the diagram to the paper. The printable width cannot be measured
	 * from JavaScript -- beforeprint still reports screen geometry -- so the
	 * target is a fixed width that fits A4 and Letter in landscape, and the
	 * script works out the matching scale from the chart's own size. Override
	 * with printwidth="..." on the shortcode (use about 700 for portrait).
	 */
	.teamgraphed-view-diagram .teamgraphed-scroll {
		width: var(--teamgraphed-print-width, 940px) !important;
		height: var(--teamgraphed-print-height, auto) !important;

		/*
		 * Centre the chart on the sheet rather than inside the theme's content
		 * column. In printed output "vw" resolves against the page area, so
		 * "50% - 50vw" cancels whatever centring margin the theme applies and
		 * the remaining term re-centres the box against the paper itself. In
		 * right-to-left pages this also stops the box being pushed off the
		 * right-hand edge.
		 */
		max-width: 100vw !important;
		margin-left: calc(
			50% - 50vw + max(0px, (100vw - var(--teamgraphed-print-width, 940px)) / 2)
		) !important;
		margin-right: 0 !important;

		/*
		 * Printing scales and shifts the canvas, so anything it leaves hanging
		 * over the border is clipped by the frame. The overflow is a custom
		 * property so that with JavaScript off, where nothing is scaled, the
		 * box still spills rather than silently cropping the chart.
		 */
		padding: 0 !important;
		overflow: var(--teamgraphed-print-overflow, visible) !important;
		border-radius: 12px !important;

		/*
		 * Keep the whole diagram on one sheet. If it cannot fit on the page it
		 * has landed on, the browser moves the entire chart to the next page
		 * instead of splitting it. A chart taller than a full page still
		 * breaks, which is the best that can be done without knowing the
		 * paper height.
		 */
		break-inside: avoid;
		page-break-inside: avoid;
	}

	.teamgraphed-view-diagram .teamgraphed-diagram-canvas {
		/*
		 * Panning and zooming leave inline left, top and margin values on the
		 * canvas. Printing them would carry whatever the reader had dragged
		 * the chart to on screen into the page, shifting the diagram out of
		 * its frame and clipping the far side. Reset them, but keep the
		 * canvas positioned, because the cards inside are absolute and use it
		 * as their containing block.
		 */
		position: relative !important;
		left: 0 !important;
		top: 0 !important;
		margin: 0 !important;
		transform: scale(var(--teamgraphed-print-scale, 1))
			translate(calc(var(--teamgraphed-print-x, 0px) * -1), calc(var(--teamgraphed-print-y, 0px) * -1)) !important;
		transform-origin: top left !important;

		/* The frame carries the canvas colour and the rounded corner; see above. */
		background-image: none !important;
		background-color: transparent !important;
		border-radius: 0 !important;
		min-width: 0 !important;
		min-height: 0 !important;
	}

	/* Never slice a card in half across a page break. */
	.teamgraphed-diagram-node,
	.teamgraphed-card,
	.teamgraphed-row {
		break-inside: avoid;
		page-break-inside: avoid;
	}

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

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

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

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