/**
 * Browse view — filters, map above list, listing cards, page footer.
 *
 * Scoped under `.dir` so it never reaches the marketing pages. Accent colour per directory tree
 * comes from the body class set in pages/browse.php.
 */

.ddx-app--browse main {
    padding-top: 1.25rem !important;
}

.dir {
    --dir-action: var(--hs1-jordy-500);
    --dir-action-hover: var(--hs1-jordy-500);
    --dir-action-soft: var(--hs1-jordy-400);
    --dir-accent: var(--hs1-jordy-400);
    --dir-accent-soft: var(--hs1-jordy-100);
    --dir-gap: 1.5rem;
    --dir-ink: var(--hs1-true-black);
    --dir-text: var(--hs1-true-black);
    --dir-muted: var(--hs1-aluminum-400);
    --dir-border: var(--hs1-aluminum-200);
    position: relative;
    color: var(--dir-text);
    font-family: var(--ddx-font);
}

.ddx-app--lab .dir,
.ddx-app--specialist .dir,
.ddx-app--practice .dir {
    --dir-accent: var(--hs1-jordy-400);
    --dir-accent-soft: var(--hs1-jordy-100);
}

.dir.is-loading .dir-layout__results {
    opacity: 0.55;
    transition: opacity 0.12s ease;
}

/* ---------------------------------------------------------------- breadcrumbs */

.dir-crumbs {
    margin-bottom: 1.25rem;
}

.dir-crumbs__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem 0;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.8125rem;
    color: var(--dir-muted);
}

.dir-crumbs__item {
    display: inline-flex;
    align-items: center;
}

.dir-crumbs__sep {
    margin: 0 0.4rem;
    color: var(--hs1-aluminum-300);
}

.dir-crumbs__link {
    color: var(--dir-muted);
    text-decoration: none;
}

.dir-crumbs__link:hover {
    color: var(--dir-action);
    text-decoration: underline;
}

.dir-crumbs__current {
    color: var(--dir-ink);
    font-weight: 600;
}

.ddx-app--specialist .dir-crumbs__current {
    color: var(--dir-action);
}

/* ------------------------------------------------------------------ page head */

.dir-head {
    margin-bottom: 1.5rem;
}

.dir-head__title {
    font-family: var(--ddx-font);
    font-size: clamp(1.625rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
    color: var(--dir-ink);
    margin: 0 0 0.65rem;
    text-wrap: balance;
}

.dir-head__lead {
    font-family: var(--ddx-font);
    font-size: 0.9875rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--dir-text);
    max-width: 62ch;
    margin: 0;
}

/* -------------------------------------------------------------------- filters */

.dir-filters {
    margin-bottom: 1.25rem;
}

.dir-filters__fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.85rem 1rem;
}

.dir-filters__field {
    flex: 0 1 14rem;
    min-width: 11rem;
}

.dir-filters__field--keyword.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.dir-filters__label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--dir-ink);
    margin-bottom: 0.35rem;
}

.dir-filters__input,
.dir-filters__select {
    border-radius: 6px;
    border-color: var(--dir-border);
    font-size: 0.9375rem;
    min-height: 2.5rem;
}

.dir-filters__input:focus,
.dir-filters__select:focus {
    border-color: var(--dir-action);
    box-shadow: 0 0 0 3px var(--dir-accent-soft);
}

.dir-filters__actions {
    display: flex;
    align-items: flex-end;
    flex: 0 0 auto;
}

.dir-filters__apply {
    background: var(--dir-action);
    border: none;
    color: #fff;
    font-family: var(--ddx-font);
    font-size: 0.9375rem;
    font-weight: 700;
    border-radius: 6px;
    padding: 0.55rem 1.15rem;
    min-height: 2.5rem;
    white-space: nowrap;
}

.dir-filters__apply:hover,
.dir-filters__apply:focus {
    background: var(--dir-action-hover);
    color: #fff;
}

.dir-filters__toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.25rem;
    background: none;
    border: none;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--dir-ink);
}

.dir-filters__toggle::after {
    content: "";
    width: 1.5rem;
    height: 1.5rem;
    background-color: var(--dir-muted);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform 0.15s ease;
}

.dir-filters__toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.dir-filters__toggle-count {
    margin-left: auto;
    margin-right: 0.25rem;
    min-width: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--dir-action);
    color: #fff;
    font-size: 0.75rem;
    line-height: 1.25rem;
    text-align: center;
}

/* ------------------------------------------------------------- active filters */

.dir-active {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.dir-active__label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--dir-muted);
}

.dir-active__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.dir-active__chip {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    background: var(--dir-accent-soft);
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.8125rem;
    color: var(--dir-ink);
    text-decoration: none;
}

.dir-active__chip:hover {
    border-color: var(--dir-accent);
    color: var(--dir-ink);
}

.dir-active__chip-key {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--dir-muted);
}

.dir-active__chip-value {
    font-weight: 600;
}

.dir-active__chip-remove {
    display: inline-flex;
    font-size: 1rem;
    line-height: 1;
    color: var(--dir-muted);
}

.dir-active__chip:hover .dir-active__chip-remove {
    color: var(--dir-action);
}

.dir-active__clear {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--dir-action-soft);
    text-decoration: none;
}

/* ------------------------------------------------------------ results toolbar */

.dir-results-head {
    padding: 1.25rem 0 0.85rem;
}

.dir-results-head__count {
    margin: 0;
    font-size: 0.9875rem;
    color: var(--dir-ink);
}

.dir-results-head__count strong {
    font-weight: 700;
}

/* -------------------------------------------------------------- stacked layout */

.dir-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.dir-layout__map {
    position: relative;
    width: 100%;
}

.dir-layout__results {
    width: 100%;
}

/* ------------------------------------------------------------------- listings */

.dir-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.dir-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem 1.75rem;
    padding: 2rem 1.35rem 2rem 2rem;
    background: #fff;
    border: 1px solid var(--dir-border);
    border-radius: 12px;
}

.dir-card:hover,
.dir-card.is-highlighted {
    border-color: var(--dir-action-soft);
    box-shadow: 0 0 0 3px var(--dir-accent-soft);
}

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

.dir-card__name {
    font-family: var(--ddx-font);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 0.2rem;
    line-height: 1.3;
}

.dir-card__name-link,
.dir-card__name-text {
    color: var(--dir-ink);
    text-decoration: none;
}

.dir-card__name-link:hover {
    color: var(--dir-ink);
    text-decoration: underline;
}

.dir-card__ext {
    display: inline-flex;
    vertical-align: middle;
    margin-left: 0.3rem;
    color: var(--dir-action-soft);
}

.dir-card__meta {
    font-family: var(--ddx-font);
    font-size: 0.875rem;
    color: var(--hs1-aluminum-300);
    margin: 0 0 0.6rem;
}

.dir-card__phone {
    color: inherit;
    text-decoration: none;
}

.dir-card__phone:hover {
    color: var(--dir-action);
    text-decoration: underline;
}

.dir-card__dot {
    margin: 0 0.2rem;
}

.dir-card__badges {
    margin: 0 0 0.45rem;
}

.dir-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: var(--dir-accent-soft);
    color: var(--dir-accent);
}

.dir-card__services {
    font-size: 1rem;
    color: var(--dir-ink);
    margin: 0;
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dir-card__actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 9.75rem;
}

.dir-card__action {
    background: var(--dir-action);
    border: none;
    color: #fff;
    font-family: var(--ddx-font);
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: 6px;
    white-space: nowrap;
    padding: 0.55rem 1rem;
    text-align: center;
}

.dir-card__action:hover,
.dir-card__action:focus,
.dir-card__action--outsource:hover,
.dir-card__action--outsource:focus,
.dir-card__action--specialist:hover,
.dir-card__action--specialist:focus,
.dir-card__action--lab:hover,
.dir-card__action--lab:focus {
    background: var(--dir-action-hover);
    color: #fff;
}

.dir-card__action--outsource,
.dir-card__action--specialist,
.dir-card__action--lab {
    background: var(--dir-action);
}

/* Full-width disclosure row; hidden once JS moves its content into the drawer. */
.dir-card__more {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.dir-card__more[hidden] {
    display: none;
}

.dir-card__more-body {
    padding-top: 0.75rem;
}

.dir-card__details {
    cursor: pointer;
    list-style: none;
}

.dir-card__details::-webkit-details-marker {
    display: none;
}

/* ---------------------------------------------------------- results footer */

.dir-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin: 2rem auto 0.5rem;
    max-width: 22rem;
    text-align: center;
}

.dir-more__count {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--dir-ink);
}

.dir-more__bar {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: #e8e8ec;
    overflow: hidden;
}

.dir-more__bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--dir-action);
    transition: width 0.2s ease;
}

/* Page controls under the results progress bar (also usable standalone). */
.dir-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

.dir-more .dir-pagination {
    width: 100%;
    max-width: 100%;
}

.dir-pagination__pages {
    display: flex;
    gap: 0.2rem;
    list-style: none;
    margin: 0 0.5rem;
    padding: 0;
}

.dir-pagination__page,
.dir-pagination__step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.125rem;
    height: 2.125rem;
    padding: 0 0.6rem;
    border-radius: 6px;
    color: var(--dir-ink);
    text-decoration: none;
    font-variant-numeric: tabular-nums;
}

.dir-pagination__page:hover,
.dir-pagination__step:hover {
    background: var(--ddx-surface);
    color: var(--dir-action);
}

.dir-pagination__page.is-current {
    background: var(--dir-action);
    color: #fff;
    font-weight: 600;
}

.dir-pagination__step.is-disabled {
    color: var(--hs1-aluminum-300);
    pointer-events: none;
}

.dir-pagination__gap {
    align-self: end;
    padding: 0 0.15rem;
    color: var(--dir-muted);
}

/* ---------------------------------------------------------------- empty state */

.dir-empty {
    padding: 2rem 1.5rem;
    background: #fff;
    border: 1px dashed var(--dir-border);
    border-radius: 8px;
}

.dir-empty__title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dir-ink);
}

.dir-empty__text {
    font-size: 0.9375rem;
    color: var(--dir-muted);
    max-width: 52ch;
    margin-bottom: 1.25rem;
}

.dir-empty__options {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}

.dir-empty__option {
    display: inline-block;
    padding: 0.45rem 0.85rem;
    background: var(--ddx-surface);
    border: 1px solid var(--dir-border);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--dir-ink);
    text-decoration: none;
}

.dir-empty__option:hover {
    border-color: var(--dir-action);
    color: var(--dir-action);
}

.dir-empty__trees-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dir-muted);
    margin-bottom: 0.6rem;
}

.dir-empty__tree-list {
    display: grid;
    gap: 0.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (min-width: 576px) {
    .dir-empty__tree-list {
        grid-template-columns: 1fr 1fr;
    }

    .dir-empty__options {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

.dir-empty__tree {
    display: block;
    padding: 1.15rem 1.25rem;
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
}

.dir-empty__tree--labs,
.dir-empty__tree--specialists {
    background: #eef3ff;
}

.dir-empty__tree--outsource {
    background: #f5f1ee;
}

.dir-empty__tree-name {
    display: block;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--dir-ink);
    margin-bottom: 0.35rem;
}

.dir-empty__tree-desc {
    display: block;
    font-size: 0.875rem;
    color: var(--dir-text);
    margin-bottom: 0.85rem;
}

.dir-empty__tree-cta {
    display: inline-block;
    padding: 0.45rem 1rem;
    background: var(--dir-action);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 6px;
}

/* ------------------------------------------------------------------------ map */

.dir-map {
    background: #fff;
    border: 1px solid var(--dir-border);
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
}

.dir-map__canvas {
    height: clamp(16rem, 42vh, 26rem);
    background: var(--ddx-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dir-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 1rem;
}

.dir-map__canvas.has-map {
    display: block;
    padding: 0;
    overflow: hidden;
}

.dir-map__status {
    font-size: 0.75rem;
    color: var(--dir-muted);
    margin: 0;
    padding: 0.5rem 0.75rem;
}

.dir-map__note {
    font-size: 0.8125rem;
    color: var(--dir-muted);
    margin: 0;
    padding: 0.5rem 0.75rem 0.75rem;
}

/* ------------------------------------------------------------ in-map detail */

.dir-mappanel {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 3;
    display: flex;
    flex-direction: column;
    width: min(23rem, calc(100% - 2rem));
    max-height: calc(100% - 4rem);
    background: #fff;
    border: 1px solid var(--dir-border);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(24, 24, 26, 0.2);
    overflow: hidden;
}

.dir-mappanel[hidden] {
    display: none;
}

.dir-layout:not([data-view="map"]) .dir-mappanel {
    display: none;
}

.dir-mappanel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.625rem 0.5rem 0.625rem 1rem;
    border-bottom: 1px solid var(--dir-border);
}

.dir-mappanel__title {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--dir-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dir-mappanel__close {
    border: 0;
    background: none;
    color: var(--dir-muted);
    font-size: 1.5rem;
    line-height: 1;
    padding: 0 0.5rem;
    cursor: pointer;
}

.dir-mappanel__close:hover {
    color: var(--dir-ink);
}

.dir-mappanel__body {
    overflow-y: auto;
    padding: 1rem;
}

/* --------------------------------------------------------------- detail drawer */

.dir-drawer {
    position: fixed;
    inset: 0;
    z-index: 1060;
}

.dir-drawer__message {
    color: var(--dir-muted);
    margin: 0;
    padding: 1rem 0;
}

.dir-drawer[hidden] {
    display: none;
}

.dir-drawer__scrim {
    position: absolute;
    inset: 0;
    background: rgba(24, 24, 26, 0.4);
}

.dir-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(28rem, 100vw);
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: -8px 0 32px rgba(24, 24, 26, 0.18);
}

.dir-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--dir-border);
}

.dir-drawer__title {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dir-muted);
    margin: 0;
}

.dir-drawer__close {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 6px;
    background: var(--ddx-surface);
    font-size: 1.25rem;
    line-height: 1;
    color: var(--dir-muted);
}

.dir-drawer__close:hover {
    color: var(--dir-ink);
}

.dir-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

body.dir-drawer-open {
    overflow: hidden;
}

.dir-detail__name {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.dir-detail__section {
    margin-bottom: 1.25rem;
}

.dir-detail__heading {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dir-muted);
    margin-bottom: 0.4rem;
}

.dir-detail__count {
    display: inline-block;
    margin-left: 0.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--ddx-surface);
    color: var(--dir-muted);
}

.dir-detail__address {
    font-size: 0.9375rem;
    font-style: normal;
    margin: 0;
}

.dir-detail__contact {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.9375rem;
}

.dir-detail__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--dir-border);
}

/* --------------------------------------------------------------- page footer */

.dir-foot {
    margin-top: 3rem;
    padding-top: 0.5rem;
}

.dir-trees {
    margin-bottom: 2.5rem;
}

.dir-trees__title {
    font-family: var(--ddx-font);
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    color: var(--dir-ink);
    margin: 0 0 1.75rem;
}

.dir-trees__list {
    display: grid;
    gap: 1.25rem;
    list-style: none;
    margin: 0 auto;
    padding: 0;
    max-width: 55rem;
}

@media (min-width: 576px) {
    .dir-trees__list {
        grid-template-columns: 1fr 1fr;
    }
}

.dir-trees__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.45rem;
    padding: 2rem 1.5rem 1.75rem;
    border-radius: 14px;
    text-decoration: none;
    min-height: 100%;
    border: none;
}

.dir-trees__item--labs,
.dir-trees__item--specialists {
    background: #e4e8ff;
}

.dir-trees__item--outsource {
    background: #f5f1ee;
}

.dir-trees__item:hover {
    filter: brightness(0.98);
}

.dir-trees__name {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--dir-ink);
}

.dir-trees__desc {
    display: block;
    font-size: 1rem;
    color: var(--dir-text);
    margin-bottom: 0.65rem;
}

.dir-trees__cta {
    display: inline-block;
    margin-top: auto;
    padding: 0.6rem 1.75rem;
    background: var(--hs1-jordy-300);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 6px;
}

.dir-trees__item:hover .dir-trees__cta {
    background: var(--hs1-jordy-400);
}

/* --------------------------------------------------------------------- mobile */

.dir-map-fab {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    z-index: 40;
    padding: 0.6rem 1.35rem;
    border: none;
    border-radius: 999px;
    background: var(--dir-ink);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(24, 24, 26, 0.3);
}

.dir-map-fab[hidden] {
    display: none;
}

@media (max-width: 991.98px) {
    .dir-filters__toggle {
        display: flex;
    }

    .dir-filters__fields.is-collapsed {
        display: none;
    }

    .dir-filters__fields {
        flex-direction: column;
        align-items: stretch;
    }

    .dir-filters__field {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
    }

    .dir-filters__apply {
        width: 100%;
    }

    .dir {
        padding-bottom: 4rem;
    }

    .dir-layout__map {
        display: none;
    }

    .dir-layout.is-map-open .dir-layout__map {
        display: block;
        margin-bottom: 1rem;
    }

    .dir-layout.is-map-open .dir-layout__results {
        display: none;
    }

    .dir-layout.is-map-open .dir-mappanel {
        display: flex;
    }

    .dir-mappanel {
        inset: 0.5rem 0.5rem auto;
        width: auto;
        max-height: calc(100% - 4.5rem);
    }

    .dir-card {
        flex-direction: column;
        align-items: stretch;
    }

    .dir-card__actions {
        width: 100%;
    }

    .dir-card__action {
        width: 100%;
        text-align: center;
    }

    .dir-drawer__panel {
        top: auto;
        left: 0;
        width: 100%;
        max-height: 88vh;
        border-radius: 14px 14px 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dir-card,
    .dir .is-loading,
    .dir-more__bar-fill {
        transition: none;
    }
}

/* ------------------------------------------------- Wireframe V6 alignment */

/* Breadcrumbs: bold ink links, blue current page. */
.dir-crumbs__list {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dir-ink);
}

.dir-crumbs__link {
    color: var(--dir-ink);
}

.dir-crumbs__sep {
    margin: 0 0.15rem;
    color: var(--dir-ink);
}

.dir-crumbs__current,
.ddx-app--specialist .dir-crumbs__current {
    color: var(--dir-action);
    font-weight: 700;
}

/* Specialist directory: Celeste (teal) action color for buttons, current crumb and focus. */
.ddx-app--specialist .dir {
    --dir-action: var(--hs1-celeste-400);
    --dir-action-hover: var(--hs1-celeste-500);
    --dir-action-soft: var(--hs1-celeste-400);
    --dir-accent: var(--hs1-celeste-400);
    --dir-accent-soft: var(--hs1-celeste-100);
}

/* The results progress bar stays in the shared blue on every directory. */
.ddx-app--specialist .dir-more__bar-fill {
    background: var(--hs1-jordy-400);
}

/* Page head: large display title with a readable lead. */
.dir-head {
    margin: 2.5rem 0 2rem;
}

.dir-head__title {
    font-family: var(--ddx-font-display);
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.dir-head__lead {
    font-size: 1.125rem;
    line-height: 1.4;
    max-width: 44rem;
}

/* Filters: compact labels, rounded selects, solid action button. */
.dir-filters {
    margin-bottom: 1.5rem;
}

.dir-filters__field {
    flex: 0 1 12.5rem;
}

.dir-filters__label {
    font-size: 0.75rem;
}

.dir-filters__select {
    border-radius: 0.5rem;
}

.dir-filters__apply {
    border-radius: 0.5rem;
    font-weight: 600;
}

.dir-map {
    border: 0;
    border-radius: 0;
}

/* Results count: small, regular weight. */
.dir-results-head {
    padding: 2rem 0 1rem;
}

.dir-results-head__count {
    font-size: 0.8125rem;
}

/* Listing cards: display-font name, quiet meta, CTA bottom-right. */
.dir-card {
    align-items: stretch;
    padding: 1.75rem 1.5rem 1.5rem 2rem;
    border-radius: 0.75rem;
}

.dir-card__body {
    align-self: center;
}

.dir-card__actions {
    justify-content: flex-end;
    min-width: 0;
}

.dir-card__name {
    font-family: var(--ddx-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0;
}

.dir-card__meta {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.dir-card__services {
    font-size: 0.875rem;
}

.dir-card__action {
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
}

/* Results footer: compact count + progress bar + page links. */
.dir-more {
    margin-top: 3.5rem;
    max-width: 22rem;
}

.dir-more__bar {
    background: var(--hs1-aluminum-200);
}

.dir-more__bar-fill {
    background: var(--dir-action-soft);
}

/* Other Directories heading uses the display face. */
.dir-trees__title,
.dir-trees__name {
    font-family: var(--ddx-font-display);
    font-weight: 600;
}

.dir-trees__title {
    font-size: 1.5rem;
}

.dir-trees__item {
    border-radius: 0.75rem;
}

/* ------------------------------------------- Services row and "See all" */

.dir-card__services-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 0;
}

.dir-card__services-row .dir-card__services {
    flex: 0 1 auto;
    min-width: 0;
}

.dir-card__see-all {
    flex: 0 0 auto;
    padding: 0;
    background: none;
    border: 0;
    font-family: var(--ddx-font);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--dir-action);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.dir-card__see-all:hover,
.dir-card__see-all:focus-visible {
    color: var(--dir-action-hover);
}

.dir-card__see-all[hidden] {
    display: none;
}

/* Full procedure/specialty list inside the detail panel. */
.dir-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.dir-tag {
    padding: 0.2rem 0.6rem;
    background: var(--dir-accent-soft);
    border-radius: 999px;
    font-size: 0.8125rem;
    color: var(--dir-ink);
}

/* ---------------------------------------- Detail drawer: design language */

/* The drawer and map panel render outside `.dir`, so they need their own tokens. */
.dir-drawer,
.dir-mappanel {
    --dir-action: var(--hs1-jordy-500);
    --dir-action-hover: var(--hs1-jordy-500);
    --dir-accent: var(--hs1-jordy-400);
    --dir-accent-soft: var(--hs1-jordy-100);
    --dir-ink: var(--hs1-true-black);
    --dir-text: var(--hs1-true-black);
    --dir-muted: var(--hs1-aluminum-400);
    --dir-border: var(--hs1-aluminum-200);
    font-family: var(--ddx-font);
    color: var(--dir-text);
}

.ddx-app--specialist .dir-drawer,
.ddx-app--specialist .dir-mappanel {
    --dir-action: var(--hs1-celeste-400);
    --dir-action-hover: var(--hs1-celeste-500);
    --dir-accent: var(--hs1-celeste-400);
    --dir-accent-soft: var(--hs1-celeste-100);
}

.dir-drawer__panel {
    border-radius: 1rem 0 0 1rem;
    overflow: hidden;
}

.dir-drawer__head {
    padding: 1.25rem 1.5rem;
}

.dir-drawer__title {
    font-family: var(--ddx-font-display);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--dir-ink);
}

.dir-drawer__close {
    border-radius: 999px;
    background: var(--hs1-aluminum-100, #f5f1ee);
    color: var(--dir-ink);
}

.dir-drawer__body {
    padding: 1.5rem;
}

.dir-detail__name {
    font-family: var(--ddx-font-display);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.25;
    color: var(--dir-ink);
    margin-bottom: 1.5rem;
}

.dir-detail__section {
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--dir-border);
}

.dir-detail__heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--ddx-font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--dir-ink);
    margin-bottom: 0.6rem;
}

.dir-detail__count {
    margin: 0;
    padding: 0.05rem 0.5rem;
    background: var(--dir-accent-soft);
    color: var(--dir-ink);
    font-size: 0.75rem;
    font-weight: 600;
}

.dir-detail__address,
.dir-detail__contact {
    font-size: 0.9375rem;
    line-height: 1.5;
}

.dir-detail__contact a {
    color: var(--dir-action);
    text-decoration: none;
}

.dir-detail__contact a:hover {
    text-decoration: underline;
}

.dir-tag {
    padding: 0.25rem 0.7rem;
    background: #f5f1ee;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
}

.dir-detail__actions {
    flex-direction: column;
    border-top: 0;
    padding-top: 0;
}

.dir-detail__actions .btn {
    width: 100%;
    border-radius: 0.5rem;
    font-weight: 600;
    text-align: center;
}

.dir-detail__actions .app-btn-outline {
    border: 1px solid var(--dir-action);
    color: var(--dir-action);
    background: #fff;
}

/* ------------------------------------- Drawer: icon rows and scrolling list */

.dir-detail__row,
.dir-detail__contact li {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.dir-detail__row .ddx-icon,
.dir-detail__contact .ddx-icon {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
    color: var(--dir-action);
}

.dir-detail__contact li + li {
    margin-top: 0.4rem;
}

/* Header and actions stay visible; only the procedure list scrolls. */
.dir-drawer__body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Content may be wrapped (cloned card body or API html), so size each level to fill. */
.dir-drawer__body > *,
.dir-drawer__body .dir-detail {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.dir-drawer__body > .dir-drawer__message {
    display: block;
    flex: none;
}

.dir-drawer__body .dir-card__more-body {
    padding-top: 0;
}

.dir-detail__section--scroll {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 6rem;
    border-bottom: 0;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}

.dir-detail__list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin: 0;
    padding: 0 0.5rem 0 1.1rem;
    font-size: 0.9375rem;
    line-height: 1.4;
    list-style: disc;
}

.dir-detail__list li {
    padding: 0.2rem 0;
}

.dir-detail__list li::marker {
    color: var(--dir-muted);
}

.dir-detail__actions {
    flex: none;
    padding-top: 1rem;
    border-top: 1px solid var(--dir-border);
}

/* Icons sit on the vertical center of their content. */
.dir-detail__row,
.dir-detail__contact li {
    align-items: center;
}

.dir-detail__row .ddx-icon,
.dir-detail__contact .ddx-icon {
    margin-top: 0;
    vertical-align: middle;
}

/* ------------------------------- Drawer info rows (address / phone / email) */

.dir-detail__info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--dir-border);
    border-bottom: 1px solid var(--dir-border);
}

.dir-detail__item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dir-detail__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: var(--dir-accent-soft);
    color: var(--dir-action);
    font-size: 1.25rem;
}

.dir-detail__icon .ddx-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
}

.dir-detail__item-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.dir-detail__label {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--dir-muted);
}

.dir-detail__value {
    font-size: 0.9375rem;
    font-style: normal;
    line-height: 1.4;
    color: var(--dir-ink);
    text-decoration: none;
    margin: 0;
    overflow-wrap: anywhere;
}

a.dir-detail__value:hover {
    color: var(--dir-action);
    text-decoration: underline;
}

/* ------------------------- Drawer: accessibility, rhythm, responsiveness */

/* Visible keyboard focus on every interactive element in the panel. */
.dir-drawer a:focus-visible,
.dir-drawer button:focus-visible,
.dir-drawer .dir-detail__list:focus-visible {
    outline: 2px solid var(--dir-action-hover);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* Touch-friendly close target (44px). */
.dir-drawer__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
}

.dir-drawer__close:hover {
    background: var(--hs1-aluminum-200);
}

/* Text and icons use the darker accent step for AA contrast on white. */
.dir-detail__icon,
a.dir-detail__value:hover,
.dir-detail__actions .app-btn-outline {
    color: var(--dir-action-hover);
}

.dir-detail__actions .app-btn-outline {
    border-color: var(--dir-action-hover);
}

/* Primary vs secondary actions: filled primary, outlined secondary, equal size. */
.dir-detail__actions .btn {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
}

.dir-detail__actions .app-btn-outline:hover {
    background: var(--dir-accent-soft);
}

/* Slide in from the right; skipped for reduced-motion users. */
@keyframes dir-drawer-in {
    from { transform: translateX(1.5rem); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.dir-drawer:not([hidden]) .dir-drawer__panel {
    animation: dir-drawer-in 0.18s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .dir-drawer:not([hidden]) .dir-drawer__panel {
        animation: none;
    }
}

/* Small screens: full-width sheet, square edges, tighter padding. */
@media (max-width: 575.98px) {
    .dir-drawer__panel {
        width: 100vw;
        border-radius: 0;
    }

    .dir-drawer__head {
        padding: 0.75rem 1rem;
    }

    .dir-drawer__body {
        padding: 1rem;
    }
}

/* ------------------------------------------------------ Responsive pass
 * Existing breakpoints (991.98 / 575.98). The details drawer is a bottom sheet below 992px,
 * as defined earlier in this file; these rules restore that after the desktop panel styling.
 */
@keyframes dir-sheet-in {
    from { transform: translateY(1.5rem); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@media (max-width: 991.98px) {
    .dir-drawer__panel {
        top: auto;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 88vh;
        max-height: 88dvh;
        border-radius: 1rem 1rem 0 0;
    }

    .dir-drawer:not([hidden]) .dir-drawer__panel {
        animation-name: dir-sheet-in;
    }

    .dir-head { margin: 1.5rem 0; }
    .dir-results-head { padding-top: 1.25rem; }
    .dir-more { margin-top: 2.5rem; }

    .dir-card { padding: 1.25rem; gap: 1rem; }
    .dir-card__actions { justify-content: stretch; }

    /* 44px touch targets for form controls, card actions and the "See more" link. */
    .dir-filters__select,
    .dir-filters__apply,
    .dir-card__action,
    .dir-pagination__page,
    .dir-pagination__step { min-height: 2.75rem; }
    .dir-card__see-all { padding: 0.5rem 0.25rem; }
}

@media (max-width: 575.98px) {
    .dir-head__lead { font-size: 1rem; }
    .dir-card__name { font-size: 1.125rem; }
    .dir-crumbs__list { font-size: 0.875rem; }
    .dir-detail__name { font-size: 1.25rem; }
}

/* Stacked cards: the body must fill the card width so long service lists truncate inside it. */
@media (max-width: 991.98px) {
    .dir-card__body {
        align-self: stretch;
        width: 100%;
        min-width: 0;
    }

    .dir-card__services-row {
        width: 100%;
    }

    .dir-card__services {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Stacked filters: in a column, flex-basis is height, so size fields to their content. */
@media (max-width: 991.98px) {
    .dir-filters__field {
        flex: 0 0 auto;
        min-width: 0;
        width: 100%;
    }

    .dir-filters__fields {
        gap: 0.75rem;
    }
}

/* Small screens: filter chips stack key over value so wrapped text lines up. */
@media (max-width: 991.98px) {
    .dir-filters__toggle { padding-inline: 0; }

    .dir-active__list { width: 100%; }
    .dir-active__list li { max-width: 100%; }

    .dir-active__chip {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "key remove"
            "value remove";
        align-items: center;
        column-gap: 0.75rem;
        row-gap: 0.125rem;
        padding: 0.5rem 0.9rem 0.5rem 1rem;
        border-radius: 1rem;
    }

    .dir-active__chip-key { grid-area: key; }
    .dir-active__chip-value { grid-area: value; line-height: 1.3; }
    .dir-active__chip-remove { grid-area: remove; align-self: center; }
}

/* Chip: center the remove icon on the text line. */
.dir-active__chip {
    align-items: center;
}

.dir-active__chip-remove .ddx-icon {
    display: block;
    width: 1rem;
    height: 1rem;
    vertical-align: 0;
}

/* Drawer content scrolls as a whole if the viewport is short (tablets, landscape), and the
 * action buttons stay pinned at the bottom so they can never be pushed out of view. */
.dir-drawer__body {
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.dir-drawer__body > *,
.dir-drawer__body .dir-detail {
    display: block;
    flex: none;
    min-height: 0;
}

.dir-detail__section--scroll {
    display: block;
    min-height: 0;
}

.dir-detail__list {
    max-height: clamp(8rem, 35dvh, 22rem);
}

.dir-detail__actions {
    position: sticky;
    bottom: 0;
    z-index: 1;
    display: flex;
    margin: 0 -1.5rem -1.5rem;
    padding: 1rem 1.5rem 1.5rem;
    background: #fff;
}

@media (max-width: 575.98px) {
    .dir-detail__actions {
        margin: 0 -1rem -1rem;
        padding: 1rem;
    }
}

/* Buttons sit at the bottom of the panel; the list grows to use spare room. */
.dir-drawer__body {
    display: flex;
    flex-direction: column;
}

.dir-drawer__body > *,
.dir-drawer__body .dir-detail {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
}

.dir-drawer__body > .dir-drawer__message {
    display: block;
    flex: none;
}

.dir-detail__section--scroll {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.dir-detail__list {
    flex: 1 1 auto;
    max-height: max(8rem, 45dvh);
}

.dir-detail__actions {
    margin-top: auto;
}

/* ---------------------------------------------------------------------------
 * Details drawer: bottom sheet at every screen size.
 * Layout: fixed-height panel = header + body. The body holds name, info rows, a procedure
 * list that takes the remaining height and scrolls, and the action buttons at the bottom.
 * ------------------------------------------------------------------------- */
.dir-drawer__panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    margin-inline: auto;
    width: min(40rem, 100%);
    height: min(85vh, 46rem);
    height: min(85dvh, 46rem);
    max-height: none;
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -8px 32px rgba(24, 24, 26, 0.18);
}

.dir-drawer:not([hidden]) .dir-drawer__panel {
    animation: dir-sheet-in 0.18s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .dir-drawer:not([hidden]) .dir-drawer__panel {
        animation: none;
    }
}

.dir-drawer__head {
    flex: none;
}

.dir-drawer__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    padding: 1.5rem;
}

/* The wrapper around the cloned/API markup must not add a box of its own. */
.dir-drawer__body > .dir-card__more-body,
.dir-drawer__body > div:not(.dir-detail) {
    display: contents;
}

.dir-drawer__body .dir-detail {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
}

.dir-drawer__body .dir-detail > * {
    flex: none;
}

.dir-drawer__body .dir-detail__section--scroll {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 6rem;
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

.dir-drawer__body .dir-detail__list {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

.dir-drawer__body .dir-detail__actions {
    position: static;
    display: flex;
    flex-direction: column;
    margin: auto 0 0;
    padding: 1rem 0 0;
    background: none;
    border-top: 1px solid var(--dir-border);
}

@media (max-width: 575.98px) {
    .dir-drawer__panel {
        width: 100%;
    }

    .dir-drawer__body {
        padding: 1rem;
    }

    .dir-drawer__body .dir-detail__actions {
        margin: auto 0 0;
        padding: 0.75rem 0 0;
    }
}

/* Locking page scroll for the drawer must not shift the layout when the scrollbar disappears. */
html:has(body.ddx-app--browse) {
    scrollbar-gutter: stable;
}

/* Drawer header carries the listing name. */
.dir-drawer__title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1.25rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

/* Info rows sit without divider lines. */
.dir-detail__info {
    border-top: 0;
    border-bottom: 0;
    padding-block: 0;
}

/* Info rows: icon circle aligned to the first line of its value; labels stay for screen readers. */
.dir-detail__info {
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.dir-detail__item {
    align-items: flex-start;
    gap: 0.75rem;
}

.dir-detail__icon {
    width: 2rem;
    height: 2rem;
}

.dir-detail__icon .ddx-icon {
    width: 1.125rem;
    height: 1.125rem;
}

.dir-detail__item-text {
    /* Centers the first text line on the 2rem icon circle (2rem - 1.3125rem line) / 2. */
    padding-top: 0.34375rem;
}

.dir-detail__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.dir-detail__value {
    line-height: 1.4;
}

/* Icons are plain glyphs in a box exactly one text line tall, so they sit on the first line. */
.dir-detail__icon {
    width: 1.5rem;
    height: 1.3125rem;
    border-radius: 0;
    background: none;
}

.dir-detail__icon .ddx-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.dir-detail__item-text {
    padding-top: 0;
}

.dir-detail__value {
    font-size: 0.9375rem;
    line-height: 1.3125rem;
}

/* Circle badges again. The first text line is given the badge's own 2rem height, so the badge
 * and the first line share one center, whatever the font metrics. */
.dir-detail__icon {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--dir-accent-soft);
}

.dir-detail__icon .ddx-icon {
    width: 1.125rem;
    height: 1.125rem;
}

.dir-detail__item {
    align-items: flex-start;
}

.dir-detail__item-text {
    padding-top: 0;
}

.dir-detail__value {
    line-height: 1.3125rem;
}

.dir-detail__value::first-line {
    line-height: 2rem;
}
