/*
 * redmillshorse.com: Red Mills Facets 2.0 styles (the theme's facets.css; facets.json has
 * "base_styles": false). Each theme's facets.css is this file followed by its own file(s), joined
 * by tools/cutover/convert-theme.mjs per migration/facets-2.0/redmillshorse.com/cutover.json.
 * This part is the structure every theme shares; the theme files do the look.
 * Selectors start with .facets (the listing's <section>) to outrank the themes' own element
 * rules such as `.product-category .left-side li`.
 */
.facets .facets-panel ul { list-style: none; margin: 0; padding: 0; }
.facets .facets-panel label { margin: 0; cursor: pointer; }
.facets .facets-term-input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.facets .facets-group-head { cursor: pointer; }
.facets .facets-group-body { display: none; }
.facets .facets-group.is-open > .facets-group-body { display: block; }
.facets .facets-panel.is-open { display: block; }
.facets .facets-term.is-unavailable { display: none; }
.facets .facets-group.is-empty { display: none; }
.facets ul.facets-children:not(:has(> li.facets-term:not(.is-unavailable))) { display: none; }
.facets .facets-group-icon, .facets .facets-term-toggle, .facets .facets-term-box { display: none; }
/* fe-pro printed a no-break space after a term's name: before its count (checkboxes), or always (labels) */
.facets .facets-term-label:has(+ .facets-term-count)::after, .facets .facets-group-labels .facets-term-label::after { content: "\a0"; }
/* in a label the count follows the name, so the space goes between them */
.facets .facets-group-labels .facets-term-label::after { order: 1; }
.facets .facets-group-labels .facets-term-count { order: 2; }
.facets .facets-empty { font-style: italic; }

/* chips */
.facets .facets-chips { display: flex; flex-wrap: wrap; align-items: center; }
.facets .facets-chip { display: inline-flex; align-items: center; }
:where(.facets) :where(button.facets-chip, button.facets-chip-remove) { -webkit-appearance: none; appearance: none; cursor: pointer; }

/* keyboard focus: the group head is a role="button", the checkbox itself is invisible.
   !important because the themes carry `a:focus, *:focus { outline: none !important }` rules */
.facets .facets-group-head:focus-visible { outline: 2px solid #222 !important; outline-offset: 2px; }
.facets .facets-term-label:has(.facets-term-input:focus-visible) { outline: 2px solid #222 !important; outline-offset: 2px; }

/* "show more" under a long list: a full row of the theme's grid, the theme's own button */
.facets .facets-more { flex: 0 0 100%; max-width: 100%; width: 100%; text-align: center; padding: 10px 15px 40px; }
.facets .facets-more-button { cursor: pointer; }

/* the mobile Filters toggle: the sliders/cross icon */
.facets .facets-toggle { display: none; }
@media (max-width: 768px) {
	.facets .facets-toggle { display: flex; align-items: center; width: 100%; margin: 0; border: 0; background: none; font-family: inherit; font-weight: 400; text-align: left; cursor: pointer; }
	.facets .facets-panel { display: none; }
	.facets .facets-toggle-icon { position: relative; display: inline-block; margin-right: 10px; top: 2px; }
	.facets .facets-toggle-line { display: block; height: 1px; width: 18px; border-radius: 3px; background: currentColor; margin-bottom: 4px; position: relative; }
	.facets .facets-toggle-line:last-child { margin-bottom: 0; }
	.facets .facets-toggle-line::after { content: ""; display: block; position: absolute; top: -2px; width: 3px; height: 3px; border: 1px solid currentColor; border-radius: 50%; background: #fff; box-sizing: content-box; }
	.facets .facets-toggle-line:nth-child(1)::after { left: 5px; }
	.facets .facets-toggle-line:nth-child(2)::after { left: 12px; }
	.facets .facets-toggle-line:nth-child(3)::after { left: 2px; }
	.facets .facets-toggle.is-open .facets-toggle-line:nth-child(2), .facets .facets-toggle.is-open .facets-toggle-line::after { display: none; }
	.facets .facets-toggle.is-open .facets-toggle-line:nth-child(1) { transform: rotate(45deg); margin-bottom: -1px; top: -3px; }
	.facets .facets-toggle.is-open .facets-toggle-line:nth-child(3) { transform: rotate(-45deg); margin-bottom: -1px; top: -3px; }
}

/* The GCC look (theme "redmillsgccsa": en-sa, en-kw, en-qa, en-bh, en-om; the base of redmillsfr,
   redmillsgccar and redmillsgccsaar): plain facets separated by a hairline, a dark title with a
   Font Awesome plus (closed, grey) or minimize bar (open, red) at the right, checkbox rows with
   no box, "labels" facets as inline pills, grey chips. Measured with scripts/rmh-theme-dump.mjs. */
.facets .facets-panel, .facets .facets-toggle { color: #1b1c20; font-size: 16px; line-height: 24px; }
/* the old widget sat 1px in from each side of its column */
.facets .facets-panel { width: calc(100% - 2px); margin: 0 0 0 1px; }

/* a facet */
.facets .facets-panel .facets-group { position: relative; padding: 15px; border-bottom: 1px solid #ececec; }
.facets .facets-panel .facets-group-head { display: block; }
.facets .facets-panel .facets-group-title { display: flex; flex-wrap: wrap; align-items: center; width: 100%; min-height: 14px; padding-right: 20px; font-size: 14px; font-weight: 700; line-height: 14px; color: #1b1c20; }
.facets .facets-panel .facets-group-head::before { content: "\f067"; position: absolute; top: 18px; right: 10px; font-family: "Font Awesome 5 Pro"; font-weight: 900; font-size: 12px; line-height: 18px; color: #a7a8aa; }
.facets .facets-panel .facets-group.is-open > .facets-group-head::before { content: "\f2d1"; color: #e1002c; }
/* a title that does not collapse is plain text: 16px, regular */
.facets .facets-panel .facets-group-head:not([aria-expanded]) .facets-group-title { padding: 0; font-size: 16px; font-weight: 400; line-height: 24px; }
.facets .facets-panel .facets-group-body { padding-top: 15px; }

/* a term row: no box, a bold 14px name */
/* !important: the theme forces margin-bottom:0 on every list item in this column */
.facets .facets-panel li.facets-term { position: relative; margin: 0 0 10px !important; padding: 0; }
.facets .facets-panel .facets-term-row { position: relative; display: flex; align-items: center; color: #1b1c20; font-size: 16px; line-height: 1.3; }
.facets .facets-panel .facets-term-label { display: flex; align-items: center; padding-left: 5px; color: #1b1c20; }
.facets .facets-panel .facets-term-name { display: block; font-size: 14px; font-weight: 700; line-height: 1.3; color: #1b1c20; }
.facets .facets-panel .facets-term-count { margin: 0 5px; font-size: 12px; line-height: 1.3; opacity: .6; white-space: nowrap; }
.facets .facets-panel ul.facets-children { display: block; margin: 14px 0 0 20px; }
/* sub-ranges: a regular name and a real 20px checkbox, drawn on the input itself as the theme does */
.facets .facets-panel ul.facets-children .facets-term-name { font-weight: 400; }
.facets .facets-panel ul.facets-children .facets-term-label { padding-left: 0; }
.facets .facets-panel ul.facets-children .facets-term-input { position: relative; display: block; width: 20px; height: 20px; min-width: 20px; margin: 0 7px 0 1px; opacity: 1; -webkit-appearance: none; appearance: none; background: #fff; border: 2px solid #ccd0dc; border-radius: 5px; cursor: pointer; }
.facets .facets-panel ul.facets-children .facets-term-input:checked { border-color: #0570e2; }
.facets .facets-panel ul.facets-children .facets-term-input:checked::after { content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #0570e2; border-width: 0 2px 2px 0; transform: rotate(45deg); }
/* the products page: once a range is chosen, only it and its sub-ranges stay listed */
.post-type-archive-product .facets .facets-panel .facets-group-checkboxes.has-selection li.facets-term { display: none; }
.post-type-archive-product .facets .facets-panel .facets-group-checkboxes.has-selection li.facets-term.has-selection,
.post-type-archive-product .facets .facets-panel .facets-group-checkboxes.has-selection ul.facets-children li.facets-term { display: block; }

/* the "labels" facets: inline pills (the row), the name and count in a box that colours when chosen */
.facets .facets-panel .facets-group-labels .facets-group-body > ul::after { content: ""; display: block; clear: both; }
.facets .facets-panel .facets-group-labels li.facets-term { float: left; }
.facets .facets-panel .facets-group-labels .facets-term-row { margin-right: 8px; border: 1px solid rgba(0, 0, 0, .1); border-radius: 5px; }
.facets .facets-panel .facets-group-labels .facets-term-label { align-items: normal; padding: 6px 10px 0; border: 1px solid transparent; border-radius: 3px; }
/* the chosen one: blue with light text, except on the products and article pages where it greys */
.facets .facets-panel .facets-group-labels .facets-term.is-selected > .facets-term-row { border-color: rgba(0, 0, 0, .25); }
.facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-label { background: #0570e2; color: #f5f5f5; }
.facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-name,
.facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-count { color: #f5f5f5; }
.post-type-archive-product .facets .facets-panel .facets-group-labels .facets-term.is-selected > .facets-term-row,
.post-type-archive-nutritionarticle .facets .facets-panel .facets-group-labels .facets-term.is-selected > .facets-term-row { border-color: #d8d8d8; }
.post-type-archive-product .facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-label,
.post-type-archive-nutritionarticle .facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-label { background: #d8d8d8; color: #333; }
.post-type-archive-product .facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-name,
.post-type-archive-product .facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-count,
.post-type-archive-nutritionarticle .facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-name,
.post-type-archive-nutritionarticle .facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-count { color: #333; }

/* chips: grey pills in the results column, the reset one alike */
.facets .facets-chips { flex-wrap: nowrap; width: calc(100% - 15px); margin-left: 15px; overflow: auto; }
.facets.product-category .facets-chips { flex-wrap: wrap; overflow-x: hidden; }
.facets .facets-chip { position: relative; margin: 0 7px 10px 0; padding: 2px 14px; font-size: 14px; line-height: 21px; text-align: left; color: #1b1c20; background: rgba(0, 0, 0, .03); border: 1px solid #d8d8d8; border-radius: 6px; }
.facets .facets-chip-reset { background: none; }
.facets .facets-chip-remove { position: relative; bottom: 1px; margin-left: 7px; padding: 0; border: 0; background: none; color: #e1002c; font-size: 1.25em; line-height: .8; cursor: pointer; }

/* mobile: smaller type, a full-width borderless Filters button */
@media (max-width: 768px) {
	.facets .facets-panel { font-size: 14px; line-height: 21px; }
	.facets .facets-panel .facets-term-row { font-size: 14px; }
	.facets .facets-panel .facets-group-head:not([aria-expanded]) .facets-group-title { font-size: 14px; line-height: 21px; }
	.facets .facets-panel .facets-group-checkboxes li.facets-term { padding: 2px 0; }
	.facets .facets-toggle { width: calc(100% - 2px); padding: 7px 12px; border-radius: 2px; color: #2c2d33; font-size: 14px; line-height: 21px; }
	/* the toggle was a link: the theme's link hover colour, which stays after a tap */
	.facets .facets-toggle:hover { color: #0056b3; }
}

/* Theme "redmillsfr" (fr-fr), after redmillsgccsa.css: the GCC look, with the chosen pill blue on
   the products and article pages too. On mobile production showed its facets in a popup that was
   broken there; this stays the inline panel. */
.post-type-archive-product .facets .facets-panel .facets-group-labels .facets-term.is-selected > .facets-term-row,
.post-type-archive-nutritionarticle .facets .facets-panel .facets-group-labels .facets-term.is-selected > .facets-term-row { border-color: rgba(0, 0, 0, .25); }
.post-type-archive-product .facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-label,
.post-type-archive-nutritionarticle .facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-label { background: #0570e2; color: #f5f5f5; }
.post-type-archive-product .facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-name,
.post-type-archive-product .facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-count,
.post-type-archive-nutritionarticle .facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-name,
.post-type-archive-nutritionarticle .facets .facets-panel .facets-group-labels .facets-term.is-selected .facets-term-count { color: #f5f5f5; }
/* the panel keeps the GCC width but not the 1px inset */
.facets .facets-panel { margin: 0; }
/* sub-range names read in lower case on the article and podcast pages */
.post-type-archive-nutritionarticle .facets .facets-panel ul.facets-children .facets-term-name,
.post-type-archive-podcasts .facets .facets-panel ul.facets-children .facets-term-name { text-transform: lowercase; }
