/* Boris Cherner homebuyer tools: shared styles */
@font-face {
  font-family: "Bricolage";
  src: url("../fonts/bricolage.woff2") format("woff2-variations"), url("../fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  color-scheme: light;
  --navy: #1B3A6B;
  --ink: #1B2A4E;
  --muted: #56627D;
  --faint: #8A95AD;
  --sky: #EEF3FA;
  --sky-2: #E1E9F5;
  --line: #D3DCEA;
  --surface: #FFFFFF;
  --coral: #F25E3D;
  --coral-ink: #B8381C;
  --green: #6FB97A;
  --green-ink: #2F7A42;
  --amber: #F2B33D;
  --amber-ink: #8A5A00;
  --blue: #4A8FCB;

  --good: var(--green);
  --fair: var(--amber);
  --poor: var(--coral);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --pad: 16px;
  --col: 640px;
  --bar-h: 76px;

  --font: "Bricolage", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--sky);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--navy); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* ---------- Type ---------- */
h1, h2, h3 { margin: 0; line-height: 1.08; letter-spacing: -0.01em; }
.display {
  font-weight: 800;
  font-stretch: 78%;
  font-size: clamp(38px, 11vw, 56px);
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.h2 { font-size: 24px; font-weight: 750; font-stretch: 85%; }
.h3 { font-size: 19px; font-weight: 700; font-stretch: 90%; }
.lede { font-size: 17px; color: var(--muted); max-width: 34em; }
.small { font-size: 14px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.wrap { max-width: var(--col); margin: 0 auto; padding: 0 var(--pad); }
.stack > * + * { margin-top: 12px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(238, 243, 250, 0.92);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-inner {
  max-width: var(--col); margin: 0 auto; padding: 10px var(--pad);
  display: flex; align-items: center; gap: 10px; min-height: 56px;
}
.topbar .spacer { flex: 1; }
.back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 8px 4px; margin-left: -4px;
  color: var(--navy); font-weight: 600; text-decoration: none; font-size: 16px;
}
.back svg { width: 20px; height: 20px; }
.brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.brand img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; }
.brand > span { font-size: 15px; font-weight: 650; color: var(--ink); line-height: 1.1; white-space: nowrap; }
.brand small { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.save-state { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.save-state.saving::before { background: var(--amber); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 650; font-size: 16px; text-decoration: none;
  transition: transform .08s ease, background-color .15s, border-color .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #142e57; }
.btn-accent { background: var(--coral); color: #fff; }
.btn-accent:hover { background: #e14d2c; }
.btn-ghost { background: var(--surface); color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-quiet { background: transparent; color: var(--navy); padding: 0 12px; }
.btn-danger { background: var(--surface); color: var(--coral-ink); border-color: #F6C3B6; }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent;
  display: inline-grid; place-items: center; color: var(--navy);
}
.icon-btn:hover { background: var(--sky-2); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Fields ---------- */
.field { display: block; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.input, .textarea, .select {
  width: 100%; min-height: 48px;
  padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 16px; /* prevents iOS zoom */
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: #A3ADC2; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(74, 143, 203, 0.25); }
.textarea { min-height: 88px; resize: vertical; line-height: 1.4; }
.select {
  -webkit-appearance: none; 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.5l5 5 5-5' fill='none' stroke='%231B3A6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.money .input { padding-left: 26px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ---------- Segmented choice (Good / Fair / Poor etc.) ---------- */
.seg { display: inline-flex; gap: 4px; flex: none; }
.seg button {
  min-width: 52px; height: 40px; padding: 0 10px;
  border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--muted);
  transition: background-color .12s, border-color .12s, color .12s, transform .08s;
}
.seg button:active { transform: scale(0.94); }
.seg button[aria-pressed="true"] { color: var(--ink); border-color: transparent; }
.seg button[data-v="g"][aria-pressed="true"], .seg button[data-v="yes"][aria-pressed="true"], .seg button[data-v="pro"][aria-pressed="true"] { background: var(--good); }
.seg button[data-v="f"][aria-pressed="true"], .seg button[data-v="maybe"][aria-pressed="true"], .seg button[data-v="unsure"][aria-pressed="true"] { background: var(--fair); }
.seg button[data-v="p"][aria-pressed="true"], .seg button[data-v="no"][aria-pressed="true"], .seg button[data-v="con"][aria-pressed="true"] { background: var(--poor); }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 15px; color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 18px var(--pad);
}
.panel + .panel { margin-top: 12px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.panel-head .meta { font-size: 14px; color: var(--muted); white-space: nowrap; }

/* rows inside a panel */
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--sky-2);
}
.row:first-of-type { border-top: 0; }
.row-label { font-size: 16px; line-height: 1.25; }

/* ---------- Sheet (bottom drawer) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 27, 51, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
.sheet {
  width: 100%; max-width: var(--col);
  background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 10px var(--pad) calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow: auto;
  animation: rise .22s cubic-bezier(.2,.8,.2,1);
}
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { margin-bottom: 6px; }
.sheet p { margin: 0 0 14px; color: var(--muted); }
.sheet .actions { display: grid; gap: 10px; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--sky-2); border-top-color: var(--navy); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Bottom action bar ---------- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255,255,255,0.96);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 10px var(--pad) calc(10px + env(safe-area-inset-bottom));
}
.actionbar-inner { max-width: var(--col); margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.actionbar .btn { flex: 1; }
.has-actionbar { padding-bottom: calc(var(--bar-h) + 24px + env(safe-area-inset-bottom)); }

/* ---------- Boris card ---------- */
.boris {
  background: var(--navy); color: #fff; border-radius: var(--r-lg);
  padding: 20px var(--pad);
}
.boris-top { display: flex; gap: 14px; align-items: center; }
.boris img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.25); }
.boris .name { font-size: 20px; font-weight: 750; font-stretch: 88%; }
.boris .role { font-size: 14px; color: #C9D6EC; }
.boris p { color: #DCE5F3; margin: 14px 0 0; font-size: 15px; }
.boris-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.boris-links a {
  display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px;
  border-radius: 12px; background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; font-weight: 600; font-size: 15px;
}
.boris-links a:hover { background: rgba(255,255,255,0.18); }
.boris-links a svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.boris-links a.wide { grid-column: 1 / -1; background: var(--coral); justify-content: center; }
.boris-links a.wide:hover { background: #e14d2c; }

.disclosure {
  font-size: 12.5px; color: var(--muted); line-height: 1.5;
  padding: 18px var(--pad) 28px; max-width: var(--col); margin: 0 auto;
  display: flex; gap: 12px; align-items: flex-start;
}
.disclosure .ehl { display: grid; justify-items: center; gap: 2px; flex: none; width: 46px; color: var(--muted); }
.disclosure .ehl svg { width: 30px; height: 30px; }
.disclosure .ehl small { font-size: 7.5px; line-height: 1.1; font-weight: 700; text-align: center; text-transform: uppercase; letter-spacing: .02em; }
.disclosure p { margin: 0 0 4px; }
.disclosure .disc-id b { color: var(--ink); font-weight: 650; }
.disclosure .disc-contact { margin-bottom: 10px; }
.disclosure .disc-contact a { color: var(--navy); font-weight: 600; text-decoration: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bar-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 15px; z-index: 60;
  animation: rise .2s ease;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 700px) {
  :root { --pad: 22px; }
}

/* Small phones */
.actionbar .btn { flex: 1 1 0; min-width: 0; padding: 0 12px; }
.boris-links a { padding: 0 12px; white-space: nowrap; }
@media (max-width: 379px) {
  .save-state .long { display: none; }
  .actionbar .btn:not(.icon-only) svg { display: none; }
  .boris-links a { font-size: 14px; gap: 6px; }
}
