/* Site-wide search page (templates/template-site-wide-search.php) */

.site-search .screen-reader-text,
#site-search-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Honeypot field: kept off screen, never shown to people */
.site-search-website {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Suggestion list under the search box (javascript/search-suggestions.js).
   Placed over the page below the box, as wide as the box. */
#site-search-form {
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 50;
    width: 82.5%;
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    max-height: 22em;
    overflow-y: auto;
    background: #fff;
    border: 2px solid #d7d7d7;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    text-align: left;
}

/* Rows the same height as the category dropdown's (font size, line height and
   padding as .fs-dropdown / .fs-option). #content: the theme sizes every list there. */
.search-suggestions,
#content ul.search-suggestions {
    font-size: 1.1em;
    line-height: 1.3;
}

.search-suggestions li {
    margin: 0;
    padding: 0;
    border-top: 1px solid #ececec;
}

.search-suggestions li:first-child {
    border-top: 0;
}

.search-suggestions [role="option"] {
    padding: 0.5em 0.75em;
    color: #2a2a2a;
    cursor: pointer;
}

.search-suggestions [role="option"][aria-selected="true"],
.search-suggestions [role="option"]:hover {
    background: #f1e8f6;
    color: #502481;
}

.search-suggestions .search-suggestions-waiting,
.search-suggestions .search-suggestions-waiting:hover {
    color: #666;
    font-style: italic;
    background: none;
    cursor: default;
}

/* Shown instead of the result boxes: nothing ticked, or too many searches */
.site-search-message {
    margin: 2em 0;
    padding: 1.25em 1.5em;
    background: #f1e8f6;
    border-radius: 8px;
    text-align: center;
}

.site-search-message p {
    margin: 0;
    font-size: 1.25em;
    font-weight: 700;
    color: #502481;
}

/* While new results are on their way the old ones fade, so the change is visible */
.site-search-results {
    transition: opacity 0.2s;
}

.site-search-results.is-loading {
    opacity: 0.4;
}

@media all and (max-width: 767px) {
    .search-suggestions {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-search-results,
    .search-listing .facetwp-template,
    .calendar-container {
        transition: none;
    }
}


/* Section search pages on FacetWP (Search_Listing). FacetWP draws the keyword
   box and the category list; these make them look like the theme's own search
   box and dropdown. Selectors are deliberately specific: FacetWP's and fSelect's
   own stylesheets would otherwise win. */
.search-listing .facetwp-facet {
    margin-bottom: 0.8em;
    position: relative;
}

.search-listing .facetwp-facet input.facetwp-search,
:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-label-wrap {
    display: block;
    margin: 0;
    padding: 10px 20px 12px;
    width: 100%;
    min-width: 0;
    min-height: 58px;
    box-sizing: border-box;
    font-family: "Lato", sans-serif;
    font-size: 1.563em;
    line-height: 1.3;
    color: #2b2b2b;
    text-align: left;
    background-color: #fff;
    border: 3px solid #cdcdcd;
    border-radius: 9px;
    -webkit-appearance: none;
}

.search-listing .facetwp-facet input.facetwp-search:focus {
    border-color: #a58bc4;
    outline: 2px solid #502481;
    outline-offset: 1px;
}

/* FacetWP wraps the keyword box in an inline element; make it full width like the category list */
.search-listing .facetwp-facet .facetwp-input-wrap {
    display: block;
    width: 100%;
}

/* FacetWP's magnifier inside the box: the Search button does that job here */
.search-listing .facetwp-type-search .facetwp-icon {
    display: none;
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap {
    display: block;
    width: 100%;
    line-height: 1.3;
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-label-wrap {
    padding-right: 72px;
    background-image: url("../images/select-arrow.png");
    background-repeat: no-repeat;
    background-position: center right;
    cursor: pointer;
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-label-wrap .fs-label {
    padding: 0;
    color: #2b2b2b;
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-arrow {
    display: none;
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-dropdown {
    width: 100%;
    margin-top: -3px;
    font-size: 1.1em;
    text-align: left;
    border: 2px solid #d7d7d7;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    z-index: 60;
}

/* The search line and the option rows share one height: same font size, line height and padding */
:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-search {
    padding: 0;
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-search input,
:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-option {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0.5em 0.75em;
    box-sizing: border-box;
    font-size: 1em;
    line-height: 1.3;
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-option .fs-option-label {
    padding: 0;
}

/* Multi-select lists: the tick box sits in line before the label, with a gap,
   instead of fSelect's absolutely placed box (which overlapped the label here) */
:is(.search-listing .facetwp-facet, .search-field) .fs-wrap.multiple .fs-option {
    display: flex;
    align-items: center;
    gap: 0.65em;
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap.multiple .fs-checkbox {
    position: static;
    flex: none;
    width: auto;
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap.multiple .fs-option .fs-checkbox i {
    position: relative;
    display: block;
    width: 18px;
    height: 18px;
    margin: 0;
    box-sizing: border-box;
    border: 2px solid #cdcdcd;
    border-radius: 4px;
    background-color: #fff;
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap.multiple .fs-option:hover .fs-checkbox i,
:is(.search-listing .facetwp-facet, .search-field) .fs-wrap.multiple .fs-option.hl .fs-checkbox i {
    border-color: #502481;
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap.multiple .fs-option.selected .fs-checkbox i {
    background-color: #502481;
    border-color: #502481;
}

/* The tick */
:is(.search-listing .facetwp-facet, .search-field) .fs-wrap.multiple .fs-option.selected .fs-checkbox i::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 0;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-option.selected,
:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-option:hover,
:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-option.hl {
    background: #f1e8f6;
    color: #502481;
}

/* Space between the top of the grey box and the fields, on every section */
.search-listing #site-search-form {
    position: relative;
    margin-top: 40px;
}

/* The suggestion list opens under the keyword box (it is placed inside the box's
   FacetWP container), as wide as the box */
.search-listing .search-suggestions {
    width: 100%;
    top: 100%;
}

/* Organisations: visible labels above the fields, as before. The theme floats the
   labels and gives them their own top margin, so the form needs no extra top space. */
.search-listing.search-listing-labelled #site-search-form {
    margin-top: 0;
}

.search-listing-labelled .facetwp-facet {
    clear: both;
}

/* Sub-areas indented under their area in a dropdown (Location) */
:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-option.d1 .fs-option-label {
    padding-left: 1.25em;
}

:is(.search-listing .facetwp-facet, .search-field) .fs-wrap .fs-option.d2 .fs-option-label {
    padding-left: 2.5em;
}

/* Commissioned services tick box: the results page (a FacetWP tick box) and the landing
   page (a plain one, .search-tickbox) look the same: bold text like the field labels and a
   box like the dropdowns' tick boxes */
.search-listing-tickbox {
    clear: both;
    padding-top: 30px;
    text-align: left;
}

.search-listing .facetwp-facet .facetwp-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    background: none;
    font-weight: 900;
    font-size: 1.563em;
    line-height: 1.3;
    cursor: pointer;
}

.search-listing .facetwp-facet .facetwp-checkbox::before,
.search-tickbox input[type="checkbox"] {
    content: "";
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0 10px 0 0;
    box-sizing: border-box;
    border: 2px solid #cdcdcd;
    border-radius: 4px;
    background: #fff;
    vertical-align: middle;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.search-listing .facetwp-facet .facetwp-checkbox::before {
    margin: 0;
}

.search-listing .facetwp-facet .facetwp-checkbox:hover::before,
.search-listing .facetwp-facet .facetwp-checkbox:focus::before,
.search-tickbox:hover input[type="checkbox"],
.search-tickbox input[type="checkbox"]:focus {
    border-color: #502481;
}

.search-listing .facetwp-facet .facetwp-checkbox.checked::before,
.search-tickbox input[type="checkbox"]:checked {
    border-color: #502481;
    background: #502481 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.search-tickbox input[type="checkbox"]:focus-visible {
    outline: 2px solid #502481;
    outline-offset: 2px;
}

.search-listing .facetwp-facet .facetwp-checkbox .facetwp-display-value {
    padding: 0;
}

@media all and (max-width: 600px) {
    .search-listing .facetwp-facet .facetwp-checkbox {
        font-size: 1.25em;
    }
}

/* The count of matching organisations next to the tick box was not shown before */
.search-listing .facetwp-facet .facetwp-counter {
    display: none;
}

.search-listing .facetwp-template {
    margin-top: 1.5em;
}

/* A landing page box with its button below it (News): the list opens under the box */
.search-suggestions-anchor {
    position: relative;
    /* The theme floats the box; this keeps it inside, so the list opens below it */
    display: flow-root;
}

.search-suggestions-anchor .search-suggestions {
    width: 100%;
}

/* Active filters as boxes ("Category: Money ×"); the value removes that filter */
.search-listing-selections {
    margin: 1.5em 0 0;
    text-align: center;
}

.search-listing-selections .facetwp-selections ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5em;
    margin: 0;
    padding: 0;
    list-style: none;
}

.search-listing-selections .facetwp-selections li {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    margin: 0;
    padding: 0.45em 0.75em;
    line-height: 1.2;
    color: #2b2b2b;
    background: #fff;
    border: 1px solid #d7d7d7;
    border-radius: 4px;
}

.search-listing-selections .facetwp-selections .facetwp-selection-value {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    margin: 0;
    padding: 0;
    font-weight: 700;
    background: none;
    cursor: pointer;
}

/* Site purple unless the section's colour class (e.g. .information-colour) says otherwise */
:where(.search-listing-selections .facetwp-selection-value) {
    color: #502481;
}

.search-listing-selections .facetwp-selections .facetwp-selection-value::after {
    content: "\00d7";
    font-weight: 700;
    color: #2b2b2b;
}

.search-listing-selections .facetwp-selections .facetwp-selection-value:hover,
.search-listing-selections .facetwp-selections .facetwp-selection-value:focus {
    text-decoration: underline;
}

/* Results fade while new ones load, and back in when they arrive (listings and the Events Calendar) */
.search-listing .facetwp-template,
.calendar-container {
    transition: opacity 0.2s;
}

.search-listing .facetwp-template.is-loading,
.calendar-container.is-loading {
    opacity: 0.4;
}

.search-listing .custom-pagination a[aria-disabled="true"] {
    visibility: hidden;
}

.search-listing .custom-pagination a.facetwp-page {
    cursor: pointer;
}


/* Events & Activities and the Events Calendar: fields and dropdowns the size of the
   events form's own boxes (its date box: 46px high, 1.125em text) */
.event-search .facetwp-facet input.facetwp-search,
.event-search :is(.facetwp-facet, .search-field) .fs-wrap .fs-label-wrap {
    min-height: 46px;
    padding: 8px 10px;
    font-size: 1.125em;
}

.event-search :is(.facetwp-facet, .search-field) .fs-wrap .fs-label-wrap {
    padding-right: 56px;
}

.event-search :is(.facetwp-facet, .search-field) .fs-wrap .fs-dropdown {
    font-size: 1em;
}

/* When a search finds nothing (step 11): a note, popular searches and the /search/
   result boxes with their alternatives, on /search/ and the section listings */
.search-alternatives-note {
    margin: 1em 0 0.75em;
    font-size: 1.25em;
    text-align: center;
}

.search-popular {
    margin: 0 0 1.5em;
    text-align: center;
}

.search-popular span {
    margin-right: 0.5em;
    font-weight: 700;
}

.search-popular a {
    display: inline-block;
    margin: 0.25em 0.3em;
    padding: 0.2em 0.7em;
    border: 1px solid #d7d7d7;
    border-radius: 4px;
    background: #fff;
}

.search-alternatives-heading {
    margin: 0.75em 0 0.25em;
    font-weight: 700;
}

.search-alternatives {
    clear: both;
}

/* The boxes in a row line up in height, buttons at the bottom, as matchHeight does on
   /search/; in CSS here, as the listings redraw them on every search */
.search-alternatives .row.centre-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.search-alternatives .row.centre-row > .columns {
    display: flex;
}

.search-alternatives .latest-info .container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.search-alternatives .latest-info .container .resize-me {
    flex: 1 1 auto;
}

/* As on /search/: space between rows of boxes, and the button its own size, centred.
   The theme styles the paragraph itself as a button (.button in dist/css/style.css), so
   in a flex box it would otherwise stretch to the full width. */
.search-alternatives .latest-info .container {
    margin-top: 60px;
}

.search-alternatives .latest-info .container p.button {
    align-self: center;
    text-align: center;
}

@media all and (max-width: 600px) {
    .search-alternatives .latest-info .container {
        margin-top: 40px;
    }
}
