/* Clerkbell: one stylesheet for the home page and the explorer. */
:root {
  --ground: #F5F7F6; --surface: #FFFFFF; --ink: #0F1E22; --muted: #4A5B60; --soft: #33474D;
  --line: #D9E0DE; --line-strong: #B8C4C1; --chip: #EEF1F0; --accent: #0A5C63; --sun: #FFD23F;
  --growth-bg: #DDF3E4; --growth: #14532D; --deals-bg: #DCE9FB; --deals: #1E3A8A;
  --distress-bg: #FBE1D6; --distress: #8A2C0D; --money-bg: #FBF0C4; --money: #6B4E00;
  --building-bg: #E9E2F8; --building: #4C2A85; --compliance-bg: #E2E8EA; --compliance: #33474D;
  --display: "Space Grotesk", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font: 16px/1.45 Inter, system-ui, sans-serif; }
a { color: var(--accent); }
a:hover { color: #063F44; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--mono); font-weight: 700; }

/* brand */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand b { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
.badge { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 4px; background: var(--sun); color: var(--ink); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn-ink { background: var(--ink); color: #fff; } .btn-ink:hover { color: #fff; background: #1c3238; }
.btn-accent { background: var(--accent); color: #fff; } .btn-accent:hover { color: #fff; background: #063F44; }
.btn-sun { background: var(--sun); color: var(--ink); } .btn-sun:hover { color: var(--ink); background: #f5c520; }
.btn-line { background: var(--surface); color: var(--ink); border-color: var(--line-strong); } .btn-line:hover { color: var(--ink); border-color: var(--ink); }

/* tags */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 6px; font-size: 13px; font-weight: 500; background: var(--chip); color: var(--soft); white-space: nowrap; }
.tag svg { width: 14px; height: 14px; flex: none; }
.tag.fam { font-weight: 600; }
.tag.outline { background: transparent; border: 1px solid var(--ink); color: var(--ink); font-weight: 600; padding: 2px 8px; }
.tag.amt { background: var(--ink); color: #fff; font-family: var(--mono); font-weight: 700; }
.f-growth { background: var(--growth-bg); color: var(--growth); } .f-deals { background: var(--deals-bg); color: var(--deals); }
.f-distress { background: var(--distress-bg); color: var(--distress); } .f-money { background: var(--money-bg); color: var(--money); }
.f-building { background: var(--building-bg); color: var(--building); } .f-compliance { background: var(--compliance-bg); color: var(--compliance); }

/* the score chip: the one piece of conditional formatting every record carries */
.score { flex: none; width: 54px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--soft); }
.score b { font-family: var(--mono); font-size: 19px; line-height: 1; }
.score i { font-style: normal; font-size: 9px; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); }
.score.notable { background: #FFF4C7; border-color: #E5C74A; color: var(--ink); } .score.notable i { color: var(--money); }
.score.hot { background: var(--ink); border-color: var(--ink); color: #fff; } .score.hot i { color: var(--sun); }

/* a record row */
.lead { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 12px; border-radius: 12px; background: var(--surface); border: 2px solid var(--line); cursor: pointer; }
.lead:hover { border-color: var(--line-strong); }
.lead.on { border-color: var(--ink); }
.lead .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.lead .tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lead .name { font-weight: 600; font-size: 16px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lead .facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.age { font-family: var(--mono); font-weight: 700; }
.age.fresh { color: var(--growth); } .age.mid { color: var(--ink); } .age.old { color: #5A6A6F; }

/* ---------- home ---------- */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding-top: 12px; padding-bottom: 12px; }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.top nav a.link { padding: 12px 14px; color: var(--ink); text-decoration: none; font-weight: 500; }
.hero { display: flex; flex-wrap: wrap; gap: 48px; align-items: center; padding-top: 72px; padding-bottom: 56px; }
.hero > div { flex: 1 1 440px; min-width: 0; }
.hero h1 { margin: 0 0 20px; font-family: var(--display); font-weight: 700; font-size: clamp(40px, 5.6vw, 72px); line-height: 1.02; letter-spacing: -0.03em; text-wrap: balance; }
.hero p.sub { margin: 0 0 24px; font-size: 20px; color: var(--soft); }
.searchbox { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; background: var(--surface); border: 2px solid var(--ink); border-radius: 12px; max-width: 560px; }
.searchbox input { flex: 1 1 200px; min-width: 0; height: 48px; border: 0; padding: 0 12px; font-size: 17px; background: transparent; }
.tries { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.tries a { padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.sample { display: flex; flex-direction: column; gap: 10px; }
.sample .cap { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); }
.sample .lead { cursor: default; }
.band { background: var(--ink); color: #fff; }
.band .wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 24px; padding-top: 28px; padding-bottom: 28px; }
.band b { display: block; font-family: var(--display); font-size: 44px; line-height: 1; color: var(--sun); }
.band span { font-size: 15px; color: #D5DEDC; }
section.block { padding-top: 64px; }
section.block h2 { margin: 0 0 8px; font-family: var(--display); font-weight: 700; font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -0.02em; }
section.block p.lede { margin: 0 0 28px; font-size: 18px; color: var(--soft); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.card .tag { font-size: 15px; padding: 5px 11px; } .card .tag svg { width: 16px; height: 16px; }
.card span.what { color: var(--soft); }
.card .n { font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--muted); }
.key { margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-wrap: wrap; gap: 20px 40px; }
.key h3 { margin: 0 0 8px; font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); }
.key div.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill { padding: 5px 11px; border-radius: 6px; font-weight: 700; font-size: 14px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--soft); }
.pill.hot { background: var(--ink); border-color: var(--ink); color: #fff; } .pill.hot em { font-style: normal; color: var(--sun); }
.pill.notable { background: #FFF4C7; border-color: #E5C74A; color: var(--ink); }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.tier { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.tier .when { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 4px; background: var(--chip); color: var(--soft); }
.tier .price { font-family: var(--display); font-weight: 700; font-size: 44px; line-height: 1; }
.tier p { margin: 0; font-size: 17px; color: var(--soft); }
.tier.now { background: var(--ink); border-color: var(--ink); color: #fff; } .tier.now p { color: #D5DEDC; } .tier.now .when { background: var(--sun); color: var(--ink); }
.tier .btn { align-self: stretch; margin-top: 6px; }
.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.limits div { display: flex; gap: 12px; align-items: flex-start; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-weight: 500; }
.limits svg { flex: none; width: 22px; height: 22px; color: var(--accent); }
footer.foot { margin-top: 72px; background: var(--surface); border-top: 1px solid var(--line); }
footer.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-top: 24px; padding-bottom: 24px; font-size: 14px; color: var(--muted); }

/* ---------- explorer ---------- */
body.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.bar { flex: none; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.bar .brand b { font-size: 20px; }
.q { flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border: 2px solid var(--ink); border-radius: 10px; background: var(--surface); }
.q svg { flex: none; width: 18px; height: 18px; }
.q input { flex: 1; min-width: 0; height: 38px; border: 0; background: transparent; font-size: 16px; }
.seg { display: flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { height: 44px; padding: 0 16px; border: 0; border-left: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.filters { flex: none; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid currentColor; font-weight: 600; cursor: pointer; }
.chip small { font-family: var(--mono); font-size: 13px; font-weight: 700; }
.chip[aria-pressed="true"].f-growth { background: var(--growth); color: #fff; border-color: var(--growth); }
.chip[aria-pressed="true"].f-deals { background: var(--deals); color: #fff; border-color: var(--deals); }
.chip[aria-pressed="true"].f-distress { background: var(--distress); color: #fff; border-color: var(--distress); }
.chip[aria-pressed="true"].f-money { background: var(--money); color: #fff; border-color: var(--money); }
.chip[aria-pressed="true"].f-building { background: var(--building); color: #fff; border-color: var(--building); }
.chip[aria-pressed="true"].f-compliance { background: var(--compliance); color: #fff; border-color: var(--compliance); }
.chip.hotonly { background: var(--surface); color: var(--ink); }
.chip.hotonly::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--sun); border: 2px solid var(--ink); }
.chip.hotonly[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.sel { min-height: 44px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 500; max-width: 100%; }
.sep { width: 1px; height: 28px; background: var(--line); }
.count { margin-left: auto; font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--soft); }
.panes { flex: 1; min-height: 0; display: flex; }
.list { flex: 0 1 540px; min-width: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; border-right: 1px solid var(--line); }
.list .note { padding: 10px 12px; border-radius: 10px; background: #FFF4C7; border: 1px solid #E5C74A; font-size: 14px; }
.list .empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.list .more { align-self: center; margin: 8px 0 16px; }
.mapwrap { flex: 1 1 0; min-width: 0; position: relative; }
#map { position: absolute; inset: 0; background: #E6ECEA; }
body[data-view="map"] .list, body[data-view="list"] .mapwrap { display: none; }
body[data-view="list"] .list { flex: 1 1 auto; border-right: 0; }
.legend { position: absolute; z-index: 500; left: 16px; bottom: 16px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.legend span { display: flex; align-items: center; gap: 8px; }
.dot-hot { width: 16px; height: 16px; border-radius: 50%; background: var(--ink); border: 4px solid var(--sun); }
.dot-other { width: 12px; height: 12px; margin: 0 2px; border-radius: 50%; background: var(--soft); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-strong); }
.cluster { display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--ink); color: #fff; font-family: var(--mono); font-weight: 700; font-size: 13px; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(15, 30, 34, 0.35); }
.cluster.has-hot { border-color: var(--sun); }
.detail { position: absolute; z-index: 600; right: 16px; top: 16px; width: min(360px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow-y: auto; padding: 16px; border-radius: 14px; background: var(--surface); border: 2px solid var(--ink); display: flex; flex-direction: column; gap: 12px; }
.detail[hidden] { display: none; }
.detail .head { display: flex; gap: 12px; align-items: flex-start; }
.detail h2 { margin: 0; font-family: var(--display); font-size: 20px; line-height: 1.2; overflow-wrap: anywhere; }
.detail .x { margin-left: auto; flex: none; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 20px; line-height: 1; }
.detail dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.detail dt { color: var(--muted); } .detail dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.detail ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.detail h3 { margin: 0 0 6px; font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); }
.leaflet-container { font: inherit; }
@media (max-width: 760px) {
  body[data-view="both"] .panes { flex-direction: column-reverse; }
  body[data-view="both"] .list { flex: 1 1 50%; border-right: 0; border-top: 1px solid var(--line); }
  body[data-view="both"] .mapwrap { flex: 1 1 50%; }
  .count { margin-left: 0; width: 100%; }
  .legend { display: none; }
}
