/*
 * The sustainability widgets' shared parts.
 *
 * Read from cp-all-designer css/sustain.css:213-249 (.susacc). A widget sets
 * --custom-sus-acc-accent and tunes the rest through its own classes.
 */

/* sustain.css:219-222 — no scroll anchoring: the panel's slide is the one movement */
[data-custom-sus-acc] {
	display: grid;
	gap: 14px;
	overflow-anchor: none;
}

[data-custom-sus-acc] [data-custom-sus-acc-item] {
	overflow: hidden;
	border: 2px solid #EEF2F7;               /* sustain.css:224 measures 1px */
	border-radius: 14px 0 14px 0;            /* --r */
	background: #FFFFFF;
	box-shadow: 0 6px 18px -6px rgba(22, 65, 140, 0.14);   /* --sh-sm */
	transition: border-color 400ms cubic-bezier(0.2, 0.8, 0.2, 1),
	            box-shadow 400ms cubic-bezier(0.2, 0.8, 0.2, 1),
	            background-color 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-custom-sus-acc] [data-custom-sus-acc-item].is-open {
	border-color: color-mix(in srgb, var(--custom-sus-acc-accent, #5CA13F) 40%, #FFFFFF);
	box-shadow: 0 18px 44px -14px rgba(22, 65, 140, 0.2);   /* --sh */
}

[data-custom-sus-acc] [data-custom-sus-acc-head] {
	display: flex;
	align-items: center;
	gap: 16px;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 22px 24px;
	border: 0;
	border-radius: 0;
	background: none;
	font-family: inherit;
	text-align: left;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
}

[data-custom-sus-acc] [data-custom-sus-acc-head]:hover,
[data-custom-sus-acc] [data-custom-sus-acc-head]:focus {
	background: none;
}

[data-custom-sus-acc] [data-custom-sus-acc-head]:focus-visible {
	outline: 2px solid #50A3D5;
	outline-offset: -2px;
}

[data-custom-sus-acc] [data-custom-sus-acc-q] {
	flex: 1;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.5;
	color: #16418C;
}

/* sustain.css:233-240 — a plus whose upright bar folds away as it opens */
[data-custom-sus-acc] [data-custom-sus-acc-icon] {
	position: relative;
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
}

[data-custom-sus-acc] [data-custom-sus-acc-icon]::before,
[data-custom-sus-acc] [data-custom-sus-acc-icon]::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	background: var(--custom-sus-acc-accent, #5CA13F);
	transition: transform 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-custom-sus-acc] [data-custom-sus-acc-icon]::before {
	width: 14px;
	height: 2px;
	transform: translate(-50%, -50%);
}

[data-custom-sus-acc] [data-custom-sus-acc-icon]::after {
	width: 2px;
	height: 14px;
	transform: translate(-50%, -50%);
}

[data-custom-sus-acc] .is-open > [data-custom-sus-acc-head] [data-custom-sus-acc-icon]::after {
	transform: translate(-50%, -50%) scaleY(0);
}

/* sustain.css:241-243 — rows 0fr → 1fr, a height the browser can move through */
[data-custom-sus-acc] [data-custom-sus-acc-body] {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 450ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-custom-sus-acc] .is-open > [data-custom-sus-acc-body] {
	grid-template-rows: 1fr;
}

[data-custom-sus-acc] [data-custom-sus-acc-inner] {
	min-height: 0;
	overflow: hidden;
}

[data-custom-sus-acc] [data-custom-sus-acc-answer] {
	padding: 0 24px 24px;
	font-size: 16px;
	line-height: 1.7;
	color: #475569;
}

/* sustain.css:249 — 4 above; the 12 under it is the design's own paragraph foot */
[data-custom-sus-acc] [data-custom-sus-acc-answer] p {
	margin: 4px 0 12px;
	font-size: inherit;
	line-height: inherit;
	color: inherit;
}

[data-custom-sus-acc] [data-custom-sus-acc-answer] ul {
	display: grid;
	gap: 8px;
	margin: 10px 0 0;
	padding-left: 0;
	list-style: none;
}

[data-custom-sus-acc] [data-custom-sus-acc-answer] li {
	position: relative;
	margin: 0;
	padding-left: 18px;
}

[data-custom-sus-acc] [data-custom-sus-acc-answer] li::before {
	content: "";
	position: absolute;
	top: 12px;                             /* sustain.css:252 measures 11px */
	left: 0;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--custom-sus-acc-accent, #5CA13F);
}

@media (prefers-reduced-motion: reduce) {
	[data-custom-sus-acc] [data-custom-sus-acc-item],
	[data-custom-sus-acc] [data-custom-sus-acc-icon]::before,
	[data-custom-sus-acc] [data-custom-sus-acc-icon]::after,
	[data-custom-sus-acc] [data-custom-sus-acc-body] {
		transition: none;
	}
}

/* ------------------------------------------------------------------ */
/* Side tabs — sustain.css:262-392 (.sustabs--side): a rail of tabs down the
   left that stays in view, the chosen tab's panel beside it; below 1000 the
   rail runs across the top and scrolls. A widget sets --custom-sus-tab-p on
   each tab and panel, and --custom-sus-rail / --custom-sus-rail-top. */
/* ------------------------------------------------------------------ */

[data-custom-sus-tabs] {
	display: grid;
	grid-template-columns: minmax(240px, var(--custom-sus-rail, 300px)) minmax(0, 1fr);
	align-items: start;
}

[data-custom-sus-tabs] > [role="tablist"] {
	position: sticky;
	top: var(--custom-sus-rail-top, 110px);
	display: flex;
	flex-direction: column;
	align-self: start;
	border-left: 2px solid #EEF2F7;
}

[data-custom-sus-tabs] [data-custom-sus-tab] {
	position: relative;
	display: block;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	border: 0;
	border-radius: 0 6px 6px 0;              /* --r-sm */
	background: none;
	color: #475569;
	font-family: inherit;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.5;
	text-align: left;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	transition: background-color 250ms cubic-bezier(0.2, 0.8, 0.2, 1),
	            color 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* the stretch of rail that is this tab, drawn over the rail */
[data-custom-sus-tabs] [data-custom-sus-tab]::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: -2px;
	width: 2px;
	background: transparent;
	transition: background-color 250ms cubic-bezier(0.2, 0.8, 0.2, 1),
	            width 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-custom-sus-tabs] [data-custom-sus-tab]:hover {
	background: color-mix(in srgb, var(--custom-sus-tab-p, #5CA13F) 7%, #FFFFFF);
	color: var(--custom-sus-tab-p, #5CA13F);
}

[data-custom-sus-tabs] [data-custom-sus-tab].is-active {
	background: color-mix(in srgb, var(--custom-sus-tab-p, #5CA13F) 12%, #FFFFFF);
	color: #16418C;
	font-weight: 600;
}

[data-custom-sus-tabs] [data-custom-sus-tab].is-active::before {
	width: 4px;
	background: var(--custom-sus-tab-p, #5CA13F);
}

[data-custom-sus-tabs] [data-custom-sus-tab]:focus-visible {
	outline: 2px solid var(--custom-sus-tab-p, #5CA13F);
	outline-offset: -2px;
}

[data-custom-sus-tabs] > [data-custom-sus-panel] {
	grid-row: 1;
	grid-column: 2;
	min-width: 0;
}

[data-custom-sus-tabs] > [data-custom-sus-panel][hidden] {
	display: none;
}

[data-custom-sus-tabs] > [data-custom-sus-panel].is-active {
	animation: custom-sus-fade 500ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes custom-sus-fade {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: none; }
}

@media (max-width: 1000px) {
	[data-custom-sus-tabs] {
		grid-template-columns: minmax(0, 1fr);
	}
	/* across the top, running off both edges of the window so the last tab is cut: there is more */
	[data-custom-sus-tabs] > [role="tablist"] {
		position: static;
		flex-direction: row;
		flex-wrap: nowrap;
		margin: 0 -24px 24px;
		padding-right: 24px;
		padding-left: 24px;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		border-bottom: 2px solid #EEF2F7;
		border-left: 0;
		scroll-padding-inline: 24px;
		scroll-snap-type: x proximity;
		scrollbar-width: none;
	}
	[data-custom-sus-tabs] > [role="tablist"]::-webkit-scrollbar {
		display: none;
	}
	[data-custom-sus-tabs] [data-custom-sus-tab] {
		flex: 0 0 auto;
		width: auto;
		border-radius: 6px 6px 0 0;
		white-space: nowrap;
		scroll-snap-align: start;
	}
	[data-custom-sus-tabs] [data-custom-sus-tab]::before {
		top: auto;
		right: 0;
		bottom: -2px;
		left: 0;
		width: auto;
		height: 2px;
	}
	[data-custom-sus-tabs] [data-custom-sus-tab].is-active::before {
		width: auto;
		height: 4px;
	}
	[data-custom-sus-tabs] > [data-custom-sus-panel] {
		grid-row: auto;
		grid-column: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	[data-custom-sus-tabs] [data-custom-sus-tab],
	[data-custom-sus-tabs] [data-custom-sus-tab]::before {
		transition: none;
	}
	[data-custom-sus-tabs] > [data-custom-sus-panel].is-active {
		animation: none;
	}
}

/* ------------------------------------------------------------------ */
/* Leaves behind a band — sustain.css:677-711 (.sec--leaf, .susleaf) */
/* ------------------------------------------------------------------ */

[data-custom-partner-band]:has([data-custom-sus-leaf]) {
	position: relative;
	overflow: hidden;
}

[data-custom-partner-band]:has([data-custom-sus-leaf]) > [data-custom-investor-inner] {
	position: relative;
	z-index: 1;
}

[data-custom-sus-leaf] {
	position: absolute;
	z-index: 0;
	line-height: 0;
	color: var(--custom-sus-leaf, #00428F);
	pointer-events: none;
}

[data-custom-sus-leaf] svg {
	display: block;
	width: 100%;
	height: auto;
}

[data-custom-sus-leaf] svg path {
	vector-effect: non-scaling-stroke;
}

[data-custom-sus-leaf="a"] {
	top: -46px;
	left: -58px;
	width: var(--custom-sus-leaf-a, 216px);
	opacity: var(--custom-sus-leaf-a-o, 0.16);
}

[data-custom-sus-leaf="b"] {
	right: -78px;
	bottom: -100px;
	width: var(--custom-sus-leaf-b, 360px);
	opacity: var(--custom-sus-leaf-b-o, 0.12);
	transform: rotate(180deg);
}

@media (max-width: 640px) {
	[data-custom-sus-leaf="a"] {
		top: -30px;
		left: -38px;
	}
	[data-custom-sus-leaf="b"] {
		right: -48px;
		bottom: -62px;
	}
}

/* ------------------------------------------------------------------ */
/* A heading's own line breaks hold at every width: sustain.css keeps   */
/* them, where the partner pages close them up below 1024              */
/* (partner-widget.css, app.css:903, 3094).                            */
/* ------------------------------------------------------------------ */

@media (max-width: 1024px) {
	[class^="custom-sustainability-"][data-custom-partner-band] [data-custom-investor-title] br,
	[class^="custom-sustainability-"][data-custom-partner-band] [data-custom-investor-intro] br {
		display: inline;
	}
}

/* ------------------------------------------------------------------ */
/* A table in a white frame — sustain-materiality-issues.css (.mitab2, */
/* .mitab): a blue band of column names, rows ruled apart; the frame   */
/* scrolls sideways when the table is wider than the page.             */
/* ------------------------------------------------------------------ */

[data-custom-partner-band] [data-custom-sus-table-frame] {
	overflow-x: auto;
	overflow-y: visible;
	overscroll-behavior-x: contain;
	border: 2px solid var(--custom-sus-table-edge, #EEF2F7);   /* measures 1px */
	border-radius: 14px;                   /* --r */
	background: #FFFFFF;
}

[data-custom-partner-band] [data-custom-sus-table-frame]:focus-visible {
	outline: 2px solid var(--custom-sus-table-accent, #5CA13F);
	outline-offset: 2px;
}

[data-custom-partner-band] table[data-custom-sus-table] {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	font-size: 16px;
	line-height: 1.7;
	color: var(--custom-sus-table-ink, #475569);
}

[data-custom-partner-band] table[data-custom-sus-table] thead th {
	padding: 14px 18px;
	border: 0;
	background: linear-gradient(120deg, var(--custom-sus-table-head-a, #16418C) 0%, var(--custom-sus-table-head-b, #2E6BC4) 100%);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
	text-align: left;
	vertical-align: bottom;
	color: #FFFFFF;
}

[data-custom-partner-band] table[data-custom-sus-table] tbody th,
[data-custom-partner-band] table[data-custom-sus-table] tbody td {
	padding: 14px 18px;
	border: 0;
	border-top: 2px solid var(--custom-sus-table-edge, #EEF2F7);   /* measures 1px */
	background: none;
	text-align: left;
	vertical-align: top;
}

[data-custom-partner-band] table[data-custom-sus-table] tbody tr:first-child > * {
	border-top: 0;
}

[data-custom-partner-band] table[data-custom-sus-table] tbody th {
	font-weight: 600;
	color: var(--custom-sus-table-key, #16418C);
}

[data-custom-partner-band] table[data-custom-sus-table] p {
	margin: 0;
	color: inherit;
}

[data-custom-partner-band] table[data-custom-sus-table] p + p {
	margin-top: 10px;
}

@media (max-width: 600px) {
	[data-custom-partner-band] table[data-custom-sus-table] {
		font-size: 14px;
	}
	[data-custom-partner-band] table[data-custom-sus-table] thead th,
	[data-custom-partner-band] table[data-custom-sus-table] tbody th,
	[data-custom-partner-band] table[data-custom-sus-table] tbody td {
		padding: 12px 14px;
	}
}

/* the floating copy of a table's column names (sustainability-widget.js) */
[data-custom-partner-band] .custom-sus-table-float {
	position: fixed;
	z-index: 500;
	display: none;
	overflow: hidden;
	border: 0;
	border-radius: 0;
	background: none;
}

[data-custom-partner-band] .custom-sus-table-float table[data-custom-sus-table] {
	width: auto;
	min-width: 0;
	table-layout: fixed;
}
