.nearby-page {
    --nearby-map-height: clamp(520px, 62vh, 660px);
    padding-bottom: clamp(36px, 6vw, 72px);
}

.nearby-page .nearby-intro {
    padding: clamp(28px, 5vw, 56px) 0 20px;
}

.nearby-intro h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 54px);
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: -.065em;
    word-break: keep-all;
}

.nearby-intro p {
    max-width: 53ch;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: clamp(14px, 1.6vw, 16px);
    line-height: 1.65;
    word-break: keep-all;
}

.nearby-page .nearby-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px 16px;
    margin-bottom: 14px;
    padding: 0;
}

.nearby-field {
    display: grid;
    min-width: 0;
    gap: 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.nearby-field select {
    min-height: 44px;
    max-width: 100%;
    margin: 0;
    padding: 0 28px 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
}

.nearby-toolbar .btn {
    min-height: 44px;
    cursor: pointer;
}

.nearby-toolbar .btn:disabled {
    opacity: .55;
    cursor: default;
}

.nearby-page .nearby-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(275px, 31%);
    align-items: start;
    gap: 14px;
    padding: 0;
}

.nearby-map-panel {
    position: relative;
    min-width: 0;
}

.nearby-map {
    width: 100%;
    height: var(--nearby-map-height);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--soft);
}

.nearby-search-area {
    position: absolute;
    z-index: 2;
    top: 14px;
    left: 50%;
    translate: -50% 0;
    width: max-content;
    max-width: calc(100% - 32px);
    min-height: 44px;
    padding: 8px 15px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--brand-dark);
    box-shadow: var(--soft-shadow);
    font-weight: 800;
    line-height: 1.3;
    cursor: pointer;
}

.nearby-search-area:hover:not(:disabled) {
    background: var(--soft);
}

.nearby-search-area:disabled {
    cursor: default;
    color: var(--muted);
}

.nearby-map-message {
    position: absolute;
    z-index: 2;
    top: 70px;
    left: 50%;
    translate: -50% 0;
    width: max-content;
    max-width: calc(100% - 32px);
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-strong);
    color: var(--muted);
    box-shadow: var(--soft-shadow);
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    word-break: keep-all;
    overflow-wrap: anywhere;
    pointer-events: none;
}

.nearby-page [hidden],
.nearby-map-message:empty {
    display: none;
}

.nearby-results {
    display: flex;
    min-width: 0;
    max-height: var(--nearby-map-height);
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--surface);
}

.nearby-results-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 4px 12px;
    padding: 15px 16px 11px;
    border-bottom: 1px solid var(--line);
}

.nearby-results-heading h2 {
    margin: 0;
    color: var(--ink);
    font-size: 20px;
    line-height: 1.3;
    letter-spacing: -.045em;
}

.nearby-count {
    margin: 0;
    color: var(--herb);
    font-size: 13px;
    font-weight: 700;
}

.nearby-sort {
    flex-basis: 100%;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.nearby-results-list {
    min-height: 0;
    margin: 0;
    padding: 7px;
    overflow-y: auto;
    list-style: none;
}

.nearby-results-list > :where(li, .nearby-result) + :where(li, .nearby-result) {
    margin-top: 3px;
}

.nearby-empty {
    padding: 14px 10px;
    color: var(--muted);
    font-size: 14px;
}

.nearby-result {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    min-height: 58px;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--ink);
    text-align: start;
    cursor: pointer;
}

.nearby-result:hover {
    background: var(--paper);
}

.nearby-result[aria-pressed="true"] {
    border-color: var(--line);
    background: var(--soft);
    color: var(--brand-dark);
}

.nearby-result > img {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--soft);
    object-fit: cover;
}

.nearby-result-copy {
    display: grid;
    flex: 1 1 auto;
    min-width: 0;
    gap: 2px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.nearby-result-copy strong {
    font-size: 15px;
}

.nearby-result-copy small,
.nearby-card-copy :is(p, small) {
    color: var(--muted);
    font-size: 13px;
}

.nearby-result-distance,
.nearby-card-distance {
    color: var(--herb);
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.nearby-result-distance {
    flex-shrink: 0;
    white-space: nowrap;
}

.nearby-map-panel > .nearby-selection {
    margin-top: 12px;
}

.nearby-selection {
    min-width: 0;
}

.nearby-card {
    display: flex;
    align-items: center;
    gap: clamp(10px, 2vw, 16px);
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.nearby-card-image {
    display: block;
    flex: 0 0 auto;
    width: clamp(60px, 14vw, 86px);
    aspect-ratio: 1;
    border-radius: 9px;
    overflow: hidden;
    background: var(--soft);
    object-fit: cover;
}

.nearby-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nearby-card-copy {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.nearby-card-copy :is(h2, h3, p) {
    margin: 0;
}

.nearby-card-copy :is(h2, h3, strong) {
    font-size: clamp(16px, 2vw, 20px);
    letter-spacing: -.035em;
}

.nearby-card-copy a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--brand-dark);
    font-weight: 750;
    text-decoration: underline;
    text-underline-offset: .2em;
}

.nearby-pin {
    display: grid;
    place-items: center;
    min-width: 32px;
    min-height: 32px;
    padding: 0 7px;
    border: 2px solid var(--surface-strong);
    border-radius: 999px;
    background: var(--herb);
    color: #fff;
    box-shadow: 0 2px 8px rgb(36 40 33 / 30%);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.nearby-pin:is(:hover, [aria-pressed="true"]) {
    background: var(--brand);
}

.nearby-pin:not(.nearby-cluster)::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    content: "";
}

.nearby-cluster {
    min-width: 38px;
    min-height: 38px;
    background: var(--brand-dark);
}

.nearby-user-position {
    display: block;
    width: 16px;
    height: 16px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #2263b9;
    box-shadow: 0 0 0 5px rgb(34 99 185 / 28%);
}

.nearby-page :is(button, a, select):focus-visible {
    outline: 2px solid var(--brand-dark);
    outline-offset: 2px;
}

.nearby-page .nearby-pin:focus-visible {
    outline-color: var(--ink);
}

@media (max-width: 760px) {
    .nearby-page {
        --nearby-map-height: clamp(280px, 49vh, 435px);
    }

    .nearby-page .nearby-intro {
        padding-bottom: 16px;
    }

    .nearby-page .nearby-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .nearby-layout > .nearby-results {
        order: 1;
    }

    .nearby-results {
        max-height: none;
    }

    .nearby-results-list {
        overflow-y: visible;
    }
}

@media (max-width: 420px) {
    .nearby-page .nearby-toolbar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .nearby-field select {
        width: 100%;
    }

    .nearby-toolbar .btn {
        width: 100%;
    }

    .nearby-toolbar .nearby-list-link {
        grid-column: 1 / -1;
    }
}
