/* Sustainability Report page template
 *
 * PDF colors (VSME Hållbarhetsrapport 2025):
 *   Extra extra large / H1 → green  #286018
 *   Large / H3             → blue   #405c8c
 *
 * Spacing: headings have no margins; groups carry vertical rhythm.
 */

.sustainability-report {
	--sr-title: #286018;
	--sr-heading: #405c8c;
	--sr-text: #1a1a1a;
	--sr-group-gap: 2rem;
	--sr-group-gap-lg: 3.5rem;

	width: 100%;
	color: var(--sr-text);
}

/* Headings: tight but readable gap before following content */
.sustainability-report :is(h1, h2, h3, h4, h5, h6),
.sustainability-report .wp-block-heading {
	margin: 0 0 0.35em 0 !important;
	padding: 0 !important;
	line-height: 1.15 !important;
}

.sustainability-report .wp-block-heading + *,
.sustainability-report :is(h1, h2, h3, h4, h5, h6) + * {
	margin-top: 0 !important;
	padding-top: 0 !important;
}

/* Leading <br> that WP/paste inserts at start of each paragraph */
.sustainability-report p > br:first-child {
	display: none !important;
	margin: 0 !important;
	padding: 0 !important;
	line-height: 0 !important;
	height: 0 !important;
	content: none !important;
}

/* Keep leading <br> inside columns (layout uses them) */
.sustainability-report .wp-block-columns p > br:first-child {
	display: inline !important;
	margin: unset !important;
	padding: unset !important;
	line-height: unset !important;
	height: unset !important;
	content: unset !important;
}

/* Tight paragraph gap (PDF-like) */
.sustainability-report p {
	margin-top: 0;
	margin-bottom: 0;
}

.sustainability-report p + p {
	margin-top: 0.75em !important;
}

/* Groups carry vertical rhythm */
.sustainability-report .wp-block-group {
	margin-top: 0;
	margin-bottom: var(--sr-group-gap) !important;
}

.sustainability-report .wp-block-group + .wp-block-group {
	margin-top: var(--sr-group-gap-lg) !important;
}

.sustainability-report .wp-block-group:last-child {
	margin-bottom: 0 !important;
}

/* Keep images inside the content grid */
.sustainability-report .wp-block-image,
.sustainability-report .wp-block-image img,
.sustainability-report figure,
.sustainability-report img {
	max-width: 100% !important;
	height: auto !important;
	box-sizing: border-box;
}

.sustainability-report .wp-block-image {
	width: 100%;
}

/* Media & Text: no padding on text, gap between text and image */
.sustainability-report .wp-block-media-text {
	gap: 2rem;
}

.sustainability-report .wp-block-media-text .wp-block-media-text__content {
	padding: 0 !important;
	margin: 0 !important;
}

.sustainability-report .wp-block-media-text .wp-block-media-text__content > :first-child {
	margin-top: 0 !important;
	padding-top: 0 !important;
}

.sustainability-report .wp-block-media-text .wp-block-media-text__content > :last-child {
	margin-bottom: 0 !important;
	padding-bottom: 0 !important;
}

.sustainability-report .wp-block-media-text .wp-block-media-text__media,
.sustainability-report .wp-block-media-text .wp-block-media-text__media img {
	max-width: 100% !important;
	height: auto !important;
}

/* Extra extra large / H1 — PDF green */
.sustainability-report .wp-block-heading.has-x-x-large-font-size {
	color: var(--sr-title) !important;
}

/* Large / H3 + Medium small — PDF blue */
.sustainability-report .wp-block-heading.has-large-font-size,
.sustainability-report .wp-block-heading.has-medium-small-font-size {
	color: var(--sr-heading) !important;
}

/* Column headings (often without font-size class, e.g. Affärsidé / Vision) */
.sustainability-report .wp-block-column .wp-block-heading {
	margin: 1.75rem 0 0.35em 0 !important;
	padding: 0 !important;
	line-height: 1.15 !important;
	color: var(--sr-heading) !important;
}

.sustainability-report .wp-block-column .wp-block-heading + * {
	margin-top: 0 !important;
	padding-top: 0 !important;
	margin-block-start: 0 !important;
}

.sustainability-report .wp-block-column.is-layout-flow > .wp-block-heading {
	margin-block-start: 1.75rem !important;
	margin-block-end: 0.35em !important;
}

/* Table of contents — Word-style dotted leaders */
.sustainability-report .sr-toc {
	margin: 0;
	padding: 0;
	list-style: none;
	font-family: inherit;
	font-size: 1.05em;
	line-height: 1.55;
	color: #1a1a1a;
}

.sustainability-report .sr-toc li {
	margin: 0;
	padding: 0;
}

.sustainability-report .sr-toc__row {
	display: flex;
	align-items: baseline;
	width: 100%;
	max-width: 100%;
	gap: 0.15em;
	box-sizing: border-box;
}

.sustainability-report .sr-toc__label {
	flex: 0 1 auto;
	min-width: 0;
	max-width: calc(100% - 2.5em);
	white-space: normal;
	overflow-wrap: break-word;
}

.sustainability-report .sr-toc__dots {
	flex: 1 1 0;
	min-width: 0.75em;
	overflow: hidden;
	white-space: nowrap;
	color: #1a1a1a;
}

.sustainability-report .sr-toc__dots::before {
	content: " ................................................................................................................................................................................................ ";
	letter-spacing: 0.12em;
	speak: never;
}

.sustainability-report .sr-toc__page {
	flex: 0 0 auto;
	margin-left: 0.25em;
	min-width: 1.25em;
	text-align: right;
	white-space: nowrap;
}

/* Tables — fit on desktop, horizontal scroll on small screens */
.sustainability-report .wp-block-table {
	margin: 0 0 1.5rem;
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.sustainability-report .wp-block-table table {
	width: 100%;
	table-layout: auto !important;
	border-collapse: collapse;
	font-family: inherit;
	font-size: 1.05em;
	line-height: 1.45;
	color: #1a1a1a;
}

.sustainability-report .wp-block-table td,
.sustainability-report .wp-block-table th {
	border: 1px solid #4a4a4a;
	padding: 0.55em 0.75em;
	font-family: inherit;
	vertical-align: top;
	text-align: left;
	font-weight: 400;
	white-space: normal;
	overflow-wrap: break-word;
	word-break: normal;
}

@media (max-width: 781px) {
	.sustainability-report .wp-block-table table {
		width: max-content;
		min-width: 100%;
	}

	.sustainability-report .wp-block-table td,
	.sustainability-report .wp-block-table th {
		white-space: nowrap;
		overflow-wrap: normal;
	}
}

/* Header: thead, or first row when table is tbody-only */
.sustainability-report .wp-block-table thead th,
.sustainability-report .wp-block-table thead td,
.sustainability-report .wp-block-table table:not(:has(thead)) tbody tr:first-child td {
	background: #d0d0d0;
	font-weight: 700;
}

/* First column bold */
.sustainability-report .wp-block-table td:first-child,
.sustainability-report .wp-block-table th:first-child {
	font-weight: 700;
}
