/* WordPress adds block gap between direct children of .wp-site-blocks */
.wp-site-blocks > main {
	margin-block-start: 0 !important;
	padding-top: 0 !important;
}

.wp-site-blocks > footer.wp-block-template-part {
	margin-block-start: 0;
	margin-block-end: 0;
}

@media screen and (max-width: 991px) {
	.wp-site-blocks > .wp-block-template-part:has( .theme-header ),
	.wp-site-blocks > header.wp-block-template-part {
		margin-block-start: 0;
		margin-block-end: 0;
	}

	.wp-site-blocks > main .wp-block-post-content > :first-child.startsida-hero,
	.wp-site-blocks > main .wp-block-post-content > :first-child.undersida-hero,
	.wp-site-blocks > main .wp-block-post-content > :first-child.undersida-hero.theme-section,
	.wp-site-blocks > main > :first-child.undersida-hero,
	.wp-site-blocks > main > :first-child.undersida-hero.theme-section {
		padding-block: calc(var(--theme-header-offset, var(--theme-mobile-header-height, 4.5rem)) + 2rem) 3.5rem;
	}

	.wp-site-blocks > main .wp-block-post-content > :first-child.startsida-hero,
	.wp-site-blocks > main > :first-child.startsida-hero {
		min-height: calc(80vh + var(--theme-header-offset, var(--theme-mobile-header-height, 4.5rem)));
	}

	.wp-site-blocks > main .wp-block-post-content > :first-child.undersida-hero--has-image,
	.wp-site-blocks > main > :first-child.undersida-hero--has-image {
		min-height: calc(clamp(16rem, 36vw, 24rem) + var(--theme-header-offset, var(--theme-mobile-header-height, 4.5rem)));
	}
}

@media screen and (max-width: 781px) {
	.wp-site-blocks > main .wp-block-post-content > :first-child.startsida-hero,
	.wp-site-blocks > main > :first-child.startsida-hero {
		min-height: calc(70vh + var(--theme-header-offset, var(--theme-mobile-header-height, 4.5rem)));
	}
}

/*
 * Consistent air between undersida hero and the first content section.
 * Higher specificity than block `.foo.theme-section { padding-block: … }`
 * so individual blocks cannot diversify this gap.
 */
.wp-block-post-content > .undersida-hero + .theme-section,
.wp-site-blocks > main .undersida-hero + .theme-section {
	padding-top: clamp(3rem, 7vw, 5.5rem);
}

.theme-header {
	background: var(--wp--preset--color--white, #fff);
	color: var(--wp--preset--color--blue-900, #0c2033);
}

/*
 * Overlay header on pages with a dark hero: transparent bar, white UI,
 * hero image runs edge-to-edge under the header. Content keeps its place
 * via extra top padding equal to the header height.
 * On scroll (`html.is-header-solid`): white compact bar that stays fixed.
 *
 * Projekt singles keep the solid white header — hero images vary too much
 * for reliable white nav over the photo.
 */
body:has( .startsida-hero ) .theme-header,
body:has( .undersida-hero--has-image ) .theme-header {
	background: transparent;
	color: var(--wp--preset--color--white, #fff);
	transition:
		color var(--theme-duration, 0.2s) var(--theme-ease, ease),
		box-shadow var(--theme-duration, 0.2s) var(--theme-ease, ease);
}

body:has( .startsida-hero ) .theme-header__nav .wp-block-navigation-item__content,
body:has( .undersida-hero--has-image ) .theme-header__nav .wp-block-navigation-item__content {
	color: var(--wp--preset--color--white, #fff);
}

body:has( .startsida-hero ) .theme-header__nav .wp-block-navigation-item__content:hover,
body:has( .startsida-hero ) .theme-header__nav .wp-block-navigation-item__content:focus-visible,
body:has( .startsida-hero ) .theme-header__nav .current-menu-item > .wp-block-navigation-item__content,
body:has( .undersida-hero--has-image ) .theme-header__nav .wp-block-navigation-item__content:hover,
body:has( .undersida-hero--has-image ) .theme-header__nav .wp-block-navigation-item__content:focus-visible,
body:has( .undersida-hero--has-image ) .theme-header__nav .current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--white, #fff);
}

body:has( .startsida-hero ) .theme-header__social a,
body:has( .startsida-hero ) .theme-header__social a:visited,
body:has( .undersida-hero--has-image ) .theme-header__social a,
body:has( .undersida-hero--has-image ) .theme-header__social a:visited {
	color: var(--wp--preset--color--white, #fff);
}

html.is-header-solid body:has( .startsida-hero ) .theme-header,
html.is-header-solid body:has( .undersida-hero--has-image ) .theme-header {
	background: var(--wp--preset--color--white, #fff);
	color: var(--wp--preset--color--blue-900, #0c2033);
	box-shadow: 0 1px 0 color-mix(in srgb, var(--wp--preset--color--blue-900, #0c2033) 8%, transparent);
}

html.is-header-solid body:has( .startsida-hero ) .theme-header__nav .wp-block-navigation-item__content,
html.is-header-solid body:has( .undersida-hero--has-image ) .theme-header__nav .wp-block-navigation-item__content {
	color: var(--wp--preset--color--blue-900, #0c2130);
}

html.is-header-solid body:has( .startsida-hero ) .theme-header__nav .wp-block-navigation-item__content:hover,
html.is-header-solid body:has( .startsida-hero ) .theme-header__nav .wp-block-navigation-item__content:focus-visible,
html.is-header-solid body:has( .startsida-hero ) .theme-header__nav .current-menu-item > .wp-block-navigation-item__content,
html.is-header-solid body:has( .undersida-hero--has-image ) .theme-header__nav .wp-block-navigation-item__content:hover,
html.is-header-solid body:has( .undersida-hero--has-image ) .theme-header__nav .wp-block-navigation-item__content:focus-visible,
html.is-header-solid body:has( .undersida-hero--has-image ) .theme-header__nav .current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--blue-900, #0c2130);
}

html.is-header-solid body:has( .startsida-hero ) .theme-header__social a,
html.is-header-solid body:has( .startsida-hero ) .theme-header__social a:visited,
html.is-header-solid body:has( .undersida-hero--has-image ) .theme-header__social a,
html.is-header-solid body:has( .undersida-hero--has-image ) .theme-header__social a:visited {
	color: #000;
}

@media screen and (min-width: 992px) {
	body:has( .startsida-hero ) .wp-site-blocks > .wp-block-template-part:has( .theme-header ),
	body:has( .startsida-hero ) .wp-site-blocks > header.wp-block-template-part,
	body:has( .undersida-hero--has-image ) .wp-site-blocks > .wp-block-template-part:has( .theme-header ),
	body:has( .undersida-hero--has-image ) .wp-site-blocks > header.wp-block-template-part {
		height: 0;
		min-height: 0;
		overflow: visible;
		margin: 0;
		padding: 0;
		pointer-events: none;
	}

	body:has( .startsida-hero ) .wp-site-blocks > .wp-block-template-part:has( .theme-header ) .theme-header,
	body:has( .startsida-hero ) .wp-site-blocks > header.wp-block-template-part .theme-header,
	body:has( .undersida-hero--has-image ) .wp-site-blocks > .wp-block-template-part:has( .theme-header ) .theme-header,
	body:has( .undersida-hero--has-image ) .wp-site-blocks > header.wp-block-template-part .theme-header {
		pointer-events: auto;
	}

	body:has( .startsida-hero ) .theme-header,
	body:has( .undersida-hero--has-image ) .theme-header {
		position: fixed;
		top: 0;
		right: 0;
		left: 0;
		z-index: 100;
		width: 100%;
	}

	body:has( .startsida-hero ) .theme-header__inner,
	body:has( .undersida-hero--has-image ) .theme-header__inner {
		padding-block: 1.5rem 0.85rem;
		transition: padding-block var(--theme-duration, 0.2s) var(--theme-ease, ease);
	}

	html.is-header-solid body:has( .startsida-hero ) .theme-header__inner,
	html.is-header-solid body:has( .undersida-hero--has-image ) .theme-header__inner {
		padding-block: 0.7rem;
	}

	html.admin-bar body:has( .startsida-hero ) .theme-header,
	html.admin-bar body:has( .undersida-hero--has-image ) .theme-header {
		top: var(--wp-admin--admin-bar--height, 32px);
	}

	/*
	 * Keep the pre-overlay hero footprint: image extends under the header,
	 * but min-height grows by header height so content stays where it was.
	 * Use --theme-header-offset (frozen at top) so solid compact state does not shrink the hero.
	 */
	body:has( .startsida-hero ) .startsida-hero {
		min-height: calc(80vh + var(--theme-header-offset, var(--theme-header-height, 4.5rem)));
		padding-top: calc(var(--theme-header-offset, var(--theme-header-height, 4.5rem)) + clamp(4.5rem, 12vh, 7rem));
		padding-bottom: clamp(4.5rem, 12vh, 7rem);
	}

	body:has( .undersida-hero--has-image ) .undersida-hero--has-image {
		min-height: calc(clamp(16rem, 36vw, 24rem) + var(--theme-header-offset, var(--theme-header-height, 4.5rem)));
	}

	body:has( .undersida-hero--has-image ) .undersida-hero--has-image.theme-section {
		padding-top: calc(var(--theme-header-offset, var(--theme-header-height, 4.5rem)) + clamp(3rem, 7vw, 5.5rem));
		padding-bottom: clamp(3rem, 7vw, 5.5rem);
	}

	/*
	 * Projekt / nyhet singles: sticky white header (no transparent overlay).
	 * Same fixed shell as overlay pages; content offset keeps layout stable.
	 */
	body:has( .projekt-single ) .wp-site-blocks > .wp-block-template-part:has( .theme-header ),
	body:has( .projekt-single ) .wp-site-blocks > header.wp-block-template-part,
	body:has( .nyhet-single ) .wp-site-blocks > .wp-block-template-part:has( .theme-header ),
	body:has( .nyhet-single ) .wp-site-blocks > header.wp-block-template-part {
		height: 0;
		min-height: 0;
		overflow: visible;
		margin: 0;
		padding: 0;
		pointer-events: none;
	}

	body:has( .projekt-single ) .wp-site-blocks > .wp-block-template-part:has( .theme-header ) .theme-header,
	body:has( .projekt-single ) .wp-site-blocks > header.wp-block-template-part .theme-header,
	body:has( .nyhet-single ) .wp-site-blocks > .wp-block-template-part:has( .theme-header ) .theme-header,
	body:has( .nyhet-single ) .wp-site-blocks > header.wp-block-template-part .theme-header {
		pointer-events: auto;
	}

	body:has( .projekt-single ) .theme-header,
	body:has( .nyhet-single ) .theme-header {
		position: fixed;
		top: 0;
		right: 0;
		left: 0;
		z-index: 100;
		width: 100%;
		background: var(--wp--preset--color--white, #fff);
	}

	html.admin-bar body:has( .projekt-single ) .theme-header,
	html.admin-bar body:has( .nyhet-single ) .theme-header {
		top: var(--wp-admin--admin-bar--height, 32px);
	}

	html.is-header-solid body:has( .projekt-single ) .theme-header,
	html.is-header-solid body:has( .nyhet-single ) .theme-header {
		box-shadow: 0 1px 0 color-mix(in srgb, var(--wp--preset--color--blue-900, #0c2033) 8%, transparent);
	}

	body:has( .projekt-single ) .projekt-single__hero.theme-section {
		padding-top: calc(var(--theme-header-height, 4.5rem) + clamp(3rem, 7vw, 5.5rem));
		padding-bottom: clamp(3rem, 7vw, 5.5rem);
	}

	body:has( .projekt-single ) .projekt-single__hero--has-image {
		min-height: calc(clamp(16rem, 36vw, 24rem) + var(--theme-header-height, 4.5rem));
	}

	body:has( .nyhet-single ) .nyhet-single__content.theme-section {
		padding-top: calc(var(--theme-header-height, 4.5rem) + clamp(3rem, 7vw, 5.5rem));
		padding-bottom: clamp(3rem, 7vw, 5.5rem);
	}
}

.theme-header__inner {
	display: flex;
	flex-wrap: nowrap;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	padding-block: 0.7rem;
}

/* Same container as Södermalmstornet until extra-large screens, then 1600px. */
@media (min-width: 1800px) {
	.theme-header .theme-container,
	.theme-footer .theme-container {
		width: min(calc(100% - 2.5rem), 1600px);
	}
}

.theme-header__logo {
	flex-shrink: 0;
	margin: 0;
	line-height: 0;
}

.theme-header__logo .theme-logo__link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.theme-header__logo .theme-logo__link:has(.theme-logo__img) {
	line-height: 0;
}

.theme-header__logo .theme-logo__text {
	font-size: var(--wp--preset--font-size--nav, 0.875rem);
	font-weight: 300;
	line-height: 1.2;
}

.theme-header__logo .theme-logo__img {
	display: block;
	width: auto;
	height: clamp(2.25rem, 4vw, 3.25rem);
	max-width: min(14rem, 55vw);
	object-fit: contain;
}

/* After .theme-logo__img — same specificity, must win via source order. */
.theme-header__logo .theme-logo__img--light {
	display: none;
}

body:has( .startsida-hero ) .theme-header .theme-logo__img--dark,
body:has( .undersida-hero--has-image ) .theme-header .theme-logo__img--dark {
	display: none;
}

body:has( .startsida-hero ) .theme-header .theme-logo__img--light,
body:has( .undersida-hero--has-image ) .theme-header .theme-logo__img--light {
	display: block;
}

html.is-header-solid body:has( .startsida-hero ) .theme-header .theme-logo__img--dark,
html.is-header-solid body:has( .undersida-hero--has-image ) .theme-header .theme-logo__img--dark {
	display: block;
}

html.is-header-solid body:has( .startsida-hero ) .theme-header .theme-logo__img--light,
html.is-header-solid body:has( .undersida-hero--has-image ) .theme-header .theme-logo__img--light {
	display: none;
}

.theme-header__nav {
	margin-left: auto;
	flex-shrink: 0;
}

/* Beat WP flex child margin reset (.is-layout-flex > * { margin-left: 0 }). */
.theme-header .theme-header__nav {
	margin-left: auto;
}

.theme-header__social {
	display: flex;
	align-items: center;
	align-self: center;
	flex-shrink: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	line-height: 0;
}

/* Nav link gap is 2.5rem; header inner already has 1rem flex gap. */
.theme-header .theme-header__social {
	margin-left: 1rem;
}

.theme-header__social li {
	display: flex;
	align-items: center;
	margin: 0;
	line-height: 0;
}

.theme-header__social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #000;
	line-height: 0;
	text-decoration: none;
	transition: opacity var(--theme-duration, 0.2s) var(--theme-ease, ease);
	margin-top: -1px;
}

.theme-header__social a:visited {
	color: #000;
}

.theme-header__social a:hover,
.theme-header__social a:focus-visible {
	opacity: 0.72;
}

.theme-header__social svg {
	display: block;
	width: 2rem;
	height: 2rem;
}

.theme-header__nav.wp-block-navigation {
	gap: 2.5rem;
}

.theme-header__nav .wp-block-navigation-item__content {
	color: var(--wp--preset--color--blue-700, #133453);
	font-size: var(--wp--preset--font-size--nav, 0.875rem);
	font-weight: 300;
	line-height: 1.4;
	text-decoration: none;
}

.theme-header__nav .wp-block-navigation-item__content:hover,
.theme-header__nav .wp-block-navigation-item__content:focus-visible,
.theme-header__nav .current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--blue-900, #0c2033);
}

.theme-header__nav .wp-block-navigation-item__content,
.theme-footer__nav .wp-block-navigation-item__content {
	position: relative;
}

.theme-header__nav .wp-block-navigation-item__content::before,
.theme-footer__nav .wp-block-navigation-item__content::before {
	content: "";
	position: absolute;
	bottom: var(--theme-underline-offset);
	left: 0;
	width: 100%;
	height: var(--theme-underline-thickness);
	background-color: currentColor;
	transition: transform var(--theme-underline-duration) var(--theme-ease);
	transform-origin: right;
	transform: scaleX(0) rotate(0.001deg);
	pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
	.theme-header__nav .wp-block-navigation-item__content:hover::before,
	.theme-header__nav .wp-block-navigation-item__content:focus-visible::before,
	.theme-footer__nav .wp-block-navigation-item__content:hover::before,
	.theme-footer__nav .wp-block-navigation-item__content:focus-visible::before {
		transform-origin: left;
		transform: scaleX(1) rotate(0.001deg);
	}
}

.theme-header__nav .current-menu-item > .wp-block-navigation-item__content::before,
.theme-footer__nav .current-menu-item > .wp-block-navigation-item__content::before {
	transform-origin: left;
	transform: scaleX(1) rotate(0.001deg);
}

.theme-footer {
	background: var(--wp--preset--color--blue-900, #0c2130);
	color: var(--wp--preset--color--white, #fff);
}

.theme-footer a {
	color: inherit;
	text-decoration: none;
}

.theme-footer .is-layout-flow > * {
	margin-block-start: 0;
}

.theme-footer__inner {
	/* Former toolbar sat below padding-top and added the same clamp as margin-bottom. */
	padding-block: calc(clamp(2rem, 4vw, 3.5rem) + clamp(2rem, 4vw, 3.5rem)) 0;
}

.theme-footer__main {
	display: grid;
	grid-template-columns: minmax(16rem, 0.9fr) minmax(22rem, 1.4fr);
	gap: clamp(2rem, 4vw, 4.5rem);
	align-items: start;
}

.theme-footer__offices {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1.5rem 2rem;
}

.theme-footer .theme-footer__brand {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0;
}

.theme-footer .theme-footer__brand > * {
	margin-block: 0;
}

.theme-footer .theme-footer__lead {
	margin-block-start: clamp(1.5rem, 2.4vw, 2rem);
}

.theme-footer__lead {
	max-width: 28rem;
	margin: 0;
	color: color-mix(in srgb, var(--wp--preset--color--white, #fff) 88%, transparent);
	line-height: 1.5;
}

.theme-footer__more,
.theme-footer__address,
.theme-footer__contact,
.theme-footer__legal {
	margin: 0;
}

.theme-footer .theme-footer__more {
	margin-block-start: 1rem;
	font-weight: 600;
}

.theme-footer__address {
	margin-top: 0.15rem;
	line-height: 1.5;
}

.theme-footer__contact {
	line-height: 1.5;
}

/* Same draw-underline as header nav / .theme-animated-underline */
.theme-footer__more a,
.theme-footer__contact a {
	position: relative;
	text-decoration: none;
}

.theme-footer__contact a {
	font-weight: 600;
}

.theme-footer__more a::before,
.theme-footer__contact a::before {
	content: "";
	position: absolute;
	bottom: var(--theme-underline-offset);
	left: 0;
	width: 100%;
	height: var(--theme-underline-thickness);
	background-color: currentColor;
	transition: transform var(--theme-underline-duration) var(--theme-ease);
	transform-origin: right;
	transform: scaleX(0) rotate(0.001deg);
	pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
	.theme-footer__more a:hover::before,
	.theme-footer__more a:focus-visible::before,
	.theme-footer__contact a:hover::before,
	.theme-footer__contact a:focus-visible::before {
		transform-origin: left;
		transform: scaleX(1) rotate(0.001deg);
	}
}

.theme-footer__more a::after,
.theme-footer__shortcuts .wp-block-navigation-item__content::after {
	content: "→";
	margin-left: 0.35em;
	font-weight: 400;
}

.theme-footer__partners {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-evenly;
	gap: clamp(1.25rem, 3vw, 2.5rem);
	margin: 0;
	/* Beat .theme-footer .is-layout-flow > * { margin-block-start: 0 } */
	margin-block-start: clamp(3.5rem, 7vw, 5.5rem);
	padding: clamp(1.5rem, 3vw, 2.25rem) 0;
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--white, #fff) 28%, transparent);
	list-style: none;
}

.theme-footer .is-layout-flow > .theme-footer__partners {
	margin-block-start: clamp(3.5rem, 7vw, 5.5rem);
}

.theme-footer__partner {
	margin: 0;
	line-height: 0;
}

.theme-footer__partner-img {
	display: block;
	width: auto;
	height: clamp(2rem, 3vw, 2.5rem);
	max-width: min(11rem, 40vw);
	object-fit: contain;
}

.theme-footer__bar {
	background: color-mix(in srgb, #000 22%, var(--wp--preset--color--blue-900, #0c2130));
	color: color-mix(in srgb, var(--wp--preset--color--white, #fff) 72%, transparent);
	font-size: 0.8125rem;
	line-height: 1.3;
}

.theme-footer__bar-inner {
	display: flex;
	align-items: center;
	justify-content: center;
	padding-block: 0.55rem;
}

.theme-footer__legal {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.55rem;
	text-align: center;
}

.theme-footer__legal a {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.theme-footer__legal-sep {
	line-height: 1;
	opacity: 0.7;
}

.theme-footer__logo {
	margin: 0;
	line-height: 0;
}

.theme-footer__logo .theme-logo__link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.theme-footer__logo .theme-logo__link:has(.theme-logo__img) {
	line-height: 0;
}

.theme-footer__logo .theme-logo__text {
	font-size: var(--wp--preset--font-size--body, 1.125rem);
	font-weight: 300;
	line-height: 1.2;
}

.theme-footer__logo .theme-logo__img {
	display: block;
	width: auto;
	height: clamp(3rem, 5vw, 4rem);
	max-width: min(18rem, 70vw);
}

.theme-footer__column {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0;
	min-width: 9rem;
	text-align: left;
}

.theme-footer__column > * {
	margin-inline: 0;
	max-width: none;
}

.theme-footer__column-title {
	margin: 0 0 0.85rem;
	color: var(--wp--preset--color--white, #fff);
	font-size: clamp(1.25rem, 1.6vw, 1.5rem);
	font-weight: 600;
	letter-spacing: 0;
	line-height: 1.2;
	text-align: left;
	text-transform: none;
	width: 100%;
}

.theme-footer__nav {
	margin: 0;
	width: 100%;
}

.theme-footer__nav .wp-block-navigation__responsive-container,
.theme-footer__nav .wp-block-navigation__container {
	justify-content: flex-start;
}

.theme-footer__nav .wp-block-navigation__container {
	align-items: flex-start;
	gap: 0.75rem;
}

.theme-footer__nav .wp-block-navigation-item {
	margin: 0;
	padding: 0;
}

.theme-footer__nav .wp-block-navigation-item__content {
	color: var(--wp--preset--color--white, #fff);
	font-size: var(--wp--preset--font-size--body, 1.125rem);
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
}

.theme-footer__nav .wp-block-navigation-item__content:hover,
.theme-footer__nav .wp-block-navigation-item__content:focus-visible,
.theme-footer__nav .current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--white, #fff);
}

@media (max-width: 991px) {
	.theme-header__inner {
		flex-wrap: nowrap;
		justify-content: space-between;
		align-items: center;
	}

	.theme-header__logo {
		min-width: 0;
	}

	.theme-header__nav {
		margin-left: auto;
		width: auto;
		align-self: center;
	}

	.theme-header__social {
		display: none;
	}
}

@media (max-width: 991px) {
	.theme-footer__main {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 640px) {
	.theme-footer__main,
	.theme-footer__offices {
		grid-template-columns: 1fr;
	}
}

