/*
 * All layout changes are deliberately limited to phone-sized screens.
 * Blocksy, WooCommerce and Kadence markup remain untouched.
 */
@media (max-width: 767px) {
	html {
		-webkit-text-size-adjust: 100%;
		text-size-adjust: 100%;
	}

	body:has(#ct-popup-16708.active) {
		width: 100%;
		max-width: 100vw;
		overflow-x: hidden !important;
	}

	/* Filter popup: leave room for the fixed results action. */
	#ct-popup-16708 {
		--tyf-mobile-action-height: 70px;
		--tyf-gold: #d09a12;
		--tyf-ink: #171717;
		--popup-edges-offset: 0px !important;
		--popup-border-radius: 0px !important;
		width: 100%;
		max-width: 100vw;
		overflow-x: clip !important;
		touch-action: pan-y;
	}

	/* Full-screen filter sheet, matching the clean mobile shop examples. */
	#ct-popup-16708 .ct-popup-inner {
		inset: 0 !important;
		width: 100vw !important;
		height: 100dvh !important;
		align-items: stretch !important;
		padding: 0 !important;
		overflow-x: hidden !important;
	}

	#ct-popup-16708 .ct-popup-inner > article {
		position: relative;
		display: flex;
		flex-direction: column;
		width: 100% !important;
		max-width: none !important;
		height: 100dvh;
		max-height: 100dvh !important;
		overflow: hidden;
		border-radius: 0 !important;
		background: #fff;
	}

	#ct-popup-16708 .tyf-filter-shell-header {
		display: flex;
		flex: 0 0 76px;
		align-items: center;
		justify-content: center;
		padding: 0 58px;
		border-bottom: 1px solid #e3e3e3;
		background: #fff;
	}

	#ct-popup-16708 .tyf-filter-shell-header h2 {
		margin: 0;
		color: var(--tyf-ink);
		font-size: 22px;
		font-weight: 700;
		line-height: 1;
	}

	#ct-popup-16708 .ct-popup-inner > article > .ct-toggle-close {
		position: absolute !important;
		z-index: 30;
		top: 16px !important;
		right: 16px !important;
		display: grid !important;
		width: 44px;
		height: 44px;
		min-width: 44px;
		min-height: 44px;
		padding: 0 !important;
		place-items: center;
		color: var(--tyf-ink) !important;
		background: transparent !important;
		border: 0 !important;
		box-shadow: none !important;
		--theme-icon-color: var(--tyf-ink) !important;
		--toggle-button-background: transparent !important;
	}

	#ct-popup-16708 .ct-popup-inner > article > .ct-toggle-close svg {
		width: 18px;
		height: 18px;
		fill: var(--tyf-ink) !important;
	}

	#ct-popup-16708 .ct-popup-inner > article > .ct-toggle-close svg path {
		fill: var(--tyf-ink) !important;
	}

	#ct-popup-16708
		.ct-popup-inner
		> article
		> .ct-popup-content.entry-content {
		flex: 1 1 auto;
		min-height: 0;
		overflow-x: hidden !important;
		overflow-y: auto !important;
		padding: 24px 0 0 !important;
		overscroll-behavior: contain;
		scroll-padding-bottom: 110px;
		-webkit-overflow-scrolling: touch;
	}

	/*
	 * A real scroll spacer is more reliable than popup padding because
	 * Blocksy/Kadence can reset entry-content padding at runtime.
	 */
	#ct-popup-16708 .tyf-filter-bottom-spacer {
		display: block !important;
		flex: 0 0 auto;
		width: 100% !important;
		max-width: none !important;
		height: 94px !important;
		min-height: 94px !important;
		margin: 0 !important;
		padding: 0 !important;
		pointer-events: none;
	}

	#ct-popup-16708 .ct-popup-content,
	#ct-popup-16708 .ct-popup-content *,
	#ct-popup-16708 .kt-row-column-wrap,
	#ct-popup-16708 .wp-block-kadence-column,
	#ct-popup-16708 .kt-inside-inner-col {
		box-sizing: border-box;
	}

	#ct-popup-16708 .kt-row-column-wrap,
	#ct-popup-16708 .wp-block-kadence-column,
	#ct-popup-16708 .kt-inside-inner-col {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}

	#ct-popup-16708 .kt-inside-inner-col {
		padding-right: 22px !important;
		padding-bottom: 0 !important;
		padding-left: 22px !important;
	}

	#ct-popup-16708
		:is(
			button,
			input,
			textarea,
			select,
			.jet-filter-label,
			.jet-filter-items-dropdown__label,
			.jet-checkboxes-list__label
		) {
		font-family: inherit !important;
	}

	#ct-popup-16708 .tyf-mobile-sticky-action {
		position: fixed;
		z-index: 999999;
		right: 0;
		bottom: 0;
		left: 0;
		display: block;
		margin: 0 !important;
		padding: 10px 22px calc(10px + env(safe-area-inset-bottom, 0px));
		background: var(--theme-palette-color-8, #fff);
		border-top: 1px solid var(--theme-border-color, #e6e6e6);
		box-shadow: 0 -8px 24px rgb(0 0 0 / 8%);
		transition:
			opacity 150ms ease,
			transform 150ms ease;
	}

	#ct-popup-16708 .tyf-mobile-sticky-action > a {
		width: 100% !important;
		min-height: 50px;
		max-height: 50px;
		margin: 0 !important;
		padding: 0 16px !important;
		border-radius: 4px;
		font-size: 16px;
		font-weight: 600;
		line-height: 1;
	}

	/*
	 * Hide the action only while the iOS keyboard is actually active.
	 * With one outer scroll owner the button can safely remain available
	 * while a regular dropdown is open.
	 */
	#ct-popup-16708.tyf-mobile-input-active .tyf-mobile-sticky-action {
		opacity: 0;
		pointer-events: none;
		transform: translateY(110%);
	}

	/* Product categories: Bol-style compact list with Meer/Minder. */
	#ct-popup-16708 .tyf-category-heading {
		display: flex;
		width: 100%;
		align-items: center;
		justify-content: space-between;
		margin: 0 0 12px !important;
		padding: 0 0 14px !important;
		border-bottom: 0 !important;
		color: var(--theme-heading-color, #1e1e1e);
		background: transparent !important;
		border-top: 0 !important;
		border-right: 0 !important;
		border-left: 0 !important;
		font-size: 20px;
		font-weight: 700;
		text-align: left;
		cursor: pointer;
	}

	#ct-popup-16708 .tyf-section-chevron {
		width: 11px;
		height: 11px;
		margin-right: 3px;
		border-top: 2px solid currentColor;
		border-left: 2px solid currentColor;
		transform: rotate(45deg) translateY(3px);
		transition: transform 160ms ease;
	}

	#ct-popup-16708
		.tyf-category-heading[aria-expanded='false']
		.tyf-section-chevron {
		transform: rotate(225deg) translateY(3px);
	}

	#ct-popup-16708 .tyf-mobile-categories {
		margin: 0 !important;
		padding-bottom: 0 !important;
	}

	#ct-popup-16708 .tyf-category-panel {
		display: grid;
		grid-template-rows: 1fr;
		margin-bottom: 8px;
		border-bottom: 1px solid #e8e8e8;
		transition: grid-template-rows 220ms ease;
	}

	#ct-popup-16708 .tyf-category-panel.tyf-is-collapsed {
		grid-template-rows: 0fr;
	}

	#ct-popup-16708 .tyf-category-panel__inner {
		min-height: 0;
		overflow: hidden;
	}

	#ct-popup-16708 .tyf-mobile-categories ul {
		margin-top: 0;
		margin-bottom: 0;
	}

	#ct-popup-16708
		.tyf-mobile-categories
		.wc-block-product-categories-list-item {
		margin-bottom: 0;
		padding-block: 6px;
		font-size: 16px;
		line-height: 1.35;
	}

	#ct-popup-16708
		.tyf-mobile-categories
		.wc-block-product-categories-list--depth-1 {
		padding-left: 20px;
		border-left: 1px solid var(--theme-border-color, #e5e5e5);
	}

	#ct-popup-16708
		.tyf-mobile-categories
		.wc-block-product-categories-list-item[hidden] {
		display: none !important;
	}

	#ct-popup-16708 .tyf-category-more-toggle {
		display: inline-flex;
		gap: 9px;
		align-items: center;
		min-height: 44px;
		margin: 0 0 16px !important;
		padding: 5px 0 !important;
		color: #b98400 !important;
		background: transparent;
		border: 0;
		font: inherit;
		font-size: 16px;
		font-weight: 600 !important;
		line-height: 1.2;
		cursor: pointer;
	}

	#ct-popup-16708 .tyf-category-more-toggle__icon {
		width: 9px;
		height: 9px;
		border-right: 2px solid currentColor;
		border-bottom: 2px solid currentColor;
		transform: rotate(45deg) translateY(-2px);
		transition: transform 180ms ease;
	}

	#ct-popup-16708
		.tyf-category-more-toggle[aria-expanded='true']
		.tyf-category-more-toggle__icon {
		transform: rotate(225deg) translate(-2px, -1px);
	}

	/* JetSmartFilters groups: strong headings, calm dividers, compact controls. */
	#ct-popup-16708 .jet-filter {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		margin: 0 !important;
		padding: 18px 0 !important;
		border-top: 0 !important;
		border-bottom: 1px solid #e8e8e8 !important;
	}

	/* The plugin owns section dividers to prevent missing or doubled lines. */
	#ct-popup-16708 .wp-block-separator {
		display: none !important;
	}

	#ct-popup-16708 .jet-filter-label {
		margin: 0 0 11px !important;
		color: var(--tyf-ink);
		font-size: 18px !important;
		font-weight: 700 !important;
		letter-spacing: 0 !important;
		text-transform: none !important;
	}

	#ct-popup-16708 .jet-filter-items-dropdown__label {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		min-height: 48px;
		padding: 12px 44px 12px 14px !important;
		border: 1px solid #d8d8d8 !important;
		border-radius: 4px !important;
		background: #fff !important;
		font-size: 16px;
	}

	#ct-popup-16708 .jet-filter-items-dropdown.active
		.jet-filter-items-dropdown__label,
	#ct-popup-16708 .jet-filter-items-dropdown.jet-dropdown-open
		.jet-filter-items-dropdown__label,
	#ct-popup-16708 .jet-filter-items-dropdown__label:focus {
		border-color: var(--tyf-gold) !important;
		box-shadow: 0 0 0 1px var(--tyf-gold);
		outline: 0;
	}

	#ct-popup-16708 .jet-filter-items-dropdown__body {
		position: relative !important;
		z-index: 2;
		/*
		 * Keep one vertical scroll owner on iOS. JetSmartFilters normally
		 * turns this body into a second scroll pane. Safari can keep that
		 * inner pane "captured" after the keyboard opens, making swipes on
		 * the rest of the filter sheet appear unresponsive.
		 */
		max-height: none !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		overflow-y: visible !important;
		overflow-x: hidden !important;
		overscroll-behavior: auto;
		-webkit-overflow-scrolling: auto;
		border: 1px solid #e1e1e1;
		border-top: 0;
		border-radius: 0 0 4px 4px;
		background: #fff;
		box-shadow: 0 10px 24px rgb(0 0 0 / 8%);
	}

	#ct-popup-16708
		.jet-filter-items-dropdown__body
		:is(input[type='text'], input[type='search']) {
		display: block;
		width: calc(100% - 18px) !important;
		max-width: calc(100% - 18px) !important;
		min-width: 0 !important;
		min-height: 46px;
		margin: 9px !important;
		padding: 10px 13px !important;
		border-radius: 4px;
		font-family: inherit !important;
		font-size: 16px !important;
		line-height: 1.35 !important;
		-webkit-appearance: none;
		appearance: none;
	}

	#ct-popup-16708
		.jet-filter-items-dropdown__body
		:is(input, button, label) {
		font-size: max(16px, 1em);
	}

	#ct-popup-16708
		.jet-filter-items-dropdown.jet-dropdown-open
		.jet-filter-items-dropdown__body {
		animation: tyf-filter-dropdown-in 160ms ease both;
	}

	/* Blocksy add-to-cart popup: full-height mobile modal with a compact image. */
	#ct-added-to-cart-popup .ct-popup-inner {
		box-sizing: border-box;
		align-items: stretch;
		padding: 12px !important;
	}

	#ct-added-to-cart-popup .ct-popup-inner > article {
		position: relative;
		display: flex;
		flex-direction: column;
		width: 100%;
		max-height: calc(100dvh - 64px);
		overflow: hidden;
		border-radius: 12px;
	}

	#ct-added-to-cart-popup .ct-toggle-close {
		position: absolute !important;
		z-index: 40;
		top: 10px !important;
		right: 10px !important;
		display: grid !important;
		width: 44px !important;
		height: 44px !important;
		min-width: 44px !important;
		min-height: 44px !important;
		margin: 0 !important;
		padding: 0 !important;
		place-items: center;
		background: transparent !important;
		border: 0 !important;
		box-shadow: none !important;
	}

	#ct-added-to-cart-popup .ct-toggle-close svg {
		width: 18px !important;
		height: 18px !important;
	}

	#ct-added-to-cart-popup .ct-added-to-cart-message {
		flex: 0 0 auto;
		padding: 16px 20px;
	}

	#ct-added-to-cart-popup .ct-popup-content {
		position: static !important;
		min-height: 0;
		padding: 18px 20px
			calc(128px + env(safe-area-inset-bottom, 0px)) !important;
		overflow-y: auto !important;
		overscroll-behavior: contain;
		scroll-padding-bottom: calc(
			128px + env(safe-area-inset-bottom, 0px)
		);
	}

	#ct-added-to-cart-popup .ct-added-to-cart-product {
		gap: 14px;
	}

	#ct-added-to-cart-popup
		.ct-added-to-cart-product
		> .ct-media-container {
		width: 100%;
		height: clamp(125px, 20dvh, 165px) !important;
		min-height: 0 !important;
		padding-bottom: 0 !important;
		overflow: hidden;
		aspect-ratio: auto !important;
		background: transparent;
	}

	#ct-added-to-cart-popup
		.ct-added-to-cart-product
		> .ct-media-container
		img {
		position: static !important;
		display: block;
		width: 100% !important;
		height: 100% !important;
		object-fit: contain !important;
		/*
		 * Product thumbnails contain generous whitespace. A clearly visible
		 * 35% zoom enlarges the bottle while the image panel and modal keep
		 * exactly the same dimensions.
		 */
		transform: scale(1.35) !important;
		transform-origin: center;
	}

	#ct-added-to-cart-popup .ct-product-title-price {
		gap: 8px;
	}

	/* A little internal breathing room without enlarging the modal. */
	#ct-added-to-cart-popup .ct-suggested-products--cart-popup {
		box-sizing: border-box;
		margin-bottom: 0 !important;
		padding-bottom: 14px !important;
	}

	#ct-added-to-cart-popup
		.ct-suggested-products--cart-popup
		:is(.button, .added_to_cart) {
		border-radius: 4px !important;
	}

	#ct-added-to-cart-popup .ct-popup-actions {
		position: absolute;
		z-index: 20;
		right: 0;
		bottom: 0;
		left: 0;
		display: flex;
		flex-direction: column;
		flex-wrap: nowrap;
		gap: 7px;
		margin: 0 !important;
		padding: 10px 18px
			calc(9px + env(safe-area-inset-bottom, 0px)) !important;
		background: var(--theme-palette-color-8, #fff);
		border-top: 1px solid var(--theme-border-color, #e6e6e6) !important;
		box-shadow: 0 -8px 24px rgb(0 0 0 / 8%);
	}

	#ct-added-to-cart-popup .ct-popup-actions > * {
		min-width: 0;
		width: 100%;
		min-height: 46px;
		max-height: 46px;
		margin: 0;
		padding: 0 8px !important;
		border-radius: 4px;
		white-space: nowrap;
		font-size: 13.5px;
		font-weight: 600;
		line-height: 1;
	}

	#ct-added-to-cart-popup
		.ct-popup-actions
		.ct-added-to-cart-popup-continue {
		color: #a97800 !important;
		background: #fff !important;
		border: 2px solid var(--tyf-gold, #d09a12) !important;
	}

}

@media (max-width: 370px) {
	#ct-added-to-cart-popup .ct-popup-actions > * {
		font-size: 13px;
	}
}

/* Extra vertical breathing room on short phones such as iPhone SE. */
@media (max-width: 767px) and (max-height: 720px) {
	#ct-added-to-cart-popup .ct-popup-inner > article {
		max-height: calc(100dvh - 48px);
	}

	#ct-added-to-cart-popup .ct-added-to-cart-message {
		padding: 12px 18px;
	}

	#ct-added-to-cart-popup .ct-popup-content {
		padding-top: 12px !important;
	}

	#ct-added-to-cart-popup
		.ct-added-to-cart-product
		> .ct-media-container {
		height: 100px !important;
	}
}

@keyframes tyf-filter-dropdown-in {
	from {
		opacity: 0;
		transform: translateY(-5px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	#ct-popup-16708 .tyf-category-panel,
	#ct-popup-16708 .tyf-mobile-sticky-action {
		transition: none !important;
	}

	#ct-popup-16708
		.jet-filter-items-dropdown.jet-dropdown-open
		.jet-filter-items-dropdown__body {
		animation: none !important;
	}
}
