/* Hawley burials: register search + churchyard map. Everything is scoped under .hb so it
   can sit inside any WordPress theme without clashing. */
.hb {
  --hb-ink: #2a2a28;
  --hb-muted: #66635c;
  --hb-line: #d9d4c7;
  --hb-paper: #fffdf8;
  --hb-bg: #f6f4ef;
  --hb-on-map: #1f6b5c;      /* register + map */
  --hb-not-map: #5b6b85;     /* register only */
  --hb-map-only: #9a5b1e;    /* map only */
  --hb-hl: #c0392b;          /* highlighted plot */
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 16px;
  height: min(86vh, 980px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--hb-ink);
  box-sizing: border-box;
}
.hb *, .hb *::before, .hb *::after { box-sizing: border-box; }
/* guard against WordPress theme styles that would break the map or restyle the controls */
/* Leaflet 1.9.4 blends tiles with plus-lighter, which makes the light lines where tiles meet worse in Safari; the gaps themselves are closed in the JS (SeamlessTiles) */
.hb .leaflet-container img.leaflet-tile { mix-blend-mode: normal; }
.hb .leaflet-container img, .hb .leaflet-container svg { max-width: none !important; max-height: none !important; box-shadow: none !important; border: 0 !important; margin: 0 !important; padding: 0 !important; }
.hb button { text-transform: none; letter-spacing: normal; line-height: 1.3; min-height: 0; box-shadow: none; }
.hb h2, .hb h3, .hb h4 { letter-spacing: normal; text-transform: none; font-family: inherit; line-height: 1.3; }
.hb .hb-group h3 { text-transform: uppercase; letter-spacing: 0.06em; }
.hb input[type=search] { box-shadow: none; height: auto; }
.hb .leaflet-bar a, .hb .leaflet-control-layers-toggle { text-decoration: none !important; }
.hb pre { background: none; border: 0; padding: 0; overflow: visible; font-size: inherit; line-height: 1.45; }

.hb-panel {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--hb-paper); border: 1px solid var(--hb-line); border-radius: 8px;
}
.hb-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--hb-line); }
.hb-head h2 { font-size: 1.15rem; margin: 0 0 4px; font-weight: 600; }
.hb-head p { margin: 0 0 10px; color: var(--hb-muted); font-size: 0.9rem; }
.hb-form { display: flex; gap: 6px; }
.hb-form input {
  flex: 1 1 auto; min-width: 0; width: auto; max-width: none; margin: 0; font: inherit; padding: 9px 11px;
  border: 1px solid #b9b3a4; border-radius: 6px; background: #fff; color: var(--hb-ink);
}
.hb-form input:focus { outline: 2px solid var(--hb-on-map); outline-offset: 1px; }
.hb-form button {
  flex: 0 0 auto; margin: 0; font: inherit; padding: 9px 14px; border: 0; border-radius: 6px;
  background: var(--hb-on-map); color: #fff; cursor: pointer;
}
.hb-hint { margin-top: 6px; font-size: 0.8rem; color: var(--hb-muted); }

.hb-results { flex: 1; overflow-y: auto; padding: 8px 12px 16px; min-height: 0; }
.hb-group { margin: 10px 0 4px; }
.hb-group h3 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--hb-muted);
  margin: 14px 4px 6px; font-weight: 600;
}
.hb-item {
  border: 1px solid var(--hb-line); border-left: 4px solid var(--hb-c, #999);
  border-radius: 6px; padding: 8px 10px; margin: 6px 0; background: #fff;
}
.hb-item.c1 { --hb-c: var(--hb-on-map); }
.hb-item.c2 { --hb-c: var(--hb-not-map); }
.hb-item.c3 { --hb-c: var(--hb-map-only); }
.hb-item .n { font-weight: 600; }
.hb-item .meta { color: var(--hb-muted); font-size: 0.85rem; }
.hb-item .where { margin-top: 4px; font-size: 0.9rem; }
.hb .about { font-size: 0.85rem; color: #4d4a44; margin-top: 3px; font-style: italic; }
.hb-notable-btn { margin-top: 8px; font: inherit; font-size: 0.85rem; background: none; border: 0; padding: 0; color: #8e1b3a; cursor: pointer; text-decoration: underline; }
.hb-startag { font-size: 0.72rem; font-weight: 600; color: #8e1b3a; white-space: nowrap; }
.hb-notable { color: #8e1b3a; font-weight: 600; margin: 2px 0 6px; }
.hb .hb-star { color: #8e1b3a; font-size: 20px; line-height: 22px; text-align: center; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 5px #fff; cursor: pointer; }
.hb-star-key { color: #8e1b3a; display: inline-block; width: 14px; margin-right: 6px; text-align: center; }
.hb-item .fuzzy { font-size: 0.75rem; color: var(--hb-muted); font-style: italic; }
.hb-link {
  font: inherit; font-size: 0.85rem; border: 1px solid var(--hb-on-map); color: var(--hb-on-map);
  background: #fff; border-radius: 4px; padding: 1px 8px; margin-left: 4px; cursor: pointer; white-space: nowrap;
}
.hb-link:hover, .hb-link:focus { background: var(--hb-on-map); color: #fff; }
.hb-msg { padding: 10px 12px; margin: 10px 0; border-radius: 6px; background: #f3efe4; font-size: 0.92rem; }
.hb-more { font: inherit; font-size: 0.85rem; background: none; border: 0; color: var(--hb-on-map); cursor: pointer; padding: 4px; text-decoration: underline; }
.hb-foot { padding: 8px 14px; border-top: 1px solid var(--hb-line); font-size: 0.75rem; color: var(--hb-muted); }

.hb-mapwrap { position: relative; min-height: 0; border: 1px solid var(--hb-line); border-radius: 8px; overflow: hidden; }
.hb-map { position: absolute; inset: 0; background: #e9e4d8; }
.hb .leaflet-container { font: inherit; font-size: 13px; }
.hb .hb-planimg { background: #fffdf8; }
.hb .leaflet-popup-content { margin: 10px 12px; min-width: 220px; max-width: 320px; }
.hb-pop h4 { margin: 0 0 4px; font-size: 1rem; }
.hb-pop ul { margin: 4px 0; padding-left: 18px; }
.hb-pop .meta { color: var(--hb-muted); }
.hb-pop-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 0.85rem; }
.hb-info-btn { border: 1px solid var(--hb-line); background: #fff; color: var(--hb-muted); border-radius: 50%; width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.hb-info-btn:hover, .hb-info-btn:focus, .hb-info-btn.on { color: #fff; background: var(--hb-on-map); border-color: var(--hb-on-map); }
.hb-info { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--hb-line); font-size: 0.8rem; max-height: 220px; overflow-y: auto; }
.hb-info-h { font-weight: 600; color: var(--hb-ink); }
.hb-pop pre { white-space: pre-wrap; font: inherit; margin: 4px 0 0; color: var(--hb-muted); }
.hb-pop .tag { display: inline-block; font-size: 0.75rem; padding: 0 6px; border-radius: 3px; background: #eee; margin-left: 4px; }

.hb-legend, .hb-north {
  background: rgba(255, 253, 248, 0.94); border: 1px solid var(--hb-line); border-radius: 6px;
  padding: 6px 8px; font-size: 12px; line-height: 1.5;
}
.hb-legend i { display: inline-block; width: 14px; height: 10px; margin-right: 6px; vertical-align: -1px; border: 2px solid; }
.hb-north { padding: 4px; text-align: center; }
.hb-north svg { display: block; }

/* WordPress: the shortcode widens the widget beyond the theme's text column (sized by the script) */
.hb-wrap { margin: 1.5em 0; }
.hb-breakout { max-width: none !important; margin-right: 0 !important; }
@media (min-width: 761px) { .hb-breakout .hb { height: min(84vh, 900px); } }

@media (max-width: 760px) {
  .hb { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 70vh; height: auto; }
  .hb-panel { max-height: 60vh; }
  .hb-legend { font-size: 10px; padding: 4px 6px; }
  .hb.hb-popup-open .hb-north, .hb.hb-popup-open .hb-legend { visibility: hidden; }
}

/* ---- three maps (rev 32): the map switcher, the opening-view labels and the turn */
.hb .hb-switch { display: flex; background: #fff; overflow: hidden; }
.hb .hb-switch button {
  margin: 0; border: 0; border-right: 1px solid #ccc; background: #fff; color: var(--hb-ink); font: 600 12px/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  padding: 8px 9px; cursor: pointer; white-space: nowrap;
}
.hb .hb-switch button:last-child { border-right: 0; }
.hb .hb-switch button:hover { background: #f1efe8; }
.hb .hb-switch button.on { background: var(--hb-on-map); color: #fff; }
.hb .hb-label { background: none; border: 0; }
.hb .hb-label span {
  position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: none;
  font-family: Georgia, "Times New Roman", serif; color: #3d3a33;
}
.hb .hb-label-map span {
  transform: translate(-50%, -50%); font-size: 15px; font-weight: bold; padding: 3px 8px;
  background: rgba(255, 253, 248, 0.88); border: 1px solid #b9b3a4; border-radius: 4px;
}
.hb .hb-label-road span { font-size: 14px; font-style: italic; letter-spacing: 0.08em; color: #5c584e; }
.hb .hb-ovimg { image-rendering: auto; }
.hb .leaflet-container { background: #ebe7dc; }
/* while the map turns, hide the things that would spin with it */
.hb.hb-turning .leaflet-tooltip-pane, .hb.hb-turning .leaflet-popup-pane, .hb.hb-turning .leaflet-marker-pane { visibility: hidden; }
@media (max-width: 760px) { .hb .hb-switch button { padding: 7px 6px; font-size: 11px; } }

/* ---- the grave finder (experimental) */
.hb .hb-locate a { font-size: 17px; line-height: 30px; text-align: center; }
.hb .hb-pop-find { margin-top: 8px; }
.hb .hb-find-btn { margin: 0; font: inherit; font-size: 0.9rem; padding: 6px 10px; border: 0; border-radius: 6px; background: #c0392b; color: #fff; cursor: pointer; }
.hb .hb-me { position: relative; }
.hb .hb-me-dot { position: absolute; left: -8px; top: -8px; width: 16px; height: 16px; border-radius: 50%; background: #2a6fdb; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 1px 4px rgba(0,0,0,.4); }
.hb .hb-finder {
  display: none; position: absolute; z-index: 98; left: 50%; bottom: 12px; transform: translateX(-50%);
  width: min(92%, 380px); padding: 10px 34px 10px 12px; background: rgba(255, 253, 248, 0.97);
  border: 1px solid #b9b3a4; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.2); font-size: 14px; line-height: 1.35;
}
.hb .hb-finder-row { display: flex; align-items: center; gap: 10px; }
.hb .hb-finder-arrow { flex: 0 0 auto; transition: transform .25s linear; }
.hb .hb-finder-txt { font-weight: 600; }
.hb .hb-finder-note { color: var(--hb-muted); font-size: 12px; margin-top: 4px; }
.hb .hb-finder-x { position: absolute; right: 6px; top: 4px; margin: 0; border: 0; background: none; font-size: 20px; line-height: 1; color: #666; cursor: pointer; padding: 2px 6px; }
.hb .hb-cross { position: absolute; z-index: 65; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; pointer-events: none;
  background: linear-gradient(#c0392b, #c0392b) center / 2px 100% no-repeat, linear-gradient(#c0392b, #c0392b) center / 100% 2px no-repeat; }
.hb .hb-cal {
  position: absolute; z-index: 98; left: 8px; top: 8px; width: min(320px, calc(100% - 70px)); max-height: 46%; overflow: auto;
  margin-left: 56px; padding: 8px 10px; background: rgba(255, 253, 248, 0.97); border: 1px solid #b9b3a4; border-radius: 8px; font-size: 12.5px; line-height: 1.35;
}
.hb .hb-cal-h { font-weight: 700; margin-bottom: 3px; }
.hb .hb-cal-help { color: var(--hb-muted); margin-bottom: 6px; }
.hb .hb-cal-label { width: 100%; margin: 0 0 6px; font: inherit; padding: 6px 7px; border: 1px solid #b9b3a4; border-radius: 5px; }
.hb .hb-cal-btns { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.hb .hb-cal-btns button { margin: 0; font: inherit; padding: 6px 9px; border: 1px solid #b9b3a4; border-radius: 5px; background: #fff; cursor: pointer; }
.hb .hb-cal-btns .hb-cal-rec { background: #c0392b; border-color: #c0392b; color: #fff; font-weight: 600; }
.hb .hb-cal-status { font-weight: 600; color: #1f6b5c; margin: 4px 0; }
.hb .hb-cal-list .meta { color: var(--hb-muted); }
.hb .hb-cal-fold { float: right; margin: -2px -4px 0 6px; border: 1px solid #b9b3a4; border-radius: 4px; background: #fff; font: 600 14px/1 system-ui, sans-serif; width: 24px; height: 22px; cursor: pointer; padding: 0; }
.hb .hb-cal.folded { width: auto; max-height: none; padding: 5px 7px; }
.hb .hb-cal.folded > :not(.hb-cal-fold):not(.hb-cal-h) { display: none; }
.hb .hb-cal.folded .hb-cal-h { display: inline; margin: 0; font-size: 12px; }
/* pinning: on phones the heading and instructions sit under the side panel, so the box on the map is small */
.hb .hb-cal-intro { display: none; padding: 8px 16px 10px; border-top: 1px solid var(--hb-line); font-size: 13px; line-height: 1.4; }
@media (max-width: 760px) {
  .hb .hb-cal-intro { display: block; }
  .hb .hb-cal-intro-in { display: none; }
  .hb .hb-cal { max-height: 58%; }
  .hb .hb-cal-fold { margin-top: 0; }
}
.hb .hb-cal.folded .hb-cal-intro-in > :not(.hb-cal-h) { display: none; }
.hb .hb-cal.folded .hb-cal-intro-in { display: inline; }
.hb .hb-foot, .hb .hb-cal-intro, .hb .hb-head { flex-shrink: 0; }
@media (max-width: 760px) {
  .hb.hb-calibrating .hb-panel { max-height: none; }
  .hb.hb-calibrating .hb-results:empty { display: none; }
}
/* the box must never reach the cross in the middle of the map: on phones the list of spots goes under "Map data" */
.hb .hb-cal-count { color: var(--hb-muted); }
.hb .hb-cal-list-out { margin-top: 8px; }
@media (max-width: 760px) {
  .hb .hb-cal { max-height: calc(50% - 40px); }
  .hb .hb-cal-list-in { display: none; }
}
@media (min-width: 761px) { .hb .hb-cal-count { display: none; } }
/* pinning box, 5 Nov 2026: label and fold button on one row; slimmer buttons; no key; a deeper map on phones */
.hb .hb-cal-top { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.hb .hb-cal-top .hb-cal-label { flex: 1 1 auto; min-width: 0; margin: 0; }
.hb .hb-cal-top .hb-cal-fold { float: none; flex: 0 0 auto; margin: 0; width: 30px; height: 30px; }
.hb .hb-cal-btns button { padding-top: 4.5px; padding-bottom: 4.5px; }
.hb .hb-cal-status:empty { display: none; }
.hb .hb-cal.folded { padding: 4px; }
.hb .hb-cal.folded .hb-cal-top .hb-cal-label, .hb .hb-cal.folded .hb-cal-intro-in { display: none; }
.hb.hb-calibrating .hb-legend { display: none; }
@media (max-width: 760px) {
  .hb.hb-calibrating { grid-template-rows: auto 88vh; }
}

/* the opening sketch map */
.hb svg.hb-sketch { cursor: inherit; }
.hb svg.hb-sketch .hb-sk-area { transition: fill 0.15s; }
.hb svg.hb-sketch .hb-sk-area:hover { fill: #a6cc7e; }
.hb svg.hb-sketch .hb-sk-badge rect { transition: fill 0.15s; }
.hb svg.hb-sketch .hb-sk-badge:hover rect { fill: #2c8a71; }
.hb.hb-turning svg.hb-sketch [data-map] { pointer-events: none; }
.hb svg.hb-sketch .hb-sk-north { display: none; }   /* the page has its own north arrow */
.hb svg.hb-sketch .hb-sk-badge-in { transform-box: fill-box; transform-origin: center; }   /* the signs turn about their own middle */

/* phones (7 Nov 2026): the page scrolls, not the side panel, so the search box and all the results can be
   reached, with the map below at its usual height; the key goes in a full-width box under the map */
.hb .hb-key { display: none; }
@media (max-width: 760px) {
  .hb { grid-template-rows: auto 70vh auto; }
  .hb .hb-panel { max-height: none; }
  .hb .hb-results { flex: none; overflow: visible; }
  .hb .hb-mapwrap .hb-legend { display: none; }
  .hb .hb-key {
    display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; margin-top: -6px;
    background: var(--hb-paper); border: 1px solid var(--hb-line); border-radius: 8px;
    padding: 8px 12px; font-size: 12px; line-height: 1.4;
  }
  .hb .hb-key i { display: inline-block; width: 14px; height: 10px; margin-right: 6px; vertical-align: -1px; border: 2px solid; }
  .hb.hb-calibrating { grid-template-rows: auto 88vh auto; }
  .hb.hb-calibrating .hb-key { display: none; }
}

/* touch screens (7 Nov 2026): no hover labels; a bigger close button on popups for fingers */
.hb.hb-touch .leaflet-tooltip-pane { display: none; }
@media (any-pointer: coarse) {
  .hb .leaflet-container a.leaflet-popup-close-button { width: 40px; height: 40px; font: 28px/38px Tahoma, Verdana, sans-serif; color: #555; }
  .hb .leaflet-popup-content > :first-child { padding-right: 24px; }   /* room for the button beside the first line only */
}
/* phones: while a popup is open, the map's buttons hide (as the north arrow and key already do), so none sits on it */
@media (max-width: 760px) {
  .hb.hb-popup-open .leaflet-control-zoom, .hb.hb-popup-open .leaflet-control-layers, .hb.hb-popup-open .hb-locate { visibility: hidden; }
}

/* the key (8 Nov 2026): only on the three maps, not the opening sketch; "Lost part of Map 1" only on Map 1 */
.hb.hb-mode-ov .hb-legend, .hb.hb-mode-ov .hb-key { display: none !important; }
.hb:not(.hb-mode-1) .hb-lost-key { display: none; }

/* ------------------------------------------------ full screen (8 Nov 2026), for screens 1280 px wide or more */
.hb .hb-switchrow { display: flex; gap: 8px; align-items: center; }
.hb .hb-switchrow .hb-switch { margin: 0; }
.hb .hb-fs {
  display: none; align-items: center; gap: 7px; height: 32px; padding: 0 11px; margin: 0;
  border: 1px solid var(--hb-on-map); border-radius: 4px; background: #fff; color: var(--hb-on-map);
  font: 600 12px/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; cursor: pointer; box-shadow: 0 1px 5px rgba(0,0,0,.3);
}
@media (min-width: 1280px) { .hb .hb-fs { display: flex; } }
.hb .hb-headrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hb .hb-headrow h2 { margin: 0 0 4px; }
.hb .hb-fold, .hb .hb-about, .hb .hb-unfold, .hb .hb-fulltitle { display: none; }

.hb.hb-full {
  position: fixed; inset: 0; z-index: 98; display: block; height: 100vh; height: 100dvh; max-width: none; margin: 0;
  background: #efe6cf;
}
.hb.hb-full .hb-fs { display: flex; background: #2a2a28; border-color: #2a2a28; color: #fff; }
.hb.hb-full .hb-mapwrap { position: absolute; inset: 0; border: 0; border-radius: 0; }
.hb.hb-full .hb-panel {
  position: absolute; left: 50px; top: 16px; width: 380px; max-height: calc(100% - 32px); z-index: 90;
  border-radius: 10px; box-shadow: 0 3px 14px rgba(0,0,0,.16); overflow: hidden;
}
.hb.hb-full .hb-fold {
  display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; margin: 0 0 4px;
  border: 1px solid var(--hb-line); border-radius: 6px; background: #fff; color: var(--hb-muted); cursor: pointer;
}
.hb.hb-full .hb-fulltitle {
  display: block; position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 90; white-space: nowrap;
  padding: 8px 18px; background: rgba(255,253,248,.94); border: 1px solid var(--hb-line); border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12); font-size: 18px; font-weight: 600; line-height: 1.25; color: var(--hb-ink); pointer-events: none;
}
/* after a search, the introduction tucks away behind "About this search" */
.hb.hb-full.hb-searched:not(.hb-about-open) .hb-intro { display: none; }
.hb.hb-full.hb-searched .hb-about {
  display: block; margin: 8px 0 0; padding: 0; border: 0; background: none; color: var(--hb-on-map);
  font: inherit; font-size: 0.8rem; text-decoration: underline; cursor: pointer; text-align: left;
}
/* folded: only the search box, and a button to bring the results back */
.hb.hb-full.hb-folded .hb-panel { width: 380px; }
.hb.hb-full.hb-folded .hb-headrow, .hb.hb-full.hb-folded .hb-intro, .hb.hb-full.hb-folded .hb-about,
.hb.hb-full.hb-folded .hb-results, .hb.hb-full.hb-folded .hb-foot { display: none !important; }
.hb.hb-full.hb-folded .hb-head { padding: 8px; border-bottom: 0; }
.hb.hb-full.hb-folded .hb-unfold {
  display: block; flex: 0 0 auto; margin: 0; padding: 9px 10px; border: 1px solid var(--hb-line); border-radius: 6px;
  background: #fff; color: var(--hb-ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
/* the map's buttons: the switcher and Exit top right; zoom, north and locate move across from the left, below the layers button */
.hb.hb-full .leaflet-top.leaflet-right { top: 6px; right: 6px; }
.hb.hb-full .leaflet-top.leaflet-left { left: auto; right: 6px; top: 110px; display: flex; flex-direction: column; align-items: flex-end; }
.hb.hb-full .leaflet-top.leaflet-left .leaflet-control { float: none; margin-right: 10px; }
/* the key: bottom right, in two columns */
.hb.hb-full .leaflet-bottom.leaflet-left { left: auto; right: 6px; bottom: 6px; }
.hb.hb-full .hb-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; width: 380px; }
