/* Site layout fixes — loaded independently of the Vite bundle. */

html,
body {
	overflow-x: hidden;
	max-width: 100%;
}

/* Hide Alpine x-show UI until Alpine starts (Vite CSS loads too late on slow 4G). */
[x-cloak] {
	display: none !important;
}

/* Full-width breakout without vertical white gaps. */
.alignfull,
.alignwide {
	width: 100vw;
	max-width: 100vw;
	margin-top: 0;
	margin-bottom: 0;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}

@media (min-width: 960px) {
	.alignwide {
		width: calc(100% + 20vw);
		max-width: none;
		margin-left: -10vw;
		margin-right: -10vw;
	}
}

/* Images should fill their frame. */
.wp-block-image img,
.wp-block-cover img,
.wp-block-cover__image-background,
figure.wp-block-image img {
	max-width: 100%;
	width: 100%;
	object-fit: cover;
}

.wp-block-image.w-full img,
.wp-block-image.h-full img,
.wp-block-post-featured-image img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover;
}

/* Keep Gutenberg's own width/height on explicitly resized images (contact icons, etc.). */
.wp-block-image.is-resized img {
	width: auto;
	height: auto;
	max-width: 100%;
	object-fit: contain;
}

.size-full {
	max-width: 100%;
}

/* Calendar / query loop: stack earlier than WP's 600px default. */
@media (max-width: 1023px) {
	.wp-block-post-template.is-layout-grid,
	ul.wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 767px) {
	.wp-block-post-template.is-layout-grid,
	ul.wp-block-post-template.is-layout-grid {
		grid-template-columns: minmax(0, 1fr) !important;
	}
}

/* Activity cards should not keep a desktop-only fixed width. */
.mbr-5c11055546e6,
.mbr-7778eb9704a4 {
	width: 100% !important;
	max-width: 100%;
}

/* Homepage / subpage heroes: readable type on small screens. */
@media (max-width: 767px) {
	h1.wp-block-heading,
	.wp-block-heading.has-x-large-font-size {
		font-size: clamp(1.75rem, 8vw, 2.5rem) !important;
		line-height: 1.15 !important;
		letter-spacing: 0.02em !important;
	}

	/* Startsida: short title should stay large; Extra CSS on the heading wins too. */
	h1.wp-block-heading.has-custom-r-d-prim-r-color {
		font-size: clamp(2.6rem, 11vw, 3.25rem) !important;
		line-height: 1.08 !important;
		letter-spacing: 0.01em !important;
	}

	/* Startsida hero is min-h 921px + centered — that is the empty gap under the header. */
	#hero-section section[class*="min-h-[921px]"] {
		min-height: 0 !important;
		padding-top: 32px !important;
		padding-bottom: 48px !important;
		justify-content: flex-start !important;
	}

	.text-\[64px\] {
		font-size: 2rem !important;
	}

	.leading-\[72px\] {
		line-height: 1.2 !important;
	}

	.md\:grid-cols-2 {
		grid-template-columns: minmax(0, 1fr) !important;
	}
}

/* Kontakta oss: long emails/titles must wrap in the cards. */
.mbr-aa35d491daa3 {
	min-width: 0;
}

.mbr-aa35d491daa3 > .wp-block-group {
	min-width: 0;
	overflow: visible;
}

.mbr-aa35d491daa3 p,
.mbr-aa35d491daa3 a {
	overflow-wrap: anywhere;
	word-break: break-word;
}

.mbr-aa35d491daa3 .is-layout-flex {
	flex-wrap: wrap !important;
	min-width: 0;
}

.mbr-aa35d491daa3 .is-layout-flex > * {
	min-width: 0;
	max-width: 100%;
}

/* 3 columns are too tight below desktop — stack so names and emails fit. */
@media (max-width: 1023px) {
	.mbr-aa35d491daa3 {
		display: grid !important;
		grid-template-columns: minmax(0, 1fr) !important;
		width: 100% !important;
		max-width: 100% !important;
		padding-left: 24px !important;
		padding-right: 24px !important;
		box-sizing: border-box;
	}

	.mbr-aa35d491daa3 > .wp-block-group {
		width: 100% !important;
		max-width: 100% !important;
		grid-column: 1 / -1 !important;
	}
}

/* Single aktivitet: content needs a container (task #106). */
.single-aktivitet .wp-site-blocks > .wp-block-group,
.single-aktivitet .aktivitet-single {
	max-width: 860px;
	width: 100%;
	margin-left: auto;
	margin-right: auto;
	padding-left: 24px;
	padding-right: 24px;
	padding-top: 24px;
	padding-bottom: 6rem;
	box-sizing: border-box;
}

.single-aktivitet .wp-block-post-featured-image {
	margin-top: 0 !important;
}

@media (min-width: 768px) {
	.single-aktivitet .wp-site-blocks > .wp-block-group,
	.single-aktivitet .aktivitet-single {
		padding-left: 80px;
		padding-right: 80px;
		padding-top: 2rem;
	}
}

/* Aktiviteter listing: keep inner content in a container. */
#kalender > .wp-block-group,
.stitch-section > section > .wp-block-group.max-w-\[1440px\],
.wp-block-group.max-w-\[1440px\] {
	max-width: 1440px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 24px;
	padding-right: 24px;
	box-sizing: border-box;
	width: 100%;
}

@media (min-width: 768px) {
	#kalender > .wp-block-group,
	.wp-block-group.max-w-\[1440px\] {
		padding-left: 80px;
		padding-right: 80px;
	}
}

/* Header logo: half height on mobile, even padding around the mark. */
.stitch-header-logo,
.stitch-header-logo img {
	height: 64px !important;
	width: auto !important;
	max-width: min(70vw, 220px);
	object-fit: contain;
	display: block;
}

@media (min-width: 768px) {
	.stitch-header-logo,
	.stitch-header-logo img {
		height: 112px !important;
		max-width: none;
	}
}

/* Footer type sizes from design annotation */
.stitch-footer-heading {
	font-size: 18px !important;
	line-height: 1.3 !important;
}
