/* Row Organisation (module organization) : organigramme sur 3 niveaux (photo, poste, nom) relié par des traits. Site et éditeur. Couleurs du thème du projet (--theme-*) */

.og {
	--og-line: rgba(128, 128, 128, .4);
	--og-gap: 1.5rem;
	--og-pad: .9rem;
	--og-s1: var(--og-p, 5rem);
	--og-s2: calc(var(--og-s1) * .68);
	--og-s3: calc(var(--og-s1) * .48);
	position: relative;
	width: 100%;
	container-type: inline-size;
}

@supports (color: color-mix(in srgb, red 10%, transparent)) {
	.og {
		--og-line: color-mix(in srgb, currentColor 22%, transparent);
	}
}

/* Sans photo : chaque membre est dans un encadré, les traits visent son milieu */
.og[data-no-photo] {
	--og-s2: 2.4rem;
	--og-s3: 2.4rem;
}

.og-title {
	margin: 0 0 1.75rem;
	font-family: var(--theme-font-title, inherit);
	font-size: 1.35rem;
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
}

.og[data-title-align="left"] .og-title {
	text-align: left;
}

.og[data-title-align="right"] .og-title {
	text-align: right;
}

.og-tree {
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* Un membre : photo à gauche, poste puis nom à droite */
.og-node {
	display: flex;
	align-items: center;
	gap: .8rem;
	min-width: 0;
	max-width: 100%;
	text-align: left;
}

.og[data-no-photo] .og-node {
	padding: .55rem .9rem;
	border: 1px solid var(--og-line);
	border-radius: .5rem;
}

.og-n1 { --og-s: var(--og-s1); }
.og-n2 { --og-s: var(--og-s2); }
.og-n3 { --og-s: var(--og-s3); }

.og-photo {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: var(--og-s);
	height: var(--og-s);
	overflow: hidden;
	color: #8b8b95;
	background: #e6e6ea;
	border-radius: 50%;
}

.og-photo-empty i {
	font-size: calc(var(--og-s) * .42);
	line-height: 1;
}

.og-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.og-text {
	display: flex;
	flex-direction: column;
	gap: .1rem;
	min-width: 0;
	line-height: 1.25;
}

.og-pos {
	font-family: var(--theme-font-title, inherit);
	font-weight: 700;
	color: var(--theme-primary, currentColor);
	overflow-wrap: anywhere;
}

.og-name {
	opacity: .75;
	overflow-wrap: anywhere;
}

.og-n1 .og-pos { font-size: 1.5rem; }
.og-n1 .og-name { font-size: 1.05rem; }
.og-n2 .og-pos { font-size: 1.05rem; }
.og-n2 .og-name { font-size: .9rem; }
.og-n3 .og-pos { font-size: .95rem; }
.og-n3 .og-name { font-size: .85rem; }

.og-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.og-branch {
	position: relative;
	min-width: 0;
}

/* Niveau 2 : les collaborateurs du sommet côte à côte, reliés par une barre */
.og-l2 {
	--og-cx: calc(var(--og-pad) + var(--og-s2) / 2);
	display: flex;
	position: relative;
	align-items: flex-start;
	justify-content: center;
	max-width: 100%;
	margin-top: var(--og-gap);
}

.og[data-no-photo] .og-l2 {
	--og-cx: 50%;
}

.og-l2::before {
	content: "";
	position: absolute;
	top: calc(var(--og-gap) * -1);
	left: 50%;
	height: var(--og-gap);
	border-left: 1px solid var(--og-line);
}

.og-l2 > .og-branch {
	padding: var(--og-gap) var(--og-pad) 0;
}

.og-l2 > .og-branch::before {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	border-top: 1px solid var(--og-line);
}

.og-l2 > .og-branch:first-child::before {
	left: var(--og-cx);
}

.og-l2 > .og-branch:last-child::before {
	right: auto;
	width: var(--og-cx);
}

.og-l2 > .og-branch:only-child::before {
	display: none;
}

.og-l2 > .og-branch::after {
	content: "";
	position: absolute;
	top: 0;
	left: var(--og-cx);
	height: var(--og-gap);
	border-left: 1px solid var(--og-line);
}

.og-l2 > .og-branch:only-child::after {
	left: 50%;
}

/* Niveau 3 : en colonne sous son responsable, relié par un trait vertical */
.og-l3 {
	margin-left: calc(var(--og-s2) / 2);
}

.og-l3 > .og-branch {
	padding: .6rem 0 0 1.1rem;
}

.og-l3 > .og-branch::before {
	content: "";
	position: absolute;
	top: calc(.6rem + var(--og-s3) / 2);
	left: 0;
	width: 1.1rem;
	border-top: 1px solid var(--og-line);
}

.og-l3 > .og-branch::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	border-left: 1px solid var(--og-line);
}

.og-l3 > .og-branch:last-child::after {
	bottom: auto;
	height: calc(.6rem + var(--og-s3) / 2);
}

.og[data-no-photo] .og-l3 {
	margin-left: 1.2rem;
}

/* Écran étroit (d'après la largeur de l'organigramme) : le niveau 2 passe en colonne, comme le niveau 3 */
@container (max-width: 760px) {
	.og-tree { align-items: flex-start; }
	.og-l2 { display: block; margin: 0 0 0 calc(var(--og-s1) / 2); --og-cx: 0px; }
	.og-l2::before { display: none; }
	.og-l2 > .og-branch { padding: .6rem 0 0 1.1rem; }
	.og-l2 > .og-branch::before,
	.og-l2 > .og-branch:first-child::before,
	.og-l2 > .og-branch:last-child::before,
	.og-l2 > .og-branch:only-child::before { display: block; right: auto; left: 0; width: 1.1rem; top: calc(.6rem + var(--og-s2) / 2); }
	.og-l2 > .og-branch::after,
	.og-l2 > .og-branch:only-child::after { top: 0; bottom: 0; left: 0; height: auto; }
	.og-l2 > .og-branch:last-child::after,
	.og-l2 > .og-branch:only-child::after { bottom: auto; height: calc(.6rem + var(--og-s2) / 2); }
	.og[data-no-photo] .og-l2 { margin-left: 1.2rem; }
}

/* Plus de quatre collaborateurs au niveau 2 : la colonne dès 1000 px */
@container (max-width: 1000px) {
	.og-tree:has(> .og-l2[data-n="5"]) { align-items: flex-start; }
	.og-l2[data-n="5"] { display: block; margin: 0 0 0 calc(var(--og-s1) / 2); --og-cx: 0px; }
	.og-l2[data-n="5"]::before { display: none; }
	.og-l2[data-n="5"] > .og-branch { padding: .6rem 0 0 1.1rem; }
	.og-l2[data-n="5"] > .og-branch::before,
	.og-l2[data-n="5"] > .og-branch:first-child::before,
	.og-l2[data-n="5"] > .og-branch:last-child::before,
	.og-l2[data-n="5"] > .og-branch:only-child::before { display: block; right: auto; left: 0; width: 1.1rem; top: calc(.6rem + var(--og-s2) / 2); }
	.og-l2[data-n="5"] > .og-branch::after,
	.og-l2[data-n="5"] > .og-branch:only-child::after { top: 0; bottom: 0; left: 0; height: auto; }
	.og-l2[data-n="5"] > .og-branch:last-child::after,
	.og-l2[data-n="5"] > .og-branch:only-child::after { bottom: auto; height: calc(.6rem + var(--og-s2) / 2); }
	.og[data-no-photo] .og-l2[data-n="5"] { margin-left: 1.2rem; }
}
