/*
 * Rebmann — custom, token-driven styles.
 * Values come from theme.json presets. This layer adds motion + premium polish.
 */

/* ============================================================= MOTION */
/* Reveals are visible by default (no-JS / no-FOUC). Hidden state only with .js
   (added synchronously in <head>) so nothing flashes. */
@media (prefers-reduced-motion: no-preference) {
	.js .reveal {
		opacity: 0;
		transform: translateY(22px);
		transition: opacity .55s ease, transform .55s cubic-bezier(.2, .7, .2, 1);
		will-change: opacity, transform;
	}
	.js .reveal.is-visible { opacity: 1; transform: none; }
}

/* ============================================================= HEADER */
/* Let the inner <header> stick to the viewport (wrapper collapses). */
.wp-block-template-part:has(> .site-header) { display: contents; }

.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: color-mix(in srgb, var(--wp--preset--color--surface) 88%, transparent);
	backdrop-filter: saturate(1.1) blur(8px);
	transition: padding .25s ease, box-shadow .25s ease, background .25s ease;
}
.site-header.is-scrolled {
	padding-top: var(--wp--preset--spacing--30) !important;
	padding-bottom: var(--wp--preset--spacing--30) !important;
	box-shadow: 0 6px 24px rgba(27, 31, 28, .07);
	background: color-mix(in srgb, var(--wp--preset--color--surface) 95%, transparent);
}

/* Compact brand lockup */
.brand {
	display: inline-flex;
	flex-direction: column;
	line-height: 1;
	text-decoration: none;
	gap: 2px;
}
.brand__name {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	font-size: 1.6rem;
	letter-spacing: -.01em;
	color: var(--wp--preset--color--brand);
}
.brand__sub {
	font-family: var(--wp--preset--font-family--body);
	font-weight: 600;
	font-size: .72rem;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

/* Nav: compact, animated underline, Kontakt as a pill */
.site-header .wp-block-navigation { font-size: .98rem; }
.site-header .wp-block-navigation-item__content {
	position: relative;
	padding-bottom: 3px;
	color: var(--wp--preset--color--text);
}
.site-header .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0; bottom: 0;
	height: 2px; width: 0;
	background: var(--wp--preset--color--accent);
	transition: width .22s cubic-bezier(.2, .7, .2, 1);
}
.site-header .wp-block-navigation-item:hover .wp-block-navigation-item__content::after,
.site-header .wp-block-navigation-item.current-menu-item .wp-block-navigation-item__content::after { width: 100%; }

/* Last nav item ("Kontakt") becomes a filled CTA pill */
.site-header .wp-block-navigation__container > .wp-block-navigation-item:last-child .wp-block-navigation-item__content {
	background: var(--wp--preset--color--brand);
	color: var(--wp--preset--color--surface);
	padding: .5rem 1.1rem;
	border-radius: 999px;
	transition: background .2s ease, transform .2s ease;
}
.site-header .wp-block-navigation__container > .wp-block-navigation-item:last-child:hover .wp-block-navigation-item__content {
	background: var(--wp--preset--color--accent);
	transform: translateY(-1px);
}
.site-header .wp-block-navigation__container > .wp-block-navigation-item:last-child .wp-block-navigation-item__content::after { display: none; }

/* ============================================================= LINKS (content) */
/* Signature underline draw-in — but NOT on buttons or nav. */
.entry-content a:not(.wp-block-button__link),
.wp-block-post-content a:not(.wp-block-button__link) {
	color: var(--wp--preset--color--accent);
	text-decoration: none;
	background-image: linear-gradient(var(--wp--preset--color--accent), var(--wp--preset--color--accent));
	background-repeat: no-repeat;
	background-position: 0 100%;
	background-size: 0% 2px;
	transition: background-size .25s var(--wp--custom--easing);
	padding-bottom: 1px;
}
.entry-content a:not(.wp-block-button__link):hover,
.wp-block-post-content a:not(.wp-block-button__link):hover { background-size: 100% 2px; }

/* ============================================================= BUTTONS */
.wp-block-button__link {
	transition: transform .18s var(--wp--custom--easing), box-shadow .18s var(--wp--custom--easing), background-color .18s ease;
	will-change: transform;
}
.wp-block-button:not(.is-style-outline) .wp-block-button__link {
	color: var(--wp--preset--color--surface) !important; /* guarantee legible button text */
	box-shadow: 0 2px 0 rgba(27, 31, 28, .12);
}
.wp-block-button__link:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 22px rgba(142, 63, 32, .28);
}
.wp-block-button.is-style-outline .wp-block-button__link {
	border: 2px solid var(--wp--preset--color--brand);
	color: var(--wp--preset--color--brand);
	background: transparent;
}
.wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: var(--wp--preset--color--brand);
	color: var(--wp--preset--color--surface);
}
.wp-block-button__link:focus-visible {
	outline: 3px solid var(--wp--preset--color--brand);
	outline-offset: 3px;
}

/* ============================================================= HERO */
.is-style-rebmann-grain { position: relative; isolation: isolate; }
.is-style-rebmann-grain::before {
	content: "";
	position: absolute; inset: 0; z-index: -1;
	pointer-events: none; opacity: .05;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Gentle float for the hero image/placeholder */
@media (prefers-reduced-motion: no-preference) {
	.hero-figure { animation: rebmann-float 7s ease-in-out infinite; }
}
@keyframes rebmann-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-10px); }
}
.wp-block-image img { border-radius: var(--wp--custom--radius--lg); }

/* ============================================================= IMAGE PLACEHOLDERS */
.rb-ph {
	margin: 0;
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-end;
	gap: .15rem;
	padding: 1.1rem 1.2rem;
	border-radius: var(--wp--custom--radius--lg);
	overflow: hidden;
	position: relative;
	isolation: isolate;
	color: var(--wp--preset--color--background);
	background:
		radial-gradient(120% 100% at 85% 12%, rgba(181, 85, 47, .85), transparent 42%),
		linear-gradient(150deg, var(--wp--preset--color--brand), var(--wp--preset--color--brand-alt));
}
.rb-ph::after { /* grain */
	content: "";
	position: absolute; inset: 0; z-index: -1; opacity: .06; pointer-events: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.rb-ph__tag {
	font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
	color: #E9A07F;
}
.rb-ph__label { font-family: var(--wp--preset--font-family--display); font-size: 1.1rem; line-height: 1.2; }
.rb-ph__file { font-size: .72rem; opacity: .72; font-variant-numeric: tabular-nums; }
/* card image bleeds to the card edges (card clips the radius) */
.is-style-rebmann-card .card-ph { border-radius: 0; }
.is-style-rebmann-card .card-body { padding: var(--wp--preset--spacing--50); }
.gallery-ph { border-radius: var(--wp--custom--radius--lg); }
/* card images (real or placeholder) fill the top, no gap */
.is-style-rebmann-card .card-ph img,
.is-style-rebmann-card > figure:first-child img { display: block; width: 100%; }

/* Contact form card */
.contact-form-card {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--lg);
	padding: var(--wp--preset--spacing--50);
}

/* ============================================================= EYEBROW */
.rebmann-eyebrow {
	font-family: var(--wp--preset--font-family--body);
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
	font-size: .8rem;
	/* accent-dark for 4.5:1 contrast on the light paper background (small text). */
	color: var(--wp--preset--color--accent-dark);
	/* block-level flex so the constrained layout aligns it with sibling H1/H2
	   (inline-flex drifted to the page edge on wide screens). */
	display: flex;
	align-items: center;
	gap: .6rem;
}
.rebmann-eyebrow::before {
	content: "";
	width: 28px; height: 2px;
	background: var(--wp--preset--color--accent-dark);
	display: inline-block;
	flex: 0 0 auto;
}

/* ============================================================= SERVICE CARDS */
.is-style-rebmann-card {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--lg);
	background: var(--wp--preset--color--surface);
	position: relative;
	overflow: hidden;
	transition: transform .28s var(--wp--custom--easing), border-color .28s ease, box-shadow .28s ease;
}
.is-style-rebmann-card::after {
	content: "";
	position: absolute; left: 0; top: 0; height: 3px; width: 0;
	background: var(--wp--preset--color--accent);
	transition: width .35s var(--wp--custom--easing);
}
.is-style-rebmann-card:hover {
	transform: translateY(-6px);
	border-color: transparent;
	box-shadow: 0 18px 40px rgba(27, 31, 28, .12);
}
.is-style-rebmann-card:hover::after { width: 100%; }
/* arrow nudge on card hover */
.is-style-rebmann-card a { transition: color .2s ease; }
.is-style-rebmann-card:hover a { color: var(--wp--preset--color--accent-dark); }

/* ============================================================= TRUST STRIP */
.rebmann-usp {
	display: flex;
	gap: .9rem;
	align-items: flex-start;
}
.rebmann-usp svg { flex: 0 0 auto; width: 28px; height: 28px; color: var(--wp--preset--color--accent); }
.rebmann-usp strong { display: block; font-family: var(--wp--preset--font-family--display); font-size: 1.15rem; color: var(--wp--preset--color--brand); }

/* ============================================================= PROCESS STEPS */
.rebmann-step { position: relative; }
.rebmann-step .step-num {
	font-family: var(--wp--preset--font-family--display);
	font-size: 3rem; font-weight: 600; line-height: 1;
	color: var(--wp--preset--color--accent);
	opacity: .35;
}

/* ============================================================= FOOTER (contrast fix) */
.site-footer,
.site-footer :where(p, li, a, h1, h2, h3, h4, .wp-block-heading, .wp-block-site-title, .wp-block-navigation-item__content) {
	color: var(--wp--preset--color--background) !important;
}
.site-footer .wp-block-heading,
.site-footer .wp-block-site-title {
	color: #fff !important;
	opacity: .95;
}
.site-footer a {
	text-decoration: none;
	opacity: .85;
	transition: opacity .2s ease, color .2s ease;
}
.site-footer a:hover { opacity: 1; color: var(--wp--preset--color--accent) !important; }
.site-footer .wp-block-navigation-item__content::after { display: none; }

/* ============================================================= SERVICE PAGE */
.service-hero .rebmann-eyebrow a { color: var(--wp--preset--color--muted); text-decoration: none; }
.service-hero .rebmann-eyebrow a:hover { color: var(--wp--preset--color--accent); }
.service-hero .wp-block-post-title { line-height: 1.05; }

/* Lead paragraph (first paragraph of content) */
.entry-content .wp-block-post-content > p:first-of-type,
.entry-content > p:first-of-type {
	font-size: 1.3rem;
	line-height: 1.5;
	color: var(--wp--preset--color--text);
}
/* Section headings get an accent tick */
.entry-content h2 {
	position: relative;
	padding-top: var(--wp--preset--spacing--30);
	margin-top: var(--wp--preset--spacing--60);
}
.entry-content h2::before {
	content: "";
	position: absolute; top: 0; left: 0;
	width: 40px; height: 3px;
	background: var(--wp--preset--color--accent);
}
.entry-content h3 { margin-top: var(--wp--preset--spacing--50); }
/* Custom list markers */
.entry-content ul { list-style: none; padding-left: 0; }
.entry-content ul li {
	position: relative;
	padding-left: 1.9rem;
	margin-bottom: .65rem;
}
.entry-content ul li::before {
	content: "";
	position: absolute; left: 0; top: .55em;
	width: .7rem; height: .7rem;
	border-right: 2px solid var(--wp--preset--color--accent);
	border-bottom: 2px solid var(--wp--preset--color--accent);
	transform: rotate(45deg) translateY(-2px);
}
/* FAQ-ish H3 blocks read as a tidy list */
.entry-content h3 + p { color: var(--wp--preset--color--muted); }

/* Sticky sidebar */
.service-sidebar {
	position: sticky;
	top: 110px;
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--40);
}
.sidebar-card {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--lg);
	background: var(--wp--preset--color--surface);
	padding: var(--wp--preset--spacing--50);
}
.sidebar-card--accent {
	background: var(--wp--preset--color--brand);
	border-color: transparent;
	color: var(--wp--preset--color--background);
}
.sidebar-eyebrow {
	font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
	font-size: .75rem; color: var(--wp--preset--color--accent);
	margin: 0 0 .6rem;
}
.sidebar-card--accent .sidebar-eyebrow { color: #E9A07F; }
.sidebar-lead { margin: 0 0 1.1rem; font-size: 1.05rem; }
.sidebar-cta {
	display: block; text-align: center;
	background: var(--wp--preset--color--accent); color: #fff;
	padding: .85rem 1rem; border-radius: var(--wp--custom--radius--md);
	font-weight: 700; text-decoration: none;
	transition: transform .18s ease, background .2s ease;
}
.sidebar-cta:hover { transform: translateY(-2px); background: var(--wp--preset--color--accent-dark); }
.sidebar-contact { margin: 1.2rem 0 0; display: grid; grid-template-columns: auto 1fr; gap: .35rem .8rem; font-size: .95rem; }
.sidebar-contact dt { font-weight: 700; opacity: .8; }
.sidebar-contact dd { margin: 0; }
.sidebar-contact a, .sidebar-card--accent a { color: #fff; text-decoration: none; }
.sidebar-contact a:hover { text-decoration: underline; }
.sidebar-nav { list-style: none; margin: 0; padding: 0; }
.sidebar-nav li { border-top: 1px solid var(--wp--preset--color--border); }
.sidebar-nav li:first-child { border-top: 0; }
.sidebar-nav a {
	display: flex; justify-content: space-between; align-items: center;
	padding: .7rem 0; color: var(--wp--preset--color--text);
	text-decoration: none; font-weight: 600;
	transition: color .2s ease, padding .2s ease;
}
.sidebar-nav a::after { content: "→"; color: var(--wp--preset--color--accent); opacity: 0; transition: opacity .2s ease, transform .2s ease; }
.sidebar-nav a:hover { color: var(--wp--preset--color--accent); padding-left: .35rem; }
.sidebar-nav a:hover::after { opacity: 1; }

@media (max-width: 781px) {
	.service-sidebar { position: static; }
}

/* ============================================================= MISC POLISH */
:where(h1, h2, h3) { text-wrap: balance; }
p { text-wrap: pretty; }
::selection { background: var(--wp--preset--color--accent); color: #fff; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Anchored sections must clear the sticky header (≈84px) when scrolled to. */
:where(#kontakt, #leistungen, [id]) { scroll-margin-top: 96px; }

/* Accessibility: visible focus rings on all interactive elements. */
a:focus-visible,
button:focus-visible,
.wp-block-navigation-item__content:focus-visible,
input:focus-visible, textarea:focus-visible, summary:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent-dark);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Touch targets: ≥44px tap height for nav links on small screens. */
@media (max-width: 781px) {
	.site-header .wp-block-navigation-item__content { min-height: 44px; display: flex; align-items: center; }
}

/* CF7 form fields styled to the brand */
.wpcf7 input[type="text"], .wpcf7 input[type="email"], .wpcf7 input[type="tel"], .wpcf7 textarea {
	width: 100%;
	padding: .8rem 1rem;
	margin-top: .35rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--preset--color--background);
	font-family: var(--wp--preset--font-family--body);
	font-size: 1rem;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.wpcf7 input:focus, .wpcf7 textarea:focus {
	outline: none;
	border-color: var(--wp--preset--color--accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wp--preset--color--accent) 20%, transparent);
}
.wpcf7 label { display: block; margin-bottom: 1rem; font-weight: 600; color: var(--wp--preset--color--brand); }
.wpcf7 .wpcf7-submit {
	background: var(--wp--preset--color--accent);
	color: #fff; border: 0;
	padding: .85rem 1.6rem;
	border-radius: var(--wp--custom--radius--md);
	font-weight: 700; cursor: pointer;
	transition: transform .18s ease, background .2s ease;
}
.wpcf7 .wpcf7-submit:hover { transform: translateY(-2px); background: var(--wp--preset--color--accent-dark); }
.wpcf7-acceptance { font-size: .9rem; color: var(--wp--preset--color--muted); }
