/*
Theme Name: Humbel Audio
Theme URI: https://www.humbelaudio.ch/
Author: Humbel Audio
Author URI: https://www.humbelaudio.ch/
Description: Schlichtes One-Page-Theme für Humbel Audio. Home, Über uns und Produkte liegen auf einer Seite, das Menü scrollt zu den Abschnitten. Zusammen mit dem Plugin «Humbel Audio – Konto» öffnet «Log In» ein Anmelde-Popup mit Kundenbereich.
Version: 1.1.0
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: humbel-audio
Tags: one-column, block-patterns, full-site-editing, wide-blocks
*/

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

:root {
	--ha-header-h: 4.25rem;
	--ha-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Farbschema ----------
 * Standard ist dunkel (Farben in theme.json). Der Schalter in der Kopfzeile setzt
 * data-farbschema="hell" am <html>-Element; dann gelten die hellen Farben aus
 * theme.json → settings.custom.hell. Schwarze Logos werden im dunklen Modus umgekehrt.
 */
:root {
	color-scheme: dark;
	--ha-logo-filter: invert(1);
}

:root[data-farbschema="hell"],
:root[data-farbschema="hell"] body {
	color-scheme: light;
	--ha-logo-filter: none;
	--wp--preset--color--base: var(--wp--custom--hell--base);
	--wp--preset--color--base-2: var(--wp--custom--hell--base-2);
	--wp--preset--color--line: var(--wp--custom--hell--line);
	--wp--preset--color--contrast-3: var(--wp--custom--hell--contrast-3);
	--wp--preset--color--contrast-2: var(--wp--custom--hell--contrast-2);
	--wp--preset--color--contrast: var(--wp--custom--hell--contrast);
	--wp--preset--color--accent: var(--wp--custom--hell--accent);
}

/* Weicher Übergang nur im Moment des Umschaltens */
html.ha-farbwechsel,
html.ha-farbwechsel *,
html.ha-farbwechsel *::before,
html.ha-farbwechsel *::after {
	transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, filter 0.35s ease !important;
}

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

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
	text-wrap: balance;
}

p {
	text-wrap: pretty;
}

/* Kopfzeile, Inhalt und Fusszeile liegen direkt aneinander; die Fusszeile sitzt auch auf kurzen Seiten unten. */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
}

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

.wp-site-blocks > main {
	flex: 1 0 auto;
}

/* Sprungziele nicht unter der fixierten Kopfzeile verstecken. */
main [id] {
	scroll-margin-top: calc(var(--ha-header-h) + var(--wp-admin--admin-bar--height, 0px));
}

/* ---------- Kopfzeile ---------- */

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
	border-bottom: 1px solid transparent;
	transition: border-color 0.25s ease;
}

/* Milchglas als eigene Ebene: ein Filter direkt an der Kopfzeile würde das mobile Menü einsperren. */
.wp-site-blocks > header.wp-block-template-part::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--wp--preset--color--base);
	background: color-mix(in srgb, var(--wp--preset--color--base) 86%, transparent);
	-webkit-backdrop-filter: saturate(180%) blur(14px);
	backdrop-filter: saturate(180%) blur(14px);
}

.wp-site-blocks > header.wp-block-template-part.is-scrolled {
	border-bottom-color: var(--wp--preset--color--line);
}

@media (max-width: 600px) {
	.admin-bar .wp-site-blocks > header.wp-block-template-part {
		top: 0;
	}
}

.ha-header {
	min-height: var(--ha-header-h);
	align-content: center;
}

.ha-brand {
	gap: 0.7rem;
}

.ha-brand__logo {
	margin: 0;
	line-height: 0;
}

.ha-brand__logo img {
	width: 2.4rem;
	height: auto;
}

/* Schwarze Logos (Welle, Herstellerlogos) im dunklen Modus hell darstellen */
.ha-brand__logo img,
.ha-hero__logo img,
.ha-marke {
	filter: var(--ha-logo-filter);
}

/* Menü und Farbschalter stehen zusammen rechts in der Kopfzeile */
.ha-nav-gruppe {
	display: flex;
	align-items: center;
	gap: clamp(0.75rem, 2vw, 1.5rem);
}

.ha-farbschalter {
	order: 2;
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 50%;
	background: transparent;
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ha-farbschalter:hover,
.ha-farbschalter:focus-visible {
	border-color: var(--wp--preset--color--contrast);
}

.ha-farbschalter svg {
	display: block;
}

.ha-farbschalter__mond,
:root[data-farbschema="hell"] .ha-farbschalter__sonne {
	display: none !important;
}

:root[data-farbschema="hell"] .ha-farbschalter__mond {
	display: block !important;
}

/* Auf dem Handy steht der Schalter vor dem Menü-Knopf */
@media (max-width: 599px) {
	.ha-farbschalter {
		order: 0;
	}
}

/* Menü */
.ha-nav .wp-block-navigation-item__content {
	position: relative;
	padding-block: 0.35rem;
	text-decoration: none;
}

.ha-nav .wp-block-navigation-item:not(.ha-login-link) .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 1px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.3s var(--ha-ease);
}

.ha-nav .wp-block-navigation-item__content:hover::after,
.ha-nav .wp-block-navigation-item__content:focus-visible::after,
.ha-nav .wp-block-navigation-item__content[aria-current]::after {
	transform: scaleX(1);
}

/* «Log In» bzw. «Mein Profil» als Rahmen-Knopf */
.ha-nav .ha-login-link .wp-block-navigation-item__content {
	padding: 0.5rem 1.05rem;
	border: 1px solid currentColor;
	border-radius: 999px;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.ha-nav .ha-login-link .wp-block-navigation-item__content:hover,
.ha-nav .ha-login-link .wp-block-navigation-item__content:focus-visible {
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
}

/* Mobiles Menü: grosse, ruhige Einträge, linksbündig */
.ha-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: calc(var(--ha-header-h) + 1rem);
	gap: 1.4rem;
	align-items: flex-start;
}

.ha-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	align-items: flex-start;
	gap: 1.4rem;
}

.ha-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: 1.625rem;
	font-weight: 500;
	letter-spacing: -0.02em;
	text-transform: none;
}

.ha-nav .wp-block-navigation__responsive-container.is-menu-open .ha-login-link .wp-block-navigation-item__content {
	margin-top: 0.75rem;
	font-size: 1.125rem;
	padding: 0.7rem 1.4rem;
}

/* ---------- Abschnitte der Startseite ---------- */

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

.is-style-eyebrow {
	font-size: var(--wp--preset--font-size--x-small) !important;
	font-weight: 600;
	letter-spacing: 0.14em;
	line-height: 1.4;
	text-transform: uppercase;
	color: var(--wp--preset--color--contrast-3);
}

.is-style-badge {
	display: inline-block;
	width: fit-content;
	margin: 0;
	padding: 0.2rem 0.6rem;
	border: 1px solid currentColor;
	border-radius: 999px;
	color: var(--wp--preset--color--accent);
	font-size: 0.6875rem !important;
	font-weight: 600;
	letter-spacing: 0.1em;
	line-height: 1.4;
	text-transform: uppercase;
}

/* Home */
.ha-hero {
	min-height: calc(100svh - var(--ha-header-h) - var(--wp-admin--admin-bar--height, 0px));
	text-align: center;
}

.ha-hero__logo {
	margin: 0;
}

.ha-hero__logo img {
	width: min(23rem, 70vw);
	height: auto;
}

.ha-hero__claim {
	max-width: 32rem;
	margin-inline: auto;
}

.ha-hero__weiter {
	margin-top: var(--wp--preset--spacing--60) !important;
}

.ha-hero__weiter a {
	display: inline-grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 50%;
	color: var(--wp--preset--color--contrast-2);
	text-decoration: none;
	transition: border-color 0.2s ease, color 0.2s ease, transform 0.3s var(--ha-ease);
}

.ha-hero__weiter a:hover,
.ha-hero__weiter a:focus-visible {
	border-color: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--contrast);
	transform: translateY(3px);
}

@media (prefers-reduced-motion: no-preference) {
	.ha-hero > * {
		animation: ha-auftauchen 0.9s var(--ha-ease) both;
	}

	.ha-hero > :nth-child(2) {
		animation-delay: 0.08s;
	}

	.ha-hero > :nth-child(3) {
		animation-delay: 0.16s;
	}

	.ha-hero > :nth-child(4) {
		animation-delay: 0.3s;
	}
}

@keyframes ha-auftauchen {
	from {
		opacity: 0;
		transform: translateY(14px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* Über uns */
@media (max-width: 600px) {
	.ha-section .ha-aussage {
		font-size: 1.5rem;
	}
}

.ha-angebot {
	margin-top: var(--wp--preset--spacing--60) !important;
	column-gap: clamp(1.5rem, 4vw, 3rem) !important;
	row-gap: 2.5rem !important;
}

.ha-angebot__spalte {
	padding-top: 1.1rem;
	border-top: 1px solid var(--wp--preset--color--contrast);
}

.ha-angebot__spalte > * {
	margin: 0;
}

.ha-angebot__spalte > * + * {
	margin-top: 0.75rem;
}

.ha-aufzaehlung {
	padding: 0;
	list-style: none;
	color: var(--wp--preset--color--contrast-2);
}

/* Gleiche Zeilenhöhe in allen drei Spalten, damit die Linien auf einer Höhe laufen */
.ha-aufzaehlung li {
	display: flex;
	align-items: center;
	min-height: 3.25rem;
	padding: 0.5rem 0;
	border-bottom: 1px solid var(--wp--preset--color--line);
}

/* Herstellerlogos: feste Spalte, damit die Namen bündig stehen */
.ha-aufzaehlung--marken li {
	display: grid;
	grid-template-columns: 10.5rem minmax(0, 1fr);
	column-gap: 1rem;
}

.ha-marke {
	display: block;
	max-width: 100%;
	height: auto;
}

.ha-marken-hinweis {
	margin-top: var(--wp--preset--spacing--50) !important;
}

/* Produkte */
.ha-product__icon {
	margin: 0;
}

.ha-product__icon img {
	width: min(100%, 20rem);
	height: auto;
	margin-inline: auto;
	display: block;
}

@media (max-width: 781px) {
	.ha-product__icon img {
		width: min(60%, 13rem);
		margin-inline: 0;
	}
}

.ha-product__meta {
	gap: 0.75rem;
	align-items: center;
}

.ha-product__meta > * {
	margin: 0;
}

.ha-product h3 {
	margin-top: 0.6rem;
}

.ha-features {
	margin-top: var(--wp--preset--spacing--60) !important;
	column-gap: clamp(1.5rem, 4vw, 3rem) !important;
	row-gap: 2.25rem !important;
}

.ha-feature {
	padding-top: 1.1rem;
	border-top: 1px solid var(--wp--preset--color--contrast);
}

.ha-feature > * {
	margin: 0;
}

.ha-feature > * + * {
	margin-top: 0.4rem;
}

.ha-requirements {
	margin-top: var(--wp--preset--spacing--60) !important;
	padding: 1.1rem 1.4rem;
	border-radius: 14px;
	background: var(--wp--preset--color--base-2);
}

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

.ha-page .wp-block-post-title {
	margin-bottom: var(--wp--preset--spacing--50);
}

/* ---------- Fusszeile ---------- */

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

.ha-footer p {
	margin: 0;
}

.ha-footer a {
	color: inherit;
	text-decoration: none;
}

.ha-footer a:hover,
.ha-footer a:focus-visible {
	color: var(--wp--preset--color--contrast);
	text-decoration: underline;
}

/* ---------- Fokus ---------- */

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

/* ---------- Konto-Plugin im dunklen Modus ----------
 * Das Plugin bringt helle Standardfarben mit. Im dunklen Modus des Themes werden
 * Meldungen, Reiter, Rahmen und das Logo hier angepasst; im hellen Modus gilt das Plugin.
 */
.ha-modal__logo {
	filter: var(--ha-logo-filter);
}

:root:not([data-farbschema="hell"]) .ha-modal,
:root:not([data-farbschema="hell"]) .ha-profil,
:root:not([data-farbschema="hell"]) .ha-kaufen {
	--ha-ok: #7fd6a1;
	--ha-ok-grund: rgb(46 160 90 / 0.18);
	--ha-fehler: #ff9a8f;
	--ha-fehler-grund: rgb(229 72 60 / 0.18);
}

:root:not([data-farbschema="hell"]) .ha-modal {
	box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.6), 0 0 0 1px var(--wp--preset--color--line);
}

:root:not([data-farbschema="hell"]) .ha-modal::backdrop {
	background: rgb(0 0 0 / 0.6);
}

:root:not([data-farbschema="hell"]) .ha-tabs [role="tab"][aria-selected="true"],
:root:not([data-farbschema="hell"]) .ha-schluessel__kopieren {
	background: var(--wp--preset--color--line);
}

:root:not([data-farbschema="hell"]) .ha-feld input:focus {
	box-shadow: 0 0 0 3px rgb(255 255 255 / 0.12);
}

/* Anmeldeseite von WordPress (wp-login.php), in beiden Modi */
body.login {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

body.login h1 a {
	filter: var(--ha-logo-filter);
}

body.login form {
	background: var(--wp--preset--color--base-2);
	border-color: var(--wp--preset--color--line);
}

body.login label {
	color: var(--wp--preset--color--contrast);
}

body.login input[type="text"],
body.login input[type="password"],
body.login input[type="email"] {
	border-color: var(--wp--preset--color--line);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

body.login input[type="text"]:focus,
body.login input[type="password"]:focus,
body.login input[type="email"]:focus {
	border-color: var(--wp--preset--color--contrast);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wp--preset--color--contrast) 14%, transparent);
}

body.login .button-primary {
	border-color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
}

body.login .button-primary:hover,
body.login .button-primary:focus {
	border-color: var(--wp--preset--color--contrast-2);
	background: var(--wp--preset--color--contrast-2);
	color: var(--wp--preset--color--base);
}

body.login .button.wp-hide-pw,
body.login .button.wp-hide-pw .dashicons,
body.login #nav a,
body.login #backtoblog a,
body.login .privacy-policy-page-link a {
	color: var(--wp--preset--color--contrast-2);
}

body.login .message,
body.login .notice,
body.login .success,
body.login #login_error {
	background: var(--wp--preset--color--base-2);
	color: var(--wp--preset--color--contrast);
}

body.login .message,
body.login .success {
	border-left-color: var(--wp--preset--color--contrast);
}

body.login .language-switcher .button {
	border-color: var(--wp--preset--color--line);
	background: transparent;
	color: var(--wp--preset--color--contrast);
}
