/* Layout: single editorial column (≈68ch) with wide data bands that break out to 1100px.
   Palette drawn from San Diego itself: jacaranda bloom, canyon sage, marine-layer grey, deep bay ink. */
:root {
  --bg: #f7f7f4;          /* marine-layer paper */
  --surface: #ffffff;
  --ink: #18242b;         /* bay at dusk */
  --muted: #56636b;
  --line: #d9ddd8;
  --field-line: #7a847f;  /* input borders: 3.86:1 on white, 3.19:1 on the lead box (WCAG 1.4.11) */
  --accent: #6b4fb8;      /* jacaranda */
  --accent-soft: #ece7f8;
  --sage: #4f6b57;        /* canyon chaparral */
  --sage-soft: #e3ebe3;
  --good: #2f7a4f;
  --warn: #8f5700;        /* 5.54:1 on --bg */
  --bad: #b23b3b;
  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-body: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.7rem;
  --step-3: 2.3rem;
  --step-4: clamp(2.4rem, 6vw, 3.6rem);
  --radius: 10px;
  --wide: 1100px;
  --read: 68ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12191d; --surface: #1a2328; --ink: #e9ece8; --muted: #a3afb4; --line: #2e3a40;
    --accent: #b9a3f0; --accent-soft: #2c2547; --sage: #9cc0a4; --sage-soft: #1f2d24;
    --good: #6cc792; --warn: #e3a64a; --bad: #ef8080; --field-line: #7d8c93; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12191d; --surface: #1a2328; --ink: #e9ece8; --muted: #a3afb4; --line: #2e3a40;
  --accent: #b9a3f0; --accent-soft: #2c2547; --sage: #9cc0a4; --sage-soft: #1f2d24;
  --good: #6cc792; --warn: #e3a64a; --bad: #ef8080; --field-line: #7d8c93; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: var(--step-0); line-height: 1.6;
  /* room for the bottom dock, so nothing ends up hidden behind it */
  padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
}
:root { --dock-h: 68px; }

/* Skip link */
.skip { position: absolute; left: 8px; top: -60px; z-index: 10; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; font-weight: 700; }
.skip:focus { top: 8px; }

/* Bottom dock. Netlify's free-plan "Powered by Netlify" badge is a fixed iframe in the
   bottom-right corner (about 216x92px including its own padding; the visible pill sits
   inside the bottom 60px). The dock reserves that strip across the full width, and keeps
   its own content out of the right-hand 240px, so the badge only ever sits on the dock's
   empty corner and never over page content. */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; align-items: center;
}
.dock-inner {
  width: 100%; max-width: var(--wide); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: 240px;
  display: flex; flex-direction: column; justify-content: center; gap: 0;
  font-size: var(--step--1); line-height: 1.3; min-width: 0;
}
.dock-inner .dock-label { color: var(--muted); font-size: 0.78rem; }
.dock-inner a, .dock-inner b { font-weight: 700; }
.dock-inner b { font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; height: auto; }

.wrap {
  max-width: var(--wide); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.read { max-width: var(--read); }

/* Header */
.site-head { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 14px; }
.brand { font-family: var(--font-display); font-size: 1.35rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.nav { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--step--1); }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a[aria-current="page"], .nav a:hover { color: var(--ink); }
.nav a.cta-link { color: var(--accent); }

/* Type */
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; text-wrap: balance; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }
.eyebrow { font-family: var(--font-data); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sage); }
.lede { font-size: var(--step-1); color: var(--muted); line-height: 1.5; }
.fine { font-size: var(--step--1); color: var(--muted); }
.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; }

main { display: block; }
.section { padding-block: 56px; }
.section + .section { border-top: 1px solid var(--line); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 28px; }
.prose p, .prose ul, .prose ol { margin: 0; }
.prose { display: flex; flex-direction: column; gap: 14px; }
.prose h2 { margin-top: 24px; font-size: var(--step-2); }
.prose h3 { margin-top: 12px; }
.prose li + li { margin-top: 6px; }

/* Hero */
.hero { padding-block: 56px 40px; }
.hero .stack { max-width: 760px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 999px;
  background: var(--accent); color: var(--bg); font-weight: 700; text-decoration: none; border: 0;
  font: inherit; font-weight: 700; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* Rent bars (to scale) */
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 170px) 1fr auto; align-items: center; gap: 12px; font-size: var(--step--1); }
.bar-row .label { min-width: 0; }
.bar-track { height: 14px; background: var(--sage-soft); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--sage); border-radius: 3px; }
.bar-row.city .bar-fill { background: var(--accent); }
.bar-row .val { font-family: var(--font-data); font-variant-numeric: tabular-nums; text-align: right; min-width: 4.5em; }

/* Cards (used sparingly: neighborhood tiles, lead box) */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); }
.tile:hover { border-color: var(--accent); }
.tile .zip { font-family: var(--font-data); font-size: 0.78rem; color: var(--muted); }
.tile .rent { font-family: var(--font-data); font-size: var(--step-1); }

/* Lead capture */
.lead-box { background: var(--accent-soft); border-radius: var(--radius); padding: 28px; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
.lead-box > * { min-width: 0; }
form.lead { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: var(--step--1); font-weight: 700; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--field-line);
  border-radius: 8px; padding: 10px 12px; width: 100%;
}
input[type=checkbox] { width: 24px; height: 24px; padding: 0; margin: 0; flex: none; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; min-height: 24px; }
.req { color: var(--bad); font-weight: 700; }
.field .hint { font-weight: 400; color: var(--muted); }
textarea { min-height: 110px; resize: vertical; }
.form-note { font-size: var(--step--1); color: var(--good); font-weight: 700; }

/* Calculator */
.calc { display: grid; gap: 28px; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); align-items: start; }
@media (max-width: 820px) { .calc { grid-template-columns: 1fr; } }
.calc-inputs { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.calc-inputs .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.calc-out { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.verdict { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 16px; }
.big { font-family: var(--font-data); font-size: clamp(2rem, 6vw, 3rem); font-variant-numeric: tabular-nums; line-height: 1; }
.pill { font-size: 0.8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; letter-spacing: 0.02em; }
.pill.good { color: var(--good); box-shadow: inset 0 0 0 2px var(--good); }
.pill.warn { color: var(--warn); box-shadow: inset 0 0 0 2px var(--warn); }
.pill.bad { color: var(--bad); box-shadow: inset 0 0 0 2px var(--bad); }
.stackbar { display: flex; height: 22px; border-radius: 4px; overflow: hidden; background: var(--line); }
.stackbar span { display: block; height: 100%; }
.breakdown { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.breakdown td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.breakdown td:last-child { text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 12px; }
.breakdown .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.breakdown tr.total td { font-weight: 700; border-bottom: 2px solid var(--ink); }
.breakdown .note { display: block; color: var(--muted); font-size: 0.8rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { border-top: 2px solid var(--line); padding-top: 8px; }
.kpi b { display: block; font-family: var(--font-data); font-size: var(--step-1); font-variant-numeric: tabular-nums; font-weight: 500; }

/* Tables */
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline-offset: 4px; }
table.data { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
table.data caption { text-align: left; font-size: var(--step--1); color: var(--muted); padding-bottom: 8px; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data td.n, table.data th.n { text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data th { font-weight: 700; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
table.data tr.city td { font-weight: 700; }
/* On phones, each row becomes a stacked card so no column is hidden offscreen */
@media (max-width: 640px) {
  table.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.cards, table.cards caption, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px 14px; margin-bottom: 12px; }
  table.cards td { border: 0; padding: 3px 0; display: grid; grid-template-columns: 7.5em 1fr; gap: 10px; text-align: left; white-space: normal; }
  table.cards td.n { text-align: left; }
  table.cards td::before { content: attr(data-label); font-weight: 700; color: var(--muted); font-family: var(--font-body); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
  table.cards td.name { display: block; font-weight: 700; font-size: var(--step-0); padding-bottom: 6px; }
  table.cards td.name::before { content: none; }
}

/* Fact strip for neighborhood pages */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; border-block: 1px solid var(--line); padding-block: 16px; }
.facts div { display: flex; flex-direction: column; gap: 2px; }
.facts b { font-family: var(--font-data); font-weight: 500; font-size: var(--step-1); }
.proscons { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.proscons ul { margin: 0; padding-left: 1.2em; }

/* Affiliate slot: only renders when a link is configured */
.partner { border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; }
.partner .tag { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

/* San Diego Move Kit callout: buy button shows only once product.url is set in data.js */
.kit-callout { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--surface);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.kit-callout h3 { font-size: var(--step-1); }
.kit-callout p { margin: 0; }
.kit-callout .btn-row { align-items: center; }
.kit-cta { display: inline-flex; flex-wrap: wrap; gap: 12px; }
.kit-list { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.kit-list > div { border-top: 2px solid var(--accent); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.kit-list h3 { font-size: var(--step-1); }
.kit-list p { margin: 0; }
.kit-shot { width: 100%; max-width: 640px; height: auto; border-radius: var(--radius); border: 1px solid var(--line); display: block; }

details { border-bottom: 1px solid var(--line); padding-block: 12px; }
summary { cursor: pointer; font-weight: 700; }
details p { margin: 8px 0 0; }

/* Footer */
.site-foot { border-top: 1px solid var(--line); margin-top: 40px; }
.site-foot .wrap { padding-block: 32px; display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; font-size: var(--step--1); color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.site-foot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
