/* The Ordinance Map on safeparkher.com: one card on a full-bleed map. The
   card holds the disclaimer, two inputs and links (plans/ordinances/search/PLAN.md §3.1). */

:root {
  --ink:        #14161f;
  --ink-2:      #41465c;
  --muted:      #6b6f80;
  --line:       #e5e7f0;
  --line-2:     #eef0f7;
  --surface:    #ffffff;
  --brand:      #4338ca;
  --brand-600:  #4f46e5;
  --brand-700:  #3730a3;
  --brand-tint: #eef0ff;
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px;
  --shadow-2: 0 4px 12px rgba(20,22,31,.07), 0 12px 32px rgba(20,22,31,.08);
}

/* Several classes below set `display`, which would otherwise beat [hidden]. */
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.panel-map { position: absolute; inset: 0; overflow: hidden; }
#finder-map { position: absolute; inset: 0; }

.map-fallback, .map-error {
  position: absolute; inset: 0; display: grid; place-items: center;
  padding: 32px; text-align: center; color: var(--muted);
}

/* ── The card ────────────────────────────────────────────────────────── */

.map-card {
  position: absolute; z-index: 10;
  top: 16px; left: 16px; width: 360px; max-width: calc(100vw - 32px);
  max-height: calc(100% - 32px);
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: 14px 16px 16px;
  color: var(--ink);
  overflow-y: auto;
}

/* ── The three sections, each a disclosure ───────────────────────────── */

.card-section { border-top: 1px solid var(--line-2); padding-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.card-section summary {
  display: flex; align-items: center; gap: 8px; padding: 2px 0; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 650; color: var(--ink);
}
.card-section summary::-webkit-details-marker { display: none; }
.card-section summary:hover { color: var(--brand); }
.card-section summary::after {
  content: ""; flex-shrink: 0; margin-left: auto; width: 7px; height: 7px;
  border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s ease;
}
.card-section[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.section-count { font-size: 12px; font-weight: 550; color: var(--muted); }

.sheet-handle { display: none; }

/* ── The first-visit disclaimer ──────────────────────────────────────── */

.disclaimer {
  width: min(440px, calc(100vw - 32px)); padding: 22px 22px 18px; border: 0; border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2);
}
.disclaimer::backdrop { background: rgba(20,22,31,.42); }
.disclaimer-text { margin: 0 0 16px; font-size: 15px; line-height: 1.5; }
.disclaimer form { margin: 0; }
.primary-btn {
  display: block; width: 100%; padding: 11px 18px; border: 0; border-radius: var(--r-md);
  background: var(--brand); color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.primary-btn:hover { background: var(--brand-600); }
.primary-btn:focus-visible { outline: 3px solid rgba(79,70,229,.35); outline-offset: 2px; }

.beta-tag {
  display: inline-block; padding: 1px 6px; border-radius: 999px; background: var(--brand-tint); color: var(--brand-700);
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; vertical-align: 1px;
}

input[type="search"] {
  width: 100%; min-width: 0;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: #fbfbfe; color: var(--ink);
  font: inherit; font-size: 15px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input[type="search"]:focus {
  outline: none; background: #fff; border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(79,70,229,.16);
}
input[type="search"]::placeholder { color: #8a8fa0; }

/* ── Place box and its options ───────────────────────────────────────── */

.place-search { position: relative; }
.place-options {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0;
  margin: 0; padding: 4px; list-style: none;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-2); max-height: 280px; overflow: auto;
}
.place-option {
  padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 14px; line-height: 1.35; color: var(--ink);
}
.place-option-address { color: var(--ink-2); }
.place-option-point { font-variant-numeric: tabular-nums; }
.place-option[aria-selected="true"], .place-option:hover { background: var(--brand-tint); }

/* ── Ordinance search ────────────────────────────────────────────────── */

.ordinance-search { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.mode-buttons { display: flex; gap: 6px; }
.mode-btn {
  flex: 1; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink-2);
  font: inherit; font-size: 13px; font-weight: 550; cursor: pointer;
}
.mode-btn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.mode-btn:focus-visible, .copy-btn:focus-visible, .more-link:focus-visible, .chip-remove:focus-visible {
  outline: 3px solid rgba(79,70,229,.35); outline-offset: 2px;
}

.selection-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 3px 4px 3px 10px; border-radius: 999px;
  background: var(--brand-tint); color: var(--brand-700); font-size: 12.5px; font-weight: 550;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-remove {
  width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent;
  color: var(--brand-700); font-size: 16px; line-height: 1; cursor: pointer;
}
.chip-remove:hover { background: rgba(67,56,202,.12); }
/* Counties, regional districts and other upper tiers are the lighter purple, as on the map. */
.chip-upper { background: #f5f6ff; border: 1px solid #c7d2fe; color: var(--brand-600); padding-top: 2px; padding-bottom: 2px; }
.chip-upper .chip-remove { color: var(--brand-600); }
.chip-upper .chip-remove:hover { background: rgba(67,56,202,.1); }

.status { margin: 0; font-size: 13px; line-height: 1.4; color: var(--ink-2); }

/* ── Links: the card's only scrolling region ─────────────────────────── */

.links { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.copy-btn {
  align-self: flex-start; padding: 6px 12px;
  border: 1px solid var(--brand); border-radius: var(--r-sm); background: #fff; color: var(--brand);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.copy-btn:hover { background: var(--brand-tint); }
.links-list { overflow-y: auto; max-height: 30vh; min-height: 0; overscroll-behavior: contain; }
.link-group + .link-group { margin-top: 10px; }
.link-caption { margin: 0 0 4px; font-size: 13px; font-weight: 650; color: var(--ink); }
.link-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border: 0; border-radius: 999px; vertical-align: 1px;
  background: var(--line-2); color: var(--muted); font: inherit; font-size: 10px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
}
.link-tag-county { background: #f5f6ff; border: 1px solid #c7d2fe; color: var(--brand-600); }
/* The marker is a button: hover shows the sentence as a tooltip, a tap opens it under the caption. */
button.link-tag-unindexed { background: #fff; border: 1px dashed #a5b4fc; color: var(--brand); cursor: pointer; }
button.link-tag-unindexed:hover, button.link-tag-unindexed[aria-expanded="true"] { background: var(--brand-tint); }
.tag-note { margin: 0 0 6px; font-size: 12px; line-height: 1.4; color: var(--ink-2); }
/* Sites the index has not reached are set off, so they can be searched by hand. */
.link-group-unindexed { padding-left: 8px; border-left: 3px solid #c7d2fe; }
.link-group ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.link-group li { display: grid; gap: 1px; min-width: 0; }
.link-label { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-group a {
  font-size: 13px; color: var(--brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-underline-offset: 3px;
}
.more-link {
  align-self: flex-start; padding: 2px 0; border: 0; background: none;
  color: var(--brand); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Map controls ────────────────────────────────────────────────────── */

.maplibregl-ctrl-attrib { font-size: 10.5px; }

/* ── A phone: the card is a bottom sheet, 45% tall, dragged up to 90% ── */

@media (max-width: 720px) {
  .map-card {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none;
    height: var(--sheet, 45dvh); max-height: 90dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 6px max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    overflow-y: auto; transition: height .18s ease;
  }
  .map-card.is-dragging { transition: none; }
  .sheet-handle {
    display: block; align-self: center; flex: none;
    width: 44px; height: 18px; padding: 0; border: 0; background: none; cursor: grab; touch-action: none;
  }
  .sheet-handle::before {
    content: ""; display: block; width: 40px; height: 4px; margin: 7px auto; border-radius: 2px; background: var(--line);
  }
  .links-list { max-height: none; }
  .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: var(--sheet, 45dvh); }
}
