/**
 * UniDig Theme - Custom Styles
 * 
 * Styles that complement theme.json settings
 */

/* ==========================================================================
   Base & Typography
   ========================================================================== */

html {
	height: 100%;
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	background-color: #ffffff;
	background-image: radial-gradient(ellipse at top left, rgba(249, 115, 22, 0.07) 0%, transparent 40%);
	background-repeat: no-repeat;
	background-size: 100% 100vh;
	min-height: 100%;
	display: flex;
	flex-direction: column;
}

/* Sticky footer - push footer to bottom when content is short */
.wp-site-blocks {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.wp-site-blocks > main,
.wp-site-blocks > .front-page-content {
	flex: 1;
	padding-block-end: var(--wp--preset--spacing--50);
}

/* Remove bottom padding when newsletter section is last (sits flush against footer) */
.front-page-content:has(.newsletter-section) {
	padding-block-end: 0;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
	position: sticky;
	top: 0.75rem;
	z-index: 100;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
	border-radius: 1.5rem;
	border-bottom-right-radius: 0;
	max-width: 1360px;
	width: calc(100% - 2rem);
	margin: 0.75rem auto 0;
}

.site-header .wp-block-navigation__responsive-container-open {
	color: var(--wp--preset--color--gray-700);
}

/* Submenu dropdown */
.site-header .wp-block-navigation__submenu-container {
	background-color: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--gray-200);
	border-radius: 1rem;
	border-bottom-right-radius: 0;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
	padding: var(--wp--preset--spacing--20);
	min-width: 180px;
}

.site-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--40);
	border-radius: 0.5rem;
	border-bottom-right-radius: 0;
}

.site-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover {
	background-color: var(--wp--preset--color--gray-100);
}

.site-header .wp-block-navigation a {
	text-decoration: none;
	transition: color 0.2s ease;
}

.site-header .wp-block-navigation a:hover {
	color: var(--wp--preset--color--primary);
}

.language-selector {
	border-left: 1px solid var(--wp--preset--color--gray-200);
	padding-left: var(--wp--preset--spacing--40);
	margin-left: var(--wp--preset--spacing--40);
}

.trp-shortcode-switcher__wrapper {
	display: flex;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero-section {
	position: relative;
	overflow: hidden;
	min-height: 42vh;
	display: flex;
	align-items: center;
}

.hero-illustration {
	position: absolute;
	top: 50%;
	right: -5%;
	transform: translateY(-50%);
	width: 65%;
	z-index: 0;
	margin: 0 !important;
	mix-blend-mode: multiply;
}

.hero-illustration img {
	width: 100%;
	height: auto;
}

.hero-heading {
	position: relative;
	z-index: 1;
	max-width: 44%;
	padding-right: 20rem;
}

/* Hero responsive */
@media (max-width: 1024px) {
	.hero-heading {
		max-width: 55%;
		padding-right: 0;
	}
}

@media (max-width: 781px) {
	.hero-section {
		min-height: auto;
		flex-direction: column;
		align-items: flex-start;
		padding-top: var(--wp--preset--spacing--50) !important;
		padding-bottom: var(--wp--preset--spacing--40) !important;
	}

	.hero-illustration {
		position: relative;
		top: auto;
		right: auto;
		transform: none;
		width: 100vw;
		max-width: none;
		order: 2;
		margin: var(--wp--preset--spacing--40) calc(-50vw + 50%) 0 calc(-50vw + 50%) !important;
	}

	.hero-heading {
		max-width: 100%;
		padding-right: 0;
		order: 1;
		font-size: 2rem !important;
	}
}

/* Mobile: remove wrapper padding around hero/about in page content */
@media (max-width: 781px) {
	.front-page-content .wp-block-post-content > .wp-block-group:has(.hero-section) {
		padding-top: 0 !important;
		padding-bottom: 0 !important;
	}
}

/* Mobile: reduce section spacing */
@media (max-width: 781px) {
	.about-section {
		padding-top: var(--wp--preset--spacing--60) !important;
		padding-bottom: var(--wp--preset--spacing--60) !important;
	}

	.about-section > .wp-block-spacer {
		height: 0.5rem !important;
	}

	.contact-section {
		padding-top: var(--wp--preset--spacing--60) !important;
		padding-bottom: var(--wp--preset--spacing--60) !important;
	}

	.members-section {
		padding-top: var(--wp--preset--spacing--50) !important;
		padding-bottom: var(--wp--preset--spacing--50) !important;
	}
}

/* Mobile overlay: add inner padding */
.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	padding-left: var(--wp--preset--spacing--50) !important;
}

/* Mobile overlay: left-align menu items (override center from navigation block layout) */
.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	align-items: flex-start !important;
}

/* Mobile: remove submenu shadow in overlay menu */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
	box-shadow: none;
	border: none;
}

/* ==========================================================================
   Content Max Width (matches header)
   ========================================================================== */

.front-page-content > .wp-block-group:not(.hero-section):not(.newsletter-section) {
	max-width: 1360px;
	width: calc(100% - 2rem);
	margin-left: auto;
	margin-right: auto;
	border-radius: 1.5rem;
	border-bottom-right-radius: 0;
}

/* ==========================================================================
   Gray Background Section (from about onwards)
   ========================================================================== */

.front-page-content {
	background: linear-gradient(
		to bottom,
		transparent 0%,
		transparent 70vh,
		var(--wp--preset--color--gray-100) 90vh,
		var(--wp--preset--color--gray-100) 100%
	);
}

/* ==========================================================================
   About Section
   ========================================================================== */

.about-section {
	max-width: 1360px;
	width: calc(100% - 2rem);
	margin-left: auto;
	margin-right: auto;
	border-radius: 1.5rem;
	border-bottom-right-radius: 0;
}

/* ==========================================================================
   Separator - UniDig Accent Style
   ========================================================================== */

.wp-block-separator.is-style-unidig-accent {
	width: 80px;
	height: 4px;
	border: none;
	background-color: var(--wp--preset--color--primary);
	margin: 1.5rem auto;
}

/* ==========================================================================
   News Section
   ========================================================================== */

/* Featured news card */
.news-section .featured-news .wp-block-post-template > li {
	background: var(--wp--preset--color--white);
	border-radius: 1.5rem;
	border-bottom-right-radius: 0;
	overflow: hidden;
}

.news-section .featured-news .wp-block-columns {
	gap: 0 !important;
	height: 100%;
	margin-bottom: 0;
}

.news-section .featured-news .wp-block-column:first-child {
	display: flex;
}

.news-section .featured-news .wp-block-column:last-child {
	padding: var(--wp--preset--spacing--50);
}

.news-section .featured-news .wp-block-post-featured-image {
	height: 100%;
	width: 100%;
	/* Rounded on left side (outer edge), straight on right side (against text) */
	border-radius: 0.75rem 0 0 0.75rem;
	overflow: hidden;
}

.news-section .featured-news .wp-block-post-featured-image img {
	height: 100%;
	width: 100%;
	object-fit: cover;
}

.news-section .featured-news img {
	transition: transform 0.3s ease;
}

.news-section .featured-news a:hover img {
	transform: scale(1.02);
}

/* Small news cards */
.news-section .news-cards .wp-block-post-template > li {
	background: var(--wp--preset--color--white);
	border-radius: 1rem;
	border-bottom-right-radius: 0;
	overflow: hidden;
}

.news-section .news-cards .wp-block-post-template > li > .wp-block-group {
	height: 100%;
	display: flex;
	flex-direction: column;
}

.news-section .news-cards .wp-block-post-featured-image {
	overflow: hidden;
	/* Rounded on top (outer edge), straight on bottom (against text) */
	border-radius: 0.75rem 0.75rem 0 0;
	margin: 0;
}

.news-section .news-cards .wp-block-post-title,
.news-section .news-cards .wp-block-read-more {
	padding-left: var(--wp--preset--spacing--40);
	padding-right: var(--wp--preset--spacing--40);
}

.news-section .news-cards .wp-block-post-title {
	padding-top: var(--wp--preset--spacing--40);
}

.news-section .news-cards .wp-block-read-more {
	padding-bottom: var(--wp--preset--spacing--50);
	margin-top: auto;
}

.news-section .news-cards img {
	transition: transform 0.3s ease;
}

.news-section .news-cards a:hover img {
	transform: scale(1.05);
}

/* Featured image placeholder when no image is set */
.news-section .wp-block-post-featured-image:not(:has(img)) {
	background-image: url('../images/unidig-pattern-grey.svg');
	background-color: var(--wp--preset--color--gray-100);
	background-size: cover;
	background-position: center;
}

/* White background when image exists (prevents pattern showing through transparent images) */
.news-section .wp-block-post-featured-image:has(img) {
	background-color: var(--wp--preset--color--white);
}

/* "Visa hela bilden" - show full image without cropping and without upscaling */

/* News section: scale-down within the fixed-size container */
.news-section .unidig-image-contain img {
	object-fit: scale-down !important;
}

/* Single post and similar: remove forced aspect-ratio and show at natural size */
main > .unidig-image-contain {
	aspect-ratio: auto !important;
}
main > .unidig-image-contain img {
	width: auto !important;
	max-width: 100% !important;
	height: auto !important;
	display: block;
	margin: 0 auto;
}

/* Featured news - placeholder on empty column (WP doesn't render the block if no image) */
.news-section .featured-news .wp-block-column:first-child:not(:has(*)) {
	background-image: url('../images/unidig-pattern-grey.svg');
	background-color: var(--wp--preset--color--gray-100);
	background-size: 150%;
	background-position: center;
	min-height: 280px;
	border-radius: 0.75rem 0 0 0.75rem;
}

/* News cards - placeholder on empty group */
.news-section .news-cards .wp-block-post-featured-image:not(:has(img)) {
	aspect-ratio: 16/9;
}

.news-section .news-cards .wp-block-group:not(:has(.wp-block-post-featured-image img))::before {
	content: "";
	display: block;
	aspect-ratio: 16/9;
	background-image: url('../images/unidig-pattern-grey.svg');
	background-color: var(--wp--preset--color--gray-100);
	background-size: cover;
	background-position: center;
	border-radius: 0.75rem 0.75rem 0 0;
}

.news-section .wp-block-post-title a,
.news-archive .wp-block-post-title a {
	text-decoration: none;
	transition: color 0.2s ease;
}

.news-section .wp-block-post-title a:hover,
.news-archive .wp-block-post-title a:hover {
	color: var(--wp--preset--color--primary);
}

/* News archive heading indent */
main.wp-block-group > h1.wp-block-heading {
	padding-left: var(--wp--preset--spacing--60);
}

@media (max-width: 781px) {
	.news-section .news-cards .wp-block-post-template {
		grid-template-columns: 1fr !important;
	}

	/* Reduce spacer after news heading on mobile */
	.news-section > .wp-block-spacer {
		height: 0.75rem !important;
	}

	/* Hide placeholder images on mobile when no real image is set */
	.news-section .featured-news .wp-block-column:first-child:not(:has(*)) {
		display: none;
	}

	.news-section .featured-news .wp-block-post-featured-image:not(:has(img)) {
		display: none;
	}

	.news-section .news-cards .wp-block-post-featured-image:not(:has(img)) {
		display: none;
	}

	.news-section .news-cards .wp-block-group:not(:has(.wp-block-post-featured-image img))::before {
		display: none;
	}
}

/* ==========================================================================
   Members Section
   ========================================================================== */

.members-logos {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: var(--wp--preset--spacing--50);
	max-width: 100%;
}

.member-logo {
	margin: 0;
	padding: var(--wp--preset--spacing--40);
	background: white;
	border-radius: 0.75rem;
	border-bottom-right-radius: 0;
	transition: transform 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
	max-height: 140px;
}

.member-logo:hover {
	transform: scale(1.03);
}

.member-logo a {
	display: flex;
	max-height: 100%;
}

.member-logo img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

@media (max-width: 900px) {
	.members-logos {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 600px) {
	.members-logos {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ==========================================================================
   Contact Section
   ========================================================================== */

.wp-block-unidig-contact-persons {
	width: 100%;
}

.contact-persons-grid {
	gap: var(--wp--preset--spacing--60);
}

@media (max-width: 1024px) {
	.contact-persons-grid {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}

@media (max-width: 600px) {
	.contact-persons-grid {
		grid-template-columns: 1fr !important;
	}
}

.contact-person-card {
	text-align: left;
	background: var(--wp--preset--color--white);
	border-radius: 1rem;
	border-bottom-right-radius: 0;
	overflow: hidden;
}

.contact-person-image {
	margin: 0;
}

.contact-person-image img {
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	display: block;
}

.contact-person-info {
	padding: var(--wp--preset--spacing--40);
}

.contact-person-name {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 0.25rem 0;
	color: var(--wp--preset--color--gray-900);
}

.contact-person-title {
	font-size: 0.875rem;
	color: var(--wp--preset--color--gray-600);
	margin: 0 0 0.75rem 0;
}

.contact-person-email,
.contact-person-phone {
	font-size: 0.875rem;
	margin: 0 0 0.25rem 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.contact-person-email svg,
.contact-person-phone svg {
	flex-shrink: 0;
	color: var(--wp--preset--color--primary);
}

.contact-person-email a,
.contact-person-phone a {
	color: var(--wp--preset--color--gray-700);
	text-decoration: none;
	transition: color 0.2s ease;
}

.contact-person-email a:hover,
.contact-person-phone a:hover {
	color: var(--wp--preset--color--primary);
}

/* ==========================================================================
   Newsletter Section
   ========================================================================== */

.newsletter-section {
	position: relative;
	background-color: #ff4d00 !important;
}

.newsletter-section .mc4wp-form {
	width: 100%;
}

.newsletter-section .mc4wp-form .newsletter-form-fields {
	max-width: 480px;
	margin: 0 auto;
	width: 100%;
}

.newsletter-section .mc4wp-form h2 {
	text-align: center;
	color: var(--wp--preset--color--white);
	margin-bottom: 0.75rem;
}

.newsletter-section .mc4wp-form .mc4wp-form-fields > p:first-of-type {
	text-align: center;
	color: var(--wp--preset--color--white);
	margin-bottom: 1.5rem;
}

.newsletter-section .mc4wp-form p {
	margin: 0 0 0.75rem 0;
}

.newsletter-section .mc4wp-form input[type="email"] {
	width: 100%;
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 0.75rem;
	border-bottom-right-radius: 0;
	padding: 0.75rem 1rem;
	color: var(--wp--preset--color--white);
	font-size: 1rem;
	font-family: inherit;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	box-sizing: border-box;
}

.newsletter-section .mc4wp-form input[type="email"]::placeholder {
	color: rgba(255, 255, 255, 0.7);
}

.newsletter-section .mc4wp-form input[type="email"]:focus {
	outline: none;
	border-color: rgba(255, 255, 255, 0.9);
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.newsletter-section .mc4wp-form label {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	color: var(--wp--preset--color--white);
	font-size: 0.875rem;
	cursor: pointer;
}

.newsletter-section .mc4wp-form input[type="checkbox"] {
	width: 1rem;
	height: 1rem;
	margin-top: 0.15rem;
	flex-shrink: 0;
	cursor: pointer;
	accent-color: #ffffff;
}

.newsletter-section .mc4wp-form input[type="submit"] {
	width: 100%;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--primary);
	border: none;
	border-radius: 0.75rem;
	border-bottom-right-radius: 0;
	padding: 0.75rem 1.5rem;
	font-size: 1rem;
	font-family: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.2s ease;
	box-sizing: border-box;
}

.newsletter-section .mc4wp-form input[type="submit"]:hover {
	opacity: 0.92;
}

@media (max-width: 600px) {
	.newsletter-section {
		padding-top: var(--wp--preset--spacing--60) !important;
		padding-bottom: var(--wp--preset--spacing--60) !important;
	}
}

.newsletter-success {
	text-align: center;
	padding: 1rem 0;
}

.newsletter-success__heading {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--wp--preset--color--white);
	margin: 0 0 0.5rem;
}

.newsletter-success__body {
	color: var(--wp--preset--color--white);
	margin: 0;
	opacity: 0.9;
}

.newsletter-error {
	color: var(--wp--preset--color--white);
	background: rgba(0, 0, 0, 0.25);
	border-radius: 4px;
	padding: 0.5rem 0.75rem;
	margin-bottom: 1rem;
	font-size: 0.9rem;
}

.newsletter-section .mc4wp-form input[type="submit"]:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer.wp-block-template-part {
	margin-block-start: 0;
}

.footer-pattern-bg {
	position: relative;
	background-color: #000;
}

.footer-pattern-bg::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image: var(--footer-pattern-url);
	background-repeat: repeat;
	background-size: auto;
	pointer-events: none;
}

.footer-pattern-bg > * {
	position: relative;
	z-index: 1;
}

.site-footer .wp-block-navigation a {
	text-decoration: none;
	transition: color 0.2s ease;
}

.site-footer .wp-block-navigation a:hover {
	color: var(--wp--preset--color--primary);
}

.footer-logo-wrapper {
	display: flex;
	align-items: center;
}

.footer-logo-wrapper img {
	width: 140px;
	height: auto;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.wp-block-button__link {
	transition: background-color 0.2s ease, transform 0.1s ease;
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
}

/* Arrow icon for buttons */
.wp-block-button__link::after {
	content: "";
	display: inline-block;
	width: 1em;
	height: 1em;
	background-color: currentColor;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='7' y1='17' x2='17' y2='7'/%3E%3Cpolyline points='7 7 17 7 17 17'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='7' y1='17' x2='17' y2='7'/%3E%3Cpolyline points='7 7 17 7 17 17'/%3E%3C/svg%3E");
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}

.wp-block-button__link:hover {
	transform: translateY(-1px);
}

.wp-block-button__link:active {
	transform: translateY(0);
}

/* ==========================================================================
   File Block - Download Button
   ========================================================================== */

.wp-block-file .wp-block-file__button {
	background-color: transparent;
	color: var(--wp--preset--color--primary);
	border: 1.5px solid var(--wp--preset--color--primary);
	padding: 0.4em 1em;
	font-size: 0.875rem;
	font-weight: 500;
	border-radius: 0.5rem;
	border-bottom-right-radius: 0;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.wp-block-file .wp-block-file__button:hover {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
}

/* ==========================================================================
   Focus Styles
   ========================================================================== */

:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

.site-header a:focus-visible,
.site-footer a:focus-visible {
	border-radius: 0.25rem;
}

.wp-block-button__link:focus-visible {
	outline-offset: 3px;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.visually-hidden:focus-visible,
.skip-link:focus {
	position: fixed;
	top: 0.5rem;
	left: 0.5rem;
	width: auto;
	height: auto;
	padding: 0.5rem 1rem;
	margin: 0;
	overflow: visible;
	clip: auto;
	white-space: normal;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
	text-decoration: none;
	font-weight: 600;
	border-radius: 0.5rem;
	z-index: 999;
}

/* ==========================================================================
   Read More Links
   ========================================================================== */

.wp-block-read-more {
	text-decoration: none;
	transition: color 0.2s ease;
}

.wp-block-read-more:hover {
	color: var(--wp--preset--color--primary-hover);
}

/* ==========================================================================
   Accessibility: Link Underlines
   Ensures links are identifiable by more than color alone (WCAG 1.4.1)
   ========================================================================== */

.wp-block-post-content a:not(.wp-block-button__link),
.wp-block-read-more {
	text-decoration: underline;
	text-decoration-color: currentColor;
	text-underline-offset: 0.15em;
}

.wp-block-post-content a:not(.wp-block-button__link):hover,
.wp-block-read-more:hover {
	text-decoration-color: transparent;
}

/* ==========================================================================
   Post Content
   ========================================================================== */

.wp-block-post-content p {
	margin-bottom: 1.5em;
}

.wp-block-post-content h2,
.wp-block-post-content h3,
.wp-block-post-content h4 {
	margin-top: 2em;
	margin-bottom: 0.75em;
}

.wp-block-post-content ul,
.wp-block-post-content ol {
	margin-bottom: 1.5em;
	padding-left: 1.5em;
}

.wp-block-post-content li {
	margin-bottom: 0.5em;
}

/* ==========================================================================
   Images
   ========================================================================== */

.wp-block-image img {
	height: auto;
}

.wp-block-image.is-style-rounded img {
	border-radius: 0.5rem;
}

/* ==========================================================================
   Accessibility: Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

