/* =========================================================================
   HOMEBOUND — Home Buying Guide
   Professional single-scroll stylesheet
   ========================================================================= */

:root {
  /* palette: warm neutrals + deep navy brand + terracotta accent */
  --bg:        #faf7f2;
  --bg-2:      #f2ece2;
  --paper:     #ffffff;
  --ink:       #1b2330;
  --ink-soft:  #5b6573;
  --line:      #e6ded1;

  --brand:     #163a5f;
  --brand-2:   #1f5183;
  --brand-ink: #0e2740;
  --accent:    #c9763d;
  --accent-2:  #b3632d;
  --accent-soft:#f5e7d8;

  --nc:        #1f5183;
  --nc-bg:     #eaf1f8;
  --warn:      #b8482f;
  --warn-bg:   #fbeae4;
  --good:      #2f7d56;
  --good-bg:   #e7f4ec;

  --sky-1:     #cfe6f7;
  --sky-2:     #eaf3fa;

  --radius:    16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(20,30,50,.06), 0 4px 14px rgba(20,30,50,.06);
  --shadow:    0 6px 24px rgba(20,30,50,.10);
  --shadow-lg: 0 24px 60px rgba(20,30,50,.16);

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --maxw: 1120px;
  --nav-h: 66px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--sans); color: var(--ink);
  background: var(--bg); line-height: 1.65; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-2); }
h1,h2,h3,h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; color: var(--ink); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.eyebrow {
  font-family: var(--sans); font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; font-size: .74rem; color: var(--accent);
}

/* ---------------- scroll progress bar ---------------- */
.scrollbar {
  position: fixed; top: 0; left: 0; height: 4px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 200; transition: width .08s linear;
}

/* ---------------- sticky nav ---------------- */
.nav {
  position: sticky; top: 0; z-index: 150;
  height: var(--nav-h);
  background: rgba(250,247,242,.86);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand svg { width: 30px; height: 30px; }
.brand b { font-family: var(--serif); font-size: 1.3rem; letter-spacing: .2px; }
.brand small {
  display: block; font-family: var(--sans); font-size: .6rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--accent); font-weight: 700; margin-top: -2px;
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: .92rem;
  padding: 8px 12px; border-radius: 8px; position: relative; transition: color .2s;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--brand); }
.nav-links a.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.nav-links a.nav-cta {
  background: var(--brand); color: #fff; padding: 9px 16px;
}
.nav-links a.nav-cta:hover { background: var(--brand-ink); }
.nav-links a.nav-cta::after { display: none; }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 1.1rem; color: var(--ink);
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: 1rem; text-decoration: none;
  padding: 14px 26px; border-radius: 999px; border: 1px solid transparent;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(201,118,61,.35); }
.btn-primary:hover { background: var(--accent-2); }
.btn-dark { background: var(--brand); color: #fff; }
.btn-dark:hover { background: var(--brand-ink); }
.btn-ghost { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-ghost:hover { background: var(--brand); color: #fff; }
.btn-light { background: #fff; color: var(--brand); }

/* ---------------- hero (illustrated house scene) ---------------- */
.hero { position: relative; min-height: 92vh; display: flex; align-items: center;
  overflow: hidden; isolation: isolate; padding: calc(var(--nav-h) + 20px) 0 80px; }
.hero-sky { position: absolute; inset: 0; z-index: -5;
  background: linear-gradient(180deg, #bcdcf2 0%, var(--sky-1) 38%, var(--sky-2) 70%, var(--bg) 100%); }
.hero-sun { position: absolute; top: 14%; right: 14%; width: 130px; height: 130px; z-index: -4;
  border-radius: 50%; background: radial-gradient(circle, #fff6e2 0%, #ffe6b8 55%, rgba(255,230,184,0) 72%);
  filter: blur(2px); }
.hero-layer { position: absolute; left: 0; right: 0; bottom: 0; z-index: -3; line-height: 0; will-change: transform; }
.hero-layer svg { width: 100%; height: auto; display: block; }
.hero-layer.far  { z-index: -3; opacity: .9; }
.hero-layer.mid  { z-index: -2; }
.hero-layer.near { z-index: -1; }
.hero-content { position: relative; z-index: 2; max-width: 760px; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 4rem); letter-spacing: -.5px; margin: 0 0 18px; color: var(--brand-ink); }
.hero h1 em { font-style: italic; color: var(--accent-2); }
.hero .sub { font-size: clamp(1.05rem, 1.7vw, 1.35rem); color: #2c3a4b; max-width: 600px; margin: 0 0 30px; }
.hero .btn-row { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------------- generic section ---------------- */
.section { padding: clamp(56px, 8vw, 104px) 0; position: relative; scroll-margin-top: 84px; }
.section.alt { background: var(--bg-2); }
.section-head { max-width: 720px; margin-bottom: 44px; }
.section-head h2 { font-size: clamp(1.8rem, 3.6vw, 2.7rem); margin: 12px 0 14px; }
.section-head p { font-size: 1.12rem; color: var(--ink-soft); margin: 0; }

/* intro / how it works */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.step { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-sm); }
.step .n { font-family: var(--serif); font-size: 1.5rem; color: var(--accent); }
.step h3 { font-size: 1.2rem; margin: 8px 0 8px; }
.step p { margin: 0; color: var(--ink-soft); font-size: .98rem; }

/* phase header */
.phase-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 30px; }
.phase-num { font-family: var(--serif); font-size: clamp(2.4rem,6vw,4rem); color: var(--accent-soft);
  -webkit-text-stroke: 1px var(--accent); line-height: 1; }
.phase-head h2 { font-size: clamp(1.7rem,3.4vw,2.5rem); margin: 0; }
.phase-head .blurb { flex: 1 1 320px; color: var(--ink-soft); font-size: 1.05rem; }

/* ---------------- stage card / accordion ---------------- */
.stage { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 16px; overflow: hidden; transition: box-shadow .2s, border-color .2s; }
.stage:hover { box-shadow: var(--shadow); }
.stage.open { border-color: #d8cbb8; box-shadow: var(--shadow); }
.acc-btn { width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 18px; padding: 22px 24px; font-family: var(--sans); color: var(--ink); }
.acc-btn:focus-visible { outline: 2px solid var(--brand-2); outline-offset: -2px; }
.stage-badge { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 12px;
  background: var(--brand); color: #fff; font-family: var(--serif); font-size: 1.15rem;
  display: grid; place-items: center; }
.stage.open .stage-badge { background: var(--accent); }
.acc-titles { flex: 1 1 auto; min-width: 0; }
.acc-titles h3 { font-size: 1.22rem; margin: 0 0 2px; }
.acc-titles p { margin: 0; color: var(--ink-soft); font-size: .96rem; }
.chevron { flex: 0 0 auto; width: 22px; height: 22px; color: var(--ink-soft); transition: transform .3s; }
.stage.open .chevron { transform: rotate(180deg); color: var(--accent); }

.acc-panel { display: grid; grid-template-rows: 1fr; }
.js .acc-panel { grid-template-rows: 0fr; transition: grid-template-rows .4s ease; }
.js .stage.open .acc-panel { grid-template-rows: 1fr; }
.acc-inner { overflow: hidden; }
.acc-body { padding: 4px 24px 26px; border-top: 1px solid var(--line); }
.acc-body > .intro-lead { font-size: 1.08rem; color: var(--ink); margin: 18px 0 6px; }
.acc-body h4 { font-size: 1.1rem; margin: 22px 0 8px; }
.acc-body p { margin: 0 0 12px; }
.acc-body ul { margin: 0 0 14px; padding-left: 20px; }
.acc-body li { margin: 6px 0; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 16px; margin: 20px 0; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat .value { font-family: var(--serif); font-size: 1.9rem; color: var(--brand); line-height: 1.1; }
.stat .label { font-size: .92rem; color: var(--ink); margin: 8px 0 10px; }
.stat .src { font-size: .78rem; color: var(--ink-soft); }
.stat .src a { color: var(--brand-2); font-weight: 600; }

/* callouts */
.callout { border-radius: var(--radius); padding: 18px 20px; margin: 20px 0; border-left: 4px solid var(--brand); }
.callout .ttl { font-weight: 700; margin: 0 0 8px; display: flex; align-items: center; gap: 9px; font-family: var(--sans); }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.nc { background: var(--nc-bg); border-left-color: var(--nc); }
.nc .ttl { color: var(--nc); }
.pill { font-family: var(--sans); font-size: .62rem; font-weight: 800; letter-spacing: .1em;
  background: var(--nc); color: #fff; padding: 4px 8px; border-radius: 6px; }
.watch { background: var(--warn-bg); border-left-color: var(--warn); }
.watch .ttl { color: var(--warn); }
.nextstep { background: var(--good-bg); border-left-color: var(--good); }
.nextstep .ttl { color: var(--good); }

/* sources */
.sources { background: var(--bg); border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px 20px; margin: 22px 0 4px; }
.sources h4 { margin: 0 0 8px; font-family: var(--sans); font-size: .9rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.sources ul { list-style: none; margin: 0; padding: 0; }
.sources li { padding: 5px 0; font-size: .92rem; border-bottom: 1px solid var(--line); }
.sources li:last-child { border-bottom: none; }
.sources a { color: var(--brand-2); font-weight: 600; }

/* ---------------- floating side CTA (follows scroll, hides at #realtor) ---------------- */
.cta-float {
  position: fixed; right: 24px; bottom: 24px; z-index: 120;
  width: 300px; max-width: calc(100vw - 32px);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-ink) 100%); color: #fff;
  border-radius: var(--radius); padding: 20px 20px 22px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
.cta-float.show { opacity: 1; transform: none; pointer-events: auto; }
.cta-float .cf-title { font-family: var(--serif); font-size: 1.18rem; font-weight: 600; margin: 0 0 6px; color: #fff; }
.cta-float .cf-text { margin: 0 0 14px; font-size: .92rem; color: #d7e3ef; }
.cta-float .btn { width: 100%; justify-content: center; padding: 11px 18px; }

/* ---------------- realtor / lead section ---------------- */
.realtor-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; align-items: start; }
.realtor-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 30px; box-shadow: var(--shadow); }
.realtor-card .photo { width: 130px; height: 130px; border-radius: 20px; margin-bottom: 18px;
  background: var(--bg-2) center/cover; display: grid; place-items: center; color: var(--ink-soft);
  font-size: .8rem; text-align: center; padding: 12px; border: 1px solid var(--line); }
.realtor-card h3 { font-size: 1.6rem; margin: 0 0 4px; }
.realtor-card .role { color: var(--accent); font-weight: 700; font-family: var(--sans); margin: 0 0 14px; }
.realtor-card .meta { color: var(--ink-soft); font-size: .92rem; margin-top: 14px; line-height: 1.7; }

.lead-form { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 30px; box-shadow: var(--shadow); }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.field label .req { color: var(--warn); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-family: var(--sans); font-size: 1rem; background: var(--bg); color: var(--ink); transition: border-color .15s, background .15s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand-2); background: #fff; }
.field textarea { resize: vertical; min-height: 92px; }
.field .err { color: var(--warn); font-size: .82rem; margin-top: 4px; display: none; }
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid select { border-color: var(--warn); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-note { font-size: .82rem; color: var(--ink-soft); margin-top: 12px; }
.form-success { display: none; background: var(--good-bg); border: 1px solid var(--good); border-radius: var(--radius-lg); padding: 32px; text-align: center; }
.form-success.show { display: block; animation: pop .4s ease; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- footer ---------------- */
.site-footer { background: var(--brand-ink); color: #aebccd; padding: 54px 0 30px; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.site-footer h4 { color: #fff; margin: 0 0 12px; font-family: var(--sans); font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; }
.site-footer a { color: #aebccd; text-decoration: none; display: block; padding: 3px 0; }
.site-footer a:hover { color: #fff; }
.site-footer p { max-width: 340px; color: #9fb0c2; }
.site-footer .disclaimer { margin-top: 30px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.12); font-size: .8rem; color: #8597aa; }

/* ---------------- reveal ---------------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------------- responsive ---------------- */
@media (max-width: 880px) {
  .nav-links { position: fixed; top: var(--nav-h); right: 0; left: 0; flex-direction: column; align-items: stretch;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 18px 18px; display: none; gap: 0; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 13px 8px; border-bottom: 1px solid var(--line); }
  .nav-links a.active::after { display: none; }
  .nav-links a.nav-cta { margin-top: 8px; text-align: center; border-radius: 10px; }
  .nav-toggle { display: inline-block; }
  .steps { grid-template-columns: 1fr; }
  .realtor-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .site-footer .cols { grid-template-columns: 1fr; }
  .cta-float { right: 12px; left: 12px; bottom: 12px; width: auto; padding: 12px 14px;
    display: flex; align-items: center; gap: 12px; }
  .cta-float .cf-text { display: none; }
  .cta-float .cf-title { flex: 1; font-size: 1rem; margin: 0; }
  .cta-float .btn { width: auto; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .hero-layer { transform: none !important; }
}

/* ---------------- native app safe areas (Capacitor edge-to-edge) ----------------
   On Android 15 (targetSdk 35) and notched devices the WebView draws behind the
   status/navigation bars. env(safe-area-inset-*) (with viewport-fit=cover) keeps
   the sticky nav clear of the status bar and the floating CTA clear of the
   gesture bar. On the web these insets are 0, so layout is unchanged. */
.nav {
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
}
.cta-float {
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 880px) {
  .nav-links { top: calc(var(--nav-h) + env(safe-area-inset-top, 0px)); }
  .cta-float { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}
