/*
Theme Name: billdigital
Theme URI: https://billdigital.ch
Author: biwac
Author URI: https://biwac.ch
Description: Schlankes Block-Theme für billdigital.ch. Schwarz, Weiss und Grautöne, Noto Sans, Schrägstrich-Motiv aus dem Logo.
Requires at least: 6.7
Tested up to: 7.1
Requires PHP: 8.1
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: billdigital
*/

/* ------------------------------------------------------------------
   Grundlagen
   ------------------------------------------------------------------ */

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	overflow-x: hidden;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

a:hover,
a:focus-visible {
	text-underline-offset: 0.2em;
}

:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

img,
svg {
	max-width: 100%;
	height: auto;
}

/* Kopf, Hauptteil und Fuss stossen ohne Abstand aneinander. */
.wp-site-blocks > * {
	margin-block: 0;
}

/* Skip-Link von WordPress sichtbar machen, wenn er fokussiert ist. */
.skip-link.screen-reader-text:focus {
	position: fixed;
	top: 8px;
	left: 8px;
	z-index: 100000;
	padding: 12px 20px;
	background: var(--wp--preset--color--schwarz);
	color: var(--wp--preset--color--weiss);
	font-weight: 600;
	clip: auto;
	clip-path: none;
	width: auto;
	height: auto;
}

/* ------------------------------------------------------------------
   Kopf
   ------------------------------------------------------------------ */

.bd-logo {
	display: inline-block;
	margin: 0;
	padding: 6px 0;
	line-height: 0;
}

.bd-logo svg,
.bd-logo img {
	display: block;
	width: auto;
	height: 34px;
	overflow: visible;
}

/* Schrägstriche im Logo: hüpfen als Welle nacheinander hoch und runter (per JS animiert) */
.bd-logo-slash {
	transform-box: fill-box;
	transform-origin: 50% 50%;
}

/* Navigation mit Schrägstrichen als Trenner */
.bd-nav {
	font-size: var(--wp--preset--font-size--sm);
	gap: 0 14px;
}

.bd-nav .wp-block-navigation__container {
	gap: 0 14px;
	flex-wrap: wrap;
}

.bd-nav .wp-block-navigation-item {
	gap: 0 14px;
}

.bd-nav .wp-block-navigation-item + .wp-block-navigation-item::before {
	content: "/";
	color: var(--wp--preset--color--grau);
}

.bd-nav .wp-block-navigation-item__content {
	padding: 11px 0;
}

.bd-nav .wp-block-navigation-item__content:hover,
.bd-nav .wp-block-navigation-item__content:focus-visible {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* ------------------------------------------------------------------
   Abschnitte
   ------------------------------------------------------------------ */

.bd-line {
	border-top: 1px solid var(--wp--preset--color--linie);
}

.bd-label {
	font-weight: 600;
}

.bd-num {
	color: var(--wp--preset--color--grau);
}

/* ------------------------------------------------------------------
   Einstieg
   ------------------------------------------------------------------ */

.bd-hero-text {
	flex: 999 1 520px;
	min-width: 0;
}

.bd-hero-lead {
	max-width: 620px;
}

.bd-bars {
	flex: 1 1 200px;
	display: flex;
	justify-content: flex-end;
	gap: 26px;
	padding-right: 40px;
}

.bd-bar {
	width: 30px;
	height: 300px;
	background: var(--wp--preset--color--schwarz);
	transform: skewX(-14deg);
}

.bd-bar:nth-child(3) {
	margin-left: 60px;
}

/* Button-Stil «Linie»: ohne Fläche, mit Unterstrich */
.wp-block-button.is-style-bd-linie .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--schwarz);
	padding-left: 0;
	padding-right: 0;
	border-bottom: 2px solid var(--wp--preset--color--schwarz);
}

.wp-block-button.is-style-bd-linie .wp-block-button__link:hover,
.wp-block-button.is-style-bd-linie .wp-block-button__link:focus-visible {
	background: transparent;
	color: var(--wp--preset--color--schwarz);
}

/* ------------------------------------------------------------------
   Angebot
   ------------------------------------------------------------------ */

.bd-karte {
	padding-top: 20px;
	border-top: 2px solid var(--wp--preset--color--schwarz);
}

/* Zweispaltige Listen (Leistungen, Fakten) */
.bd-liste {
	gap: 0;
}

.bd-liste > .bd-zeile {
	flex-wrap: wrap;
	gap: 4px 32px;
	padding: 18px 0;
	border-top: 1px solid var(--wp--preset--color--linie);
}

.bd-liste > .bd-zeile:last-child {
	border-bottom: 1px solid var(--wp--preset--color--linie);
}

.bd-liste > .bd-zeile > :first-child {
	flex: 1 1 240px;
	font-weight: 600;
}

.bd-liste > .bd-zeile > :last-child {
	flex: 3 1 320px;
	color: var(--wp--preset--color--grau-dunkel);
}

/* ------------------------------------------------------------------
   Arbeiten (Projektkacheln, vom Block billdigital/projekte gerendert)
   ------------------------------------------------------------------ */

.bd-projekte {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
	gap: 56px 32px;
}

.bd-projekt {
	display: flex;
	flex-direction: column;
	gap: 16px;
	color: inherit;
	text-decoration: none;
}

.bd-projekt:hover,
.bd-projekt:focus-visible {
	text-decoration: none;
}

.bd-projekt:hover .bd-projekt__titel,
.bd-projekt:focus-visible .bd-projekt__titel {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.bd-projekt__bild {
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--wp--preset--color--flaeche);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	color: var(--wp--preset--color--grau);
}

.bd-projekt__bild img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
}

.bd-projekt__bild--dunkel {
	background: var(--wp--preset--color--schwarz);
	color: var(--wp--preset--color--weiss);
	font-weight: 600;
	font-size: 28px;
	letter-spacing: -0.01em;
}

.bd-projekt__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.bd-projekt__titel {
	margin: 0;
	font-weight: 600;
	font-size: 22px;
	line-height: 1.55;
	letter-spacing: 0;
}

.bd-projekt__meta {
	font-size: var(--wp--preset--font-size--s);
	color: var(--wp--preset--color--grau-dunkel);
}

.bd-projekt__art {
	font-size: var(--wp--preset--font-size--s);
	color: var(--wp--preset--color--grau);
}

/* ------------------------------------------------------------------
   Über mich
   ------------------------------------------------------------------ */

.bd-portraet {
	flex: 1 1 320px;
	max-width: 460px;
	aspect-ratio: 4 / 5;
	overflow: hidden;
	background: var(--wp--preset--color--flaeche);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	color: var(--wp--preset--color--grau);
}

/* Höhere Spezifität als .wp-block-image img (height: auto) aus den Core-Stilen */
figure.bd-portraet img,
.bd-portraet img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center top;
}

.bd-portraet.wp-block-image {
	margin: 0;
}

.bd-ueber-text {
	flex: 2 1 420px;
	min-width: 0;
}

.bd-ueber-text > p,
.bd-fakten {
	max-width: 640px;
}

.bd-fakten {
	font-size: var(--wp--preset--font-size--sm);
}

.bd-fakten > .bd-zeile {
	gap: 4px 24px;
	padding: 14px 0;
}

.bd-fakten > .bd-zeile > :first-child {
	flex: 1 1 140px;
	font-weight: 400;
	color: var(--wp--preset--color--grau);
}

.bd-fakten > .bd-zeile > :last-child {
	flex: 3 1 260px;
	color: inherit;
}

/* ------------------------------------------------------------------
   Kontakt
   ------------------------------------------------------------------ */

.bd-kontakt h2 {
	font-size: var(--wp--preset--font-size--kontakt);
	line-height: 1.05;
	letter-spacing: -0.02em;
}

.bd-kontaktdaten {
	display: flex;
	flex-direction: column;
	gap: 32px;
}

.bd-kontaktdaten__links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 48px;
	font-size: 22px;
}

.bd-kontaktdaten__links a {
	padding: 10px 0;
	border-bottom: 2px solid currentColor;
}

.bd-kontaktdaten__adresse {
	font-style: normal;
	font-size: var(--wp--preset--font-size--m);
	color: var(--wp--preset--color--grau-hell);
}

/* Anfrageformular (auf Schwarz) */
.bd-anfrage {
	margin-top: 24px;
}

/* Der Block läuft in der Inhaltsspalte, nur das Formular selbst ist auf 760 px begrenzt */
.bd-anfrage__form,
.bd-anfrage__meldung {
	max-width: 760px;
}

.bd-anfrage__form {
	display: flex;
	flex-direction: column;
	gap: 28px;
}

.bd-anfrage__felder {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
	gap: 28px 32px;
}

.bd-anfrage__feld--projekt {
	grid-column: 1 / -1;
}

.bd-anfrage__feld {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bd-anfrage label {
	font-size: var(--wp--preset--font-size--s);
	font-weight: 600;
}

.bd-anfrage input:not([type="checkbox"]),
.bd-anfrage textarea {
	width: 100%;
	padding: 10px 0;
	font: inherit;
	color: inherit;
	background: transparent;
	border: 0;
	border-bottom: 2px solid var(--wp--preset--color--grau-hell);
	border-radius: 0;
	transition: border-color 0.25s ease;
}

.bd-anfrage input:not([type="checkbox"]):focus,
.bd-anfrage textarea:focus {
	outline: none;
	border-bottom-color: currentColor;
}

.bd-anfrage input:not([type="checkbox"]):focus-visible,
.bd-anfrage textarea:focus-visible {
	outline: none;
}

.bd-anfrage textarea {
	min-height: 140px;
	resize: vertical;
}

.bd-anfrage__zustimmung {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	font-size: var(--wp--preset--font-size--s);
	color: var(--wp--preset--color--grau-hell);
}

.bd-anfrage__zustimmung label {
	font-weight: 400;
	padding-top: 2px;
}

.bd-anfrage__zustimmung a {
	text-decoration: underline;
	text-underline-offset: 0.2em;
	color: inherit;
}

.bd-anfrage input[type="checkbox"] {
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	margin: 2px 0 0;
	accent-color: var(--wp--preset--color--weiss);
	cursor: pointer;
}

.bd-anfrage__pflicht {
	margin: -16px 0 0;
	font-size: var(--wp--preset--font-size--xs);
	color: var(--wp--preset--color--grau-hell);
}

.bd-anfrage__senden {
	align-self: flex-start;
	min-height: 52px;
	padding: 14px 26px;
	font: inherit;
	font-weight: 600;
	color: var(--wp--preset--color--schwarz);
	background: var(--wp--preset--color--weiss);
	border: 0;
	border-radius: 0;
	cursor: pointer;
	transition: transform 0.25s ease;
}

.bd-anfrage__senden:hover,
.bd-anfrage__senden:focus-visible {
	text-decoration: underline;
	text-underline-offset: 0.2em;
	transform: translateY(-2px);
}

.bd-anfrage__meldung {
	margin: 0 0 24px;
	padding: 16px 20px;
	border: 2px solid currentColor;
	font-weight: 600;
}

.bd-anfrage__meldung--erfolg {
	background: var(--wp--preset--color--weiss);
	color: var(--wp--preset--color--schwarz);
}

/* Honeypot: für Menschen unsichtbar */
.bd-anfrage__falle {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ------------------------------------------------------------------
   Fuss
   ------------------------------------------------------------------ */

.bd-fuss {
	font-size: var(--wp--preset--font-size--xs);
	color: var(--wp--preset--color--grau);
}

.bd-fuss .bd-nav,
.bd-fuss .bd-nav .wp-block-navigation__container,
.bd-fuss .bd-nav .wp-block-navigation-item {
	gap: 0 12px;
	font-size: inherit;
}

.bd-fuss .bd-nav .wp-block-navigation-item__content {
	padding: 12px 0;
}

.bd-copyright {
	margin: 0;
}

/* ------------------------------------------------------------------
   Unterseiten
   ------------------------------------------------------------------ */

.bd-seite .wp-block-post-content > * {
	max-width: 760px;
}

.bd-seite .wp-block-post-content h2 {
	font-size: var(--wp--preset--font-size--xl);
	line-height: 1.2;
	letter-spacing: 0;
	margin-top: 24px;
}

.bd-seite .wp-block-post-content h3 {
	font-size: var(--wp--preset--font-size--l);
	line-height: 1.3;
}

.bd-seite .wp-block-post-content a {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.bd-seite .wp-block-post-content ul,
.bd-seite .wp-block-post-content ol {
	margin: 0;
	padding-left: 1.2em;
}

/* ------------------------------------------------------------------
   Editor
   ------------------------------------------------------------------ */

.editor-styles-wrapper .bd-bar {
	min-height: 300px;
}

.editor-styles-wrapper .bd-projekte-hinweis {
	padding: 24px;
	border: 1px dashed var(--wp--preset--color--grau);
	color: var(--wp--preset--color--grau);
	font-size: var(--wp--preset--font-size--xs);
}

/* ------------------------------------------------------------------
   Layout-Korrekturen zu den WordPress-Layoutregeln
   ------------------------------------------------------------------ */

/* Abschnitte stossen ohne Abstand aneinander (Frontend und Editor). */
.wp-block-post-content > .bd-section,
.is-root-container > .bd-section {
	margin-block: 0;
}

/* Listenzeilen ohne Abstand zwischen den Zeilen */
.bd-liste > * + * {
	margin-block-start: 0;
}

.bd-titel {
	max-width: 860px;
}

/* ------------------------------------------------------------------
   Mobile (bis 600 px): Abstände straffen, Tap-Ziele vergrössern
   Die Abstandsskala wird über die Preset-Variablen reduziert, damit die
   im Editor gesetzten Werte (z. B. 96/120) auf dem Handy kleiner ausfallen.
   ------------------------------------------------------------------ */

@media (max-width: 600px) {
	.bd-section,
	.bd-kopf,
	.bd-fuss,
	.bd-seite {
		--wp--preset--spacing--32: 24px;
		--wp--preset--spacing--72: 40px;
		--wp--preset--spacing--96: 64px;
		--wp--preset--spacing--104: 72px;
		--wp--preset--spacing--120: 80px;
	}

	.bd-kopf {
		--wp--preset--spacing--28: 16px;
	}

	.bd-nav .wp-block-navigation__container {
		gap: 0 12px;
	}

	.bd-nav .wp-block-navigation-item__content {
		padding: 12px 2px;
	}

	/* Die drei grossen Balken gibt es nur auf grösseren Bildschirmen */
	.bd-bars {
		display: none;
	}

	.wp-block-button__link {
		min-height: 48px;
	}

	.bd-projekte {
		gap: 40px 24px;
	}

	.bd-kontaktdaten__links {
		font-size: 20px;
		gap: 4px 32px;
	}

	.bd-kontaktdaten__links a {
		padding: 12px 0;
	}

	.bd-fuss .bd-nav .wp-block-navigation-item__content {
		padding: 14px 2px;
	}
}

/* ------------------------------------------------------------------
   Animationen
   Nur im Frontend (html.js) und nur, wenn keine reduzierte Bewegung
   gewünscht ist. Ohne JavaScript bleibt alles sichtbar.
   ------------------------------------------------------------------ */

/* Navigation: Unterstrich wächst von links, aktiver Abschnitt bleibt markiert */
.bd-nav .wp-block-navigation-item__content {
	position: relative;
}

.bd-nav .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 7px;
	height: 2px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.bd-nav .wp-block-navigation-item__content:hover,
.bd-nav .wp-block-navigation-item__content:focus-visible {
	text-decoration: none;
}

.bd-nav .wp-block-navigation-item__content:hover::after,
.bd-nav .wp-block-navigation-item__content:focus-visible::after,
.bd-nav .is-current > .wp-block-navigation-item__content::after {
	transform: scaleX(1);
}

/* Schrägstrich in der Kachel «/ dein projekt?» im Logo-Winkel */
.bd-slash {
	display: inline-block;
	transform: skewX(-14deg);
	transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

	/* Einstieg: Text gestaffelt einblenden, Balken von unten aufwachsen */
	.js .bd-einstieg .bd-hero-text > * {
		animation: bd-up 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	}

	.js .bd-einstieg .bd-hero-text > :nth-child(2) {
		animation-delay: 0.12s;
	}

	.js .bd-einstieg .bd-hero-text > :nth-child(3) {
		animation-delay: 0.24s;
	}

	.js .bd-bar {
		transform-origin: bottom;
		animation: bd-bar 1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	}

	.js .bd-bar:nth-child(1) { animation-delay: 0.3s; }
	.js .bd-bar:nth-child(2) { animation-delay: 0.42s; }
	.js .bd-bar:nth-child(3) { animation-delay: 0.54s; }

	.js .bd-bars {
		animation: bd-float 9s ease-in-out 1.6s infinite;
	}

	/* Scroll-Reveal: Elemente erscheinen, sobald sie ins Bild kommen */
	.js .bd-reveal {
		opacity: 0;
		transform: translateY(24px);
		transition: opacity 0.7s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
		transition-delay: calc(var(--bd-i, 0) * 80ms);
	}

	.js .bd-reveal.is-visible {
		opacity: 1;
		transform: none;
	}

	/* Hover: Bilder leicht zoomen, Schrägstrich rutscht, Buttons heben sich */
	@media (hover: hover) {
		.bd-projekt__bild img {
			transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
		}

		.bd-projekt:hover .bd-projekt__bild img {
			transform: scale(1.04);
		}

		.bd-projekt--cta:hover .bd-slash {
			transform: skewX(-14deg) translateX(0.2em);
		}

		.wp-block-button__link {
			transition: transform 0.25s ease;
		}

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

		.bd-kontaktdaten__links a {
			transition: letter-spacing 0.3s ease;
		}

		.bd-kontaktdaten__links a:hover {
			letter-spacing: 0.01em;
		}
	}

	@keyframes bd-up {
		from { opacity: 0; transform: translateY(28px); }
		to { opacity: 1; transform: none; }
	}

	@keyframes bd-bar {
		from { transform: skewX(-14deg) scaleY(0); }
		to { transform: skewX(-14deg) scaleY(1); }
	}

	@keyframes bd-float {
		0%, 100% { transform: translateY(0); }
		50% { transform: translateY(-8px); }
	}
}

/* ------------------------------------------------------------------
   Hamburger-Navigation (Overlay des Navigationsblocks, bis 600 px)
   Schwarzes Vollbild-Menü mit grossen Links und Schrägstrich-Motiv.
   ------------------------------------------------------------------ */

.bd-nav .wp-block-navigation__responsive-container-open,
.bd-nav .wp-block-navigation__responsive-container-close {
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin: -10px -10px -10px 0;
	padding: 0;
	color: inherit;
	background: none;
	border: 0;
	cursor: pointer;
}

.bd-nav .wp-block-navigation__responsive-container-open svg,
.bd-nav .wp-block-navigation__responsive-container-close svg {
	width: 28px;
	height: 28px;
}

.bd-nav .wp-block-navigation__responsive-container-close {
	display: flex;
	margin: 0;
	top: 22px;
	right: 20px;
}

/* Hamburger-Button nur unterhalb von 600 px (Core blendet ihn darüber aus) */
@media (max-width: 599px) {
	.bd-nav .wp-block-navigation__responsive-container-open {
		display: flex;
	}
}

.bd-nav .wp-block-navigation__responsive-container.is-menu-open {
	padding: 24px;
}

.bd-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: 72px;
}

.bd-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	gap: 12px 0;
	align-items: flex-start;
}

.bd-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	flex-direction: row;
	align-items: baseline;
	gap: 0 0.3em;
	font-size: clamp(32px, 9vw, 44px);
	font-weight: 600;
	line-height: 1.15;
	letter-spacing: -0.015em;
}

.bd-nav .is-menu-open .wp-block-navigation-item::before {
	content: "/";
	color: var(--wp--preset--color--grau);
}

.bd-nav .is-menu-open .wp-block-navigation-item__content {
	padding: 6px 0;
}

.bd-nav .is-menu-open .wp-block-navigation-item__content::after {
	bottom: 2px;
	height: 3px;
}

@media (prefers-reduced-motion: no-preference) {
	.bd-nav .is-menu-open .wp-block-navigation-item {
		animation: bd-up 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	}

	.bd-nav .is-menu-open .wp-block-navigation-item:nth-child(2) { animation-delay: 0.07s; }
	.bd-nav .is-menu-open .wp-block-navigation-item:nth-child(3) { animation-delay: 0.14s; }
	.bd-nav .is-menu-open .wp-block-navigation-item:nth-child(4) { animation-delay: 0.21s; }
	.bd-nav .is-menu-open .wp-block-navigation-item:nth-child(5) { animation-delay: 0.28s; }
}
