/* ===== מפה לנפש — mobile-first stylesheet ===== */
:root {
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-light: #ccfbf1;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --bg: #f6f9f8;
  --surface: #ffffff;
  --text: #1f2937;
  --text-muted: #4b5563;
  --border: #cbd5d3;        /* decorative hairlines only */
  --border-control: #7f8a88; /* 3.6:1 on white — interactive component boundaries */
  --focus: #1d4ed8;
  --radius: 10px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --shadow: 0 2px 10px rgba(15, 60, 55, .12);
  --shadow-lg: 0 -4px 24px rgba(15, 60, 55, .18);
  --header-h: 60px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

/* The UA rule for [hidden] carries no !important, so any author `display`
   declaration silently defeats it. Every dialog and panel here relies on the
   attribute, so this must win. */
[hidden] { display: none !important; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

body {
  margin: 0;
  font-family: 'Assistant', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overscroll-behavior-y: none;
}

h1, h2, h3 { font-family: 'Rubik', 'Assistant', sans-serif; line-height: 1.25; }
a { color: var(--primary-dark); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; top: -60px; inset-inline-start: 8px;
  background: var(--primary-dark); color: #fff;
  padding: 10px 18px; border-radius: 0 0 8px 8px; z-index: 4000;
}
.skip-link:focus { top: 0; }

.noscript-emergency {
  background: var(--danger-bg); border-bottom: 3px solid var(--danger);
  padding: 16px 20px; font-size: 1rem;
}
.noscript-emergency ul { margin: 8px 0 0; padding-inline-start: 20px; }
.noscript-emergency li { margin-bottom: 6px; }
.noscript-emergency a { font-weight: 700; }

/* Both toggles must be !important: .btn/.form-grid/.site-footer all declare
   their own `display` at equal specificity and would otherwise win. Never use
   `display: initial` to restore — it means `inline`, not "whatever it was". */
@media (max-width: 859px) { .desktop-only { display: none !important; } }
@media (min-width: 860px) { .mobile-only  { display: none !important; } }

/* ===== buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px;
  border: 1px solid transparent; border-radius: var(--radius);
  font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; background: transparent; color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-ghost { border-color: var(--border-control); background: var(--surface); }
.btn-ghost:hover { background: var(--primary-light); }
.btn-danger-outline { border-color: var(--danger); color: var(--danger); background: var(--surface); }
.btn-danger-outline:hover { background: var(--danger-bg); }
.btn-block { width: 100%; }
.btn:active { transform: scale(.98); }

.link-btn {
  background: none; border: none; padding: 8px 4px; font: inherit;
  color: var(--primary-dark); text-decoration: underline; cursor: pointer;
  min-height: 44px;
}
.link-btn.danger { color: var(--danger); font-weight: 700; }

/* ===== header ===== */
.site-header {
  position: sticky; top: 0; z-index: 900;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; min-height: var(--header-h);
  padding: 8px calc(12px + env(safe-area-inset-right, 0px)) 8px calc(12px + env(safe-area-inset-left, 0px));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
body { overflow-x: hidden; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  flex: none; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #14958b);
}
.brand h1 {
  margin: 0; font-size: 1.15rem; font-weight: 800; line-height: 1.25; color: var(--primary-dark);
  /* No nowrap: the title now carries "— מאגר מידע" too, which would overflow
     the header on a narrow phone rather than wrap. */
}
/* Now carries the full descriptive sentence (demoted from the page's former
   title), so it needs real line-height and room to wrap — not a one-liner. */
.tagline { margin: 2px 0 0; font-size: .76rem; line-height: 1.35; color: var(--text-muted); }
.header-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.site-header .btn { padding: 8px 12px; font-size: .9rem; }

/* Youth / adults map switch — one click flips the whole site. */
.aud-toggle {
  display: flex; flex: none; align-items: center; gap: 0;
  border-radius: 999px; padding: 3px;
  background: var(--primary-light, #ccfbf1);
}
.aud-btn {
  border: none; background: none; cursor: pointer; font: inherit;
  font-size: .85rem; font-weight: 700; color: var(--primary-dark);
  padding: 6px 14px; border-radius: 999px; white-space: nowrap; min-height: 34px;
}
.aud-btn[aria-pressed="true"] {
  background: var(--primary, #0f766e); color: #fff;
  box-shadow: 0 2px 6px rgba(15, 118, 110, .35);
}
/* Inline SVG icon inside a text button / link */
.btn .ic, .link-btn .ic { vertical-align: -2px; margin-inline-end: 2px; display: inline-block; }
.sv { display: inline-flex; width: 16px; height: 16px; vertical-align: -3px; }
.sv svg { width: 100%; height: 100%; }

/* Segmented pill groups (top selectors bar on desktop, area switch on mobile) */
.seg-group { display: flex; }
.seg-group > button {
  min-height: 38px; padding: 6px 18px;
  border: 1px solid var(--border-control); background: var(--surface);
  font: inherit; font-weight: 700; color: var(--text-muted); cursor: pointer;
  white-space: nowrap;
}
.seg-group > button + button { border-inline-start: none; }
.seg-group > button:first-child {
  border-start-start-radius: 999px; border-end-start-radius: 999px;
}
.seg-group > button:last-child {
  border-start-end-radius: 999px; border-end-end-radius: 999px;
}
.seg-group > button[aria-selected="true"],
.seg-group > button[aria-pressed="true"] {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

/* Mobile: the area switch floats over the top of the map */
.region-fab {
  position: absolute; top: 10px; inset-inline: 0; margin-inline: auto;
  width: max-content; z-index: 650;
  box-shadow: 0 4px 14px rgba(19, 42, 46, .18); border-radius: 999px;
}
.region-fab > button { min-height: 34px; padding: 5px 12px; font-size: .8rem; }

/* Quick category chips under the mobile header */
.quick-chips {
  order: 4; flex: 1 1 100%; display: flex; gap: 6px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding: 8px 0 2px; margin: 0 -2px;
}
.quick-chips::-webkit-scrollbar { display: none; }
.qchip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: .8rem; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-control);
  border-radius: 999px; padding: 6px 12px; min-height: 32px; cursor: pointer;
}
.qchip[aria-pressed="true"] { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }
.qchip .dot { width: 8px; height: 8px; border-radius: 50%; }

@media (max-width: 859px) {
  .site-header { flex-wrap: wrap; row-gap: 2px; }
  .brand h1 { font-size: 1.06rem; }
  .brand .tagline {
    max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* The switch drops to its own full-width row; the two buttons share it. */
  .aud-toggle { order: 3; flex: 1 1 100%; margin-top: 6px; }
  .aud-btn { flex: 1; font-size: .82rem; padding: 6px 8px; min-height: 32px; }
}

/* ===== printable list ===== */
.list-toolbar { display: flex; justify-content: flex-end; padding: 6px 4px; }
#printArea[hidden] { display: none; }

@media print {
  /* Show only the prepared handout — the map UI cannot print meaningfully. */
  body.printing > :not(#printArea) { display: none !important; }
  body.printing #printArea { display: block !important; }
  #printArea { color: #000; font-size: 11pt; line-height: 1.4; }
  #printArea h1 { font-size: 15pt; margin: 0 0 4pt; }
  .print-meta { font-size: 9pt; color: #333; margin: 0 0 10pt; }
  .print-item { padding: 6pt 0; border-bottom: 1pt solid #bbb; break-inside: avoid; }
  .print-item strong { font-size: 11.5pt; }
  .print-line { font-size: 10pt; color: #222; }
}

.mobile-menu {
  position: absolute; top: var(--header-h); inset-inline-end: 8px; z-index: 950;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  min-width: 240px;
}
.menu-item {
  display: block; width: 100%; text-align: start;
  min-height: 48px; padding: 12px 16px;
  background: none; border: none; border-bottom: 1px solid var(--border);
  font: inherit; color: var(--text); cursor: pointer; text-decoration: none;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--primary-light); }

/* ===== layout ===== */
/* Flex column rather than a height calc: the header wraps to two lines at some
   widths, and a hard-coded --header-h then overflowed the page. */
body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
.app-layout {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-bottom: calc(var(--nav-h) + var(--safe-b));
}

.results-area { position: relative; height: 100%; isolation: isolate; }
#mapView { height: 100%; position: relative; }
/* The "outside" of the schematic map — there are no tiles, so this IS the sea
   and everything beyond the border. */
#map { background: #dfe7e6; }

/* Leaflet's attribution bar is z-1000 and escapes into the root stacking
   context, painting over the results sheet. Keep it under. */
#map .leaflet-bottom { z-index: 600; }

.answer-strip {
  position: absolute; top: 8px; inset-inline: 8px; z-index: 650;
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--surface); border: 1px solid var(--border-control);
  border-inline-start: 5px solid var(--primary);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px; font-size: .95rem;
  max-height: 45%; overflow-y: auto;
}
.answer-strip #answerStripText { flex: 1; }
.answer-strip.crisis {
  background: var(--danger-bg);
  border-color: var(--danger);
  border-inline-start-color: var(--danger);
}
.ai-label {
  margin: 0 0 6px; font-size: .8rem; font-weight: 600;
  color: var(--text-muted); text-transform: none;
}
.crisis-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crisis-actions .btn-primary { background: var(--danger); }
.crisis-actions .btn-primary:hover { background: #991b1b; }
.chip-crisis { border-color: var(--danger); color: var(--danger); }
.chip-crisis[aria-pressed="true"] { background: var(--danger); border-color: var(--danger); color: #fff; }
.answer-strip .close-btn { position: static; flex: none; width: 36px; height: 36px; }

.near-me-fab {
  position: absolute; z-index: 650;
  inset-block-end: 76px; inset-inline-end: 12px;
  min-height: 48px; padding: 12px 18px;
  border: none; border-radius: 999px;
  background: var(--primary); color: #fff;
  font: inherit; font-weight: 700; cursor: pointer;
  box-shadow: 0 3px 12px rgba(0,0,0,.28);
}
.near-me-fab:active { transform: scale(.97); }
#map { height: 100%; width: 100%; background: #e8eeed; }
#listView {
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 12px 20px; -webkit-overflow-scrolling: touch;
}

/* ===== search: small popup on mobile, inline block on desktop =====
   Deliberately NOT full-screen like .filters-panel — this is a quick "type a
   few words" interaction, not a set of controls to browse through. Visibility
   is class-based (.open), same technique as .filters-panel, so there is no
   fight with the global `[hidden] { display: none !important; }` rule. */
.search-panel {
  position: fixed; inset: 0; z-index: 1210;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 76px 16px 16px;
  background: rgba(15, 40, 35, .45);
  opacity: 0; visibility: hidden;
  transition: opacity 180ms var(--ease-out);
}
.search-panel.open { opacity: 1; visibility: visible; }
.search-panel-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 16px;
  transform: translateY(-10px) scale(.97);
  transition: transform 180ms var(--ease-out);
}
.search-panel.open .search-panel-card { transform: translateY(0) scale(1); }

/* ===== filters: full-screen sheet on mobile ===== */
.filters-panel {
  position: fixed; inset: 0; z-index: 1200;
  background: var(--surface);
  display: flex; flex-direction: column;
  padding: 0 16px calc(16px + var(--safe-b));
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .25s ease;
  visibility: hidden;
}
.filters-panel.open { transform: translateY(0); visibility: visible; }

.sheet-header {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; background: var(--surface); border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sheet-header h2 { margin: 0; font-size: 1.1rem; }
.sheet-footer { position: sticky; bottom: 0; padding: 12px 0; background: var(--surface); }

.field-label { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { font-size: .85rem; color: var(--text-muted); margin: 4px 0 0; }
.req { color: var(--danger); }

.search-block { margin-top: 8px; }
/* Stacked, not side by side: sharing one row left the input around 150px, which
   clipped the placeholder mid-word (and the button's own label with it). */
.search-row { display: flex; flex-direction: column; gap: 8px; }
.search-row input[type="search"] {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--border-control); border-radius: var(--radius);
  font: inherit; font-size: 1rem;
  text-overflow: ellipsis;
}
.search-row .btn { width: 100%; }
.ai-status { font-size: .88rem; color: var(--text-muted); min-height: 1.2em; margin: 6px 0 0; }
.ai-answer {
  margin-top: 8px; padding: 12px;
  background: var(--primary-light); border-radius: var(--radius); font-size: .95rem;
}

#nearMeBtn { margin-top: 12px; }

.filter-group { margin-top: 16px; border: none; padding: 0; }
.filter-group legend { font-weight: 600; padding: 0; margin-bottom: 8px; }
/* Sidebar section headings: small, muted, consistent with the chip-group ones. */
.filters-panel .filter-group legend,
.filters-panel .field-label,
.search-panel .field-label {
  font-size: .82rem; font-weight: 700; color: var(--text-muted); margin-bottom: 6px;
}

select, input[type="text"], input[type="email"], input[type="tel"],
input[type="url"], input[type="number"], textarea {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--border-control); border-radius: var(--radius);
  font: inherit; font-size: 1rem; background: var(--surface); color: var(--text);
}
textarea { min-height: 90px; }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }

.chip-groups { display: flex; flex-direction: column; gap: 4px; }
.chip-groups .chip-list { margin-bottom: 14px; }
.chip-groups .chip-list:last-child { margin-bottom: 0; }
.chip-group-heading {
  margin: 0 0 8px; font-size: .8rem; font-weight: 700;
  color: var(--text-muted);
}
.chip-groups .chip-group-heading:not(:first-child) { margin-top: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--border-control); background: var(--surface);
  font: inherit; font-size: .88rem; font-weight: 600; color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* A quiet ✓ appears when the chip is on — the state must not ride on colour
   alone, but the old boxed checkbox made every chip read as a form control. */
button.chip::before {
  content: '✓';
  flex: none; width: 12px;
  font-size: 12px; font-weight: 800; line-height: 1; color: transparent;
}
button.chip[aria-pressed="true"]::before { color: var(--primary-dark); }
.chip-crisis[aria-pressed="true"]::before { color: var(--danger); }

.chip[aria-pressed="true"] {
  background: var(--primary-light); border-color: var(--primary);
  color: var(--primary-dark);
}

.chip-tools { display: flex; gap: 14px; margin-bottom: 6px; }
.chip-tool {
  min-height: 28px; padding: 2px 2px;
  border: none; background: none;
  font: inherit; font-size: .8rem; font-weight: 700;
  color: var(--primary-dark); text-decoration: underline; cursor: pointer;
}
.chip-tool:hover { color: var(--primary); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chip:has(input:checked) { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.chip input { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary-dark); }

.filter-actions { margin-top: 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.result-count { margin: 0; font-weight: 600; color: var(--primary-dark); }

.age-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.age-row label { font-weight: 600; }
.age-row input { width: 90px; }
.age-row select { width: 100px; }

/* ===== results ===== */
.results-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.result-card {
  /* skips layout and paint for off-screen cards — cheaper than virtualising
     and with no scroll-restoration bugs */
  content-visibility: auto;
  contain-intrinsic-size: 0 150px;
  background: var(--surface); border: 1px solid var(--border);
  border-inline-start: 5px solid var(--primary);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; gap: 10px; align-items: stretch;
  box-shadow: 0 1px 4px rgba(19, 42, 46, .05);
}
.card-main { flex: 1; min-width: 0; }
.result-card h3 { margin: 0 0 3px; font-size: 1rem; font-family: 'Rubik', 'Assistant', sans-serif; }
.result-card .meta { font-size: .84rem; color: var(--text-muted); margin: 0 0 6px; }
.result-card .desc {
  margin: 0 0 8px; font-size: .9rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag {
  font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 3px 9px;
  background: var(--bg); color: var(--text-muted);
}
.tag-cat { background: color-mix(in srgb, currentColor 12%, #fff); }

.card-cta { display: flex; flex-direction: column; gap: 6px; justify-content: center; flex: none; }
.cta {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid var(--border-control); background: var(--bg);
  color: var(--text); cursor: pointer; text-decoration: none;
}
.cta .sv { width: 17px; height: 17px; vertical-align: 0; }
.cta-call { background: var(--primary); border-color: var(--primary); color: #fff; }
.cta-call:hover { background: var(--primary-dark); }

.badge {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: .8rem; font-weight: 700; color: #fff;
}

.empty-state { text-align: center; padding: 32px 16px; color: var(--text-muted); }

/* ===== mobile results sheet over the map ===== */
.results-sheet {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 700;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  max-height: 78%;
  transition: transform .25s ease;
}
.results-sheet:not(.expanded) .sheet-body { display: none; }
.sheet-grabber {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; min-height: 56px; padding: 8px 16px 12px;
  background: none; border: none; font: inherit; font-weight: 600;
  color: var(--primary-dark); cursor: pointer;
}
.grab-bar { width: 44px; height: 5px; border-radius: 3px; background: var(--border); }
.sheet-body {
  overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  padding: 0 12px 16px; -webkit-overflow-scrolling: touch;
}

/* ===== bottom navigation ===== */
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 1000;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
  padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
  height: calc(var(--nav-h) + var(--safe-b));
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: none; font: inherit; font-size: .75rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer; min-height: 44px;
  -webkit-tap-highlight-color: transparent; position: relative;
}
.nav-ico { font-size: 1.35rem; line-height: 1; }
.nav-btn[aria-pressed="true"] { color: var(--primary-dark); }
.nav-btn[aria-pressed="true"] .nav-ico { transform: scale(1.1); }
.nav-danger { color: var(--danger); }
.nav-badge {
  position: absolute; top: 4px; inset-inline-end: 18%;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: .7rem; min-width: 18px; height: 18px; line-height: 18px; text-align: center;
  padding: 0 5px;
}

/* ===== detail panel — bottom sheet on mobile ===== */
.detail-panel {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 1600;
  max-height: 88dvh; overflow-y: auto;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-lg);
  padding: 20px 18px calc(24px + var(--safe-b));
}
.detail-panel .detail-name { margin: 6px 0 4px; color: var(--primary-dark); font-size: 1.2rem; padding-inline-end: 48px; }
.detail-panel dl { margin: 12px 0 0; }
.detail-panel dt { font-weight: 700; margin-top: 12px; color: var(--text-muted); font-size: .88rem; }
.detail-panel dd { margin: 2px 0 0; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.detail-actions .btn { flex: 1 1 130px; }
.btn-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 14px; padding: 12px 0; font-family: 'Rubik', 'Assistant', sans-serif; font-weight: 700;
}
.btn-outline {
  background: var(--surface); color: var(--primary-dark);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.detail-tag { display: inline-block; margin-bottom: 6px; }
.detail-name { font-family: 'Rubik', 'Assistant', sans-serif; }
.detail-desc { color: var(--text-muted); line-height: 1.55; margin: 8px 0 12px; }
.inforows { margin-top: 6px; }
.inforow {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--border); font-size: .92rem;
}
.inforow-ic {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: var(--primary-light); color: var(--primary-dark);
  display: grid; place-items: center;
}
.inforow-ic .sv { width: 16px; height: 16px; vertical-align: 0; }
.inforow-body { min-width: 0; overflow-wrap: anywhere; }
.inforow-link { font-weight: 700; color: var(--primary-dark); white-space: nowrap; }
/* Daily update notice above the results */
.update-strip {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 10px 12px 0; padding: 12px 14px;
  background: var(--primary-light); border: 1px solid var(--primary);
  border-radius: 12px; color: var(--text);
}
.update-strip[hidden] { display: none; }
.update-body { flex: 1; min-width: 0; font-size: .92rem; line-height: 1.5; }
.update-body strong:first-child {
  display: block; font-family: 'Rubik', 'Assistant', sans-serif;
  color: var(--primary-dark); margin-bottom: 4px;
}
.update-body p { margin: 4px 0 0; }
.update-strip .close-btn { position: static; flex: none; }
.thanks-note { background: var(--primary-light); border-radius: 8px; padding: 10px 12px; }

.detail-helpus {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--primary-light); font-size: .9rem; line-height: 1.5;
}

.close-btn {
  position: absolute; top: 12px; inset-inline-end: 12px;
  width: 44px; height: 44px; border: 1px solid var(--border-control); border-radius: 50%;
  background: var(--surface); font-size: 1.1rem; cursor: pointer; z-index: 2;
}
.close-btn:hover { background: var(--danger-bg); }

/* ===== modals ===== */
/* Above .gate-overlay (3000): the emergency hotlines must be reachable from
   inside the registration gate. */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 40, 35, .55); z-index: 3500;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  position: relative; background: var(--surface);
  border-radius: 16px 16px 0 0;
  width: 100%; max-height: 92dvh; overflow-y: auto;
  padding: 24px 18px calc(28px + var(--safe-b));
  box-shadow: var(--shadow-lg);
}
.modal h2 { margin: 0 0 12px; color: var(--primary-dark); font-size: 1.2rem; padding-inline-end: 48px; }
.modal h3 { font-size: 1.02rem; }
.disclaimer-text { background: #fef9c3; padding: 12px; border-radius: var(--radius); }
.urgent-note { background: var(--danger-bg); padding: 12px; border-radius: var(--radius); font-weight: 600; }

.hotlines-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.hotlines-list li { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.hotlines-list .phone {
  display: inline-flex; align-items: center; min-height: 44px;
  font-weight: 700; font-size: 1.15rem;
}

/* ===== registration gate ===== */
.gate-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: linear-gradient(160deg, #0f766e, #134e4a);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
}
.gate-card {
  background: var(--surface); border-radius: 16px;
  width: 100%; max-width: 520px; padding: 24px 20px calc(24px + var(--safe-b));
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
  max-height: 94dvh; overflow-y: auto;
}
.gate-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.gate-head h2 { margin: 0; font-size: 1.2rem; color: var(--primary-dark); }
.gate-step p { margin-top: 0; }
.gate-foot { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border); text-align: center; }

.code-input {
  font-size: 1.6rem; letter-spacing: .4em; text-align: center;
  font-family: 'Rubik', monospace; padding: 12px;
}
.disclaimer-scroll {
  max-height: 40dvh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; background: #fffbeb; font-size: .95rem; margin-bottom: 14px;
}
.disclaimer-scroll ul { margin: 8px 0 0; padding-inline-start: 20px; }
.disclaimer-scroll li { margin-bottom: 8px; }

.consent-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; border: 1.5px solid var(--border-control); border-radius: var(--radius);
  cursor: pointer; font-weight: 600;
}
.consent-row input { width: 24px; height: 24px; min-height: 0; flex: none; accent-color: var(--primary-dark); }

/* ===== forms ===== */
/* custom autocomplete (replaces native datalist — unusable on mobile) */
.ac-field { position: relative; }
.ac-list {
  position: absolute; top: 100%; right: 0; left: 0; z-index: 40;
  background: #fff; border: 1px solid var(--border, #cbd5d1); border-radius: 10px;
  margin-top: 4px; max-height: 230px; overflow-y: auto;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.ac-item {
  display: block; width: 100%; text-align: right; padding: 10px 14px;
  background: none; border: none; cursor: pointer; font: inherit; color: inherit;
}
.ac-item:hover, .ac-item.active { background: #e6f2f0; }

.form-grid { display: grid; gap: 14px; }
.form-grid label { font-weight: 600; }
.form-grid fieldset { border: none; padding: 0; margin: 0; }
.form-grid legend { font-weight: 600; padding: 0; margin-bottom: 8px; }
.form-error { color: var(--danger); font-weight: 600; margin: 4px 0 0; font-size: .9rem; }
.form-ok { color: var(--primary-dark); font-weight: 600; margin: 4px 0 0; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--danger); border-width: 2px;
}

.admin-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.admin-item .row-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ===== footer ===== */
.site-footer {
  padding: 8px 20px; background: var(--surface); border-top: 1px solid var(--border);
  font-size: .85rem; color: var(--text-muted); text-align: center;
  flex: none;
}
.site-footer p { margin: 0; }
.site-footer .link-btn { min-height: 0; padding: 0 2px; }

/* ===== leaflet ===== */
.leaflet-popup-content { direction: rtl; text-align: right; font-family: 'Assistant', sans-serif; margin: 12px 14px; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 10px; }
.marker-pin {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.pin-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; opacity: .95; }

/* Brand-teal cluster pins — the single-marker pin shape, scaled up, with the
   count inside (replaces markercluster's default yellow/green discs). */
.cl-marker {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  color: #fff; font-family: 'Rubik', 'Assistant', sans-serif; font-weight: 700; font-size: .85rem;
  background: radial-gradient(circle at 32% 28%, #1ba496, var(--primary) 65%);
  border: 3px solid #fff; box-shadow: 0 4px 12px rgba(15, 118, 110, .4);
}
.cl-marker > span { transform: rotate(45deg); }
.cl-marker.cl-mid { font-size: .95rem; }
.cl-marker.cl-big {
  font-size: 1.05rem;
  background: radial-gradient(circle at 32% 28%, #177f74, var(--primary-dark) 65%);
}
/* ===== Hebrew place names drawn over a label-free basemap ===== */
.place-label-icon { pointer-events: none; }
.place-label {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-family: 'Assistant', sans-serif;
  font-weight: 600;
  color: #52616b;
  /* halo so names stay legible over roads and the grey mask */
  text-shadow:
     1px  1px 0 rgba(255,255,255,.95),
    -1px  1px 0 rgba(255,255,255,.95),
     1px -1px 0 rgba(255,255,255,.95),
    -1px -1px 0 rgba(255,255,255,.95),
     0 0 4px rgba(255,255,255,.9);
  user-select: none;
}
.place-label.rank-1 { font-size: .92rem; font-weight: 700; color: #3d4a52; }
.place-label.rank-2 { font-size: .8rem; }
.place-label.rank-3 { font-size: .72rem; color: #6b7780; }
.place-label.is-water {
  color: #6d93a8; font-style: italic;
  text-shadow: 0 0 5px rgba(255,255,255,.95);
}

/* ===== cluster hover card ===== */
.cluster-card {
  position: absolute; z-index: 680;
  width: 288px; max-height: 62%;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-control);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 60, 55, .24), 0 2px 6px rgba(15, 60, 55, .12);
  overflow: hidden;
  opacity: 0;
  transform: scale(.97);
  transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out);
}
.cluster-card.is-open { opacity: 1; transform: scale(1); }

.cc-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px 8px 8px;
  border-bottom: 1px solid var(--border);
  font-size: .88rem; color: var(--primary-dark);
  background: var(--primary-light);
}
/* Matches the app's other close buttons (.close-btn) — a solid white circle
   with a visible border, not a transparent glyph on a tinted background.
   The previous transparent style was reported unreadable on a real phone. */
.cc-close {
  flex: none; width: 30px; height: 30px; min-width: 30px; border-radius: 50%;
  border: 1px solid var(--border-control); background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  cursor: pointer; font-size: .85rem; font-weight: 700;
  color: var(--text); line-height: 1;
}
.cc-close:hover { background: var(--danger-bg); border-color: var(--danger); }

.cc-list { overflow-y: auto; overscroll-behavior: contain; padding: 4px; }

@keyframes cc-row-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cc-row {
  display: flex; align-items: flex-start; gap: 9px; width: 100%;
  padding: 8px 9px; border: none; border-radius: 9px;
  background: none; font: inherit; text-align: start; cursor: pointer;
  animation: cc-row-in 190ms var(--ease-out) both;
}
.cc-row:hover { background: var(--primary-light); }
.cc-dot {
  flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px;
  border: 1px solid rgba(0,0,0,.18);
}
.cc-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cc-name { font-size: .87rem; font-weight: 700; line-height: 1.3; color: var(--text); }
.cc-meta { font-size: .76rem; color: var(--text-muted); line-height: 1.3; }

.cc-more {
  border: none; border-top: 1px solid var(--border);
  background: var(--surface); cursor: pointer;
  padding: 10px; font: inherit; font-size: .8rem; font-weight: 600;
  color: var(--primary-dark);
}
.cc-more:hover { background: var(--primary-light); }

/* The cluster badge should read as hoverable */
.marker-cluster { transition: transform 140ms var(--ease-out); cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .marker-cluster:hover { transform: scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  /* gentler, not gone: keep the fade, drop the movement and the stagger */
  .cluster-card { transform: none !important; }
  .cc-row { animation: none; opacity: 1; }
  .marker-cluster:hover { transform: none; }
}

.me-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: #1d4ed8; border: 3px solid #fff; box-shadow: 0 0 0 3px rgba(29,78,216,.35);
}

/* =========================================================
   TABLET / DESKTOP
   ========================================================= */
@media (min-width: 860px) {
  :root { --header-h: 68px; --nav-h: 0px; }

  .site-header .btn { padding: 8px 16px; font-size: 1rem; }
  .brand-mark { font-size: 2rem; }
  .brand h1 { font-size: 1.6rem; }
  .tagline { font-size: .92rem; max-width: 52ch; }
  .gate-head h2 { font-size: 1.4rem; }
  .site-header { flex-wrap: wrap; padding: 10px 20px; }
  .header-actions { flex-wrap: wrap; }

  .app-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    /* row 1 = search block (auto height), row 2 = filters (fills the rest) */
    grid-template-rows: auto 1fr;
    margin-bottom: 0;
  }

  /* Reset the mobile popup entirely — on desktop this is a plain always-visible
     block stacked above the filters, not an overlay. */
  .search-panel {
    position: static; inset: auto; z-index: auto;
    display: block; padding: 0; background: none;
    opacity: 1; visibility: visible; transition: none;
    grid-column: 1; grid-row: 1;
    border-inline-start: 1px solid var(--border);
  }
  .search-panel-card {
    max-width: none; padding: 14px 16px 0; border-radius: 0; box-shadow: none;
    transform: none; transition: none;
  }
  .search-block { margin-top: 0; }
  .search-row input[type="search"] {
    min-height: 42px; background: var(--bg); border-color: var(--border);
    border-radius: 12px; font-size: .95rem;
  }
  .ai-status { min-height: 0; margin: 2px 0 0; }

  .filters-panel {
    position: static; transform: none; visibility: visible;
    inset: auto; z-index: auto;
    grid-column: 1; grid-row: 2;
    border-inline-start: 1px solid var(--border);
    padding: 4px 16px 16px; box-shadow: none; border-radius: 0;
    max-height: none; height: 100%;
  }
  #nearMeBtn { margin-top: 8px; min-height: 40px; font-size: .9rem; }
  .chip { min-height: 34px; font-size: .84rem; padding: 5px 11px; }
  .filter-group { margin-top: 14px; }
  .chip-groups .chip-list { margin-bottom: 10px; }

  /* The audience switch lives in the top selectors bar on desktop. */
  .site-header .aud-toggle { display: none; }

  .results-area { display: flex; flex-direction: column; grid-column: 2; grid-row: 1 / -1; }
  /* Top selectors bar: audience · area · map/list — three segmented pills. */
  .view-toggle {
    display: flex; gap: 14px; flex-wrap: wrap; align-items: center; padding: 8px 12px;
    background: var(--surface); border-bottom: 1px solid var(--border); flex: none;
  }
  /* (segmented-pill base styles are global — see .seg-group above) */
  #mapView, #listView { flex: 1; min-height: 0; }
  #listView { padding: 16px; }
  .results-list { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

  .detail-panel {
    top: 0; bottom: auto; inset-inline-start: 0; inset-inline-end: auto;
    width: min(430px, 100vw); height: 100dvh; max-height: none;
    border-radius: 0; padding: 24px;
  }

  /* On desktop the strip must flow above the view tabs, not float over them. */
  .answer-strip {
    position: static; margin: 8px 12px 0; max-height: none;
  }

  .modal-backdrop { align-items: center; padding: 16px; }
  .modal { border-radius: 14px; max-width: 660px; padding: 26px; }
  .gate-card { padding: 30px; }
}

@media (min-width: 1280px) {
  .app-layout { grid-template-columns: 380px 1fr; }
}

/* ===== reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
  .btn:active { transform: none; }
}

/* ===== high contrast / forced colors ===== */
@media (forced-colors: active) {
  .chip[aria-pressed="true"] { border-width: 3px; }
  .badge { border: 1px solid; }
}
