/*
 * Layout and component styles for Jon's Alltjänst.
 *
 * Ported from the owner-approved reference (reference-preview/index.html in the
 * client kit) onto core block markup. Colors, fonts and sizes come from the
 * theme.json presets; this file only holds what theme.json cannot express:
 * grids, positioning, image cropping and the responsive breakpoints.
 *
 * Sections are identified by jat-* class names set on core blocks, so editors
 * can change every text and image without touching this file.
 */

:root {
	--jat-ink: var(--wp--preset--color--ink);
	--jat-paper: var(--wp--preset--color--paper);
	/* Approved brand blue #007fb4 misses 4.5:1 for small text; text and
	   white-on-blue buttons use the slightly darker blue-strong (#0071a0). */
	--jat-blue: var(--wp--preset--color--blue-strong);
	--jat-muted: var(--wp--preset--color--muted);
	--jat-line: var(--wp--preset--color--line);
	--jat-gutter: var(--wp--preset--spacing--gutter);
	--jat-header-height: var(--wp--custom--header-height);
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

html {
	scroll-padding-top: calc(var(--jat-header-height) + 8px);
}

body {
	margin: 0;
}

/*
 * Vertical rhythm as in the reference: no top margins, browser-default bottom
 * margins. The block gap is 0 in theme.json; :where() keeps these rules at
 * class specificity so every component rule below can override them.
 */
:is(.wp-site-blocks, .editor-styles-wrapper) :where(p, ul, ol, details, figure) {
	margin-block: 0 1em;
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(h1) {
	margin-block: 0 0.67em;
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(h2) {
	margin-block: 0 0.83em;
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(h3) {
	margin-block: 0 1em;
}

/* Flow spacing: sections sit edge to edge like in the reference. */
.wp-block-post-content > .jat-section,
.wp-block-post-content > .jat-feature,
.wp-block-post-content > .jat-proof,
.wp-block-post-content > .jat-hero,
.wp-site-blocks > * {
	margin-block-start: 0;
}

a:focus-visible,
summary:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
	outline: 3px solid var(--wp--preset--color--focus);
	outline-offset: 4px;
}

/* ---- Shared text styles ---- */

/* Long Swedish compounds ("Integritetspolicy") must wrap on narrow phones. */
h1,
h2,
h3 {
	/* Long Swedish compounds break only when they cannot fit (320 px); no automatic hyphenation, which split words on desktop. */
	overflow-wrap: break-word;
}

.jat-eyebrow {
	font-size: var(--wp--preset--font-size--x-small);
	text-transform: uppercase;
	letter-spacing: 2.5px;
	font-weight: 700;
	margin: 0 0 22px;
}

.jat-textlink a,
.jat-textlink a:visited {
	display: inline-block;
	border-bottom: 1px solid;
	padding-bottom: 4px;
	font-size: var(--wp--preset--font-size--small);
	text-decoration: none;
}

/* Decorative arrows live in CSS so the editable text stays clean. */
.jat-textlink a::after,
.jat-arrow .wp-block-button__link::after,
.jat-contact-links a::after,
.jat-nav-cta a::after {
	content: " ↗" / "";
}

.jat-arrow-down .wp-block-button__link::after {
	content: "↓" / "";
}

.jat-caption {
	position: absolute;
	right: 5%;
	bottom: 20px;
	z-index: 2;
	margin: 0;
	padding: 5px 12px;
	color: var(--wp--preset--color--white);
	background: var(--wp--custom--caption-background);
	font-size: var(--wp--preset--font-size--x-small);
}

.jat-credit {
	font-size: 12px;
	color: var(--jat-muted);
}

/* Disclosure (core/details): "+" marker as in the reference. */
.jat-disclosure > summary {
	cursor: pointer;
	font-size: 13px;
	list-style: none;
}

.jat-disclosure > summary::-webkit-details-marker {
	display: none;
}

.jat-disclosure > summary::after {
	content: " +" / "";
}

.jat-disclosure[open] > summary::after {
	content: " −" / "";
}

/* ---- Buttons ---- */

.wp-block-button .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	gap: 30px;
	text-decoration: none;
}

.wp-block-button .wp-block-button__link:hover {
	filter: brightness(1.08);
}

.wp-block-button.is-style-jat-light .wp-block-button__link {
	background: var(--jat-paper);
	border-color: var(--jat-paper);
	color: var(--jat-ink);
}

.wp-block-button.is-style-jat-outline .wp-block-button__link {
	background: transparent;
	border-color: var(--wp--custom--outline);
	color: var(--wp--preset--color--white);
}

/* ---- Header ---- */

header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 10;
}

.admin-bar header.wp-block-template-part {
	top: 32px;
}

.jat-header {
	height: var(--jat-header-height);
	padding: 0 5%;
	background: var(--jat-paper);
	border-bottom: 1px solid var(--jat-line);
}

.jat-header .wp-block-site-logo img {
	width: auto;
	max-width: 190px;
	height: 104px;
	object-fit: contain;
}

.jat-nav {
	font-size: var(--wp--preset--font-size--small);
	gap: 30px;
}

.jat-nav .wp-block-navigation__container {
	gap: 30px;
	align-items: center;
}

.jat-nav a:hover {
	color: var(--jat-blue);
}

/* Core styles the item link with a doubled class; match it to win. */
.jat-nav .jat-nav-cta > a.wp-block-navigation-item__content,
.jat-nav .jat-nav-cta > a.wp-block-navigation-item__content:hover {
	display: inline-flex;
	gap: 30px;
	padding: 15px 24px;
	background: var(--jat-blue);
	border: 1px solid var(--jat-blue);
	color: var(--wp--preset--color--white);
}

.jat-nav .wp-block-navigation__responsive-container.is-menu-open {
	padding: 24px var(--jat-gutter);
	background: var(--jat-paper);
	color: var(--jat-ink);
}

.jat-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	align-items: flex-start;
	padding-top: 64px;
}

.jat-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	align-items: flex-start;
	gap: 0;
	width: 100%;
	font-size: 1.25rem;
}

.jat-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	width: 100%;
	border-bottom: 1px solid var(--jat-line);
}

.jat-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	padding: 16px 0;
}

.jat-nav .wp-block-navigation__responsive-container.is-menu-open .jat-nav-cta {
	margin-top: 24px;
	border-bottom: 0;
}

.jat-nav .wp-block-navigation__responsive-container.is-menu-open .jat-nav-cta > a.wp-block-navigation-item__content {
	padding: 15px 24px;
}

/* ---- Hero (core/cover) ---- */

.jat-hero.wp-block-cover {
	height: min(760px, 80vw);
	min-height: 580px;
	padding: 0;
}

.jat-hero .wp-block-cover__inner-container {
	position: static;
}

.jat-hero-copy {
	position: relative;
	z-index: 1;
	max-width: 970px;
	padding: 95px var(--jat-gutter);
	color: var(--wp--preset--color--white);
}

.jat-hero-copy h1 {
	font-size: clamp(40px, 4.8vw, 70px);
	margin: 0 0 27px;
}

.jat-hero-copy .jat-lead {
	max-width: 450px;
	font-size: 17px;
	line-height: 1.75;
	color: var(--wp--custom--hero-text);
}

.jat-actions {
	gap: 12px;
	margin-top: 31px;
}

/* ---- Split sections (image + copy) ---- */

.jat-split {
	display: grid;
	align-items: center;
}

.jat-split > * {
	margin-block: 0;
}

.jat-photo {
	margin: 0;
}

.jat-photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.jat-section {
	padding: 90px var(--jat-gutter);
}

/* ---- Project story ---- */

.jat-story {
	padding-left: var(--jat-gutter);
	padding-right: var(--jat-gutter);
}

.jat-story > p:not(.jat-eyebrow) {
	max-width: 900px;
}

.jat-story .jat-disclosure {
	border-top: 1px solid var(--jat-line);
	border-bottom: 1px solid var(--jat-line);
	padding: 18px 0;
	margin: 25px 0;
}

.jat-story-body {
	max-width: 900px;
	padding-top: 30px;
}

.jat-story-body h2 {
	font-size: 32px;
}

.jat-story-body h3 {
	margin-top: 30px;
}

/* ---- Machinery ---- */

.jat-machinery {
	grid-template-columns: 0.85fr 1.15fr;
	gap: 7%;
	padding-top: 65px;
	padding-bottom: 65px;
	background: var(--wp--preset--color--mist);
}

.jat-machinery .jat-photo {
	height: 460px;
}

.jat-machinery .jat-photo img {
	object-position: center 65%;
}

.jat-machinery h2 {
	font-size: clamp(30px, 3.2vw, 45px);
}

.jat-machinery .jat-copy p:not(.jat-eyebrow, .jat-textlink) {
	color: var(--jat-muted);
	max-width: 610px;
}

.jat-machinery .jat-eyebrow,
.jat-intro .jat-eyebrow,
.jat-projects .jat-eyebrow {
	color: var(--jat-blue);
}

/* ---- Proof strip ---- */

.jat-proof {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	padding: 26px var(--jat-gutter);
	border-bottom: 1px solid var(--jat-line);
	font-size: var(--wp--preset--font-size--small);
}

.jat-proof > *,
.jat-proof p {
	margin: 0;
}

.jat-proof-value {
	font-size: 18px;
	font-weight: 500;
}

.jat-proof-label {
	margin-top: 2px;
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--jat-muted);
}

/* ---- Intro ---- */

.jat-intro {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12%;
	align-items: start;
}

.jat-intro > * {
	margin-block: 0;
}

.jat-intro p:not(.jat-eyebrow, .jat-textlink) {
	color: var(--jat-muted);
}

/* ---- Section heading row ---- */

.jat-section-top {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 30px;
	margin-bottom: 35px;
}

.jat-section-top > * {
	margin-block: 0;
}

.jat-section-top > p {
	max-width: 350px;
	color: var(--jat-muted);
	font-size: var(--wp--preset--font-size--small);
}

/* ---- Services ---- */

.jat-services {
	padding-top: 20px;
}

.jat-services-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	border-top: 1px solid var(--jat-line);
}

.jat-services-grid > .jat-service {
	display: grid;
	grid-template-columns: 40px 1fr;
	gap: 15px;
	margin: 0;
	padding: 26px 30px 28px 0;
	border-bottom: 1px solid var(--jat-line);
}

.jat-services-grid > .jat-service:nth-child(even) {
	padding-left: 30px;
	border-left: 1px solid var(--jat-line);
}

.jat-service > * {
	margin-block: 0;
}

.jat-service .jat-num {
	padding-top: 7px;
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--jat-muted);
}

.jat-service h3 {
	margin-bottom: 10px;
}

.jat-service h3 a {
	text-decoration: none;
}

.jat-service p:not(.jat-num) {
	max-width: 420px;
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--jat-muted);
}

.jat-service p a {
	display: inline-block;
	border-bottom: 1px solid;
	padding-bottom: 4px;
	text-decoration: none;
}

/* ---- Feature (Härryda) ---- */

.jat-feature {
	display: grid;
	grid-template-columns: 1.2fr 1fr;
	min-height: 530px;
	padding: 0;
	background: var(--wp--preset--color--charcoal);
	color: var(--wp--preset--color--white);
}

.jat-feature > * {
	margin-block: 0;
}

.jat-feature-photo {
	position: relative;
	min-height: 340px;
}

.jat-feature-photo .wp-block-image {
	position: absolute;
	inset: 0;
	margin: 0;
}

.jat-feature-photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.jat-feature-photo .jat-caption {
	right: 15px;
	bottom: 15px;
}

.jat-feature-copy {
	align-self: center;
	padding: 65px 12%;
}

.jat-feature-copy p:not(.jat-eyebrow) {
	color: var(--wp--custom--feature-text);
	font-size: 15px;
}

.jat-feature-copy h2 a {
	text-decoration: none;
}

/* ---- Projects ---- */

.jat-project-grid {
	display: grid;
	grid-template-columns: 1.2fr 1fr;
	gap: 34px;
}

.jat-project-grid > * {
	margin-block: 0;
}

.jat-project-image {
	position: relative;
	height: 350px;
	overflow: hidden;
}

.jat-project-image .wp-block-image {
	height: 100%;
	margin: 0;
}

.jat-project-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.jat-project-image.jat-pos-58 img {
	object-position: center 58%;
}

@media (prefers-reduced-motion: no-preference) {
	.jat-project-image img {
		transition: transform 0.4s;
	}

	.jat-project-image:hover img {
		transform: scale(1.025);
	}
}

.jat-project-label {
	position: absolute;
	top: 16px;
	left: 16px;
	margin: 0;
	padding: 5px 12px;
	background: var(--jat-paper);
	font-size: var(--wp--preset--font-size--x-small);
}

.jat-project h3 {
	margin: 20px 0 7px;
}

.jat-project h3 a {
	text-decoration: none;
}

.jat-project > p {
	font-size: var(--wp--preset--font-size--small);
	color: var(--jat-muted);
}

.jat-project .jat-disclosure {
	border-top: 1px solid var(--jat-line);
	margin-top: 20px;
	padding: 15px 0;
}

.jat-detail-images {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 15px;
}

.jat-detail-images > * {
	margin-block: 0;
}

.jat-detail-images img {
	width: 100%;
	height: 230px;
	object-fit: cover;
}

.jat-detail-images figcaption {
	margin-top: 7px;
	margin-bottom: 0;
	text-align: left;
}

/* ---- Foundation ---- */

.jat-foundation {
	grid-template-columns: 1fr 1.15fr;
	gap: 9%;
	background: var(--wp--preset--color--mist);
}

.jat-foundation .jat-photo {
	height: 390px;
}

.jat-foundation .jat-copy p:not(.jat-eyebrow, .jat-textlink) {
	color: var(--jat-muted);
	font-size: 15px;
}

/* ---- Process ---- */

.jat-process {
	padding-bottom: 85px;
}

.jat-steps {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 30px;
	padding-top: 28px;
	border-top: 1px solid var(--jat-line);
}

.jat-steps > * {
	margin-block: 0;
}

.jat-step-label {
	margin: 0;
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--jat-muted);
}

.jat-steps h3 {
	margin: 18px 0 12px;
	font-size: 19px;
}

.jat-steps p:not(.jat-step-label) {
	font-size: var(--wp--preset--font-size--small);
	color: var(--jat-muted);
}

/* ---- Contact ---- */

.jat-contact {
	display: grid;
	grid-template-columns: 1.3fr 1fr;
	gap: 10%;
	align-items: center;
	background: var(--wp--preset--color--sky);
}

.jat-contact > * {
	margin-block: 0;
}

.jat-contact h2 {
	max-width: 580px;
}

.jat-contact p {
	max-width: 490px;
	color: var(--jat-muted);
}

.jat-contact-links {
	border-top: 1px solid var(--wp--preset--color--sky-line);
}

.jat-contact-links p {
	max-width: none;
	margin: 0;
}

.jat-contact-links a {
	display: flex;
	justify-content: space-between;
	padding: 19px 0;
	border-bottom: 1px solid var(--wp--preset--color--sky-line);
	color: var(--jat-ink);
	font-size: 20px;
	text-decoration: none;
}

/* ---- Contact form (Contact Form 7) ---- */

.jat-form-section {
	padding: 60px 0 30px;
}

.wpcf7-form p {
	max-width: 640px;
}

.wpcf7-form label {
	display: block;
	margin-bottom: 6px;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
}

.wpcf7-form input[type="text"],
.wpcf7-form input[type="email"],
.wpcf7-form input[type="tel"],
.wpcf7-form textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--jat-muted);
	border-radius: 0;
	background: var(--wp--preset--color--white);
	color: var(--jat-ink);
	font: inherit;
}

.wpcf7-form textarea {
	min-height: 160px;
}

.wpcf7-form .jat-form-note {
	font-size: var(--wp--preset--font-size--small);
	color: var(--jat-muted);
}

.wpcf7-form input[type="submit"] {
	padding: 15px 24px;
	border: 1px solid var(--jat-blue);
	background: var(--jat-blue);
	color: var(--wp--preset--color--white);
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	cursor: pointer;
}

/* ---- Supporting pages ---- */

.jat-page-head {
	padding-top: 65px;
	padding-bottom: 35px;
}

.jat-page-head h1 {
	margin: 0;
	font-size: clamp(34px, 5vw, 60px);
}

.jat-page-body {
	padding-bottom: 65px;
	min-height: 30vh;
}

.jat-page-body .wp-block-image img {
	height: auto;
	max-height: 650px;
	object-fit: contain;
}

.jat-page-body > h2 {
	margin-top: 35px;
	font-size: 32px;
}

.jat-page-body > p a:not(.jat-textlink a),
.jat-page-body > ul a {
	text-decoration: underline;
}

/* ---- Footer ---- */

.jat-footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 30px;
	padding: 35px var(--jat-gutter);
	font-size: 12px;
	color: var(--jat-muted);
}

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

.jat-footer-brand {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.jat-footer-brand > * {
	margin: 0;
}

.jat-footer-brand .wp-block-site-logo img {
	width: 310px;
	height: auto;
}

.jat-footer-links {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 40px;
}

.jat-footer-links > * {
	margin-block: 0;
}

.jat-footer-links ul {
	margin: 0;
	padding: 0;
	list-style: none;
	line-height: 2;
}

.jat-footer-links li:first-child a {
	color: var(--jat-ink);
	font-weight: 700;
}

.jat-footer a {
	text-decoration: none;
}

.jat-footer a:hover {
	color: var(--jat-blue);
}

/* ---- Small screens (reference breakpoint 760px) ---- */

@media (max-width: 782px) {
	.admin-bar header.wp-block-template-part {
		top: 46px;
	}
}

@media (max-width: 760px) {
	:root {
		--jat-header-height: var(--wp--custom--header-height-mobile);
	}

	.jat-header .wp-block-site-logo img {
		max-width: 150px;
		height: 88px;
	}

	.jat-hero.wp-block-cover {
		height: 75vh;
		min-height: 680px;
	}

	.jat-hero .wp-block-cover__background {
		opacity: 0.85;
	}

	.jat-hero-copy {
		padding: 65px var(--jat-gutter) 60px;
	}

	.jat-hero-copy h1 {
		font-size: 43px;
		letter-spacing: -2px;
	}

	.jat-hero-copy .jat-lead {
		font-size: 15px;
	}

	.jat-actions {
		flex-wrap: wrap;
	}

	.jat-section {
		padding-top: 60px;
		padding-bottom: 60px;
	}

	.jat-story {
		padding-left: 0;
		padding-right: 0;
	}

	.jat-proof {
		gap: 15px;
		padding: 25px var(--jat-gutter);
	}

	.jat-proof-value {
		font-size: 14px;
	}

	.jat-proof-label {
		font-size: 10px;
	}

	.jat-intro,
	.jat-feature,
	.jat-foundation,
	.jat-contact,
	.jat-machinery {
		grid-template-columns: 1fr;
		gap: 25px;
	}

	.jat-machinery {
		gap: 30px;
		padding-top: 40px;
		padding-bottom: 40px;
	}

	.jat-machinery .jat-photo {
		height: 350px;
	}

	.jat-machinery h2 {
		font-size: 33px;
	}

	.jat-section-top {
		display: block;
	}

	.jat-section-top > p {
		margin-top: 16px;
	}

	.jat-services-grid {
		grid-template-columns: 1fr;
	}

	.jat-services-grid > .jat-service:nth-child(even) {
		padding-left: 0;
		border-left: 0;
	}

	.jat-feature-photo {
		height: 340px;
	}

	.jat-feature-copy {
		padding: 40px var(--jat-gutter);
	}

	.jat-project-grid {
		grid-template-columns: 1fr;
		gap: 35px;
	}

	.jat-project-image {
		height: 330px;
	}

	.jat-foundation .jat-photo {
		height: 300px;
	}

	.jat-steps {
		grid-template-columns: 1fr 1fr;
		gap: 25px;
	}

	.jat-contact-links a {
		font-size: 18px;
	}

	.jat-caption {
		font-size: 10px;
	}

	h2 {
		letter-spacing: -1px;
	}

	.jat-footer-brand .wp-block-site-logo img {
		width: 260px;
	}
}
