/* Shop Theme - layout rules not expressible via theme.json alone */

/*
 * WooCommerce's off-canvas mini-cart drawer sits at left:100% while closed (by design).
 * Without this, that off-screen content still widens the page's horizontal scroll area,
 * which throws off every other position:fixed element (e.g. the mobile bottom bar) since
 * they end up sized against that inflated width instead of the real viewport.
 */
html, body {
	overflow-x: hidden;
}

/* Global link underline toggle - configurable in Shop Design > Typografie. Low specificity
   on purpose, so any component that needs its own underline behavior (e.g. a hover state)
   can still override this with a normal, more specific selector. */
a {
	text-decoration: var(--shop-link-decoration, none);
}

a:hover {
	text-decoration: underline;
}

/* Buttons (incl. classic WooCommerce <a class="button">, which still matches a:hover
   above) should never underline on hover - a color shift reads as a button, not a link. */
.wp-element-button:hover,
a.button:hover {
	text-decoration: none;
	background-color: var(--wp--preset--color--accent);
}

:root {
	--shop-container-width: 1260px;
	--shop-header-minheight: 96px;
	--shop-footer-minheight: 64px;
}

/* Sticky footer: header/main/footer are siblings inside .wp-site-blocks */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}
.wp-site-blocks > main {
	flex: 1 0 auto;
	padding-inline: 1.5rem;
	box-sizing: border-box;
}

.shop-container {
	max-width: var(--shop-container-width);
	width: 100%;
	margin-inline: auto;
	padding-inline: 1.5rem;
	box-sizing: border-box;
}

.shop-header {
	background: var(--shop-header-bg, var(--wp--preset--color--surface, #f5f5f5));
	min-height: var(--shop-header-minheight);
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.5rem;
	padding-block: 0.75rem;
	width: 100%;
}

.wp-block-group.shop-header-inner {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 1rem;
	width: 100%;
}

.shop-header-start {
	justify-self: start;
	align-items: center;
	gap: 1.5rem;
}

.shop-header-logo {
	justify-self: center;
	min-width: 0;
}

.shop-header-logo .wp-block-site-logo {
	display: flex;
}

/* !important needed: WordPress core outputs a same-or-higher-specificity
   `.wp-block-site-logo.is-default-size img { width: 120px }` fallback rule. */
.shop-header-logo img {
	max-height: var(--shop-logo-height, calc(var(--shop-header-minheight) - 13px)) !important;
	width: auto !important;
	object-fit: contain;
}

.shop-header-end {
	justify-self: end;
	align-items: center;
}

.shop-header-burger {
	background: none;
	border: none;
	cursor: pointer;
	display: none;
	padding: 0.25rem;
	color: var(--wp--preset--color--primary);
}

.wp-block-group.shop-header-nav-desktop {
	display: flex;
	justify-content: center;
}

.shop-header-nav-desktop .wp-block-page-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	justify-content: center;
	gap: 2rem;
}

.shop-header-nav-desktop .wp-block-page-list li {
	list-style: none;
}

.shop-header-nav-desktop .wp-block-page-list a {
	font-size: 0.9rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.shop-header-mobile-nav {
	display: none;
	margin-top: 0;
}

@media (max-width: 782px) {
	.shop-header-burger {
		display: block;
	}

	.wp-block-group.shop-header-nav-desktop {
		display: none;
	}

	.shop-header-mobile-nav.is-open {
		display: block;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: var(--wp--preset--color--background);
		border-top: 1px solid var(--wp--preset--color--surface, #eee);
		border-bottom: 1px solid var(--wp--preset--color--surface, #eee);
		padding: 1rem 1.5rem;
		z-index: 90;
	}

	.shop-header-mobile-nav .wp-block-page-list {
		list-style: none;
		margin: 0;
		padding: 0;
		display: flex;
		flex-direction: column;
		gap: 0.75rem;
	}

	.shop-header {
		position: relative;
	}
}

.shop-header-end .wc-block-mini-cart__button {
	background: none;
	border: none;
	box-shadow: none;
	padding: 0;
	color: var(--wp--preset--color--primary);
}

.shop-footer {
	background-color: var(--shop-footer-bg-color, var(--wp--preset--color--primary));
	background-image: var(--shop-footer-bg-image, none);
	background-size: cover;
	background-position: center;
	min-height: var(--shop-footer-minheight);
	display: flex;
	align-items: center;
	width: 100%;
	color: #fff;
	margin-top: auto;
}

/*
 * The mobile bottom bar template part has no explicit tagName, so WordPress wraps it
 * in a bare div.wp-block-template-part. That wrapper collapses to 0 height (the bar
 * itself is position:fixed, out of flow) but still receives the theme's block-gap
 * margin-top, leaving a dead gap below the footer at the bottom of the page.
 * display:contents drops the wrapper's own box so it can't contribute margin or size.
 */
.wp-site-blocks > div.wp-block-template-part {
	display: contents;
}

.shop-footer a {
	color: #fff;
	opacity: 0.85;
	transition: opacity 0.15s ease;
}

.shop-footer a:hover {
	opacity: 1;
}

.shop-footer-bottom {
	flex-wrap: wrap;
	gap: 0.75rem 1.5rem;
	padding-block: 1rem;
	width: 100%;
}

.shop-legal-links {
	display: flex;
	gap: 1.25rem;
}

.wc-block-components-product-image img,
.wp-block-woocommerce-product-image img {
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

/* Product cards ship with zero inset from WooCommerce - add real padding and a visible card boundary. */
.wc-block-product {
	padding: 1rem;
	box-sizing: border-box;
	background: var(--wp--preset--color--background);
	border: 1px solid var(--wp--preset--color--surface, #eee);
	border-radius: 4px;
	text-align: center;
}

.wc-block-product .shop-product-image-wrap {
	margin: -1rem -1rem 1rem;
	width: calc(100% + 2rem);
}

.wp-block-woocommerce-add-to-cart-form .quantity {
	margin-right: 0.5rem;
}

table.shop_table th,
table.shop_table td {
	padding: 0.75rem;
	border-bottom: 1px solid var(--wp--preset--color--surface, #f0f0f0);
}

/* Mobile icon bar (Ecomus-style): Suche / Konto / Warenkorb, fixed to the bottom on small screens only. */
.shop-mobile-bar {
	display: none;
}

@media (max-width: 782px) {
	.shop-mobile-bar {
		display: flex;
		justify-content: space-around;
		align-items: stretch;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 100;
		background: var(--wp--preset--color--background);
		border-top: 1px solid var(--wp--preset--color--surface, #eee);
		padding-bottom: env(safe-area-inset-bottom, 0);
	}

	/* Leave room at the bottom of the page so content isn't hidden behind the fixed bar. */
	.wp-site-blocks > main {
		padding-bottom: 64px;
	}
}

.shop-mobile-bar__item {
	flex: 1;
	min-width: 0;
	align-items: center;
	justify-content: center;
	padding: 0.5rem 0;
	/* .shop-mobile-bar has no explicit "layout":"flex" in its block markup, so WordPress
	   still applies its default flow block-gap (margin-top on every child but the first),
	   even though our CSS lays these out as a horizontal row. Neutralize it. */
	margin-top: 0 !important;
}

.shop-mobile-bar__button {
	background: none;
	border: none;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	width: 100%;
	font-size: 0.65rem;
	color: var(--wp--preset--color--primary);
	text-decoration: none;
	padding: 0;
	margin: 0;
	/* <button> ships with UA form-control font metrics that render it shorter/taller than
	   the sibling <a> items even with identical CSS - reset to match the surrounding text. */
	font-family: inherit;
	line-height: normal;
	-webkit-appearance: none;
	appearance: none;
}

.shop-mobile-bar__icon-circle {
	--shop-mobile-bar-circle-size: 40px;
	width: var(--shop-mobile-bar-circle-size);
	height: var(--shop-mobile-bar-circle-size);
	border-radius: 50%;
	background: var(--shop-mobile-bar-accent, #2f6fed);
	color: var(--shop-mobile-bar-icon-color, #fff);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	position: relative;
	transition: background-color 0.15s ease;
	/* .shop-mobile-bar__button span targets this element too (it's a span, higher specificity
	   due to the tag selector), which would clip the badge wherever it pokes past the edge. */
	overflow: visible !important;
}

.shop-mobile-bar__button svg {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
}

.shop-mobile-bar__button span {
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

@media (max-width: 360px) {
	.shop-mobile-bar__button {
		font-size: 0.6rem;
	}
	.shop-mobile-bar__icon-circle {
		--shop-mobile-bar-circle-size: 36px;
	}
	.shop-mobile-bar__button svg {
		width: 18px;
		height: 18px;
	}
}

.shop-mobile-bar__button[aria-expanded="true"] .shop-mobile-bar__icon-circle {
	background: var(--wp--preset--color--accent);
}

.shop-mobile-search {
	display: none;
}

.shop-mobile-search.is-open {
	display: block;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 56px;
	z-index: 99;
	background: var(--wp--preset--color--background);
	border-top: 1px solid var(--wp--preset--color--surface, #eee);
	padding: 1rem;
}

.shop-mobile-bar__icon-circle .shop-wishlist-count {
	position: absolute;
	top: -6px;
	right: -8px;
	background: var(--wp--preset--color--accent);
	color: #fff;
	border-radius: 12px;
	box-sizing: border-box;
	min-width: 24px;
	height: 24px;
	line-height: 19px;
	font-size: var(--shop-mobile-bar-badge-size, 14px);
	font-weight: var(--shop-mobile-bar-badge-weight, 600);
	text-align: center;
	padding: 0 5px;
	border: 2.5px solid var(--wp--preset--color--background);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
	/* Overrides .shop-mobile-bar__button span, which also matches this badge and would
	   otherwise clip/ellipsis the count via its own overflow/max-width rules. */
	overflow: visible;
	max-width: none;
	white-space: nowrap;
	/* Without this, the digit falls back to the browser's serif default font here - a thin
	   serif "1" at this size reads as a faint smudge instead of a solid, legible numeral. */
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.shop-wishlist-count[hidden] {
	display: none;
}

/* Wishlist heart button: floats over the product image in grids, sits inline next to Add to cart on the single product page. */
.shop-product-image-wrap {
	position: relative;
}

.shop-product-image-wrap .shop-wishlist-btn {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	z-index: 1;
}

.shop-wishlist-btn {
	background: #fff;
	border: none;
	border-radius: 50%;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	color: var(--wp--preset--color--primary);
}

.shop-wishlist-btn.is-active {
	color: var(--wp--preset--color--accent);
}

.shop-product-actions {
	align-items: center;
	gap: 1rem;
}

.shop-product-actions .shop-wishlist-btn {
	box-shadow: none;
	border: 1px solid var(--wp--preset--color--surface, #eee);
}

/* Shop archive: filter sidebar + product grid */
.wp-block-columns.shop-archive-layout {
	gap: 2rem;
	align-items: flex-start;
}

.shop-archive-sidebar {
	flex: 0 0 220px !important;
}

.shop-archive-main {
	flex: 1 1 auto !important;
	min-width: 0;
}

@media (max-width: 782px) {
	.wp-block-columns.shop-archive-layout {
		flex-wrap: wrap;
	}
	.shop-archive-sidebar {
		flex-basis: 100% !important;
	}
}

.wp-block-woocommerce-product-filters .wp-block-heading {
	margin-top: 0;
}

/* Wishlist page: custom markup (not the raw [products] shortcode), one line each for
   title/price/button, no underlines, alignment + font sizes controlled from Shop Design. */
.shop-wishlist-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 1.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.shop-wishlist-list-item {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1rem;
	box-sizing: border-box;
	background: var(--wp--preset--color--background);
	border: 1px solid var(--wp--preset--color--surface, #eee);
	border-radius: 4px;
}

.shop-wishlist-list-item .shop-product-image-wrap {
	margin: -1rem -1rem 0.5rem;
	width: calc(100% + 2rem);
}

.shop-wishlist-align-left .shop-wishlist-list-item {
	align-items: flex-start;
	text-align: left;
}

.shop-wishlist-align-center .shop-wishlist-list-item {
	align-items: center;
	text-align: center;
}

.shop-wishlist-align-right .shop-wishlist-list-item {
	align-items: flex-end;
	text-align: right;
}

.shop-wishlist-list-title {
	display: block;
	width: 100%;
	font-size: var(--shop-wishlist-title-size, 18px);
	font-weight: 700;
	color: var(--wp--preset--color--accent);
	text-decoration: none;
}

.shop-wishlist-list-title:hover {
	text-decoration: underline;
}

.shop-wishlist-list-price {
	display: block;
	width: 100%;
	font-size: var(--shop-wishlist-price-size, 16px);
}

.shop-wishlist-list-price ins {
	text-decoration: none;
}

.shop-wishlist-list-button {
	width: 100%;
}

.shop-wishlist-list-button .button {
	display: inline-block;
	font-size: var(--shop-wishlist-button-size, 14px);
	text-decoration: none;
}
