/*
Theme Name:        Blachenfabrik
Theme URI:         https://blachenfabrik.ch
Author:            Flyerking
Description:       Schlankes Block-Theme für blachenfabrik.ch (WooCommerce + Print-Engine). Farben, Schriften und Abstände stehen in theme.json.
Version:           0.5.0
Requires at least: 6.6
Tested up to:      7.1
Requires PHP:      8.1
License:           Proprietär
Text Domain:       blachenfabrik
*/

/*
 * Hier nur, was theme.json nicht ausdrücken kann.
 * Farben/Schriften/Abstände immer über theme.json (var(--wp--preset--…)).
 */

/* Sichtbarer Tastatur-Fokus überall */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* =========================================================================
 * Grundlage
 * ======================================================================= */
html,
body {
	overflow-x: clip;
}

body {
	-webkit-font-smoothing: antialiased;
}

.bf-wrap {
	box-sizing: border-box;
	width: 100%;
	max-width: 1320px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 24px;
	padding-right: 24px;
}

.wp-site-blocks > * + * {
	margin-block-start: 0;
}

/* Knöpfe und Felder mindestens 48 px hoch (Touch) */
:where(.wp-element-button, .wp-block-button__link, input[type="submit"]) {
	min-height: 48px;
}

:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
	min-height: 48px;
	border: 1.5px solid var(--wp--preset--color--line-strong);
	border-radius: 12px;
	padding: 0 14px;
	font: inherit;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
}

textarea {
	padding: 12px 14px;
}

/* =========================================================================
 * Print-Engine an das Blachenfabrik-Design anpassen (Farben, Schrift)
 * ======================================================================= */
body .pe-cfg,
body .pe-box,
body .pe-mobilebar {
	--pe-blue: #0b6e64;
	--pe-blue-dark: #08534b;
	--pe-blue-soft: #e3f1ee;
	--pe-yellow: #d4f25a;
	--pe-yellow-soft: #f4fbd8;
	--pe-yellow-line: #b9d63c;
	--pe-ink: #14181b;
	--pe-ink-2: #4a5055;
	--pe-line: #d6d3cb;
	--pe-surface: #f1f4f3;
	--pe-brand-font: "Space Grotesk", Inter, sans-serif;
}

body .pe-area-preview,
body .pe-qc,
body [data-pe-preview] {
	--pe-ap-a: #0e8a7d;
	--pe-ap-b: #0b6e64;
	--pe-ap-ink: #14181b;
	--pe-ap-ink-2: #5b6166;
	--pe-ap-person: #b9c3c1;
	--pe-ap-stack: #dce5e2;
	--pe-ap-stack-line: #afc0bb;
	--pe-ap-ground: #c9cfcd;
	--pe-ap-hole: #f1f4f3;
	--pe-ap-badge: #d4f25a;
	--pe-ap-bg: #f1f4f3;
	--pe-ap-line: #e2e0da;
}

body .pe-qc {
	--pe-qc-ink: #14181b;
	--pe-qc-ink-2: #5b6166;
	--pe-qc-action: #0b6e64;
	--pe-qc-go: #14181b;
	--pe-qc-font: "Space Grotesk", Inter, sans-serif;
}

/* Karten des Konfigurators wie im Entwurf: weiss, Radius 18, Schritt-Nummer graphit */
.bf-product .pe-cfg .pe-step {
	background: #fff;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 18px;
	box-shadow: none;
}

.bf-product .pe-cfg .pe-step-num {
	background: var(--wp--preset--color--contrast);
	color: #fff;
}

.bf-product .pe-cfg .pe-step-title {
	font-family: var(--wp--preset--font-family--heading);
}

.bf-product .pe-box.pe-current-selection {
	top: 24px;
	border-radius: 20px;
	box-shadow: 0 18px 40px rgba(20, 24, 27, 0.08);
}

.bf-product .pe-box .pe-current-selection-total strong {
	font-family: var(--wp--preset--font-family--heading);
}

/* =========================================================================
 * Kopfzeile
 * ======================================================================= */
.bf-usp {
	font-size: 13px;
}

.bf-usp-row {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 6px 24px;
	padding: 9px 0;
}

.bf-usp-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bf-usp-list li::before {
	content: "✓";
	margin-right: 6px;
	color: var(--wp--preset--color--accent);
	font-weight: 700;
}

.bf-usp a {
	color: #e9ecee;
}

.bf-header {
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.bf-header-row {
	gap: 16px 32px;
	padding: 14px 0;
}

.bf-wordmark {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 24px;
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 1;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
	white-space: nowrap;
}

.bf-wordmark:hover {
	color: var(--wp--preset--color--contrast);
}

.bf-wordmark span {
	color: var(--wp--preset--color--primary);
}

.bf-wordmark--light {
	color: #fff;
	font-size: 20px;
}

.bf-wordmark--light:hover {
	color: #fff;
}

.bf-wordmark--light span {
	color: var(--wp--preset--color--accent);
}

.bf-logo {
	display: inline-flex;
	align-items: center;
	flex: none;
	line-height: 0;
}

.bf-logo img {
	display: block;
	width: auto;
	height: 40px;
}

.bf-logo--footer img {
	height: 32px;
}

.bf-header-tools {
	gap: 8px 20px;
}

.bf-nav {
	font-weight: 600;
	font-size: 15px;
	gap: 4px 24px;
}

.bf-nav a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.bf-nav a:hover {
	color: var(--wp--preset--color--primary);
}

.bf-header .wp-block-woocommerce-customer-account a,
.bf-header .wc-block-mini-cart__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	color: var(--wp--preset--color--contrast);
}

@media (max-width: 599px) {
	.bf-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 44px;
		min-height: 44px;
	}

	.bf-usp-list li:nth-child(n+2),
	.bf-usp-contact {
		display: none;
	}

	.bf-header-row {
		padding: 8px 0;
	}

	.bf-logo img {
		height: 30px;
	}

	.bf-header-tools {
		gap: 0;
	}
}

/* =========================================================================
 * Bausteine
 * ======================================================================= */
.bf-section {
	padding-top: clamp(40px, 6vw, 64px);
	padding-bottom: clamp(40px, 6vw, 64px);
}

.bf-band {
	padding: clamp(40px, 6vw, 64px) 0;
}

.bf-band--white {
	background: var(--wp--preset--color--surface);
	border-top: 1px solid var(--wp--preset--color--line);
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.bf-band--dark {
	background: var(--wp--preset--color--dark);
	color: #e9ecee;
}

.bf-band--dark .bf-h2,
.bf-band--dark h3 {
	color: #fff;
}

.bf-h2 {
	margin: 0 0 8px;
	font-family: var(--wp--preset--font-family--heading);
	font-size: clamp(1.75rem, 3.2vw, 2.375rem);
	line-height: 1.1;
}

.bf-sub {
	margin: 0 0 28px;
	font-size: 17px;
	color: var(--wp--preset--color--muted);
}

.bf-kicker {
	display: inline-block;
	margin: 0 0 14px;
	padding: 6px 10px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--accent);
	border-radius: 6px;
}

.bf-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.bf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 52px;
	padding: 0 24px;
	font-weight: 700;
	color: #fff;
	text-decoration: none;
	background: var(--wp--preset--color--primary);
	border: 1.5px solid var(--wp--preset--color--primary);
	border-radius: 12px;
}

.bf-btn:hover,
.bf-btn:focus {
	color: #fff;
	background: var(--wp--preset--color--primary-dark);
	border-color: var(--wp--preset--color--primary-dark);
}

.bf-btn--ghost {
	color: var(--wp--preset--color--contrast);
	background: transparent;
	border-color: var(--wp--preset--color--contrast);
}

.bf-btn--ghost:hover,
.bf-btn--ghost:focus {
	color: var(--wp--preset--color--contrast);
	background: rgba(20, 24, 27, 0.05);
	border-color: var(--wp--preset--color--contrast);
}

.bf-chip {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 16px;
	font-weight: 600;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line-strong);
	border-radius: 999px;
}

.bf-chip:hover {
	color: var(--wp--preset--color--contrast);
	border-color: var(--wp--preset--color--primary);
}

.bf-grid {
	display: grid;
	gap: 18px;
}

.bf-grid--2 {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.bf-grid--3 {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}

.bf-card {
	display: block;
	padding: 24px;
	color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 18px;
}

.bf-card h3 {
	margin: 0 0 6px;
	font-size: 22px;
}

.bf-card p {
	margin: 0 0 12px;
	color: var(--wp--preset--color--muted);
}

.bf-card p:last-child {
	margin-bottom: 0;
}

.bf-card--link {
	text-decoration: none;
	transition: border-color 0.15s ease, transform 0.15s ease;
}

.bf-card--link:hover {
	color: var(--wp--preset--color--contrast);
	border-color: var(--wp--preset--color--primary);
}

.bf-card--dark {
	color: #e9ecee;
	background: transparent;
	border-color: #343b40;
}

.bf-card--dark p {
	color: #b7bec2;
}

.bf-card .bf-card-kicker {
	margin: 0 0 6px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent);
}

.bf-card-art {
	display: block;
	margin: -8px -8px 16px;
	padding: 12px 8px 4px;
	background: var(--wp--preset--color--tint);
	border-radius: 12px;
	aspect-ratio: 480 / 190;
}

.bf-swatch {
	display: block;
	height: 120px;
	margin: 0 0 18px;
	border-radius: 12px;
	background: linear-gradient(135deg, #0e8a7d, #0b6e64);
}

.bf-swatch--mesh {
	background-color: #0b6e64;
	background-image: radial-gradient(#f4f3ef 1.2px, transparent 1.4px);
	background-size: 7px 7px;
}

.bf-price {
	font-weight: 700;
	color: var(--wp--preset--color--contrast) !important;
}

.bf-faq {
	display: grid;
	gap: 10px;
}

.bf-faq details {
	padding: 16px 18px;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 14px;
}

.bf-faq summary {
	font-weight: 600;
	cursor: pointer;
}

.bf-faq details p {
	margin: 10px 0 0;
	color: var(--wp--preset--color--muted);
}

/* =========================================================================
 * Startseite
 * ======================================================================= */
.bf-hero {
	padding: clamp(32px, 6vw, 56px) 0 40px;
}

.bf-hero-grid {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 40px;
}

.bf-hero-text {
	flex: 1 1 440px;
	min-width: 0;
}

.bf-hero-calc {
	flex: 1 1 500px;
	min-width: 0;
}

.bf-hero-title {
	margin: 0 0 18px;
	font-size: var(--wp--preset--font-size--hero);
	line-height: 1.02;
}

.bf-hero-lead {
	max-width: 520px;
	margin: 0 0 28px;
	font-size: clamp(17px, 1.6vw, 19px);
	line-height: 1.55;
	color: #3c4247;
}

.bf-formats {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding-bottom: 48px;
}

.bf-formats-label {
	margin-right: 6px;
	font-weight: 600;
}

.bf-tile {
	display: block;
	overflow: hidden;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
	background: #f8f7f4;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 18px;
	transition: border-color 0.15s ease;
}

.bf-tile:hover {
	color: var(--wp--preset--color--contrast);
	border-color: var(--wp--preset--color--primary);
}

.bf-tile-art {
	display: block;
	padding: 14px 10px 4px;
	background: var(--wp--preset--color--tint);
	aspect-ratio: 480 / 230;
}

.bf-tile-art .pe-ap-motif {
	font-size: 12px;
}

.bf-tile-body {
	display: block;
	padding: 18px;
}

.bf-tile-body strong {
	display: block;
	font-size: 19px;
}

.bf-tile-body span {
	display: block;
	margin-top: 6px;
	color: var(--wp--preset--color--muted);
}

.bf-steps {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
	gap: 24px;
	margin: 24px 0 0;
	padding: 0;
	list-style: none;
}

.bf-steps h3 {
	margin: 14px 0 6px;
	font-size: 20px;
}

.bf-steps p {
	margin: 0;
	line-height: 1.55;
	color: #b7bec2;
}

.bf-step-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	font-weight: 700;
	color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--accent);
	border-radius: 50%;
}

.bf-faq-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 32px;
}

.bf-faq-grid > :first-child {
	flex: 1 1 340px;
	min-width: 0;
}

.bf-faq-grid > .bf-faq {
	flex: 2 1 520px;
	min-width: 0;
}

/* =========================================================================
 * Produktseite
 * ======================================================================= */
.bf-product-top {
	padding-top: 20px;
	padding-bottom: 56px;
}

.bf-product-top .woocommerce-breadcrumb,
.bf-product-top .wc-block-breadcrumbs {
	margin-bottom: 16px;
	color: #5b6166;
}

.bf-product-cols {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr) minmax(0, 0.95fr);
	gap: 24px;
	align-items: start;
}

.bf-product-cols > * {
	margin: 0 !important;
}

.bf-product-info,
.bf-product-box {
	align-self: stretch;
}

.bf-product-title {
	margin: 0 0 14px;
	font-size: clamp(2rem, 3vw, 2.5rem);
	line-height: 1.05;
}

.bf-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 16px;
	padding: 0;
	list-style: none;
}

.bf-badges li {
	padding: 6px 10px;
	font-size: 13px;
	font-weight: 600;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 999px;
}

.bf-product-stage .pe-area-preview {
	padding: 18px;
	background: var(--wp--preset--color--surface);
	border-radius: 20px;
}

.bf-product-stage .pe-area-preview-stage {
	padding: 10px 6px 4px;
	background: var(--wp--preset--color--tint);
	border-radius: 14px;
}

.bf-product-excerpt {
	margin-top: 16px;
	color: var(--wp--preset--color--muted);
}

.bf-note-card {
	margin-top: 16px;
	padding: 22px;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 18px;
}

.bf-note-card h2 {
	margin: 0 0 6px;
	font-size: 21px;
}

.bf-note-card p {
	margin: 0;
	font-size: 14px;
	color: var(--wp--preset--color--muted);
}

.bf-anchors {
	position: sticky;
	top: 0;
	z-index: 20;
	background: var(--wp--preset--color--surface);
	border-top: 1px solid var(--wp--preset--color--line);
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.bf-anchors .bf-wrap {
	display: flex;
	gap: 4px 28px;
	overflow-x: auto;
	scrollbar-width: none;
}

.bf-anchors a {
	display: inline-flex;
	align-items: center;
	min-height: 52px;
	font-weight: 600;
	white-space: nowrap;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.bf-anchors a:hover {
	color: var(--wp--preset--color--primary);
}

.bf-product [id] {
	scroll-margin-top: 64px;
}

.bf-product-details-wrap {
	padding-bottom: 0;
}

@media (min-width: 1024px) {
	.bf-product-stage {
		position: sticky;
		top: 24px;
	}
}

/* Tablet: Vorschau + Konfigurator nebeneinander, Box darunter (Handy-Leiste übernimmt) */
@media (max-width: 1023px) {
	.bf-product-cols {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
	}

	.bf-product-box {
		grid-column: 1 / -1;
	}
}

/* Handy: eine Spalte, Vorschau läuft oben mit */
@media (max-width: 781px) {
	.bf-wrap {
		padding-left: 16px;
		padding-right: 16px;
	}

	.bf-product-cols {
		display: block;
	}

	.bf-product-info {
		display: contents;
	}

	.bf-product-title {
		font-size: 30px;
	}

	.bf-product-stage {
		position: sticky;
		top: 0;
		z-index: 15;
		margin: 0 -16px 14px;
		padding: 8px 16px;
		background: var(--wp--preset--color--surface);
		border-bottom: 1px solid var(--wp--preset--color--line);
	}

	.bf-product-stage .pe-area-preview {
		margin: 0;
		padding: 0;
		border: 0;
		border-radius: 0;
	}

	.bf-product-stage .pe-area-preview-caption {
		margin-top: 4px;
		font-size: 12px;
	}

	.bf-product-excerpt {
		margin: 0 0 14px;
	}

	.bf-product-config {
		margin-bottom: 16px !important;
	}

	.bf-anchors {
		top: 0;
	}
}

/* =========================================================================
 * Fusszeile
 * ======================================================================= */
.bf-footer {
	color: #b7bec2;
}

.bf-footer-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 48px;
	padding: 40px 0 calc(40px + env(safe-area-inset-bottom));
}

.bf-footer-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 24px;
}

.bf-footer-nav a {
	color: #e9ecee;
}

.bf-footer-copy {
	margin: 0;
	font-size: 13px;
}

/* Platz für die Handy-Leiste des Konfigurators */
@media (max-width: 1023px) {
	.single-product .bf-footer-row {
		padding-bottom: 120px;
	}
}

/* =========================================================================
 * Warenkorb und Kasse (klassisch): Farben der Print-Engine-Karten
 * ======================================================================= */
.woocommerce-checkout,
.woocommerce-cart {
	--wd-title-color: #0b6e64;
	--wd-form-brd-color: #d6d3cb;
	--wd-form-brd-width: 1.5px;
	--wd-form-brd-radius: 12px;
	--wd-form-bg: #fff;
}

.pe-fulfillment__card.is-selected {
	background: #e3f1ee;
}
