.b4pn-directory {
    --b4pn-border: #dfe3e8;
    --b4pn-text: #23272f;
    --b4pn-muted: #68707c;
    --b4pn-accent: #5f8f2f;
    color: var(--b4pn-text);
}

.b4pn-directory__filters {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(160px, 1fr)) auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 24px;
}

.b4pn-directory__filters label {
    display: grid;
    gap: 6px;
}

.b4pn-directory__filters label > span {
    font-size: 14px;
    font-weight: 600;
}

.b4pn-directory__filters input,
.b4pn-directory__filters select,
.b4pn-directory__filters button {
    min-height: 44px;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--b4pn-border);
    border-radius: 4px;
    background: #fff;
    color: inherit;
    font: inherit;
}

.b4pn-directory__filters button {
    width: auto;
    cursor: pointer;
}

.b4pn-directory__summary {
    margin-bottom: 16px;
    color: var(--b4pn-muted);
}

.b4pn-directory__results {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.b4pn-card {
    display: flex;
    min-width: 0;
    padding: 24px;
    border: 1px solid var(--b4pn-border);
    border-radius: 8px;
    background: #fff;
}

.b4pn-card[hidden] {
    display: none;
}

.b4pn-card__portrait {
    flex: 0 0 88px;
    width: 88px;
    height: 88px;
    margin-right: 20px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: #edf3e8;
    color: var(--b4pn-accent);
    font-size: 28px;
    font-weight: 700;
}

.b4pn-card__portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.b4pn-card__body {
    min-width: 0;
    flex: 1;
}

.b4pn-card__title {
    margin: 0 0 4px;
    font-size: 21px;
    line-height: 1.25;
}

.b4pn-card__position,
.b4pn-card__organisation {
    margin: 0 0 4px;
    color: var(--b4pn-muted);
}

.b4pn-card__details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin: 18px 0;
}

.b4pn-card__details > div {
    flex: 1 1 140px;
    min-width: 0;
}

.b4pn-card__details div {
    display: grid;
    gap: 2px;
}

.b4pn-card__details span {
    color: var(--b4pn-muted);
    font-size: 12px;
    text-transform: uppercase;
}

.b4pn-card__details strong {
    font-size: 14px;
    font-weight: 600;
}

.b4pn-card__description {
    margin: 0 0 18px;
    color: var(--b4pn-muted);
    line-height: 1.55;
}

.b4pn-card__contact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.b4pn-card__contact a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid var(--b4pn-accent);
    border-radius: 4px;
    color: var(--b4pn-accent);
    text-decoration: none;
}

.b4pn-card__contact a:hover,
.b4pn-card__contact a:focus-visible {
    background: var(--b4pn-accent);
    color: #fff;
}

.b4pn-directory__empty {
    grid-column: 1 / -1;
}

.b4pn-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
}

.b4pn-pagination button {
    min-width: 40px;
    min-height: 40px;
    border: 1px solid var(--b4pn-border);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.b4pn-pagination button.is-active {
    border-color: var(--b4pn-accent);
    background: var(--b4pn-accent);
    color: #fff;
}

@media (max-width: 1100px) {
    .b4pn-directory__filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .b4pn-directory__results {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .b4pn-directory__filters,
    .b4pn-directory__results {
        grid-template-columns: 1fr;
    }

    .b4pn-card {
        display: block;
    }

    .b4pn-card__portrait {
        margin: 0 0 18px;
    }
}

/* Card layout: portrait and title in the first row. Every section has a
   fixed grid row so all cards share the same 6-row structure. */
.b4pn-card {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    column-gap: 16px;
    row-gap: 0;
    align-items: start;
    align-content: start;
}

.b4pn-card__portrait {
    grid-row: 1;
    grid-column: 1;
    align-self: center;
    width: 64px;
    height: 64px;
    margin: 0;
    font-size: 21px;
}

.b4pn-card__body {
    display: contents;
}

.b4pn-card__title {
    grid-row: 1;
    grid-column: 2;
    align-self: center;
    margin: 0;
    font-size: 18px;
}

.b4pn-card__position,
.b4pn-card__organisation,
.b4pn-card__details,
.b4pn-card__description,
.b4pn-card__contact {
    grid-column: 1 / -1;
}

.b4pn-card__position {
    grid-row: 2;
    margin: 16px 0 0;
}

.b4pn-card__organisation {
    grid-row: 3;
    margin: 4px 0 0;
}

.b4pn-card__details {
    grid-row: 4;
    margin: 18px 0 0;
}

.b4pn-card__description {
    grid-row: 5;
    margin: 18px 0 0;
}

.b4pn-card__contact {
    grid-row: 6;
    align-self: end;
    margin: 18px 0 0;
}

/* Share row tracks across cards in the same visual row, so matching
   sections get the same height in every card. */
@supports (grid-template-rows: subgrid) {
    .b4pn-card {
        grid-row: span 6;
        grid-template-rows: subgrid;
    }
}

@media (max-width: 680px) {
    .b4pn-card {
        display: grid;
    }

    .b4pn-card__portrait {
        margin: 0;
    }
}

.b4pn-directory .b4pn-card .b4pn-card__title {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
}

.b4pn-country-map {
    width: 100%;
    min-height: 360px;
    margin-bottom: 28px;
    padding: 20px;
    border: 1px solid var(--b4pn-border);
    border-radius: 8px;
    background: #f7f9f6;
    overflow: hidden;
}

.b4pn-country-map__svg {
    display: block;
    width: 100%;
    height: 360px;
}

.b4pn-country-map__svg path {
    fill: #e1e5df;
    stroke: #fff;
    stroke-width: 0.7;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.b4pn-country-map__svg path.is-available {
    fill: #a9df20;
    cursor: pointer;
    pointer-events: auto;
    transition: fill 160ms ease;
}

.b4pn-country-map__svg path.is-available:hover {
    fill: #8fbd1b;
}

.b4pn-country-map__svg path.is-selected {
    fill: #55790e;
    stroke: #253805;
    stroke-width: 1.3;
}

@media (max-width: 680px) {
    .b4pn-country-map {
        min-height: 260px;
        padding: 10px;
    }

    .b4pn-country-map__svg {
        height: 260px;
    }
}

.b4pn-directory .b4pn-country-map {
    width: 100%;
    min-height: 0;
    max-height: 300px;
    padding: 10px;
}

.b4pn-directory .b4pn-country-map__svg {
    width: 100%;
    height: 280px;
    max-height: 280px;
}

.b4pn-country-map__svg path:focus,
.b4pn-country-map__svg path:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.b4pn-country-map {
    position: relative;
}

.b4pn-country-map__viewport {
    width: 100%;
    height: 280px;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}

.b4pn-country-map__viewport.is-dragging {
    cursor: grabbing;
}

.b4pn-country-map__svg {
    transform-origin: center center;
    transition: transform 120ms ease;
    user-select: none;
}

.b4pn-country-map__viewport.is-dragging .b4pn-country-map__svg {
    transition: none;
}

.b4pn-country-map__svg path,
.b4pn-country-map__svg path:hover,
.b4pn-country-map__svg path:focus,
.b4pn-country-map__svg path:focus-visible,
.b4pn-country-map__svg path.is-selected {
    outline: none !important;
    box-shadow: none !important;
}

.b4pn-country-map__svg path.is-selected {
    fill: #55790e;
    stroke: #fff;
    stroke-width: 0.7;
}

.b4pn-country-map__controls {
    position: absolute;
    z-index: 3;
    top: 18px;
    left: 18px;
    display: flex;
    gap: 6px;
}

.b4pn-country-map__controls button {
    min-width: 38px;
    min-height: 38px;
    padding: 6px 10px;
    border: 1px solid var(--b4pn-border);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--b4pn-text);
    font: inherit;
    cursor: pointer;
}

.b4pn-country-map__controls button:hover,
.b4pn-country-map__controls button:focus-visible {
    border-color: var(--b4pn-accent);
    outline: none;
}

.b4pn-country-map__tooltip {
    position: absolute;
    z-index: 4;
    max-width: 220px;
    padding: 7px 10px;
    border-radius: 4px;
    background: rgba(25, 29, 24, 0.92);
    color: #fff;
    font-size: 13px;
    line-height: 1.3;
    pointer-events: none;
    white-space: nowrap;
}

.b4pn-country-map__tooltip[hidden] {
    display: none;
}

.b4pn-country-map__svg path,
.b4pn-country-map__svg path.is-selected {
    stroke-width: 0.35;
    vector-effect: non-scaling-stroke;
}

.b4pn-directory .b4pn-directory__filters {
    align-items: end;
}

.b4pn-directory .b4pn-directory__filters input,
.b4pn-directory .b4pn-directory__filters select,
.b4pn-directory .b4pn-directory__filters button {
    box-sizing: border-box;
    height: 48px;
    min-height: 48px;
    margin: 0;
    border: 1px solid var(--b4pn-border);
    background: #fff;
    color: var(--b4pn-text);
}

.b4pn-directory .b4pn-directory__filters input:focus,
.b4pn-directory .b4pn-directory__filters select:focus {
    border-color: var(--b4pn-accent);
    background: #fff;
    color: var(--b4pn-text);
    outline: none;
    box-shadow: 0 0 0 3px rgba(95, 143, 47, 0.18);
}

.b4pn-directory button:hover,
.b4pn-directory button:focus-visible {
    color: #fff !important;
}

.b4pn-directory .b4pn-country-map__controls button:hover,
.b4pn-directory .b4pn-country-map__controls button:focus-visible,
.b4pn-directory .b4pn-directory__filters button:hover,
.b4pn-directory .b4pn-directory__filters button:focus-visible,
.b4pn-directory .b4pn-pagination button:hover,
.b4pn-directory .b4pn-pagination button:focus-visible {
    background: var(--b4pn-accent) !important;
    color: #fff !important;
    border-color: var(--b4pn-accent) !important;
}

.b4pn-directory .b4pn-pagination button {
    width: auto;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 8px 14px;
    margin: 0;
    border: 1px solid var(--b4pn-border) !important;
    border-radius: 4px;
    background: #fff !important;
    color: var(--b4pn-text) !important;
    font: inherit;
    line-height: 1;
}

.b4pn-directory .b4pn-pagination button.is-active {
    border-color: var(--b4pn-accent) !important;
    background: var(--b4pn-accent) !important;
    color: #fff !important;
}

.b4pn-directory .b4pn-pagination button:disabled {
    border-color: #e2e5e0 !important;
    background: #f2f3f1 !important;
    color: #92988f !important;
    cursor: default;
    opacity: 1;
}

#kubio .b4pn-directory,
#kubio .b4pn-directory * {
    text-align: left;
}

#kubio .b4pn-directory__summary {
    text-align: left;
}

#kubio .b4pn-pagination {
    justify-content: center;
}

.b4pn-directory .b4pn-card__position {
    font-size: 13px;
}

.b4pn-directory .b4pn-card__organisation {
    font-weight: 700;
}

.b4pn-directory .b4pn-card__contact {
    display: grid;
    gap: 6px;
    font-size: 13px;
}

.b4pn-directory .b4pn-card__contact a {
    display: flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--b4pn-accent);
    font-size: 13px;
    line-height: 1.4;
    text-decoration: none;
}

.b4pn-directory .b4pn-card__contact a:hover,
.b4pn-directory .b4pn-card__contact a:focus-visible {
    background: transparent;
    color: var(--b4pn-accent);
    text-decoration: underline;
}

.b4pn-directory .b4pn-card__contact .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
    line-height: 16px;
}

.b4pn-directory .b4pn-card__readmore,
#kubio .b4pn-directory .b4pn-card__readmore {
    display: inline;
    width: auto;
    min-height: 0;
    margin: 0 0 0 4px;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    color: var(--b4pn-accent);
    font: inherit;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}

.b4pn-directory .b4pn-card__readmore:hover,
.b4pn-directory .b4pn-card__readmore:focus-visible,
#kubio .b4pn-directory .b4pn-card__readmore:hover,
#kubio .b4pn-directory .b4pn-card__readmore:focus-visible {
    background: transparent !important;
    color: #40661f !important;
    text-decoration: underline;
}

