/* Directions inside Find a place */
.search-row { display:flex; align-items:stretch; gap:6px; }
.search-row #historic-places-search { flex:1; min-width:0; }
.search-directions-open { flex:none; width:40px; min-height:40px; display:grid; place-items:center; padding:0; border:1px solid var(--hd-line); border-radius:6px; background:var(--hd-surface); color:var(--hd-text); cursor:pointer; }
.search-directions-open:hover { background:var(--hd-soft); }
.search-directions-open:focus-visible { outline:2px solid var(--hd-ink); outline-offset:2px; }
.search-directions-open svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.search-menu.is-directions { width:min(340px,calc(100vw - 28px)); }

.search-directions { font:13px/1.4 system-ui,sans-serif; animation:directions-in .18s ease-out; }
@keyframes directions-in { from { opacity:0; transform:translateY(-3px); } to { opacity:1; transform:none; } }
.search-directions * { box-sizing:border-box; }
.search-directions button { font:inherit; color:var(--hd-text); cursor:pointer; }
.search-directions :focus-visible { outline:2px solid var(--hd-ink); outline-offset:2px; }
.directions-back { display:block; max-width:100%; margin:-2px 0 6px -4px; padding:3px 6px; border:0; border-radius:5px; background:transparent; color:var(--hd-muted) !important; font-size:12px !important; text-align:left; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.directions-back:hover { background:var(--hd-soft); color:var(--hd-text) !important; }
.directions-head { display:flex; align-items:center; gap:6px; }
.directions-head strong { font:650 15px system-ui,sans-serif; }
.directions-head span { flex:1; color:var(--hd-muted); font-size:12px; }
.directions-exit, .directions-close { flex:none; width:30px; height:30px; display:grid; place-items:center; padding:0; border:0; border-radius:6px; background:transparent; }
.directions-exit { margin-left:-6px; }
.directions-exit svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.directions-close { margin-right:-6px; font-size:20px !important; line-height:1; }
.directions-exit:hover, .directions-close:hover { background:var(--hd-soft); }

/* Travel mode */
.directions-modes { display:flex; gap:6px; margin:9px 0; }
.directions-modes button { flex:1; display:flex; align-items:center; justify-content:center; gap:6px; min-height:36px; border:1px solid var(--hd-line); border-radius:999px; background:transparent; font-size:12.5px !important; font-weight:600; transition:background-color .15s, color .15s, border-color .15s; }
.directions-modes button[aria-checked=true] { background:var(--hd-text); border-color:var(--hd-text); color:var(--hd-surface) !important; }
.directions-modes svg, .directions-swap svg, .directions-locate svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

/* From / To */
.directions-fields { position:relative; display:grid; gap:6px; padding-right:40px; }
.directions-field { position:relative; display:flex; align-items:center; gap:8px; }
.directions-dot { flex:none; width:10px; height:10px; border-radius:50%; border:2px solid #fff; box-shadow:0 0 0 1px #0004; }
.directions-dot.is-start { background:#368bdf; } .directions-dot.is-end { background:#da946b; border-radius:2px; }
.directions-field input { flex:1; min-width:0; min-height:40px; padding:8px 36px 8px 10px; border:1px solid var(--hd-line); border-radius:8px; background:var(--hd-surface); color:var(--hd-text); font:15px system-ui,sans-serif; }
.directions-field input.is-set { border-color:light-dark(#2f6b45,#9fd3ae); }
.directions-locate { position:absolute; right:4px; top:4px; width:32px; height:32px; display:grid; place-items:center; padding:0; border:0; border-radius:6px; background:transparent; }
.directions-locate:hover, .directions-swap:hover { background:var(--hd-soft); }
.directions-swap { position:absolute; right:0; top:26px; width:34px; height:34px; display:grid; place-items:center; padding:0; border:1px solid var(--hd-line); border-radius:50%; background:var(--hd-surface); }
/* Suggestions open inside the panel (it scrolls), under the field they belong to */
.directions-field { flex-wrap:wrap; min-width:0; }
.directions-suggest { flex:0 0 calc(100% - 18px); min-width:0; overflow:hidden; margin:2px 0 0 18px; padding:4px; list-style:none; border:1px solid var(--hd-line); border-radius:8px; background:var(--hd-surface); box-shadow:0 4px 12px #0003; }
.directions-suggest button { display:block; width:100%; padding:7px 8px; border:0; border-radius:6px; background:transparent; text-align:left; }
.directions-suggest button:hover, .directions-suggest button:focus-visible { background:var(--hd-soft); }
.directions-suggest strong { display:block; font-size:13px; font-weight:600; }
.directions-suggest span { display:block; color:var(--hd-muted); font-size:11.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.directions-none { padding:7px 8px; color:var(--hd-muted); font-size:12px; }

.directions-status { margin:8px 0 0; color:var(--hd-muted); font-size:12px; }
.directions-status:empty { display:none; }

/* Result: one line; the route itself is on the map */
.directions-summary { display:flex; align-items:baseline; gap:8px; margin-top:10px; padding-top:9px; border-top:1px solid var(--hd-line); animation:directions-in .2s ease-out; }
.directions-summary strong { font:650 18px system-ui,sans-serif; color:light-dark(#2f6b45,#9fd3ae); }
.directions-summary span { flex:1; color:var(--hd-muted); font-size:12.5px; }
.directions-clear { padding:4px 10px; border:1px solid var(--hd-line); border-radius:999px; background:transparent; font-size:12px !important; }
.directions-clear:hover { background:var(--hd-soft); }

.directions-about { margin-top:9px; color:var(--hd-muted); font-size:11.5px; }
.directions-about summary { cursor:pointer; }
.directions-about p { margin:6px 0 0; }
.directions-about a { color:inherit; text-decoration:underline; }

/* The route line fades in rather than appearing at once */
.leaflet-directions-route-pane path.directions-route { animation:route-in .45s ease-out; }
@keyframes route-in { from { opacity:0; } }

@media (prefers-reduced-motion: reduce) {
  .search-directions, .directions-summary, .leaflet-directions-route-pane path.directions-route { animation:none; }
}
@media (pointer:coarse) { .directions-field input, .directions-modes button, .search-directions-open { min-height:44px; } .search-directions-open { width:44px; } .directions-locate { top:6px; } .directions-swap { top:30px; } }
@media (max-width:540px) {
  .search-menu.is-directions { width:calc(100vw - 20px); }
}
/* Phones: the year, its span and the four toolbar buttons share the top row (kept from the old directions panel) */
@media (max-width:640px) {
  .toolbar { max-width:calc(100% - 20px); }
  .toolbar .years { flex:none; }
}
