/**
 * Janine´s Marmelade – Hauptstylesheet
 * Farben über Customizer (CSS-Variablen :root).
 */

:root {
	--jm-primary: #b42318;
	--jm-primary-hover: #8f1c13;
	--jm-secondary: #3d2914;
	--jm-header-bg: #fff8f0;
	--jm-footer-bg: #2a1810;
	--jm-footer-text: #f5ebe0;
	--jm-body-bg: #fffdfb;
	--jm-text: #1a1209;
	--jm-border: #e8ddd0;
	--jm-radius: 6px;
	--jm-header-height: 72px;
	--jm-max-width: 1200px;
	/* Mindest 10 px zum Bildschirmrand + iPhone Safe Area */
	--jm-edge-left: max(10px, env(safe-area-inset-left, 0px));
	--jm-edge-right: max(10px, env(safe-area-inset-right, 0px));
}

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

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

/* Sticky Footer: Fußzeile sitzt bei wenig Inhalt am unteren Viewport-Rand */
body {
	margin: 0;
	min-height: 100%;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 1rem;
	line-height: 1.55;
	color: var(--jm-text);
	background: var(--jm-body-bg);
}

body.admin-bar {
	min-height: calc(100vh - 32px);
	min-height: calc(100dvh - 32px);
}

@media screen and (max-width: 782px) {
	body.admin-bar {
		min-height: calc(100vh - 46px);
		min-height: calc(100dvh - 46px);
	}
}

img {
	max-width: 100%;
	height: auto;
	vertical-align: middle;
}

a {
	color: var(--jm-primary);
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

a:hover {
	color: var(--jm-primary-hover);
}

.jm-skip-link {
	position: absolute;
	left: -9999px;
	z-index: 999999;
	padding: 0.75rem 1rem;
	background: var(--jm-primary);
	color: #fff;
}

.jm-skip-link:focus {
	left: 0.5rem;
	top: 0.5rem;
}

/* ——— Site Header ——— */
.jm-site-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	background: var(--jm-header-bg);
	border-bottom: 1px solid var(--jm-border);
	flex-shrink: 0;
	width: 100%;
}

/* Flex: Desktop Menü mitte, Mobil Logo → Hamburger → Abstand → Icons */
.jm-header-inner {
	max-width: var(--jm-max-width);
	margin: 0 auto;
	padding-left: var(--jm-edge-left);
	padding-right: var(--jm-edge-right);
	min-height: var(--jm-header-height);
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.5rem 1rem;
}

.jm-nav-primary {
	order: 3;
	flex: 1 1 auto;
	min-width: 0;
}

.jm-header-tools {
	order: 4;
	flex-shrink: 0;
	margin-left: auto;
}

@media (min-width: 900px) {
	.jm-nav-toggle {
		display: none;
	}

	.jm-nav-primary {
		order: 2;
	}

	.jm-header-tools {
		order: 3;
	}
}

.jm-logo-wrap {
	display: flex;
	align-items: center;
	flex: 0 1 auto;
	min-width: 0;
}

.jm-logo-wrap .custom-logo-link {
	display: block;
	line-height: 0;
}

.jm-logo-wrap .custom-logo {
	max-height: 48px;
	width: auto;
}

.jm-site-title {
	font-size: 1.15rem;
	font-weight: 700;
	margin: 0;
	letter-spacing: -0.02em;
}

.jm-site-title a {
	color: var(--jm-secondary);
	text-decoration: none;
}

.jm-site-title a:hover {
	color: var(--jm-primary);
}

/* Navigation zentriert (Desktop) */
.jm-nav-primary {
	display: flex;
	justify-content: center;
	align-items: center;
}

.jm-nav-primary .jm-menu {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.15rem 1.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.jm-nav-primary .jm-menu a {
	color: var(--jm-text);
	font-weight: 500;
	font-size: 0.95rem;
	text-decoration: none;
	padding: 0.35rem 0;
}

.jm-nav-primary .jm-menu a:hover,
.jm-nav-primary .jm-menu .current-menu-item > a {
	color: var(--jm-primary);
}

.jm-nav-toggle {
	order: 2;
	flex-shrink: 0;
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--jm-border);
	background: #fff;
	border-radius: var(--jm-radius);
	cursor: pointer;
}

.jm-nav-toggle span {
	display: block;
	height: 2px;
	width: 20px;
	margin: 0 auto;
	background: var(--jm-text);
}

@media (max-width: 899px) {
	.jm-nav-toggle {
		display: flex;
	}

	/* Overlay: nimmt keinen Platz in der Kopfzeile ein */
	.jm-nav-primary {
		position: fixed;
		left: 0;
		right: 0;
		top: var(--jm-header-height);
		bottom: 0;
		width: 100%;
		max-width: none;
		margin: 0;
		padding: 1rem var(--jm-edge-left) 1.5rem var(--jm-edge-right);
		background: var(--jm-header-bg);
		box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		transform: translateX(-100%);
		transition: transform 0.2s ease;
		overflow-y: auto;
		z-index: 999;
	}

	.jm-nav-primary.is-open {
		transform: translateX(0);
	}

	.jm-nav-primary .jm-menu {
		flex-direction: column;
		align-items: flex-start;
		justify-content: flex-start;
		gap: 0;
	}

	.jm-nav-primary .jm-menu a {
		display: block;
		padding: 0.75rem 0;
		border-bottom: 1px solid var(--jm-border);
	}

	.jm-mini-cart-panel {
		right: var(--jm-edge-right);
		width: min(360px, calc(100vw - var(--jm-edge-left) - var(--jm-edge-right)));
	}
}

/* Header rechts: Konto + Warenkorb */
.jm-header-tools {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.35rem;
}

.jm-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: var(--jm-radius);
	border: 1px solid transparent;
	background: transparent;
	color: var(--jm-secondary);
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}

.jm-icon-btn:hover {
	background: #fff;
	border-color: var(--jm-border);
	color: var(--jm-primary);
}

.jm-icon-btn svg {
	width: 22px;
	height: 22px;
}

.jm-cart-wrap {
	position: relative;
}

.jm-cart-count {
	position: absolute;
	top: 2px;
	right: 2px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	font-size: 0.65rem;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	color: #fff;
	background: var(--jm-primary);
	border-radius: 9px;
}

.jm-mini-cart-panel {
	display: none;
	position: absolute;
	right: 0;
	top: calc(100% + 6px);
	width: min(360px, 92vw);
	max-height: 80vh;
	overflow: auto;
	padding: 1rem;
	background: #fff;
	border: 1px solid var(--jm-border);
	border-radius: var(--jm-radius);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
	z-index: 1001;
}

.jm-mini-cart-panel.is-open {
	display: block;
}

.jm-mini-cart-panel .woocommerce-mini-cart__empty-message {
	margin: 0;
	font-size: 0.9rem;
}

.jm-mini-cart-panel .widget_shopping_cart .buttons {
	margin-top: 1rem;
}

.jm-mini-cart-panel .button {
	display: inline-block;
	width: 100%;
	text-align: center;
	margin-bottom: 0.5rem;
	padding: 0.65rem 1rem;
	background: var(--jm-primary);
	color: #fff !important;
	border: none;
	border-radius: var(--jm-radius);
	font-weight: 600;
	text-decoration: none;
}

.jm-mini-cart-panel .button.checkout {
	background: var(--jm-secondary);
}

/* ——— Inhalt ——— */
.jm-site-main {
	max-width: var(--jm-max-width);
	margin: 0 auto;
	padding: 1.5rem var(--jm-edge-right) 3rem var(--jm-edge-left);
	flex: 1 0 auto;
	width: 100%;
}

.jm-site-main.jm-wide {
	max-width: 100%;
	padding-left: var(--jm-edge-left);
	padding-right: var(--jm-edge-right);
}

.jm-site-main.jm-no-padding {
	padding-top: 0;
	padding-bottom: 0;
	padding-left: var(--jm-edge-left);
	padding-right: var(--jm-edge-right);
}

.jm-page-title {
	font-size: clamp(1.35rem, 2.5vw, 1.85rem);
	margin: 0 0 1rem;
	color: var(--jm-secondary);
}

.jm-entry {
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid var(--jm-border);
}

.jm-entry-title {
	font-size: 1.2rem;
	margin: 0 0 0.5rem;
}

.jm-entry-title a {
	color: var(--jm-secondary);
	text-decoration: none;
}

.jm-entry-title a:hover {
	color: var(--jm-primary);
}

.jm-entry-content :where(p, ul, ol) {
	margin-top: 0;
	margin-bottom: 1rem;
}

.jm-btn {
	display: inline-block;
	margin-top: 0.5rem;
	padding: 0.65rem 1.25rem;
	background: var(--jm-primary);
	color: #fff !important;
	font-weight: 600;
	text-decoration: none;
	border-radius: var(--jm-radius);
}

.jm-btn:hover {
	background: var(--jm-primary-hover);
	color: #fff !important;
}

.jm-footer-nav {
	margin: 1.5rem 0 0;
	text-align: center;
}

.jm-footer-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem 1.25rem;
}

.jm-footer-menu a {
	color: var(--jm-footer-text);
	text-decoration: none;
}

.jm-footer-menu a:hover {
	text-decoration: underline;
}

/* Elementor: volle Breite, Rand trotzdem mindestens 10 px */
.elementor-page .jm-site-main {
	max-width: none;
	padding-top: 0;
	padding-bottom: 0;
	padding-left: var(--jm-edge-left);
	padding-right: var(--jm-edge-right);
}

/* ——— Footer ——— */
.jm-site-footer {
	background: var(--jm-footer-bg);
	color: var(--jm-footer-text);
	padding: 2.5rem var(--jm-edge-right) 1.5rem var(--jm-edge-left);
	margin-top: auto;
	flex-shrink: 0;
	width: 100%;
}

.jm-footer-widgets {
	max-width: var(--jm-max-width);
	margin: 0 auto;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 2rem;
}

@media (max-width: 767px) {
	.jm-footer-widgets {
		grid-template-columns: 1fr;
	}
}

.jm-site-footer .widget {
	font-size: 0.95rem;
}

.jm-site-footer .widget-title {
	font-size: 1rem;
	margin: 0 0 1rem;
	color: #fff;
	font-weight: 700;
}

.jm-site-footer a {
	color: var(--jm-footer-text);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.jm-site-footer a:hover {
	color: #fff;
}

.jm-site-footer .jm-social-link {
	text-decoration: none;
}

.jm-footer-social {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.5rem 1rem;
	margin: 0 auto 1.5rem;
	max-width: var(--jm-max-width);
}

.jm-social-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: var(--jm-radius);
	border: 1px solid rgba(255, 255, 255, 0.2);
	background: rgba(255, 255, 255, 0.06);
	color: var(--jm-footer-text);
	text-decoration: none;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.jm-social-link:hover {
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	border-color: rgba(255, 255, 255, 0.35);
}

.jm-social-icon {
	display: flex;
	width: 22px;
	height: 22px;
}

.jm-social-icon svg {
	width: 100%;
	height: 100%;
}

.jm-footer-bottom {
	max-width: var(--jm-max-width);
	margin: 2rem auto 0;
	padding-top: 1.25rem;
	border-top: 1px solid rgba(255, 255, 255, 0.15);
	font-size: 0.85rem;
	opacity: 0.9;
	text-align: center;
}

.jm-footer-bottom a {
	color: inherit;
}

/* ——— WooCommerce allgemein ——— */
.woocommerce .button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt {
	background: var(--jm-primary);
	color: #fff;
	border-radius: var(--jm-radius);
}

.woocommerce .button.alt:hover,
.woocommerce button.button.alt:hover {
	background: var(--jm-primary-hover);
}

.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select {
	border-radius: var(--jm-radius);
	border-color: var(--jm-border);
}

.woocommerce-info,
.woocommerce-message {
	border-top-color: var(--jm-primary);
}

.woocommerce table.shop_table {
	border-radius: var(--jm-radius);
}

/* Checkout / Kasse */
.woocommerce-checkout #payment div.payment_box {
	background: #f9f5f0;
	border-radius: var(--jm-radius);
}

/* Block-Checkout neutral unterstützen */
.wc-block-components-button:not(.is-link) {
	background: var(--jm-primary);
	color: #fff;
	border-radius: var(--jm-radius);
}

/* Breite Shop-Inhalte */
.woocommerce .jm-site-main,
.woocommerce-page .jm-site-main {
	max-width: var(--jm-max-width);
}
