/* vetmap.html — page layout, the four directory layouts, mobile rules. */

/* ------------------------------------------------------------ header/nav */
.crisis-banner {
  text-align: center; padding: 7px 16px; font-size: .86rem; color: #fff;
  background: linear-gradient(90deg, #000 0%, #6f0000 50%, #000 100%);
  border-bottom: 1px solid rgba(220, 38, 38, .5);
}
.crisis-banner a { color: #fff; font-weight: 700; }
.crisis-sep { margin: 0 6px; opacity: .6; }
@media (max-width: 480px) { .crisis-extra, .crisis-sep { display: none; } }

.site-nav {
  position: sticky; top: 0; z-index: 1100; height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px) saturate(160%); -webkit-backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) { .site-nav { background: var(--bg); } }
.site-nav-inner { height: 100%; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 1.15rem; margin-right: auto; }
.brand strong { color: var(--red); }
.brand-mark { font-size: 1.5rem; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a:not(.btn) { color: var(--text-2); text-decoration: none; font-weight: 550; font-size: .92rem; padding: 8px 12px; border-radius: 8px; }
.nav-links a:not(.btn):hover { color: var(--text); background: var(--surface-2); }
.nav-tools { display: flex; gap: 4px; }
.nav-menu-btn { display: none; }
html.light-mode .icon-moon, html:not(.light-mode) .icon-sun { display: none; }
@media (max-width: 760px) {
  .nav-menu-btn { display: inline-flex; }
  .nav-links {
    position: absolute; top: var(--nav-h); left: 0; right: 0; flex-direction: column; align-items: stretch;
    padding: 10px 16px 16px; background: var(--surface-solid); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a:not(.btn) { padding: 12px; font-size: 1rem; }
  .nav-links .btn { min-height: 46px; margin-top: 6px; }
}

.page-head { padding-top: calc(var(--section-gap) + 4px); text-align: center; }
.page-head h1 { margin: 0 0 6px; font-size: clamp(1.7rem, 4.5vw, 2.8rem); letter-spacing: -.02em; line-height: 1.15; }
.lede { margin: 0 auto; max-width: 640px; color: var(--text-2); font-size: clamp(.98rem, 2.4vw, 1.12rem); }
.stats { margin: 10px 0 0; color: var(--text-3); font-size: .88rem; min-height: 1.3em; }

/* --------------------------------------------------------------- toolbar */
:root { --section-gap: 28px; }
@media (max-width: 640px) { :root { --section-gap: 20px; } }

.toolbar-wrap { margin-top: var(--section-gap); position: relative; z-index: 900; }
.toolbar {
  display: grid; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow-sm);
}
.toolbar-row { display: flex; gap: 10px; align-items: center; min-width: 0; }
.search { position: relative; flex: 1 1 320px; min-width: 0; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 38px; }
.toolbar-selects { display: flex; gap: 10px; flex: 0 1 auto; }
.toolbar-selects .select { width: auto; min-width: 190px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px; min-width: 0; flex: 1 1 auto; }
.chips::-webkit-scrollbar { display: none; }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 1200; min-width: 220px; padding: 6px;
  background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow);
}
.menu-pop button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 7px; cursor: pointer; font-size: .92rem; }
.menu-pop button:hover, .menu-pop button:focus-visible { background: var(--red); color: #fff; }

/* Directory bar: sits between the map and the cards */
.directory-bar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.directory-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-width: 0; }
.directory-title h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.01em; }
.result-line { margin: 0; font-size: .86rem; color: var(--text-3); }
.directory-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.directory-controls .select { width: auto; min-width: 170px; min-height: 40px; }
.views { display: inline-flex; flex: 0 0 auto; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: var(--surface-solid); }
.views button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 0; background: transparent;
  color: var(--text-2); font-weight: 600; font-size: .86rem; cursor: pointer;
}
.views button + button { border-left: 1px solid var(--border); }
.views button[aria-checked="true"] { background: var(--red); color: #fff; }
.views button:hover:not([aria-checked="true"]) { background: var(--surface-2); color: var(--text); }

@media (max-width: 900px) {
  .toolbar-row:first-child { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .toolbar-selects { width: 100%; }
  .toolbar-selects .select { flex: 1 1 0; min-width: 0; }
}
@media (max-width: 640px) {
  .toolbar { padding: 12px; gap: 10px; }
  /* Search + Export share one row; the category chips replace the dropdown. */
  .toolbar-row:first-child { flex-wrap: nowrap; }
  .search { flex: 1 1 auto; }
  .toolbar-selects { width: auto; }
  #categoryFilter { display: none; }
  .label-text { display: none; }
  #exportBtn { width: 44px; min-height: 44px; padding: 0; }
  .chips { margin: 0 -12px; padding: 2px 12px; }
  .directory-bar { flex-direction: column; align-items: stretch; }
  .directory-controls { flex-wrap: nowrap; }
  .directory-controls .select { flex: 1 1 auto; min-width: 0; }
  .views button { padding: 0 11px; }
  .views button span { display: none; }
}

/* ------------------------------------------------------------------- map */
.map-section { margin-top: var(--section-gap); }
.map-frame { position: relative; }
#map { height: clamp(340px, 62vh, 1100px); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); z-index: 1; }
@media (max-width: 640px) { #map { height: 52vh; height: 52svh; min-height: 300px; border-radius: 12px; } }
/* ------------------------------------------------------------ directions */
.map-frame:fullscreen { background: var(--bg); }
.map-frame:fullscreen #map, .map-frame.vh-pseudo-fullscreen #map { height: 100%; border-radius: 0; border: 0; }
.map-frame.vh-pseudo-fullscreen { background: var(--bg); }
.vh-route {
  position: absolute; z-index: 5; top: 12px; left: 56px; width: min(380px, 42%); max-height: calc(100% - 24px);
  display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain;
  padding: 14px 16px 12px; border-radius: 14px; border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface-solid) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35); animation: vh-route-in .35s cubic-bezier(.22, .8, .24, 1);
}
@keyframes vh-route-in { from { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .vh-route { animation: none; } }
@media (min-width: 761px) { .map-frame.has-route .vh-legend { display: none; } }
.route-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.route-head h2 { margin: 0; font-size: 1.05rem; }
.route-dest { margin: 4px 0 10px; font-size: .9rem; line-height: 1.35; }
.route-dest span { display: block; color: var(--text-3); font-size: .82rem; }
.route-label { display: block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 4px; }
.route-from { display: flex; gap: 6px; }
.route-from .input { flex: 1; min-width: 0; }
.route-from .btn { flex: none; white-space: nowrap; }
.route-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 10px 0; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.route-modes button { border: 0; background: none; color: var(--text-2); padding: 7px 4px; border-radius: 8px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.route-modes button[aria-checked="true"] { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }
.route-modes button:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.route-result:empty { display: none; }
.route-result { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.route-msg { margin: 0 0 8px; font-size: .88rem; color: var(--text-2); }
.route-msg.is-error { color: var(--red); }
.route-summary { margin: 0 0 8px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.route-summary strong { font-size: 1.35rem; color: #16a34a; }
html:not(.light-mode) .route-summary strong { color: #4ade80; }
.route-summary span { color: var(--text-2); font-size: .86rem; }
.route-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.route-steps button {
  width: 100%; display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: start; text-align: left;
  padding: 7px 6px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: .86rem; line-height: 1.35; cursor: pointer;
}
.route-steps button:hover, .route-steps button.is-current { background: var(--surface-2); }
.route-steps button:focus-visible { outline: 3px solid var(--focus); outline-offset: -2px; }
.step-ico { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, #2563eb 16%, transparent); color: #2563eb; font-weight: 700; }
html:not(.light-mode) .step-ico { color: #93c5fd; }
.step-dist { color: var(--text-3); font-size: .78rem; white-space: nowrap; padding-top: 4px; }
.route-tools, .route-ext { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.route-ext span { font-size: .8rem; color: var(--text-3); margin-right: 2px; }
.route-attr { margin: 10px 0 0; font-size: .72rem; color: var(--text-3); }
.leaflet-overlay-pane path.route-line { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }
/* Phones and narrow frames: dock the panel under the map so the route stays visible. */
@media (max-width: 760px) {
  .vh-route { position: static; width: auto; max-height: none; margin-top: 12px; backdrop-filter: none; background: var(--surface-solid); box-shadow: var(--shadow); }
  .map-frame:fullscreen .vh-route, .map-frame.vh-pseudo-fullscreen .vh-route { position: absolute; left: 8px; right: 8px; top: auto; bottom: 8px; max-height: 45%; margin: 0; }
  .route-here-text { display: none; }
}
.map-status {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 500;
  padding: 7px 14px; border-radius: 999px; background: rgba(15, 23, 42, .88); color: #f8fafc; font-size: .82rem; box-shadow: var(--shadow-sm);
}
.vh-legend {
  background: var(--surface-solid); color: var(--text); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow-sm); padding: 6px; font-size: .8rem; max-width: 220px;
}
.vh-legend summary { cursor: pointer; font-weight: 700; padding: 4px 6px; list-style: none; }
.vh-legend summary::-webkit-details-marker { display: none; }
.vh-legend summary::after { content: ' ▾'; color: var(--text-3); }
.vh-legend[open] summary::after { content: ' ▴'; }
.vh-legend button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; border: 0; border-radius: 6px; background: none; cursor: pointer; text-align: left; font-size: .8rem; }
.vh-legend button:hover, .vh-legend button[aria-pressed="true"] { background: var(--surface-2); }
.vh-legend .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--c); border: 2px solid #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; flex: none; }
.popup-title { margin: 0 0 4px; font-size: 1rem; font-weight: 700; line-height: 1.3; }
.popup-meta { margin: 0 0 8px; color: var(--text-2); font-size: .82rem; }
.popup-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.popup-logo { width: 56px; height: 56px; object-fit: contain; float: right; margin: 0 0 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, .08); padding: 4px; }

/* -------------------------------------------------------------- directory */
.directory { margin-top: var(--section-gap); outline: none; scroll-margin-top: calc(var(--nav-h) + 12px); }
.directory-host { min-height: 120px; }
.loading-state, .empty-state { text-align: center; padding: 48px 16px; color: var(--text-2); }
.loading-state .vh-spinner { margin: 0 auto 12px; }
.empty-title { font-size: 1.3rem; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; }

.logo-showcase { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: flex-start; padding: 12px 16px; margin-top: var(--section-gap); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.logo-showcase button { border: 0; background: rgba(255, 255, 255, .06); border-radius: 12px; padding: 8px; cursor: pointer; transition: transform .2s; }
.logo-showcase button:hover { transform: translateY(-2px); }
.logo-showcase img { width: 56px; height: 56px; object-fit: contain; display: block; }
.showcase-label { margin: 0 12px 0 4px; font-weight: 800; font-size: .95rem; display: flex; flex-direction: column; }
.showcase-label span { font-weight: 500; font-size: .76rem; color: var(--text-3); }

/* Card (grid / scroll) */
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .2s, box-shadow .2s, transform .2s;
  scroll-margin: calc(var(--nav-h) + 90px);
}
.card:hover { border-color: var(--border-strong); }
.card.is-featured { border-color: rgba(245, 184, 61, .55); background-image: linear-gradient(135deg, rgba(245, 184, 61, .08), transparent 55%); }
.card.is-selected { border-color: var(--cat, var(--red)); box-shadow: 0 0 0 2px var(--cat, var(--red)), var(--shadow); }
.card-head { display: flex; gap: 12px; align-items: flex-start; }
.card-icon { flex: none; width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; background: color-mix(in srgb, var(--cat) 22%, transparent); border: 1px solid color-mix(in srgb, var(--cat) 50%, transparent); }
.card-logo { flex: none; width: 54px; height: 54px; border-radius: 12px; object-fit: contain; background: rgba(255, 255, 255, .92); padding: 4px; }
.card-title { margin: 0; font-size: 1.08rem; line-height: 1.3; font-weight: 700; }
.card-title button { all: unset; cursor: pointer; }
.card-title button:hover { text-decoration: underline; }
.card-title button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.card-org { margin: 2px 0 0; font-size: .84rem; color: var(--text-2); }
.card-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.card-desc { margin: 0; color: var(--text-2); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .88rem; }
.card-meta li { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.card-meta li > span:first-child { flex: none; width: 1.2em; text-align: center; }
.card-meta li > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.card-meta .meta-link { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.card-actions .btn { flex: 1 1 auto; }
.card .pill-featured { position: absolute; top: -10px; right: 14px; }

.layout-grid { display: grid; gap: clamp(14px, 1.2vw, 24px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }

/* List */
.layout-list { list-style: none; margin: 0; padding: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.row {
  display: grid; grid-template-columns: 44px minmax(0, 2.2fr) minmax(0, 1.2fr) minmax(0, 1.4fr) var(--row-actions-w, 236px); gap: 14px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border); scroll-margin: calc(var(--nav-h) + 90px);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row.is-selected { background: color-mix(in srgb, var(--cat) 16%, transparent); box-shadow: inset 4px 0 0 var(--cat); }
.row-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: color-mix(in srgb, var(--cat) 22%, transparent); }
.row-name { font-weight: 700; margin: 0; font-size: .98rem; line-height: 1.3; }
.row-name button { all: unset; cursor: pointer; }
.row-name button:hover { text-decoration: underline; }
.row-name button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.row-sub { margin: 2px 0 0; font-size: .8rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-cell { font-size: .85rem; color: var(--text-2); min-width: 0; }
.row-cell .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.list-head { display: grid; grid-template-columns: 44px minmax(0, 2.2fr) minmax(0, 1.2fr) minmax(0, 1.4fr) var(--row-actions-w, 236px); gap: 14px; padding: 10px 16px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); border-bottom: 1px solid var(--border); background: var(--surface-solid); }
@media (max-width: 860px) {
  .list-head { display: none; }
  .row { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "icon name actions" "icon meta meta"; row-gap: 6px; padding: 12px; }
  .row-icon { grid-area: icon; align-self: start; }
  .row-main { grid-area: name; }
  .row-actions { grid-area: actions; }
  .row-cell.row-cat { grid-area: meta; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
  .row-cell.row-where { display: none; }
}

/* Scroll strip */
.layout-scroll { position: relative; }
.strip-track {
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px;
  padding: 16px 4px 18px; margin: 0 -4px; list-style: none; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.strip-track > li { flex: 0 0 clamp(270px, 24vw, 380px); scroll-snap-align: center; display: flex; }
.strip-track > li > .card { width: 100%; }
.strip-track .card-desc { -webkit-line-clamp: 3; }
.strip-nav { position: absolute; top: 40%; z-index: 5; width: 44px; height: 44px; border-radius: 50%; box-shadow: var(--shadow); background: var(--surface-solid); }
.strip-nav.prev { left: -10px; }
.strip-nav.next { right: -10px; }
@media (max-width: 640px) { .strip-nav { display: none; } .strip-track > li { flex-basis: 84vw; } }
.strip-status { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; font-size: .85rem; color: var(--text-3); }
.card.is-arriving { animation: vh-arrive .55s cubic-bezier(.2, .8, .2, 1); }
@keyframes vh-arrive {
  0% { transform: translateY(18px) scale(.94); opacity: .35; }
  60% { transform: translateY(-3px) scale(1.01); opacity: 1; }
  100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .card.is-arriving { animation: none; } .strip-track { scroll-behavior: auto; } }

/* ------------------------------------------------------- spatial gallery */
.vh-spatial { --card-w: 214px; --card-h: 220px; border-radius: var(--radius); border: 1px solid var(--border); background: radial-gradient(120% 90% at 50% 10%, rgba(30, 58, 138, .28), transparent 60%), var(--surface); overflow: hidden; }
html.light-mode .vh-spatial { background: radial-gradient(120% 90% at 50% 10%, rgba(59, 130, 246, .12), transparent 60%), var(--surface); }
.vh-spatial-bar { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px; border-bottom: 1px solid var(--border); }
.vh-spatial-groups { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.vh-spatial-groups::-webkit-scrollbar { display: none; }
.vh-spatial-groups .chip[aria-selected="true"] { background: var(--chip); border-color: var(--chip); color: #fff; }
.vh-spatial-actions { display: flex; gap: 6px; flex: none; }
.vh-spatial-body { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 24vw, 460px); }
.vh-spatial-stage {
  position: relative; height: var(--stage-h, 480px); overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; outline: none;
}
.vh-spatial-stage:focus-visible { box-shadow: inset 0 0 0 3px var(--focus); }
.vh-spatial.is-dragging .vh-spatial-stage { cursor: grabbing; }
.vh-spatial-camera { position: absolute; inset: 0; perspective: 1300px; }
/* One easing for every move (ring change, card turn, fades) so they read as one motion. */
.vh-spatial { --sg-ease: cubic-bezier(.22, .8, .24, 1); --sg-dur: .85s; }
.vh-spatial-tower { position: absolute; left: 50%; top: 50%; transform-style: preserve-3d; transition: transform var(--sg-dur) var(--sg-ease); will-change: transform; }
.vh-spatial-ring {
  position: absolute; left: 0; top: 0; transform-style: preserve-3d; transform: translateY(var(--y)) scale(.94);
  transition: opacity var(--sg-dur) var(--sg-ease), transform var(--sg-dur) var(--sg-ease); opacity: 0; pointer-events: none;
}
.vh-spatial-ring.is-near { opacity: .3; }
.vh-spatial-ring.is-active { opacity: 1; transform: translateY(var(--y)); pointer-events: auto; }
.vh-spatial-ring-spin { transform-style: preserve-3d; transition: transform var(--sg-dur) var(--sg-ease); will-change: transform; }
/* Floor: a soft glow band, not a 1px border. A hairline on a plane tilted 90° is
   sampled into a broken, jagged line; a wide feathered gradient stays smooth. */
.vh-spatial-floor {
  position: absolute; left: 0; top: 0; width: calc(var(--r) * 2); height: calc(var(--r) * 2); margin: 0;
  transform: translate(-50%, -50%) translateY(calc(var(--card-h) / 2 + 22px)) translateZ(var(--r)) rotateX(90deg);
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side,
    transparent 86%,
    color-mix(in srgb, var(--ring) 10%, transparent) 93%,
    color-mix(in srgb, var(--ring) 34%, transparent) 97.5%,
    color-mix(in srgb, var(--ring) 8%, transparent) 99.4%,
    transparent 100%);
}
.vh-spatial-label { position: absolute; left: 0; top: calc(var(--card-h) / -2 - 38px); transform: translateX(-50%); white-space: nowrap; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ring); transition: opacity var(--sg-dur) var(--sg-ease); }
.vh-spatial-ring:not(.is-active) .vh-spatial-label { opacity: .5; }
.vh-scard {
  position: absolute; left: calc(var(--card-w) / -2); top: calc(var(--card-h) / -2); width: var(--card-w); height: var(--card-h);
  backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: opacity var(--sg-dur) var(--sg-ease);
  opacity: calc(.3 + var(--facing, 1) * .7);
}
/* Side cards dim with an overlay (opacity only, composited) instead of filter:brightness,
   which repaints every card on every frame and made turns stutter. */
.vh-scard::after {
  content: ""; position: absolute; inset: 0; border-radius: 14px; background: #0b1220; pointer-events: none;
  opacity: calc((1 - var(--facing, 1)) * .5); transition: opacity var(--sg-dur) var(--sg-ease);
}
html.light-mode .vh-scard::after { background: #e2e8f0; opacity: calc((1 - var(--facing, 1)) * .55); }
.vh-scard.is-back { opacity: 0; pointer-events: none; }
.vh-spatial.is-instant .vh-spatial-tower, .vh-spatial.is-instant .vh-spatial-ring, .vh-spatial.is-instant .vh-spatial-ring-spin,
.vh-spatial.is-instant .vh-scard, .vh-spatial.is-instant .vh-scard::after,
.vh-spatial.is-dragging .vh-spatial-ring-spin, .vh-spatial.is-dragging .vh-scard, .vh-spatial.is-dragging .vh-scard::after { transition: none; }
.vh-spatial.is-playing { --sg-dur: 1.4s; }
@media (prefers-reduced-motion: reduce) {
  .vh-spatial-tower, .vh-spatial-ring-spin, .vh-scard, .vh-scard::after, .vh-spatial-ring, .vh-spatial-label { transition: none !important; }
}
.scard {
  height: 100%; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; overflow: hidden;
  background: var(--surface-solid); border: 1px solid var(--border-strong); box-shadow: 0 18px 40px rgba(0, 0, 0, .4);
  border-top: 4px solid var(--cat);
}
.vh-scard.is-selected .scard { box-shadow: 0 0 0 2px var(--cat), 0 24px 50px rgba(0, 0, 0, .5); }
.scard-top { display: flex; align-items: center; gap: 10px; }
.scard-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; background: color-mix(in srgb, var(--cat) 22%, transparent); flex: none; }
.scard-logo { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; background: #fff; padding: 3px; flex: none; }
.scard-name { margin: 0; font-size: .98rem; font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.scard-desc { margin: 0; font-size: .8rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.scard-foot { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.vh-spatial-note { position: absolute; left: 12px; bottom: 8px; margin: 0; font-size: .74rem; color: var(--text-3); }
.vh-spatial-inspector { border-left: 1px solid var(--border); padding: clamp(16px, 1.4vw, 26px); overflow-y: auto; max-height: var(--stage-h, 520px); }
.vh-spatial-inspector h3 { margin: 6px 0 4px; font-size: 1.1rem; line-height: 1.3; }
.inspector-pos { font-size: .78rem; color: var(--text-3); margin: 0; }
.inspector-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media (max-width: 900px) {
  .vh-spatial-body { grid-template-columns: 1fr; }
  .vh-spatial-inspector { border-left: 0; border-top: 1px solid var(--border); max-height: none; }
}
@media (max-width: 560px) {
  .vh-spatial-bar { flex-direction: column; align-items: stretch; }
  .vh-spatial-actions { justify-content: space-between; }
}

/* --------------------------------------------------------- detail dialog */
.detail { padding: 22px; overflow-y: auto; max-height: inherit; }
.detail-head { display: flex; gap: 14px; align-items: flex-start; padding-right: 36px; }
.detail-close { position: absolute; top: 12px; right: 12px; }
.detail h2 { margin: 0; font-size: 1.35rem; line-height: 1.25; }
.detail-org { margin: 4px 0 0; color: var(--text-2); }
.detail-logo { width: 72px; height: 72px; object-fit: contain; border-radius: 12px; background: #fff; padding: 4px; flex: none; }
.detail-section { margin-top: 16px; }
.detail-section h3 { margin: 0 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.detail-section p { margin: 0; white-space: pre-line; }
.detail-contacts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.detail-contacts li { display: flex; gap: 10px; align-items: baseline; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.detail-share { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: .85rem; color: var(--text-3); }
.detail-foot { margin-top: 12px; font-size: .8rem; color: var(--text-3); }
@media (max-width: 640px) { .detail { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); } .detail-actions .btn { flex: 1 1 calc(50% - 8px); } }

/* ---------------------------------------------------------------- submit */
.submit-section { margin-top: calc(var(--section-gap) * 2); scroll-margin-top: calc(var(--nav-h) + 12px); }
.submit-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.submit-panel { border-color: rgba(220, 38, 38, .45); }
.submit-panel h2 { margin: 0 0 4px; font-size: 1.45rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.span-2 { grid-column: span 2; }
.select-emoji { font-size: 1.05rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.upload { display: flex; align-items: center; gap: 14px; padding: 14px; border: 2px dashed var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface-solid); }
.upload:hover, .upload:focus-within { border-color: var(--red); }
.upload input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.upload img { width: 64px; height: 64px; object-fit: contain; border-radius: 8px; background: #fff; }
.upload-text { display: flex; flex-direction: column; font-weight: 600; }
.form-errors { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: rgba(220, 38, 38, .12); border: 1px solid rgba(220, 38, 38, .45); font-size: .9rem; }
.form-errors ul { margin: 6px 0 0; padding-left: 18px; }
.submit-btn { margin-top: 16px; min-height: 50px; font-size: 1rem; }
.form-message { margin: 10px 0 0; text-align: center; font-weight: 600; min-height: 1.4em; }
.form-message.is-ok { color: #4ade80; }
html.light-mode .form-message.is-ok { color: #15803d; }
.form-message.is-error { color: #f87171; }
.featured-panel h3 { margin: 12px 0 6px; font-size: 1.1rem; }
.submit-lede { margin: 6px 0 12px; color: var(--text-2); max-width: 62ch; }
.submit-steps { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .86rem; color: var(--text-2); }
.submit-steps li { display: flex; align-items: center; gap: 8px; }
.submit-steps li span { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 800; background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.form-more { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 0 14px; }
.form-more summary { cursor: pointer; padding: 12px 0; font-weight: 600; font-size: .92rem; }
.form-more[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.form-more > .form-grid { padding-bottom: 14px; }
.tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.tier { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.tier-best { border-color: color-mix(in srgb, #f59e0b 60%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, #f59e0b 30%, transparent) inset; }
.tier-name { margin: 0; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tier-name .pill { font-size: .66rem; padding: 2px 7px; }
.tier-price { margin: 4px 0 6px; font-size: 1.5rem; font-weight: 800; color: var(--text) !important; }
.tier-price span { font-size: .8rem; font-weight: 500; color: var(--text-3); }
.featured-panel .tier ul { margin: 0; padding-left: 16px; }
.featured-panel .tier li { font-size: .82rem; margin: 2px 0; }
.tier-note { margin: 8px 0 0; }
.featured-panel .help-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.help-list li { display: flex; gap: 10px; align-items: baseline; }
@media (max-width: 1100px) and (min-width: 901px) { .tiers { grid-template-columns: 1fr; } }
@media (min-width: 901px) { .featured-panel { position: sticky; top: calc(var(--nav-h) + 16px); } }
@media (max-width: 420px) { .tiers { grid-template-columns: 1fr; } }
.detail-credit { margin: 14px 0 0; font-size: .86rem; color: var(--text-2); }
.featured-panel p, .featured-panel li { color: var(--text-2); font-size: .92rem; }
.featured-panel ul { padding-left: 18px; }
.featured-panel hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0 8px; }
@media (max-width: 900px) { .submit-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } .panel { padding: 16px; } }

/* ---------------------------------------------------------------- footer */
.site-footer { margin-top: 56px; padding: 32px 0 calc(28px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 70%, black 30%); font-size: .9rem; color: var(--text-2); }
html.light-mode .site-footer { background: #e9edf3; }
.footer-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.footer-grid h3 { margin: 0 0 10px; font-size: .95rem; color: var(--text); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-legal { margin-top: 24px; font-size: .8rem; color: var(--text-3); text-align: center; }
.footer-legal p { margin: 4px 0; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }

@media print {
  .site-nav, .crisis-banner, .toolbar-wrap, .map-section, .submit-section, .site-footer, .card-actions, .views { display: none !important; }
  body { background: #fff; color: #000; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; background: #fff; }
}

/* Phones: map attribution wraps to two lines; keep the legend above it. */
@media (max-width: 640px) {
  .leaflet-bottom.leaflet-left .vh-legend { margin-bottom: 38px; }
  .leaflet-control-attribution { font-size: 9.5px; line-height: 1.35; }
}
@media print { .directory-controls, .logo-showcase { display: none !important; } }

/* ------------------------------------------------------------ wide screens */
@media (min-width: 1200px) {
  /* Title and stats on one line: more of the first screen goes to the map. */
  .page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; text-align: left; padding-top: 26px; }
  .page-head h1 { margin: 0; }
  .page-head .lede { margin: 0; max-width: none; flex: 1 1 420px; }
  .page-head .stats { margin: 0; }
  .toolbar-wrap { margin-top: 18px; }
}
@media (min-width: 1500px) {
  /* Search, filters and export in a single row. */
  .toolbar { grid-template-columns: minmax(640px, 1.25fr) minmax(0, 1.5fr); align-items: center; }
  .toolbar-row:first-child { flex-wrap: nowrap; }
  .search { flex-basis: auto; }
  .toolbar-selects { width: auto; }
  .chips { order: 0; }
  .card-desc { -webkit-line-clamp: 5; }
}
@media (min-width: 1800px) {
  body { font-size: 17px; }
  .layout-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  .card { padding: 20px 22px; }
}
@media (min-width: 2200px) {
  .layout-grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
}

/* Laptops (wide but short): smaller title so the map starts higher. */
@media (min-width: 1200px) {
  .page-head h1 { font-size: clamp(1.7rem, 2.3vw, 2.8rem); white-space: nowrap; }
  .page-head .lede { font-size: 1rem; flex: 1 1 280px; }
  .page-head .stats { white-space: nowrap; }
}
@media (min-width: 1200px) and (max-height: 900px) {
  .page-head { padding-top: 16px; }
  .toolbar-wrap { margin-top: 14px; }
  .map-section { margin-top: 16px; }
  #map { height: clamp(340px, 66vh, 1100px); }
}
@media (max-width: 560px) {
  .vh-spatial-label { top: calc(var(--card-h) / -2 - 30px); }
}

/* Spatial inspector: clamp long text so the panel stays the height of the stage. */
.vh-spatial-inspector .card-desc { -webkit-line-clamp: 4; }
.inspector-services { margin: 10px 0 0; font-size: .86rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.inspector-services b { color: var(--text); font-weight: 600; }
.vh-spatial-note { right: 12px; }
