.nearby { scroll-margin-top: 6rem; }
.nearby .nearby-heading {
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .7rem 2rem;
    margin-bottom: 0;
}
.nearby-heading p, .nearby-group p, .nearby-note {
    margin: 0;
    color: var(--muted);
    font: 500 .91rem/1.5 var(--ui-type);
}
.nearby-heading p { max-width: 44ch; }
.nearby-heading a, .nearby-name {
    color: var(--navy);
    text-underline-offset: .19em;
    text-decoration: underline;
    text-decoration-color: var(--line);
}
.nearby-groups {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
}
.nearby-group { padding: clamp(20px, 2.2vw, 44px) clamp(14px, 2.2vw, 42px) 6px; }
.nearby-group:first-child { padding-left: 0; }
.nearby-group:last-child { padding-right: 0; }
.nearby-group + .nearby-group { border-left: 1px solid var(--line); }
.nearby-group h3 {
    margin: 0 0 .65rem;
    color: var(--ink);
    font: 600 clamp(1.55rem, 2.1vw, 2.7rem)/1.12 var(--serif);
}
.nearby-group ul { list-style: none; margin: 0; padding: 0; }
.nearby-group li { padding: .85rem 0 .4rem; }
.nearby-group li + li { border-top: 1px solid var(--line); }
.nearby-name { font: 700 1.03rem/1.4 var(--ui-type); }
.nearby-group p { margin-top: .3rem; }
.nearby-route {
    display: inline-flex; align-items: center; gap: .4em;
    min-height: 44px; color: var(--navy);
    font: 650 .88rem/1.3 var(--ui-type); text-decoration: none;
}
.nearby-arrow { font-size: 1.1em; color: #7e6237; }
.nearby a:hover, .nearby a:focus-visible { text-decoration: underline; text-decoration-color: currentColor; }
.nearby a:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
.nearby-note { margin-top: .65rem; font-size: .8rem; }
.nearby-atlas {
    border: 1px solid var(--line);
    border-top: 0;
    background: #faf8f1;
}
.nearby-toolbar, .nearby-map-credit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem 1.25rem;
    padding-inline: clamp(12px, 2vw, 28px);
}
.nearby-toolbar { min-height: 60px; padding-block: 6px; border-bottom: 1px solid var(--line); }
.nearby-key { display: flex; flex-wrap: wrap; gap:3px 6px; margin: 0; padding: 0; list-style: none; }
.nearby-key li { display: flex; align-items: center; gap: 7px; font: 650 .9rem/1.3 var(--ui-type); }
.nearby-key button,.nearby-key li > span {
    display:inline-flex; gap:6px; align-items:center; min-height:44px; padding:5px 10px;
    border:1px solid transparent; border-radius:4px; background:none; color:var(--navy); font:inherit;
}
.nearby-key button { cursor:pointer; }
.nearby-key button:hover,.nearby-key button:focus-visible { border-color:var(--line); }
.nearby-key button[aria-pressed=true] { color:#fffaf0; background:#25443f; }
.nearby-key button[aria-pressed=true] .nearby-icon { color:inherit; }
.nearby [hidden] { display:none !important; }
.nearby-spot[data-quiet]:not(:hover):not(:focus-within) .nearby-pin-label { visibility:hidden; }
.nearby-spot[data-quiet] .nearby-pin-label { pointer-events:none; }
.nearby [data-kind="post"] { --pin:#70507b; }
.nearby [data-kind="clinic"] { --pin:#91495b; }
.nearby [data-kind="fuel"] { --pin:#4e5462; }
.nearby [data-kind="parcel"] { --pin:#775233; }
.nearby-category { display:none; }
.nearby [data-kind="gate"] { --pin: #78541d; }
.nearby [data-kind="bus"] { --pin: #345774; }
.nearby [data-kind="shop"] { --pin: #9b5034; }
.nearby [data-kind="pharmacy"] { --pin: #246652; }
.nearby-icon { display: block; width: 21px; height: 21px; flex: none; }
.nearby-key .nearby-icon { color: var(--pin); }
.nearby-zoom { display: flex; flex: none; border: 1px solid var(--line); border-radius: 3px; }
.nearby-zoom button {
    display: grid; place-content: center; width: 44px; height: 44px; border: 0;
    background: transparent; color: var(--navy); font: 500 1.35rem/1 var(--ui-type); cursor: pointer;
}
.nearby-zoom button + button { border-left: 1px solid var(--line); }
.nearby-zoom button:disabled { color: #79776d; cursor: default; }
.nearby-zoom button:enabled:hover { background: #eae6d9; }
.nearby-zoom button:focus-visible, .nearby summary:focus-visible { outline: 2px solid var(--navy); outline-offset: -3px; }
.nearby-viewport {
    position: relative; width: 100%; aspect-ratio: 1200 / 680;
    background: #f1eee1; overflow: auto; overscroll-behavior-x: contain;
}
.nearby-viewport:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; }
.nearby-viewport[data-enlarged] { cursor: grab; }
.nearby-viewport[data-dragging] { cursor: grabbing; user-select: none; }
.nearby-sheet {
    width: var(--sheet-width, 100%); aspect-ratio: 1200 / 680;
    position: relative; container-type: inline-size; isolation: isolate;
}
.nearby-basemap { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.nearby-locality {
    position: absolute; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
    color: #465649; font: italic 600 clamp(14px, 1.15vw, 22px)/1 var(--serif);
    text-shadow: 0 1px 2px #fffdf0, 1px 0 2px #fffdf0, -1px 0 2px #fffdf0;
}
.nearby-road {
    position: absolute; transform: translate(-50%, -50%); pointer-events: none;
    font: 750 .69rem/1.4 var(--ui-type); background: #f7e9b2; color: #56431f;
    border: 1px solid #bc9a51; border-radius: 3px; padding: 0 4px;
}
.nearby-spot { position: absolute; --dx: 0px; --dy: 0px; --lead: 0px; --bearing: 0deg; }
.nearby-spot.leader-west { --dx: -26px; --lead: 26px; --bearing: 180deg; }
.nearby-spot.leader-east { --dx: 26px; --lead: 26px; }
.nearby-spot.leader-north { --dy: -26px; --lead: 26px; --bearing: -90deg; }
.nearby-spot.leader-south { --dy: 26px; --lead: 26px; --bearing: 90deg; }
.nearby-spot::before, .nearby-spot::after { content: ''; position: absolute; pointer-events: none; background: var(--pin); }
.nearby-spot::before { width: var(--lead); height: 2px; transform-origin: left center; transform: translateY(-50%) rotate(var(--bearing)); }
.nearby-spot::after { width: 5px; height: 5px; border-radius: 50%; transform: translate(-50%, -50%); }
.nearby-spot:has(.nearby-pin:is(:hover,:focus-visible)) { z-index: 2; }
.nearby-pin {
    z-index:1;
    position: absolute; left: var(--dx); top: var(--dy); transform: translate(-50%, -50%);
    display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; text-decoration: none;
}
.nearby-medallion {
    width: 35px; height: 35px; display: grid; place-items: center; border: 2px solid #fffdf4;
    border-radius: 50%; color: white; background: var(--pin); box-shadow: 0 1px 4px #263a3650;
}
.nearby-spot[data-kind="gate"] .nearby-medallion { width: 41px; height: 41px; border: 3px double #f8e2b2; }
.nearby-pin-label {
    position: absolute; top: 50%; left: calc(100% - 2px); transform: translateY(-50%);
    padding: 3px 7px; border: 1px solid #c7c6b7; border-radius: 2px;
    background: #fffdf5f5; color: #233c38; white-space: nowrap; font: 700 .84rem/1.35 var(--ui-type);
}
.label-left .nearby-pin-label { left: auto; right: calc(100% - 2px); }
.nearby-spot[data-kind="gate"] .nearby-pin-label {
    top: calc(100% + 1px); left: 50%; right: auto; transform: translateX(-50%);
    background: #233d3b; color: #fff7e2; border-color: #344b45;
}
.nearby-caption-short { display: none; }
.nearby a.nearby-pin:hover, .nearby a.nearby-pin:focus-visible { text-decoration: none; }
.nearby-pin:is(:hover,:focus-visible) .nearby-medallion { box-shadow: 0 0 0 3px #fffdf0, 0 0 0 5px var(--pin); }
.nearby-map-credit {
    flex-wrap: wrap; padding-block: 8px; border-top: 1px solid var(--line);
    color: var(--muted); font: 550 .78rem/1.5 var(--ui-type);
}
.nearby-map-credit a { color: inherit; text-underline-offset: 2px; }
.nearby-modes { display:flex; flex-wrap:wrap; border-bottom:1px solid var(--line); padding-inline:clamp(8px,2vw,28px); }
.nearby-modes button { min-height:46px; padding:6px clamp(8px,1.5vw,20px); border:0; border-bottom:3px solid transparent; background:none; color:var(--navy); font:650 .9rem var(--ui-type); cursor:pointer; }
.nearby-modes [aria-pressed=true] { border-bottom-color:#9a7135; }
.nearby-live iframe { display:block; width:100%; height:clamp(360px,51vw,800px); border:0; }
.nearby [data-kind="mixed"] { --pin:#344943; }
.nearby [data-kind="car"] { --pin:#515779; }
.nearby [data-kind="cafe"] { --pin:#873f4b; }
.nearby [data-kind="leisure"] { --pin:#4a6540; }
.nearby-cluster .nearby-pin { padding:0; border:none; background:transparent; cursor:pointer; }
.nearby-cluster .nearby-medallion { font:700 .97rem/1 var(--ui-type); box-shadow:0 0 0 2px var(--pin),0 2px 6px #263a3650; }
.nearby-place-dialog { width:min(34rem,calc(100% - 1.5rem)); max-height:80dvh; padding:clamp(16px,3vw,30px); border:1px solid var(--line); border-radius:6px; background:#faf8f1; color:var(--ink); }
.nearby-place-dialog::backdrop { background:#14272580; }
.nearby-dialog-header { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.nearby-dialog-header h3 { margin:0; font:600 2rem/1.1 var(--serif); }
.nearby-dialog-header button { min-width:44px; min-height:44px; border:1px solid var(--line); background:none; font-size:1.35rem; color:var(--ink); cursor:pointer; }
.nearby-place-dialog p { margin:.5rem 0 1rem; font:500 .9rem/1.45 var(--ui-type); color:var(--muted); }
.nearby-place-dialog ul { list-style:none; padding:0; margin:0; }
.nearby-place-dialog li { border-top:1px solid var(--line); }
.nearby-place-dialog li a { display:grid; grid-template-columns:auto 1fr; gap:.2rem .75rem; align-items:center; padding:12px 4px; color:var(--navy); text-decoration:none; font:500 .95rem/1.3 var(--ui-type); }
.nearby-place-dialog li a:hover strong { text-decoration:underline; }
.nearby-place-dialog li svg { grid-row:span 2; color:var(--pin); }
.nearby-place-dialog li small { grid-column:2; color:var(--muted); }
.nearby-directory { border-bottom: 1px solid var(--line); }
.nearby-directory summary { cursor: pointer; color: var(--navy); padding: 14px 2px; font: 650 .96rem/1.5 var(--ui-type); }
.nearby-directory[open] .nearby-note { padding-bottom: 12px; }
.nearby-search { display:flex; align-items:end; flex-wrap:wrap; gap:.6rem 1.5rem; margin:.4rem 0 .9rem; font:600 .92rem/1.4 var(--ui-type); }
.nearby-search label { display:grid; gap:.3rem; width:min(100%,26rem); }
.nearby-search input { width:100%; min-height:44px; padding:.55rem .8rem; background:#fffdf6; border:1px solid var(--line); border-radius:3px; font:inherit; }
.nearby-directory .nearby-groups { align-items:start; display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,20rem),1fr)); gap:0 1.5rem; }
.nearby-directory .nearby-group { padding:0; border:0; border-top:1px solid var(--line); }
.nearby-group summary { padding:12px 2px; }
.nearby-group small { margin-left:.35rem; font-variant-numeric:tabular-nums; color:var(--muted); }
@container (max-width: 750px) {
    .nearby-pin-label { font-size: .73rem; }
}
@container (max-width: 620px) {
    .nearby-road, .nearby-locality, .nearby-caption-long { display: none; }
    .nearby-caption-short { display: inline; }
    .nearby-pin-label { font-size: 10px; line-height: 1.2; padding: 1px 3px; }
    .nearby-medallion { width: 30px; height: 30px; }
    .nearby-medallion .nearby-icon { width: 18px; height: 18px; }
    .nearby-spot[data-kind="gate"] .nearby-medallion { width: 35px; height: 35px; }
    .nearby-spot[data-kind="gate"] { --dy: -12px; --lead: 12px; --bearing: -90deg; }
    .nearby-spot[data-kind="gate"] .nearby-pin-label { left: auto; right: calc(100% - 3px); top: 50%; transform: translateY(-50%); }
    .nearby-spot[data-kind="bus"] .nearby-pin-label {
        top: calc(100% - 8px); left: 50%; right: auto; transform: translateX(-50%);
    }
    .nearby-spot[data-kind="pharmacy"].label-left .nearby-pin-label {
        top: 0; left: 50%; right: auto; transform: translate(-50%, -50%);
    }
    .leader-south .nearby-pin-label { left: calc(100% - 3px); }
}
@media (max-width: 550px) {
    .nearby-toolbar { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px; padding:8px; align-items:start; }
    .nearby-key { display:flex; gap:0; }
    .nearby-key button { padding-inline:6px; }
    .nearby-toolbar:has(.nearby-category) .nearby-key { display:none; }
    .nearby-category {
        display:block; width:100%; min-height:44px; padding:6px 9px; font:650 .9rem var(--ui-type);
        color:var(--navy); background:#fffdf6; border:1px solid var(--line); border-radius:3px;
    }
    .nearby-key li { font-size: .78rem; gap: 5px; }
    .nearby-key .nearby-icon { width: 17px; height: 17px; }
}
@media (max-width: 360px) {
    .nearby-toolbar { padding-inline: 6px; }
    .nearby-key { column-gap: 6px; }
}
@media (max-width: 760px) {
    .nearby-groups { display: block; }
    .nearby-group { padding: 20px 0 8px; }
    .nearby-group + .nearby-group { border-left: 0; border-top: 1px solid var(--line); }
    .nearby-group h3 { margin-bottom: .25rem; }
    .nearby-group li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: .8rem 0; }
    .nearby-group p { grid-column: 1; margin: 0; }
    .nearby-route { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 440px) {
    .nearby-group li { display: block; padding: .85rem 0 .3rem; }
    .nearby-group p { margin-top: .2rem; }
}
