.murmfed-directory {
    margin: 1.5rem 0;
    --murmfed-accent: #2b7a78;
}

/* Hide Divi's floating vertical divider (`#main-content .container:before`) on the full-width
   directory pages — the same fix the profile pages use. This stylesheet only loads where the
   directory shortcode is, so the rule stays scoped to those pages. */
#main-content .container:before {
    display: none !important;
}

/* Two stacked rows: the search box, then the filter dropdowns beneath it. */
.murmfed-directory__toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.murmfed-directory__search {
    display: flex;
    gap: 0.5rem;
    margin: 0;
    flex: 0 0 auto;
}

.murmfed-directory__search input[type="search"] {
    flex: 1 1 auto;
    max-width: 460px;
    padding: 0.6rem 0.9rem;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.murmfed-directory__search input[type="search"]:focus {
    outline: none;
    border-color: var(--murmfed-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--murmfed-accent), transparent 82%);
}

.murmfed-directory__search button {
    padding: 0.6rem 1.2rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--murmfed-accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
    cursor: pointer;
}

.murmfed-directory__search button:hover {
    filter: brightness(1.06);
}

.murmfed-directory__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.murmfed-directory__dropdown {
    position: relative;
}

.murmfed-directory__dd-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.95rem;
    color: #344054;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    line-height: 1.4;
    cursor: pointer;
}

.murmfed-directory__dd-toggle:hover {
    border-color: var(--murmfed-accent);
}

.murmfed-directory__dd-toggle[aria-expanded="true"] {
    border-color: var(--murmfed-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--murmfed-accent), transparent 85%);
}

.murmfed-directory__dd-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: var(--murmfed-accent);
    border-radius: 999px;
    /* Always laid out (reserves its space); only its visibility toggles, so the toolbar
       never reflows when a count appears. */
    visibility: hidden;
}

.murmfed-directory__dd-badge.is-active {
    visibility: visible;
}

.murmfed-directory__dd-caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #98a2b3;
}

.murmfed-directory__dd-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 5px);
    left: 0;
    min-width: 230px;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.12);
    padding: 0.35rem;
}

.murmfed-directory__dd-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    font-size: 0.88rem;
    color: #344054;
    cursor: pointer;
}

.murmfed-directory__dd-option:hover {
    background: #f5f7f5;
}

.murmfed-directory__dd-option input {
    width: 16px;
    height: 16px;
    flex: none;
    accent-color: var(--murmfed-accent);
    cursor: pointer;
}

.murmfed-directory__facet-clear {
    font-size: 0.85rem;
    color: var(--murmfed-accent);
    background: none;
    border: 0;
    padding: 0.2rem 0.3rem;
    cursor: pointer;
    text-decoration: underline;
    /* Reserve its space at all times so it doesn't shove the toolbar when it appears. */
    visibility: hidden;
}

.murmfed-directory__facet-clear.is-active {
    visibility: visible;
}

.murmfed-directory__count {
    margin: 0 0 1rem;
    color: #667085;
    font-size: 0.9rem;
}

.murmfed-directory__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.murmfed-directory__card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    overflow: hidden;
    list-style: none;
    transition: box-shadow 0.16s ease, transform 0.16s ease;
}

.murmfed-directory__card:hover {
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.1);
    transform: translateY(-2px);
}

.murmfed-directory__card[hidden] {
    display: none;
}

.murmfed-directory__media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    background: #f5f7f5;
    overflow: hidden;
}

/* The logo overlays the always-present letter placeholder and is opaque, so once it loads it fully
   hides the letter. */
.murmfed-directory__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.8rem;
    box-sizing: border-box;
    background: #f5f7f5;
}

/* When the script drives the listing, the logo is hidden until it actually loads (the letter shows
   meanwhile), so a dead/slow image URL never blanks the card waiting for the load to fail. Without
   JS the image just shows normally. */
[data-murmfed-dir-ready] .murmfed-directory__media img {
    opacity: 0;
    transition: opacity 0.2s ease;
}

[data-murmfed-dir-ready] .murmfed-directory__media img.is-loaded {
    opacity: 1;
}

.murmfed-directory__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--murmfed-accent);
    opacity: 0.65;
}

.murmfed-directory__body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.85rem 1rem 1.1rem;
}

.murmfed-directory__name {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
}

.murmfed-directory__name a {
    color: #101828;
    text-decoration: none;
}

.murmfed-directory__name a:hover {
    text-decoration: underline;
}

.murmfed-directory__meta {
    color: #475467;
    font-size: 0.875rem;
}

.murmfed-directory__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.15rem;
}

.murmfed-directory__tag {
    font-size: 0.72rem;
    color: var(--murmfed-accent);
    background: color-mix(in srgb, var(--murmfed-accent), #fff 88%);
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    line-height: 1.5;
}

.murmfed-directory__empty {
    color: #667085;
    padding: 1rem 0;
}

/* "Show more" reveals the next window of matches (the script renders the list in chunks so the
   DOM stays small even when filtering across thousands of organisations). */
.murmfed-directory__more {
    display: block;
    margin: 1.5rem auto 0;
    padding: 0.6rem 1.5rem;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background: #fff;
    color: #344054;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
}

.murmfed-directory__more:hover {
    border-color: var(--murmfed-accent);
    color: var(--murmfed-accent);
}

.murmfed-directory__pager {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.murmfed-directory__pager a,
.murmfed-directory__pager strong {
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    text-decoration: none;
}

.murmfed-directory__pager a {
    color: var(--murmfed-accent);
    border: 1px solid #e4e7ec;
}

.murmfed-directory__pager strong {
    background: var(--murmfed-accent);
    color: #fff;
}
