/* Shared mobile layout adjustments */
@media (max-width: 768px) {
	:root {
		--p: 16px;
		--h4: 21px;
		--h3: 26px;
		--h2: 32px;
		--h1: 40px;
	}

	html:has(body.noOverflow) {
		height: auto;
		overflow-x: hidden;
		overflow-y: auto;
	}

	body {
		min-width: 0;
		overflow-x: hidden;
	}

	body.noOverflow {
		display: flex;
		min-height: 100vh;
		height: auto;
		overflow: visible;
	}

	body.noOverflow .topicPage,
	body.noOverflow #mainPage {
		flex: 0 0 auto;
	}

	footer,
	body.noOverflow footer,
	.kontaktPage footer {
		min-height: 100px;
		margin-top: 0;
		padding: 18px 0;
	}

	#footer {
		width: 100%;
	}

	.footerLinks {
		gap: 8px 12px;
	}

	.footerLinks a {
		padding: 8px;
		font-size: 15px;
	}

	/* Home: keep the topic clouds in the page flow instead of off-screen. */
	html:has(.homePage),
	body.homePage {
		height: auto;
		min-height: 100%;
		overflow-x: hidden;
		overflow-y: auto;
	}

	.homePage #mainPage {
		height: auto;
		min-height: 100vh;
		overflow: visible;
	}

	.homePage footer {
		margin-top: 0;
	}

	#mainPage {
		min-height: 100vh;
		padding: 20px 16px 36px;
		box-sizing: border-box;
	}

	#mainH1 {
		position: relative;
		left: auto;
		top: auto;
		z-index: 1;
		transform: none;
		padding: 34px 16px 0;
	}

	#mainH1 h1 {
		margin: 0;
		font-size: clamp(34px, 9vw, 48px);
	}

	#mainPage video {
		position: fixed;
		width: 100%;
		height: 100%;
		inset: 0;
	}

	#cloudPage,
	#cloudPage.kilderClouds {
		position: relative;
		top: auto;
		left: auto;
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		align-content: start;
		justify-items: center;
		gap: 8px;
		width: 100%;
		height: auto;
		margin: 22px auto 0;
		padding: 0;
		box-sizing: border-box;
	}

	.cloud,
	#cloudPage .cloud {
		position: relative;
		inset: auto;
		width: 100%;
		max-width: 340px;
		height: auto;
		min-height: 145px;
		aspect-ratio: 1.8 / 1;
		box-sizing: border-box;
		background-size: contain;
		animation-duration: 14s;
	}

	.cloud p {
		width: 62%;
		margin: 0;
		padding: 8px;
		box-sizing: border-box;
		font-size: 14px;
		line-height: 1.35;
	}

	#cloud2 p {
		bottom: 0;
	}

	#cloud6 p {
		left: 0;
	}

	/* Topic detail pages */
	.topicPage {
		position: relative;
		width: 100%;
		min-height: 100vh;
		padding: 24px 18px 38px;
		box-sizing: border-box;
	}

	.topicPage > .back,
	.sporsmalPage .back,
	.kontaktPage > .back {
		position: relative;
		inset: auto;
		display: block;
		margin: 0 0 28px;
		padding: 8px 0;
	}

	.back a {
		display: inline-block;
		padding: 8px 12px;
		font-size: 14px;
	}

	.topicTitle {
		position: static;
		margin: 0;
		font-size: clamp(32px, 8vw, 42px);
		line-height: 1.12;
		overflow-wrap: anywhere;
	}

	.topicUnderline {
		gap: 12px;
		margin: 12px 0 0;
	}

	.line {
		width: min(65vw, 320px);
	}

	.star {
		font-size: 26px;
	}

	.textBoxes {
		flex-direction: column;
		gap: 16px;
		margin: 24px 0 12px;
	}

	.textBox {
		padding: 18px 16px;
		border-radius: 18px;
	}

	.textBox h1 {
		margin: 0 0 10px;
		font-size: 25px;
	}

	.textBox p {
		margin: 0;
		font-size: 16px;
		line-height: 1.65;
	}

	.topicPage video {
		position: fixed;
		width: 100vw;
		height: 100vh;
		object-fit: cover;
		inset: 0;
	}

	/* Sources page uses the same cloud artwork, arranged as a responsive grid. */
	.kilderPage .topicTitle,
	.kilderPage .topicUnderline {
		transform: none;
	}

	.kilderPage #cloudPage {
		margin-top: 14px;
	}

	.kilderPage #cloudPage .cloud {
		top: auto;
		left: auto;
		right: auto;
		bottom: auto;
		max-width: 340px;
	}

	/* FAQ */
	.sporsmalPage #mainPage {
		min-height: 0;
		padding: 24px 18px 36px;
	}

	.sporsmalPage .topS {
		width: 100%;
		margin: 0 auto 24px;
	}

	.sporsmalPage .topS h1 {
		font-size: clamp(32px, 8vw, 40px);
		line-height: 1.12;
	}

	.sporsmalPage .topS p {
		font-size: 15px;
		line-height: 1.55;
	}

	.sporsmalPage .spørBox {
		width: 100%;
		gap: 14px;
	}

	.sporsmalPage .boxS {
		padding: 19px 17px;
		border-radius: 16px;
	}

	.sporsmalPage .boxS h2 {
		font-size: 20px;
		line-height: 1.35;
	}

	.sporsmalPage .answer p {
		font-size: 15px;
		line-height: 1.6;
	}

	/* Contact page */
	.kontaktPage .back {
		margin: 24px 18px 0;
	}

	.kontaktSky {
		width: 100%;
		max-width: 100%;
		height: auto;
		min-height: 310px;
		margin: 0 auto 20px;
		padding: 36px 20px;
		box-sizing: border-box;
		transform: none;
		background-size: 100% 100%;
	}

	.kontaktSkyText {
		width: 100%;
		max-width: 72%;
		margin: 0;
	}

	.kontaktSkyText h2 {
		font-size: 26px;
		transform: none;
	}

	.kontaktSkyText p,
	.kontaktSky #kontaktInfo p {
		font-size: 14px;
		line-height: 1.5;
		transform: none;
	}

	#kontaktGrid {
		width: calc(100% - 36px);
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 26px 16px;
		margin: 0 auto;
		padding: 10px 0 42px;
	}

	.kontaktKort {
		max-width: 220px;
	}

	.kontaktKort img {
		height: clamp(150px, 48vw, 220px);
		border-radius: 14px;
	}

	.kontaktKort h2 {
		font-size: 18px;
		line-height: 1.25;
		overflow-wrap: anywhere;
	}

	.kontaktKort p {
		font-size: 14px;
		line-height: 1.4;
	}

	.kontaktKort:nth-child(5),
	.kontaktKort:nth-child(6),
	.kontaktKort:nth-child(7) {
		transform: none;
	}
}

@media (max-width: 480px) {
	:root {
		--p: 15px;
		--h1: 34px;
	}

	#mainH1 {
		padding-top: 24px;
	}

	#cloudPage,
	#cloudPage.kilderClouds {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
		margin-top: 12px;
	}

	.cloud,
	#cloudPage .cloud {
		width: min(100%, 360px);
		min-height: 150px;
		aspect-ratio: 1.9 / 1;
	}

	.cloud p {
		font-size: 15px;
	}

	.kontaktSky {
		min-height: 285px;
		padding: 30px 12px;
	}

	.kontaktSkyText {
		max-width: 76%;
	}

	.kontaktSkyText h2 {
		font-size: 23px;
	}

	.kontaktSkyText p,
	.kontaktSky #kontaktInfo p {
		font-size: 12px;
	}

	#kontaktGrid {
		width: calc(100% - 28px);
		gap: 22px 12px;
	}

	.kontaktKort img {
		height: 42vw;
	}
}
