/**
 * Catalogue filter column.
 *
 * Everything is scoped under .cf so the theme's sidebar keeps its own rules.
 * The typeface is deliberately not set: it is inherited from YOOtheme, which is
 * what makes the column look like the rest of the page.
 *
 * @package chicca
 */

.cf {
	--cf-title: #4a4a66;
	--cf-item: #8b8fa6;
	--cf-item-hover: #4a4a66;
	--cf-mark: #3a2233;
	--cf-line: #c9c9d2;
	--cf-btn-bg: #eceaea;
	--cf-btn-bg-hover: #e0dddd;
	--cf-accent: #e07ba3;

	position: relative;
	font-size: 15px;
	line-height: 1.5;
}

/* The drawer -------------------------------------------------------------
 *
 * The FILTRI button and its breakpoint are not styled here: .filter-cnt is an
 * old class of this site and the theme's custom CSS still carries it — hidden
 * by default, and from 940px down fixed to the right edge on a white patch.
 * Reusing it keeps the button exactly where the shop's customers are used to
 * finding it. What is left to do here is the panel behind it.
 *
 * One gap that class leaves open: it stops at 940px, while the theme keeps the
 * sidebar for itself down to 960px. Between those two widths neither the
 * button nor the column would show, so the twenty pixels are closed here.
 */
@media (min-width: 941px) and (max-width: 959px) {

	.filter-cnt {
		display: block;
		z-index: 999;
		position: fixed;
		right: 10px;
		background-color: #fff;
		padding: 3px 7px;
	}
}

/* UIkit paints the sliding panel dark; the column is drawn for a light one. */
#cf-offcanvas .uk-offcanvas-bar {
	width: min( 330px, 88vw );
	padding: 24px 18px;
	background: #fff;
	color: var(--cf-title, #4a4a66);
	overflow-y: auto;
}

#cf-offcanvas .uk-offcanvas-close {
	color: #4a4a66;
}

.cf--drawer {
	padding-top: 8px;
}

/* The sidebar indents its entries by 38px, which a 330px panel cannot spare:
   "Prezzo: dal più basso al più alto" ran off the edge. Inside the drawer the
   indent is smaller and the entries are blocks, so long labels wrap instead of
   being cut. */
.cf--drawer .cf-list {
	padding-left: 14px;
}

.cf--drawer .cf-item {
	display: block;
	white-space: normal;
}

/* Blocks --------------------------------------------------------------- */

.cf-block {
	margin: 0 0 28px;
}

.cf-block:last-of-type {
	margin-bottom: 0;
}

.cf-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 10px;
	padding: 0;
	color: var(--cf-title);
	font-size: 19px;
	font-weight: 500;
	line-height: 1.2;
	text-transform: none;
}

.cf-toggle {
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	line-height: 0;
}

/* The minus becomes a plus when the block is closed. */
.cf-toggle-mark {
	display: block;
	width: 16px;
	height: 3px;
	margin: 0 0 0 auto;
	background: var(--cf-mark);
	position: relative;
}

.cf-toggle-mark::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 3px;
	height: 16px;
	background: var(--cf-mark);
	transform: scaleY(0);
	transition: transform .15s ease;
}

.cf-toggle[aria-expanded="false"] .cf-toggle-mark::after {
	transform: scaleY(1);
}

.cf-body[hidden] {
	display: none;
}

/* Lists ---------------------------------------------------------------- */

.cf-list {
	margin: 0;
	padding: 0 0 0 38px;
	list-style: none;
}

.cf-list li {
	margin: 0;
	padding: 0;
}

.cf-item {
	display: inline-block;
	padding: 5px 0;
	color: var(--cf-item);
	text-decoration: none;
	transition: color .12s ease;
}

.cf-item:hover,
.cf-item:focus {
	color: var(--cf-item-hover);
	text-decoration: none;
}

.cf-item.is-on {
	color: var(--cf-accent);
	font-weight: 600;
}

.cf-count {
	font-size: 12px;
	letter-spacing: .02em;
	opacity: .85;
}

.cf-search-form {
	margin: 0;
}

/* Product search ------------------------------------------------------- */

.cf-search {
	display: block;
	width: 100%;
	margin: 0 0 10px;
	padding: 7px 10px;
	border: 1px solid var(--cf-line);
	border-radius: 3px;
	background: #fff;
	color: var(--cf-title);
	font-size: 14px;
	line-height: 1.4;
	box-sizing: border-box;
}

.cf-search:focus {
	outline: 0;
	border-color: var(--cf-accent);
}

/* Price ---------------------------------------------------------------- */

.cf-slider {
	position: relative;
	height: 22px;
	margin: 14px 4px 6px;
	border: 1px solid var(--cf-line);
	border-radius: 3px;
	background: #fff;
}

.cf-slider .ui-slider-range {
	position: absolute;
	top: 0;
	height: 100%;
	background: #f3f1f4;
}

.cf-slider .ui-slider-handle {
	position: absolute;
	top: -1px;
	width: 20px;
	height: 22px;
	margin-left: -10px;
	border: 1px solid var(--cf-line);
	border-radius: 3px;
	background: #fff;
	cursor: ew-resize;
	outline: 0;
}

.cf-slider .ui-slider-handle:focus-visible {
	border-color: var(--cf-accent);
}

.cf-price-readout {
	margin: 4px 0 18px;
	color: var(--cf-item);
	text-align: center;
}

.cf-price-readout .cf-from,
.cf-price-readout .cf-to {
	color: var(--cf-title);
}

/* Buttons -------------------------------------------------------------- */

.cf-actions {
	display: flex;
	gap: 14px;
	margin: 0;
}

.cf-btn {
	flex: 1 1 0;
	padding: 15px 8px;
	border: 0;
	border-radius: 2px;
	background: var(--cf-btn-bg);
	color: var(--cf-title);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .09em;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color .12s ease;
}

.cf-btn:hover,
.cf-btn:focus {
	background: var(--cf-btn-bg-hover);
	color: var(--cf-title);
	text-decoration: none;
}

/* Loading -------------------------------------------------------------- */

.cf-overlay {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	background: rgba(255, 255, 255, .88);
}

.cf-overlay[hidden] {
	display: none;
}

.cf-confetto {
	width: 64px;
	height: 64px;
	animation: cf-bob 1.1s ease-in-out infinite;
}

.cf-loading-text {
	color: var(--cf-title);
	font-size: 15px;
	letter-spacing: .04em;
}

@keyframes cf-bob {
	0%, 100% { transform: translateY(-4px) rotate(-6deg); }
	50%      { transform: translateY(4px) rotate(6deg); }
}

@media (prefers-reduced-motion: reduce) {
	.cf-confetto {
		animation: none;
	}
}
