/*
 * The toolbar above a product list: the result count on the left, the sorting dropdown on the right (catalogs,
 * categories, search). Scoped to the two blocks' wrappers.
 *
 * Kirill, 2026-10-22: the dropdown did not read as one. Snippet 35 "Sorting appearance discount checkbox" made it a
 * borderless 20px line on the page colour (all !important); it is a pill now, like the search field, with a chevron.
 * Since 2026-10-23 the pill is our own list's button (css/dropdown.css, js/dropdown.js) over the hidden <select>.
 * The count's wording: storefront.php.
 */

.wc-block-product-results-count .woocommerce-result-count {
	margin: 0;
	font-size: 14px;
	color: #A4A4A4;
}

.wp-block-group:has(> .wc-block-catalog-sorting) {
	align-items: center;
}

.wc-block-catalog-sorting select.orderby {
	appearance: none;
	-webkit-appearance: none;
	height: 40px;
	min-width: 0;
	padding: 0 36px 0 14px;
	border: 0;
	border-radius: 12px;
	background-color: var(--wp--preset--color--custom-card-background);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23E7E7E7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	color: var(--wp--preset--color--primary);
	font-family: Onest, sans-serif;
	font-size: 14px;
	cursor: pointer;
}

/* No ring after a choice: iOS Safari keeps the select focused (and :focus-visible) while the page reloads with the
   new order, so a ring stayed on for a second (Kirill, iOS 27). The ring stays for the keyboard where there is a
   pointer. */
.wc-block-catalog-sorting select.orderby:focus {
	outline: none;
}

@media (hover: hover) {
	.wc-block-catalog-sorting select.orderby:focus-visible {
		outline: 1px solid var(--wp--preset--color--accent);
	}
}

/* The same pill as our own list's button (css/dropdown.css, js/dropdown.js); the <select> above stays for a browser
   without scripts, hidden under the list, and still sends the form. */
.wc-block-catalog-sorting select.orderby[hidden] {
	display: none;
}

.wc-block-catalog-sorting .gp-dropdown__button {
	box-sizing: border-box;
	max-width: 100%;
	height: 40px;
	padding: 0 12px 0 14px;
	border: 0;
	border-radius: 12px;
	background-color: var(--wp--preset--color--custom-card-background);
	color: var(--wp--preset--color--primary);
	font-family: Onest, sans-serif;
	font-size: 14px;
	line-height: 1;
	white-space: nowrap;
	transition: background-color var(--gp-hover-out);
}

.wc-block-catalog-sorting .gp-dropdown.is-open .gp-dropdown__button {
	background-color: #2c2c2c;
}

@media (hover: hover) {
	.wc-block-catalog-sorting .gp-dropdown__button:hover {
		background-color: #2c2c2c;
	}

	.wc-block-catalog-sorting .gp-dropdown__button:focus-visible {
		outline: 1px solid var(--wp--preset--color--accent);
	}
}

/* Over the cards while open: WOOF's front.css makes the form a stacking context at z-index 3, and the cards' sale
   ribbons stand at 9 */
.wc-block-catalog-sorting .woocommerce-ordering:has(.gp-dropdown.is-open) {
	z-index: 1000;
}

.wc-block-catalog-sorting .gp-dropdown__label {
	overflow: hidden;
	text-overflow: ellipsis;
}

.wc-block-catalog-sorting .gp-dropdown__list {
	width: max-content;
	max-width: calc(100vw - 2 * var(--gp-phone-gutter, 10px));
}

.wc-block-catalog-sorting .gp-dropdown__item {
	gap: 16px;
	min-height: 44px;
	padding: 0 10px;
	font-family: Onest, sans-serif;
	font-size: 15px;
	white-space: nowrap;
}

/*
 * The sections menu under a catalog's title ("Весь каталог", "Со скидкой", …; the blog's "Все новости", …): a core/html
 * block written into each site's catalog templates, .button-slider > .slide > .wp-block-button > a, the section's
 * picture in .icon-circle. Its rules came from snippets 69 "Side Nav", 17 and 60, and its phone row from snippet 60's
 * script (2026-10-23).
 *
 * Wider than a phone: a column of 68px pills, as it was. On a phone (Kirill, 2026-10-23: the same pictures, compact):
 * one row of 40px chips that scrolls sideways from the gutter to the screen's edge, with no scrollbar, and the page's
 * own section marked (aria-current, storefront.php) and scrolled into view (js/sections-menu.js). The script used to
 * lay the row out once, at load and under 681px: a phone turned sideways kept the row in the desktop's narrow column
 * and broke its words ("Весь ката лог"), and from 681 to 781px the row was inline blocks with other gaps.
 */
.button-slider .slide a.wp-block-button__link {
	width: auto;
	height: 68px;
	padding: 8px 24px 8px 8px;
	border: 2px solid transparent;
	border-radius: 50px;
	box-shadow: 0 0 0 transparent;
	background-color: var(--wp--preset--color--custom-card-background);
	color: var(--wp--preset--color--primary);
	transition: color var(--gp-hover-out), border-color var(--gp-hover-out), box-shadow var(--gp-hover-out);
}

/* The link's has-primary-color holds its colour with !important */
@media (hover: hover) {
	.button-slider .slide a.wp-block-button__link:hover {
		border-color: var(--wp--preset--color--accent);
		box-shadow: 0 0 10px 0 var(--wp--preset--color--accent);
		color: var(--wp--preset--color--accent) !important;
	}
}

.button-slider .icon-circle {
	display: inline-block;
	width: 50px;
	height: 50px;
	margin-right: .7rem;
	padding: 3px;
	border-radius: 50%;
	background-color: #333;
	color: #fff;
	line-height: 30px;
	text-align: center;
}

.button-slider .icon-circle img {
	width: 100%;
	height: auto;
}

@media (max-width: 781px) {
	.button-slider {
		display: flex;
		gap: 8px;
		overflow-x: auto;
		overflow-y: hidden; /* sideways only, whatever a chip's insides overhang (see the pictures below) */
		scrollbar-width: none;
		/* over the constrained layout's margin: auto !important for its children */
		margin-left: calc(-1 * var(--gp-phone-gutter)) !important;
		margin-right: calc(-1 * var(--gp-phone-gutter)) !important;
		padding: 0 var(--gp-phone-gutter);
		scroll-padding-inline: var(--gp-phone-gutter);
	}

	.button-slider::-webkit-scrollbar {
		display: none;
	}

	.button-slider .slide {
		flex: none;
	}

	/* The chip, the picture and its circle without line boxes around them. The circle keeps snippet 17's line-height
	   of 30px, and with the picture inline its line overhung the 32px circle by 9px: the row scrolled 5px up and down
	   as well as sideways (Kirill, 2026-10-23). */
	.button-slider .wp-block-button {
		display: flex;
	}

	.button-slider .icon-circle img {
		display: block;
	}

	.button-slider .slide a.wp-block-button__link {
		height: 40px;
		padding: 4px 14px 4px 4px;
		font-size: 14px;
		white-space: nowrap;
	}

	/* Over snippet 17's margins for every button of this colour set (0,6,1, printed after this file), which kept 2px
	   above the chips and 8px under them */
	.button-slider div.slide div.wp-block-button a.wp-block-button__link.wp-element-button.has-background {
		margin: 0;
	}

	.button-slider .icon-circle {
		flex: none;
		box-sizing: border-box;
		width: 32px;
		height: 32px;
		margin-right: 8px;
		padding: 2px;
	}

	.button-slider .slide a.wp-block-button__link[aria-current="page"] {
		box-shadow: inset 0 0 0 1.5px var(--wp--preset--color--accent);
		color: var(--wp--preset--color--accent) !important;
	}

	/* A catalog's title, the row and the list's toolbar 16px apart (24px before). The blog's columns keep their own
	   style="margin-top:0", and its posts start 16px under the row (they touched it, once the scrollbar's room went).
	   /digital/'s row sits in a template part. */
	.wp-block-columns:has(> .wp-block-column > .button-slider, > .wp-block-column > .wp-block-template-part > .button-slider) {
		margin-top: 16px;
		row-gap: 16px;
	}

	/* /digital/'s sidebar also holds an empty widget area, whose inner group's margins added 21px under the row */
	.wp-block-column:has(> .wp-block-template-part > .button-slider) > .wp-block-widget-area:has(> .wp-block-widget:empty:only-child) {
		display: none;
	}
}

/* The product search page as SearchBooster's results (storefront.php, gp_storefront_is_searchbooster_results). The
   main site's search template keeps a 70px spacer under the header that the catalogs do not have: without it the
   breadcrumbs sit where the catalog's do (106px from the top on a desktop), on a phone 24px under the header. The
   widget's element holds the page's height while the widget loads, so the footer does not jump up and back. */
body.gp-searchbooster-results .wp-site-blocks > header.wp-block-template-part + .wp-block-spacer {
	display: none;
}

.gp-sb-results {
	min-height: 60vh;
}

@media (max-width: 781px) {
	body.gp-searchbooster-results .wp-site-blocks > header.wp-block-template-part + .wp-block-spacer + .wp-block-group {
		padding-top: 24px !important; /* the theme's 17.5px */
	}
}
