/*
 * Phone bottom bar (includes/mobile-bottom-bar.php).
 * Only below 600px, where the header Navigation block shows its menu button instead of the links.
 * z-index 999 keeps it under the mini-cart drawer (9999), the product filters overlay (9999),
 * the open menu (100000) and the cookie banner (99999), so they still cover the bar.
 * Selectors start with .dn-bottom-bar twice or with body: this file loads before the theme's style.css.
 */

.dn-bottom-bar {
	display: none;
}

@media (max-width: 599.98px) {
	body.dn-has-bottom-bar {
		--dn-bottom-bar-height: 3.875rem;
		padding-bottom: calc(var(--dn-bottom-bar-height) + env(safe-area-inset-bottom, 0px));
	}

	.dn-bottom-bar {
		position: fixed;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 999;
		display: flex;
		padding: 0 0.25rem env(safe-area-inset-bottom, 0px);
		background: var(--wp--preset--color--base, #faf3ea);
		border-top: 1px solid rgba(43, 32, 36, 0.12);
		box-shadow: 0 -6px 18px rgba(43, 32, 36, 0.08);
	}

	.dn-bottom-bar .dn-bottom-bar__item {
		display: flex;
		flex: 1 1 0;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 0.2rem;
		min-width: 0;
		height: var(--dn-bottom-bar-height);
		margin: 0;
		padding: 0;
		border: 0;
		border-radius: 0;
		background: none;
		color: var(--wp--preset--color--contrast, #2b2024);
		font-family: inherit;
		font-size: 0.75rem;
		font-weight: 600;
		line-height: 1.2;
		text-decoration: none;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	.dn-bottom-bar .dn-bottom-bar__item[hidden],
	.dn-bottom-bar .dn-bottom-bar__badge[hidden] {
		display: none;
	}

	.dn-bottom-bar .dn-bottom-bar__item[aria-current="page"] {
		color: var(--wp--preset--color--accent-1, #a84462);
	}

	.dn-bottom-bar .dn-bottom-bar__item:focus-visible {
		outline: 2px solid var(--wp--preset--color--accent-1, #a84462);
		outline-offset: -4px;
	}

	.dn-bottom-bar .dn-bottom-bar__icon {
		position: relative;
		display: flex;
	}

	.dn-bottom-bar .dn-bottom-bar__badge {
		position: absolute;
		top: -0.375rem;
		left: 0.875rem;
		box-sizing: border-box;
		min-width: 1.0625rem;
		height: 1.0625rem;
		padding: 0 0.25rem;
		border-radius: 999px;
		background: var(--wp--preset--color--accent-1, #a84462);
		color: #fff;
		font-size: 0.625rem;
		font-weight: 700;
		line-height: 1.0625rem;
		text-align: center;
	}
}

/*
 * Phone header (below 600px, with the bottom bar).
 * The bottom bar already has Menu, Favourites and Cart, so the header copies are hidden.
 * The bar still presses the hidden header buttons, so the same menu and cart drawer open.
 * The freed space goes to the logo (about 34px wide before).
 * The expanded search field covers the header row instead of pushing the icons off screen.
 */
@media (max-width: 599.98px) {
	body.dn-has-bottom-bar header .wp-block-navigation__responsive-container-open,
	body.dn-has-bottom-bar header a.dn-fav-head,
	body.dn-has-bottom-bar header .wc-block-mini-cart__button {
		display: none;
	}
	body.dn-has-bottom-bar header .wp-block-group:has(> .wp-block-site-logo) {
		position: relative;
	}
	body.dn-has-bottom-bar header .wp-block-group:has(> .wp-block-site-logo) > .wp-block-navigation {
		position: absolute;
	}
	body.dn-has-bottom-bar header .wp-block-site-logo {
		flex-shrink: 0;
	}
	body.dn-has-bottom-bar header .wp-block-site-logo img {
		width: clamp(84px, 30vw, 110px);
	}
	body.dn-has-bottom-bar header .wp-block-search__button-only:not(.wp-block-search__searchfield-hidden) {
		position: absolute;
		inset: 0;
		z-index: 2;
		display: flex;
		align-items: center;
		background: var(--wp--preset--color--base, #faf3ea);
	}
	body.dn-has-bottom-bar header .wp-block-search__button-only:not(.wp-block-search__searchfield-hidden) .wp-block-search__inside-wrapper {
		width: 100% !important;
	}
	body.dn-has-bottom-bar header .wp-block-search__button-only:not(.wp-block-search__searchfield-hidden) .wp-block-search__input {
		flex: 1 1 auto;
		width: auto !important;
	}
}
