@media all {
    /* From omeka main styles. */
    .collapse + .collapsible {
        display: block;
        clear: both;
    }
    .collapsible {
        display: none;
    }

    [hidden],
    .hidden {
        display: none;
    }

    /* Search form */
    .form-search {
        margin-bottom: 24px;
        & fieldset {
            border: 0;
            margin: 0 0 36px;
            padding: 0;
            & > fieldset {
                margin: 0;
            }
        }
        & input[type="search"] {
            appearance: none;
            border-radius: 0;
            height: 36px;
            border: 1px solid rgba(0,0,0,.15);
            padding: 6px;
            width: 100%;
            min-height: 36px;
            margin: 0;
        }
        & label.search-submit {
            display: none;
        }
        & .search-form-buttons {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
        }
        & button.search-submit {
            float: none;
        }
        & .chosen-container-single .chosen-single,
        & .chosen-container-multi .chosen-choices {
            height: 36px;
        }

        /* Inline radios and checkboxes. */
        & .field {
            & .inputs {
                & > label {
                    display: inline-flex;
                    align-items: baseline;
                    gap: 0.35em;
                    margin-right: 1em;
                }
                & > label:last-child {
                    margin-right: 0;
                }
                & > label > input[type=radio],
                & > label > input[type=checkbox] {
                    flex: 0 0 auto;
                    margin: 0;
                }

                /* A text input fills the width of its column. */
                & > input[type=text],
                & > input[type=search] {
                    width: 100%;
                }
            }
        }
    }

    /* Search form filters */

    /* A theme with the labels on the left of the inputs, like the default theme,
       can align them on grid with the stylesheet search-grid.css. */
    .search-filters-advanced {
        --search-filter-gap: 6px;
        --search-filter-button-size: max(24px, 45px);
        display: flex;
        flex-direction: column;
        margin: 30px 0;
        & > legend {
            padding: 7.5px 0;
            font-size: inherit;
            font-weight: inherit;
            &[hidden] {
                display: none;
            }
        }
        & .filter {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: var(--search-filter-gap);
            margin-bottom: var(--search-filter-gap);
            &[hidden] {
                display: none;
            }
        }
        &:not(.has-joiner-not) .filter:first-of-type select[name$="[join]"] {
            display: none;
        }
        & .filter {
            & > select {
                flex: 0 0 auto;
                width: auto;
            }
            /* The text input takes all the remaining width. */
            & > input[type=text] {
                flex: 1 1 12em;
                width: 100%;
                min-width: 0;
            }
            & .field {
                display: contents;
                & .field-meta {
                    display: none;
                }
                & .inputs {
                    flex: 0 0 auto;
                    width: auto;
                    padding: 0;
                }
            }
        }
        & .search-filter-action {
            flex: 0 0 auto;
            width: var(--search-filter-button-size);
            height: var(--search-filter-button-size);
            aspect-ratio: 1;
            min-width: 24px;
            min-height: 24px;
            padding: 0;
            line-height: 1;
            text-align: center;
        }
        & > .search-filter-plus {
            order: 1;
            align-self: flex-start;
        }
        & .search-filter-plus::before {
            content: "+";
        }
        & .search-filter-minus::before {
            content: "\2212";
        }
    }

    /* Search results */

    /* The wrapper divides main results and aside (see below) for facets. */
    .search-results-wrapper {
        display: flex;
        gap: 2em;
    }

    /* Search result part */
    .search-results {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    /* Search results header and footer */

    .search-results-header,
    .search-results-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 12px 18px;
    }
    .search-results-header > *,
    .search-results-footer > * {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
        white-space: nowrap;
    }
    /* Search filters chips block keeps multi-line wrapping (full row). */
    .search-results-header .search-filters,
    .search-results-footer .search-filters,
    .search-results-header .facets-active,
    .search-results-footer .facets-active {
        display: block;
        white-space: normal;
        flex-wrap: wrap;
    }
    .search-pagination-per-page,
    .search-sort {
        flex-wrap: nowrap;
        white-space: nowrap;
    }
    .search-pagination-per-page label,
    .search-sort label {
        white-space: nowrap;
    }
    .search-results-count {
        flex-wrap: nowrap;
        white-space: nowrap;
        & .pagination,
        & nav.pagination {
            display: inline-flex;
            align-items: center;
            flex-wrap: nowrap;
            gap: 4px;
        }
    }

    .search-results {
        & .search-filters {
            width: 100%;
            flex: 0 0 100%;
            padding-left: 0;
            & .filter {
                & a {
                    color: inherit;
                }
                & a::after {
                    content: none;
                }
            }
        }
    }

    /* Zero specificity, so a theme can style the buttons. */
    :where(button.search-view-type) {
        padding: 0;
        border: 0;
        background: none;
        color: inherit;
        font: inherit;
        text-decoration: underline;
        cursor: pointer;
    }
    .search-view-type.active {
        font-weight: bold;
    }

    /* Search results (list and grid) */

    .search-results .resource-list {
        display: flex;
        padding-left: 0;
    }
    .search-results-count.no-total-results .row-count {
        display: none;
    }
    .search-results {
        & .resource-list {
            & .resource-heading {
                font-weight: bold;
            }
            /* Search results (list) */
            &.list {
                flex-direction: column;
            }
            &.list .resource {
                display: flex;
                flex-flow: row wrap;
                align-items: flex-start;
                padding: 6px 0 5px;
            }
            &.list .resource-thumbnail {
                margin-left: auto;
            }
            &.list .resource-thumbnail .resource-link img {
                max-width: 60px;
                max-height: 60px;
                width: auto;
                height: auto;
                margin: 0 0 0 auto;
                padding: 0;
            }
            &.list .resource-heading {
                flex-basis: calc(100% - 66px);
            }
            &.list .resource-metadata,
            &.list .resource-body {
                flex-basis: 100%;
            }
            &.grid .only-list,
            &.list .only-grid,
            & .hidden-both {
                display: none;
            }

            /* Search results (grid) */
            &.grid {
                display: flex;
                flex-wrap: wrap;
                flex-direction: row;
                justify-content: start;
                align-items: stretch;
                align-content: start;
                gap: 18px 18px;
                padding: initial;
                margin: initial;
            }
            &.grid .resource {
                display: flex;
                flex-flow: column wrap;
                flex: 1 1 200px;
                row-gap: 6px;
                align-items: flex-start;
                width: 0;
                margin: 0;
                padding: 0 0 12px;
            }
            &.grid .resource-thumbnail {
                display: flex;
                justify-content: center;
            }
            &.grid .resource-thumbnail img {
                max-width: 200px;
                max-height: 200px;
                width: auto;
                height: auto;
                margin: 0;
                padding: 0;
            }
            &.grid .resource-heading {
                justify-content: center;
            }
            /* Old .resource-metadata was replaced by .resource-body. */
            &.grid .resource-body {
                display: none;
            }
        }
    }

    /* Active facets */

    .facets-active {
        display: inline-block;
        flex: 0 0 100%;
        width: 100%;
        list-style: none;
        margin: 0 0 6px;
        padding-left: 0;
        & .facet-active {
            display: inline-block;
            font-size: 13.08px;
            margin: 0 6px 6px 0;
            padding: 0;
            vertical-align: top;
            background-color: #f0f0f0;
            border-radius: 3px;
            & .facet-active-label {
                padding: 0 6px;
                display: inline-block;
                background-color: rgba(0,0,0,.04);
                border-radius: 3px 0 0 3px;
            }
            & .facet-active-value {
                padding: 0 6px;
                color: inherit;
            }
        }
    }
    .facets-active .facet-active .facet-active-remove,
    .search-results .search-filters .filter a.filter-remove,
    .search-results .search-filters .filter a.filter-value + a.filter-remove {
        font-weight: bold;
        margin-left: 6px;
        padding: 6px;
        color: inherit;
        text-decoration: none;
    }
    /* The core admin SCSS adds ", " after every .filter-value:not(:last-child),
        but the module may add a "x" to close the filter or facet, so fix it. */
    .search-filters .filter .filter-value:not(:has(+ .filter-value))::after,
    .facets-active .facet-active .facet-active-value:not(:has(+ .facet-active-value))::after {
        content: none;
    }

    /* Search facets */

    .search-facets {
        flex: 0 0 18.75%;
        min-width: 240px;
        max-width: 400px;
        order: -1;
    }

    .facets .facets-list {
        padding-left: 0;
    }

    .facet {
        display: block;
        margin-bottom: 1em;
    }

    .facets h3,
    .facets h4,
    .facet h3,
    .facet h4 {
        margin-bottom: 0.5em;
    }
    .facets {
        & .facet-button {
            display: block;
            background: initial;
            border: none;
            border-bottom: 1px inset transparent;
            box-shadow: initial;
            text-align: initial;
            cursor: pointer;
            width: 100%;
            padding: 0;
            margin: 0 0 0.5em 0;
            font-weight: bold;
            &:hover {
                box-shadow: initial;
                border-bottom: 1px inset;
                border-radius: 0;
            }
            &::after {
                float: right;
                content: '🞃';
                position: unset;
                width: auto;
                height: auto;
                padding: 0;
                border: none;
                background: none;
            }
            &.collapse::after {
                content: '🞃';
            }
            /* Fix for the default public theme. */
            /*
            &.collapse + .collapsible {
                padding: 7.5px 0 7.5px 16px;
            }
            */
            &.expand::after {
                content: '🞂';
            }
        }
    }

    .facet-items {
        padding-left: 0;
        list-style: none;
        & li:not([hidden]) {
            display: flex;
            align-items: baseline;
            gap: 0.4em;
        }
        & li[data-level="1"] {
            margin-left: 1.4em;
        }
        & li[data-level="2"] {
            margin-left: 2.8em;
        }
        & li[data-level="3"] {
            margin-left: 4.2em;
        }
        & li[data-level="4"] {
            margin-left: 5.6em;
        }
        & li[data-level="5"] {
            margin-left: 7em;
        }
        & li[data-level="6"] {
            margin-left: 8.4em;
        }
        & li[data-level="7"] {
            margin-left: 9.8em;
        }
        & li[data-level="8"] {
            margin-left: 11.2em;
        }
        & li[data-level="9"] {
            margin-left: 12.6em;
        }
        & li[data-level="10"] {
            margin-left: 14em;
        }
        & li[data-level="11"] {
            margin-left: 15.4em;
        }
        & li[data-level="12"] {
            margin-left: 16.8em;
        }
    }
    .facet-item {
        & input[type=checkbox] {
            vertical-align: initial;
        }
        & a {
            color: inherit;
            &::before {
                display: inline-block;
                font-family: 'Font Awesome 5 Free';
                width: 1.5em;
                content: "\f0c8";
            }
        }
        &.active a::before {
            content: "\f14a";
        }
        & label {
            white-space: normal;
            word-wrap: break-word;
            overflow-wrap: break-word;
            word-break: break-word;
        }
    }

    .facet-search-input {
        width: 100%;
        padding: 4px 8px;
        margin-bottom: 0.5em;
        box-sizing: border-box;
    }
    .facet-item.facet-search-hidden {
        display: none !important;
    }

    .facet-see-more {
        /* text-align: right; */
        margin: 0.5em 0
    }
    .facet-see-more-or-less {
        display: inline-block;
        background: initial;
        border: none;
        box-shadow: initial;
        text-align: center;
        cursor: pointer;
        padding: 6px 10px;
        margin: 0;
        &::after {
            margin-left: 0.4em;
        }
        &.expand::after {
            content: "🞃";
        }
        &.collapse::after {
            content: "🞁";
        }
    }

    .facet-pagination {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 0.2em;
        margin: 0.5em 0;
        & button {
            background: none;
            border: 1px solid #ccc;
            border-radius: 3px;
            cursor: pointer;
            padding: 2px 6px;
            font-size: 1em;
            line-height: 1;
            min-width: 1.8em;
            text-align: center;
            box-shadow: none;
            &:hover:not(:disabled) {
                background-color: #f0f0f0;
            }
            &:disabled {
                opacity: 0.3;
                cursor: default;
            }
        }
    }
    .facet-page-indicator {
        display: inline-flex;
        align-items: center;
        gap: 0.15em;
        font-size: 0.9em;
        padding: 0 0.3em;
        white-space: nowrap;
        line-height: 1;
        & .page-count,
        & .facet-page-current {
            line-height: 1;
        }
    }
    .facet-page-input {
        width: 3.5em;
        height: auto;
        text-align: center;
        font-size: inherit;
        line-height: 1;
        padding: 2px 4px;
        border: 1px solid #ccc;
        border-radius: 3px;
        box-sizing: border-box;
        -moz-appearance: textfield;
        &::-webkit-outer-spin-button,
        &::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
    }

    /* Search range */

    /* Render gradient on .range-progress; native tracks are invisible to fix Chrome. */
    .range-double {
        display: flex;
        flex-direction: column;
        gap: 1em;
        margin: 1em auto;
        & .range-sliders {
            position: relative;
            height: 1em;
            display: flex;
            align-items: center;
        }
        /* Invisible track to keep thumbs interactive. Events are re-enabled below. */
        & input[type=range] {
            -webkit-appearance: none;
            appearance: none;
            height: 0;
            width: 100%;
            position: absolute;
            background: transparent;
            pointer-events: none;
        }
    }
    /* Chrome/WebKit-only: lift thumbs over the progress bar. */
    @supports selector(input::-webkit-slider-thumb) {
        .range-double .range-sliders input[type="range"] {
            margin-top: -1em;
        }
    }
    /* Allow pointer events on tracks for both engines. */
    /* Important: do not merge these two rules and keep order. */
    .range-double {
        & input[type=range]::-moz-range-track {
            pointer-events: all;
            cursor: pointer;
            background: transparent;
            height: 0;
            border: 0;
        }
        & input[type=range]::-webkit-slider-runnable-track {
            pointer-events: all;
            cursor: pointer;
            background: transparent;
            height: 0;
            border: 0;
        }
        /* Thumbs remain clickable */
        /* Important: do not merge these two rules and keep order to fix chrome. */
        & input[type=range]::-moz-range-thumb {
            -webkit-appearance: none;
            appearance: none;
            pointer-events: all;
            cursor: pointer;
            height: 1em;
            width: 1em;
            border-radius: 50%;
            background: #666;
            border: 2px solid #fff;
        }
        & input[type=range]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            pointer-events: all;
            cursor: pointer;
            height: 1em;
            width: 1em;
            border-radius: 50%;
            background: #666;
            border: 2px solid #fff;
        }
        & input.range-slider-from[type=range] {
            z-index: 1;
        }
        & input.range-slider-to[type=range] {
            z-index: 0;
        }
        /* Visible progress bar with base track and active segment overlay */
        & .range-progress {
            position: absolute;
            left: 0;
            right: 0;
            height: 0.2em;
            border-radius: 0.1em;
            background: #e9e9ed;
            overflow: hidden;
            &::before {
                content: '';
                position: absolute;
                height: 100%;
                left: var(--from, 0%);
                right: calc(100% - var(--to, 100%));
                background: linear-gradient(90deg, #3b82f6, #3b82f6);
            }
        }

        &[data-scale-ticks="1"] .range-sliders {
            padding-bottom: 2em;
        }
        & .range-ticks {
            position: absolute;
            left: 0;
            right: 0;
            top: 1.4em;
            height: 1em;
            pointer-events: none;
            font-size: 0.75em;
            color: #666;
        }
        & .range-tick {
            position: absolute;
            transform: translateX(-50%);
            white-space: nowrap;
            &::before {
                content: '';
                position: absolute;
                left: 50%;
                top: -0.4em;
                width: 1px;
                height: 0.4em;
                background: #999;
            }
        }

        & .range-numerics {
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 1em;
        }
        & .range-numeric {
            display: inline-flex;
            align-items: baseline;
            gap: 0.4em;
            & > input[type=number] {
                width: auto;
            }
        }
        & .range-numerics-button {
            gap: 0.4em;
        }
        & input[type=number] {
            border: none;
        }
    }
    .facets {
        & .range-double {
            & .range-numerics {
                flex-wrap: nowrap;
            }
            & .range-numeric input {
                width:  100%;
            }
        }
    }

    /* Autocomplete: see common-autocomplete.css (module Common). */

    /* Breadcrumbs */

    nav.breadcrumbs {
        & > ul,
        & > ol {
            list-style: none;
            & > li {
                display: inline;
            }
        }
    }

    /* Search results map view */

    .search-results-map {
        width: 100%;
        margin: 1em 0;
    }
    .search-map {
        width: 100%;
        min-height: 500px;
        border: 1px solid #ddd;
        border-radius: 4px;
    }
    .search-view-type-map {
        cursor: pointer;
    }
    .search-map-popup {
        & .popup-title {
            font-weight: bold;
            margin-bottom: 0.5em;
        }
        & .popup-thumbnail {
            max-width: 150px;
            margin-bottom: 0.5em;
        }
        & .popup-metadata {
            font-size: 0.9em;
            color: #666;
            & .metadata-label {
                font-weight: 600;
            }
        }
        & .popup-link {
            margin-top: 0.5em;
        }
    }

    /* Resource navigation (prev/next on item page). */

    .block-resource-nav {
        & .resource-nav {
            display: flex;
            align-items: center;
            gap: 0.5em;
        }
        & .resource-nav-context {
            margin-right: 0.5em;
        }
    }
}
