/* Search page, plus the confirm/unsubscribe pages. Layout: the brand nav in the page flow, a filters + results
   column on the left and the map as a rounded panel filling the rest; on phones the map sits on top.
   Colors, fonts, nav and buttons come from brand.css so this page matches the homepage. */
body { font-size: 15px; line-height: 1.5; }

/* ---------- Page frame ---------- */
body.search-page { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.nav-static { position: relative; top: auto; flex: none; padding-top: calc(env(safe-area-inset-top, 0px) + 12px); padding-bottom: 12px; }
.nav-static .nav { max-width: none; }
.updated { margin-left: 8px; padding-right: 10px; color: var(--muted); font: 600 .78rem var(--f-mono); white-space: nowrap; }
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(340px, 440px) 1fr; gap: 16px;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); }
.panel { overflow-y: auto; display: grid; gap: 14px; align-content: start; padding: 2px 4px 8px 0; min-width: 0; }
.mapwrap { position: relative; min-width: 0; border-radius: 24px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
#map { position: absolute; inset: 0; }

/* ---------- Filters (styled like the homepage search bar) ---------- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 8px; box-shadow: var(--shadow-sm); }
.field { display: grid; gap: 2px; min-width: 0; padding: 8px 12px; border-radius: 12px; transition: background .2s; }
.field:hover, .field:focus-within { background: var(--surface-2); }
.field label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field select, .field input { width: 100%; padding: 4px 0; border: 0; background: transparent; outline: none;
  font-family: var(--f-display); font-weight: 600; font-size: 16px; min-height: 32px; }
.field select option { color: #0E151C; background: #FFFFFF; }
.field input::placeholder { color: var(--muted); font-weight: 500; }
.link-button { background: none; border: 0; padding: 8px 12px; color: var(--accent); cursor: pointer; justify-self: start;
  align-self: center; font-weight: 600; font-size: .9rem; border-radius: 10px; }
.link-button:hover { background: var(--accent-soft); }

/* ---------- Results ---------- */
.resultbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.resultbar p { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; }
.resultbar .btn { min-height: 42px; padding: 0 16px; font-size: 15px; border-radius: 12px; }

.signup { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: var(--shadow-sm); }
.signup h2 { font-size: 1.1rem; font-weight: 800; margin: 0 0 4px; }
.signup .row { display: flex; gap: 8px; margin-top: 6px; }
.signup .row input { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.signup .row .btn { min-height: 44px; border-radius: 12px; font-size: 15px; }
.signup label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.criteria { margin: 0 0 12px; font-weight: 700; color: var(--accent); }
.fine { font-size: .82rem; color: var(--muted); margin: 10px 0 0; }
.status { margin: 6px 0 0; font-weight: 600; }
.status.error { color: var(--accent); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; cursor: pointer;
  display: grid; gap: 3px; box-shadow: var(--shadow-sm); transition: border-color .2s, transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card:hover, .card.selected { border-color: var(--accent); }
.card.selected { background: var(--accent-soft); }
.card .addr { font-family: var(--f-display); font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; }
.card .rent { font-family: var(--f-display); font-weight: 800; font-size: 1.05rem; }
.card .meta { color: var(--muted); font-size: .88rem; }
.badge { display: inline-block; font-size: .74rem; padding: 2px 9px; border-radius: 999px; margin: 4px 4px 0 0;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.card.selected .badge { background: var(--surface); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.empty { color: var(--muted); padding: 18px; border: 1.5px dashed var(--line); border-radius: 16px; text-align: center; }
.notes { color: var(--muted); font-size: .8rem; }
.notes p { margin: 0 0 6px; }

/* ---------- Details drawer ---------- */
.drawer { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 92px); right: max(28px, env(safe-area-inset-right, 0px));
  bottom: 28px; width: min(420px, calc(100% - 56px)); z-index: 1000; display: flex; }
.drawer-inner { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
  padding: 22px; overflow-y: auto; overscroll-behavior: contain; width: 100%; box-shadow: var(--shadow-lg); }
.drawer-backdrop { display: none; }
.drawer h2 { margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; padding-right: 32px; }
.drawer h3 { font-family: var(--f-body); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.eyebrow { margin: 0 0 4px; font-family: var(--f-display); font-weight: 700; font-size: .8rem; color: var(--accent); }
.d-title { margin: 4px 0 0; color: var(--muted); }
.close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2);
  border: 0; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--ink); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.warn { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 12px; font-size: .88rem; margin: 12px 0 0; }
.d-desc { white-space: pre-line; font-size: .92rem; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chart text { fill: var(--muted); font: 11px var(--f-mono); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .grid { stroke: var(--line); }
.chart .dot { fill: var(--accent); }
.hist-note { color: var(--muted); font-size: .88rem; margin: 4px 0 0; }

.leaflet-container { background: var(--surface-2); font: inherit; }
.leaflet-control-attribution { font-size: 11px; }

/* ---------- Simple server-rendered pages (confirm / unsubscribe) ---------- */
body.simple { min-height: 100dvh; display: grid; place-items: start center; padding: 72px max(16px, env(safe-area-inset-left, 0px)) 48px; }
.card-page { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 32px; max-width: 520px; width: 100%; box-shadow: var(--shadow-lg); }
.card-page h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; margin: 18px 0 12px; }
.card-page .brand, .card-page .brand:hover { text-decoration: none; color: var(--ink); }
.card-page p { color: var(--muted); }
.card-page p b, .card-page .criteria { color: var(--ink); }
.card-page a { color: var(--accent); }
.card-page button { background: var(--crimson); color: var(--on-crimson); border: 0; border-radius: 13px; min-height: 48px;
  padding: 0 22px; font-family: var(--f-display); font-weight: 700; font-size: 16px; cursor: pointer; }

@media (max-width: 760px) {
  body.search-page { height: auto; overflow: visible; display: block; }
  .nav-static { position: sticky; top: 0; z-index: 1100; background: var(--bg); }
  .updated { display: none; }
  .layout { grid-template-columns: 1fr; padding-bottom: 24px; }
  .mapwrap { order: -1; height: 42vh; }
  .panel { overflow: visible; padding-right: 0; }
  .drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 82vh; z-index: 1300; }
  .drawer-inner { padding-top: 30px; }
  /* grab bar so it reads as a sheet on top of the page */
  .drawer-inner::before { content: ""; position: absolute; top: 10px; left: 50%; width: 40px; height: 5px; margin-left: -20px;
    border-radius: 3px; background: var(--line); }
  .drawer-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 1200; background: rgba(14, 21, 28, 0.55);
    animation: dim-in .2s ease-out; }
  body.drawer-open { overflow: hidden; }
  @keyframes dim-in { from { opacity: 0; } }
  @media (prefers-reduced-motion: reduce) { .drawer-backdrop:not([hidden]) { animation: none; } }
  .signup .row { flex-direction: column; }
}
