/* ── Pleasant Hill Parcel Corner Finder ─────────────────────────── */

:root {
  --teal:        #12939f;
  --teal-bright: #17b3c1;
  --teal-deep:   #0d6d76;
  --teal-wash:   #eaf7f8;

  --ink:         #14181a;
  --ink-2:       #3c464a;
  --ink-3:       #6b787d;
  --line:        #dde4e6;
  --line-soft:   #edf1f2;
  --paper:       #ffffff;
  --paper-2:     #f6f8f9;

  --amber:       #d98324;
  --danger:      #b3261e;

  --r:    10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20,24,26,.06), 0 1px 1px rgba(20,24,26,.04);
  --shadow-md: 0 4px 16px rgba(20,24,26,.07), 0 1px 3px rgba(20,24,26,.05);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper-2);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-deep); }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* ── Masthead ───────────────────────────────────────────────────── */
.masthead {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  max-width: 1160px; margin: 0 auto; padding: 18px 24px;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.logo { height: 58px; width: auto; display: block; }
.masthead-meta {
  display: flex; flex-direction: column; gap: 1px;
  padding-left: 22px; border-left: 1px solid var(--line);
}
.tool-name {
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink);
}
.tool-sub {
  font-size: 12px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .09em; font-weight: 500;
}

/* ── Search band ────────────────────────────────────────────────── */
.search-band {
  background: linear-gradient(168deg, #0e3a40 0%, #12545c 55%, #12939f 130%);
  color: #fff;
  padding: 46px 0 40px;
}
.search-band h1 {
  margin: 0 0 10px;
  font-size: clamp(25px, 3.4vw, 36px);
  line-height: 1.15; letter-spacing: -0.025em; font-weight: 700;
  max-width: 20ch; text-wrap: balance;
}
.lede {
  margin: 0 0 12px; max-width: 62ch;
  color: rgba(255,255,255,.82); font-size: 15px;
}
.coverage {
  margin: 0 0 26px; max-width: 66ch;
  color: rgba(255,255,255,.6); font-size: 13.5px; line-height: 1.55;
}
.coverage strong { color: rgba(255,255,255,.9); font-weight: 600; }

.search-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.search-row[hidden] { display: none; }
.field { flex: 1 1 340px; min-width: 0; }
.field label {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.66); margin-bottom: 7px;
}
#apn, #addr {
  width: 100%; padding: 14px 16px;
  font-family: var(--mono); font-size: 17px; letter-spacing: .03em;
  color: var(--ink); background: #fff;
  border: 1px solid transparent; border-radius: var(--r);
  outline: none; transition: box-shadow .15s;
}
#apn::placeholder, #addr::placeholder { color: #9fabaf; letter-spacing: .02em; }
#apn:focus, #addr:focus { box-shadow: 0 0 0 3px rgba(23,179,193,.5); }
#addr { font-family: var(--font); font-size: 16px; letter-spacing: 0; }

.field-county { flex: 0 0 218px; }
#county {
  width: 100%; padding: 14px 14px;
  font-family: var(--font); font-size: 15px;
  color: var(--ink); background: #fff;
  border: 1px solid transparent; border-radius: var(--r);
  outline: none; cursor: pointer; min-height: 49px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%230d6d76' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px;
}
#county:focus { box-shadow: 0 0 0 3px rgba(23,179,193,.5); }

.btn-primary {
  position: relative;
  padding: 14px 26px; border: 0; border-radius: var(--r);
  background: var(--teal-bright); color: #06282c;
  font-family: var(--font); font-size: 15px; font-weight: 650; letter-spacing: -0.005em;
  cursor: pointer; transition: background .15s, transform .08s;
  min-height: 49px; white-space: nowrap;
}
.btn-primary:hover { background: #24c6d4; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { opacity: .72; cursor: progress; }

.spinner {
  display: none; width: 15px; height: 15px; margin-left: 2px;
  border: 2px solid rgba(6,40,44,.28); border-top-color: #06282c;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.btn-primary.loading .btn-label { display: none; }
.btn-primary.loading .spinner { display: block; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.search-aux {
  margin-top: 14px; display: flex; gap: 20px; align-items: center;
  flex-wrap: wrap; font-size: 13px; color: rgba(255,255,255,.62);
}
.samples { display: flex; gap: 8px; align-items: center; }
.chip {
  font-family: var(--mono); font-size: 12.5px;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.11); color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  transition: background .15s;
}
.chip:hover { background: rgba(255,255,255,.2); }

.alert {
  margin-top: 18px; padding: 13px 16px; border-radius: var(--r);
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,220,180,.4);
  color: #ffe6c9; font-size: 14px;
}

/* ── Empty state ────────────────────────────────────────────────── */
.empty { padding: 56px 24px 72px; }
.empty-card {
  text-align: center; color: var(--ink-3);
  border: 1px dashed var(--line); border-radius: var(--r-lg);
  background: var(--paper); padding: 46px 24px;
}
.empty-icon { width: 62px; height: 62px; color: #b9c6ca; margin-bottom: 12px; }
.empty p { margin: 0; font-size: 14.5px; }

/* ── Results header ─────────────────────────────────────────────── */
#results { padding: 34px 0 8px; }

.parcel-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; flex-wrap: wrap; margin-bottom: 20px;
}
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .11em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px;
}
.parcel-head h2 {
  margin: 0; font-family: var(--mono); font-size: 27px;
  font-weight: 500; letter-spacing: .01em; color: var(--ink);
}
.owner { font-size: 14px; color: var(--ink-2); margin-top: 3px; }
.county-badge {
  color: var(--teal-deep); font-weight: 700;
}
.btn-ghost-sm {
  margin-top: 12px; font-size: 12.5px; padding: 7px 12px;
}

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-ghost {
  padding: 9px 15px; border-radius: 8px; cursor: pointer;
  background: var(--paper); border: 1px solid var(--line);
  color: var(--teal-deep); font-family: var(--font);
  font-size: 13.5px; font-weight: 550; text-decoration: none;
  display: inline-flex; align-items: center;
  transition: border-color .15s, background .15s;
}
.btn-ghost:hover { border-color: var(--teal); background: var(--teal-wash); }
.btn-ghost[hidden] { display: none; }

/* ── Stat strip ─────────────────────────────────────────────────── */
.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; margin-bottom: 26px;
}
.stat { background: var(--paper); padding: 15px 17px; display: flex; flex-direction: column; gap: 3px; }
.stat .k {
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3);
}
.stat .v {
  font-size: 18px; font-weight: 600; letter-spacing: -0.015em; color: var(--ink);
  overflow-wrap: anywhere;
}
.stat .v.small { font-size: 13.5px; font-weight: 500; line-height: 1.35; }

/* ── Map ────────────────────────────────────────────────────────── */
.map-block { margin-bottom: 26px; }
.map-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap; margin-bottom: 10px;
}
.map-title { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.toggles { display: flex; gap: 16px; flex-wrap: wrap; }
.tog {
  font-size: 13px; color: var(--ink-2); display: inline-flex;
  align-items: center; gap: 6px; cursor: pointer; user-select: none;
}
.tog input { accent-color: var(--teal); width: 15px; height: 15px; cursor: pointer; }

#map {
  height: 540px; border-radius: var(--r-lg);
  border: 1px solid var(--line); box-shadow: var(--shadow-md);
  background: #dfe6e8;
}

.map-legend {
  display: flex; gap: 20px; flex-wrap: wrap; align-items: center;
  margin-top: 10px; font-size: 12.5px; color: var(--ink-3);
}
.map-legend span { display: inline-flex; align-items: center; gap: 7px; }
.sw { display: inline-block; }
.sw-line { width: 20px; height: 3px; background: #17f0ff; border-radius: 2px; }
.sw-corner { width: 13px; height: 13px; border-radius: 50%; background: #ffcf3d; border: 2px solid #1a1a1a; }
.sw-arc { width: 8px; height: 8px; border-radius: 50%; background: #fff; border: 2px solid #17b3c1; }
.legend-note { margin-left: auto; font-size: 11.5px; color: #93a1a5; }

/* corner + label markers */
.corner-pin {
  background: #ffcf3d; color: #14181a;
  border: 2px solid #1c1c1c;
  border-radius: 999px; min-width: 28px; height: 24px; padding: 0 6px;
  position: absolute; left: 0; top: 0; width: max-content;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font); font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
  transform: translate(-50%, -50%);
}
.arc-pin {
  background: #fff; border: 2px solid #17b3c1;
  border-radius: 50%; width: 11px; height: 11px;
  box-shadow: 0 1px 3px rgba(0,0,0,.45);
}
.edge-label {
  background: rgba(10,22,25,.88);
  color: #d9fbff; border: 1px solid rgba(23,240,255,.45);
  border-radius: 5px; padding: 3px 8px; white-space: nowrap;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  line-height: 1.25; text-align: center;
  box-shadow: 0 1px 5px rgba(0,0,0,.45);
  position: absolute; left: 0; top: 0; width: max-content;
  transform: translate(-50%, -50%);
}
.edge-label .bear {
  display: block; font-size: 9.5px; color: #8fd5de; letter-spacing: .01em;
}
.leaflet-div-icon { background: transparent; border: 0; }
.leaflet-container { font-family: var(--font); border-radius: var(--r-lg); }
.leaflet-popup-content { font-size: 13px; line-height: 1.5; margin: 12px 14px; }
.leaflet-popup-content b { font-family: var(--mono); font-size: 13px; }
.leaflet-popup-content .mono { font-family: var(--mono); font-size: 12px; }

/* ── Panels & tables ────────────────────────────────────────────── */
.grid-two {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; margin-bottom: 26px;
}
.panel {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--line-soft);
}
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.panel-note { font-size: 12px; color: var(--ink-3); }
.btn-mini {
  font-size: 12px; font-weight: 550; padding: 5px 11px; cursor: pointer;
  border-radius: 7px; border: 1px solid var(--line);
  background: var(--paper-2); color: var(--teal-deep); font-family: var(--font);
}
.btn-mini:hover { border-color: var(--teal); background: var(--teal-wash); }

.table-scroll { max-height: 460px; overflow: auto; scrollbar-width: thin; }
.table-scroll::-webkit-scrollbar { height: 8px; width: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: #c6d1d4; border-radius: 4px; }
table { width: 100%; border-collapse: collapse; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--paper-2); text-align: left;
  font-size: 10.5px; font-weight: 650; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-3);
  padding: 9px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 9px 14px; border-bottom: 1px solid var(--line-soft);
  font-size: 13px; vertical-align: middle; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--teal-wash); }
tbody tr.is-arc { color: var(--ink-3); }
td.mono, th.num { font-family: var(--mono); }
th.num, td.num { text-align: right; }
td.mono { font-size: 12.5px; }
.cid { font-weight: 650; font-family: var(--font); }
.cid.arc { font-weight: 400; font-size: 12px; color: var(--ink-3); }
.tlink {
  font-size: 12px; font-weight: 550; text-decoration: none;
  color: var(--teal-deep); border-bottom: 1px solid rgba(18,147,159,.3);
}
.tlink:hover { border-bottom-color: var(--teal); }

.legal-panel { padding: 18px; margin-bottom: 26px; }
.legal-panel h3 { margin: 0 0 8px; font-size: 15px; font-weight: 650; }
.legal { margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }

/* ── Field guide ────────────────────────────────────────────────── */
.field-guide {
  background: var(--teal-wash); border: 1px solid #cfe8eb;
  border-radius: var(--r-lg); padding: 22px 26px; margin-bottom: 40px;
}
.field-guide h3 { margin: 0 0 12px; font-size: 15px; font-weight: 650; color: var(--teal-deep); }
.field-guide ol { margin: 0; padding-left: 20px; }
.field-guide li { margin-bottom: 9px; font-size: 14px; color: var(--ink-2); }
.field-guide li:last-child { margin-bottom: 0; }
.field-guide strong { color: var(--ink); font-weight: 600; }

/* ── Footer ─────────────────────────────────────────────────────── */
footer { background: #0e3a40; color: rgba(255,255,255,.62); padding: 30px 0 38px; }
.footer-inner { display: grid; grid-template-columns: 260px 1fr; gap: 32px; }
.footer-inner strong { color: #fff; font-weight: 600; }
.footer-inner > div { font-size: 13px; line-height: 1.6; }
.disclaimer { margin: 0; font-size: 12.5px; line-height: 1.65; }
.disclaimer a { color: #7fd8e2; }
.disclaimer strong { color: #ffd9a8; }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 9999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-two { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  #map { height: 420px; }
}
@media (max-width: 620px) {
  .wrap { padding: 0 16px; }
  .masthead-inner { padding: 14px 16px; gap: 14px; }
  .logo { height: 42px; }
  .masthead-meta { padding-left: 14px; }
  .search-band { padding: 32px 0 30px; }
  .search-row { flex-direction: column; align-items: stretch; }
  .field { flex: 0 0 auto; }
  .field-county { flex: 0 0 auto; }
  .btn-primary { width: 100%; }
  .parcel-head h2 { font-size: 22px; }
  #map { height: 340px; }
  .legend-note { margin-left: 0; }
  .head-actions { width: 100%; }
  .btn-ghost { flex: 1 1 auto; justify-content: center; }
}

/* ── Search mode tabs ─────────────────────────────────────────────── */
.mode-tabs {
  display: inline-flex; gap: 2px; margin: 0 0 14px;
  padding: 3px; border-radius: 10px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
}
.mode-tab {
  appearance: none; border: 0; cursor: pointer;
  padding: 7px 16px; border-radius: 7px;
  font: 600 13.5px/1 var(--font); letter-spacing: .01em;
  color: rgba(255,255,255,.72); background: transparent;
  transition: background .16s ease, color .16s ease;
}
.mode-tab:hover { color: #fff; background: rgba(255,255,255,.09); }
.mode-tab.is-active { color: var(--teal-deep); background: #fff; }
.mode-tab:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ── Address autocomplete ─────────────────────────────────────────── */
.combo { position: relative; }
.suggest {
  position: absolute; z-index: 900; top: calc(100% + 6px); left: 0; right: 0;
  margin: 0; padding: 5px; list-style: none;
  background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 14px 34px rgba(10,40,44,.24);
  max-height: 268px; overflow-y: auto;
}
.sug {
  padding: 9px 11px; border-radius: 7px; cursor: pointer;
  font: 400 14px/1.35 var(--font); color: var(--ink);
}
.sug:hover, .sug.is-on { background: var(--teal-wash); color: var(--teal-deep); }

/* ── Match provenance line ────────────────────────────────────────── */
.match {
  margin-top: 7px; font-size: 13px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--teal-wash); border: 1px solid #cbe9ec;
  border-radius: 999px; padding: 4px 12px;
}
.match strong { color: var(--teal-deep); font-weight: 600; }

/* ── Map click-to-identify ────────────────────────────────────────── */
.tog-pick { padding-left: 12px; border-left: 1px solid var(--line); }
#map.picking { cursor: crosshair; }
#map.picking .leaflet-interactive { cursor: crosshair; }
.pick-note {
  margin-top: 8px; padding: 8px 12px; border-radius: 8px;
  background: var(--teal-wash); border: 1px solid #cbe9ec;
  font-size: 13px; color: var(--teal-deep);
}

@media (max-width: 620px) {
  .mode-tabs { display: flex; width: 100%; }
  .mode-tab { flex: 1 1 0; }
  .tog-pick { padding-left: 0; border-left: 0; }
}

.match[hidden] { display: none; }
