/* Touch: no double-tap zoom or tap delay on controls; no grey tap flash. */
button, summary, a, input, select, label, .leaflet-control a { touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
.toolbar, .search-menu, .layer-menu, .directions-menu, .research-dock { overscroll-behavior:contain; }
@media (max-width:640px), (pointer:coarse) {
  .toolbar .years input { min-height:40px; }
  .layer-menu a { display:inline-block; padding:10px 0; }
  .layer-menu .toggle { min-height:40px; display:flex; align-items:center; gap:8px; }
}

/* Historic transit legend, hover labels and popups */
.transit-legend { display:flex; flex-wrap:wrap; gap:4px 12px; margin:2px 0 0; color:var(--hd-muted); font:11px/1.3 system-ui,sans-serif; }
.transit-legend span { display:flex; align-items:center; gap:5px; }
.transit-legend i { display:inline-block; width:18px; height:4px; border-radius:2px; box-shadow:0 0 0 1px #0006; }
.transit-legend i.is-dashed { background-image:repeating-linear-gradient(90deg, transparent 0 3px, var(--hd-surface) 3px 5px) !important; }
#historic-transit-status { margin:2px 0 0; color:var(--hd-muted); font:11px/1.35 system-ui,sans-serif; }
.leaflet-tooltip.transit-tip { padding:3px 7px; border:0; border-radius:5px; background:#202724ee; color:#f1f0e9; font:600 12px system-ui,sans-serif; box-shadow:0 2px 8px #0005; }
.leaflet-tooltip.transit-tip::before { display:none; }
.transit-popup strong { display:block; font-size:13.5px; }
.transit-popup p { margin:3px 0 5px; color:#5c645f; font-size:12px; }
.transit-popup a { font-size:12px; }
.transit-popup .transit-evidence { margin:0 0 6px; font-size:11.5px; line-height:1.35; max-width:240px; }

/* Search refinements: order and "existed in" filter */
.search-refine { display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; margin:8px 0 0; color:var(--hd-muted); font:11px/1.3 system-ui,sans-serif; }
.search-refine .search-sort { display:flex; align-items:center; gap:6px; }
.search-refine select { min-height:30px; padding:4px 6px; border:1px solid var(--hd-line); border-radius:6px; background:var(--hd-surface); color:var(--hd-text); font:12px system-ui,sans-serif; }
.search-refine .search-present { display:flex; align-items:center; gap:5px; cursor:pointer; color:var(--hd-text); }
.search-refine input[type=checkbox] { margin:0; accent-color:var(--hd-ink); }
@media (max-width:600px) { .search-refine select { min-height:40px; } .search-refine .search-present { min-height:40px; } }

/* Copy-link button */
.toolbar button.share-link { font:inherit; }
.toolbar button.share-link:focus-visible { outline:2px solid var(--hd-ink); outline-offset:2px; }
.share-link-note { position:absolute; left:0; top:50px; padding:5px 9px; border-radius:6px; background:var(--hd-surface); color:var(--hd-text); border:1px solid var(--hd-line); box-shadow:0 3px 18px #0004; font:12px system-ui,sans-serif; white-space:nowrap; opacity:0; pointer-events:none; transition:opacity .2s; }
.share-link-note.is-visible { opacity:1; }

/* Swipe comparison divider */
.compare-handle { position:absolute; z-index:1000; width:28px; margin-left:-14px; cursor:ew-resize; touch-action:none; outline:none; }
.compare-line { position:absolute; left:13px; top:0; bottom:0; width:2px; background:#fffdf8; box-shadow:0 0 6px #0009; }
.compare-grip { position:absolute; left:50%; top:50%; width:34px; height:34px; margin:-17px 0 0 -17px; display:grid; place-items:center; border-radius:50%; background:var(--hd-surface); color:var(--hd-text); border:1px solid var(--hd-line); box-shadow:0 3px 14px #0006; }
.compare-grip svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.compare-handle:focus-visible .compare-grip, .compare-handle.is-dragging .compare-grip { outline:2px solid var(--hd-ink); outline-offset:2px; }
/* Year pickers either side of the divider: the left one is the toolbar year, the right one today or a second year */
.compare-pick { position:absolute; top:76px; display:block; }
.compare-pick.is-then { right:22px; }
.compare-pick.is-now { left:22px; }
.compare-pick::after { content:""; position:absolute; right:8px; top:50%; width:5px; height:5px; margin-top:-4px; border:solid #f1f0e9; border-width:0 1.6px 1.6px 0; transform:rotate(45deg); pointer-events:none; }
.compare-pick select { appearance:none; -webkit-appearance:none; min-height:28px; padding:4px 24px 4px 9px; border:1px solid #ffffff38; border-radius:6px; background:#202724e6; color:#f1f0e9; font:600 12px system-ui,sans-serif; font-variant-numeric:tabular-nums; cursor:pointer; box-shadow:0 2px 10px #0006; }
.compare-pick select:hover { background:#2b3430f0; }
.compare-pick select:focus-visible { outline:2px solid var(--hd-ink); outline-offset:2px; }
.compare-pick option { background:#202724; color:#f1f0e9; }
@media (max-width:600px) { .compare-pick { top:70px; } }
@media (pointer:coarse) { .compare-pick select { min-height:36px; font-size:13px; } }

/* Compare tool button: inverted while the divider is showing */
.toolbar button.compare-tool { flex:none; font:inherit; }
.toolbar button.compare-tool:focus-visible { outline:2px solid var(--hd-ink); outline-offset:2px; }
.toolbar button.compare-tool.is-on, .toolbar button.compare-tool.is-on:hover { background:var(--hd-text); color:var(--hd-surface); border-color:var(--hd-text); }
/* Visible label: testing showed the comparison was the feature people wanted, and an unlabeled icon hid it. Icon only on phones, where the toolbar is full. */
.toolbar button.compare-tool { width:auto; padding:0 15px 0 12px; grid-auto-flow:column; gap:7px; }
.toolbar button.compare-tool .compare-label { font-size:15px; font-weight:500; line-height:1; }
@media (max-width:600px) { .toolbar button.compare-tool { width:42px; padding:0; gap:0; } .toolbar button.compare-tool .compare-label { display:none; } }
