/* Public site (app.cornerstonepermit.com). Mobile-first: designed for phones;
   on a computer it shows as a centered, phone-width column.
   Same tokens as the app (DESIGN.md). */
:root {
  --primary: #1f7bb0;
  --primary-hover: #1a6996;
  --primary-soft: #e8f2f8;
  --bg: #ffffff;
  --fg: #0d0d0d;
  --muted: #5e656d;
  --surface: #f4f5f7;
  --border: #e3e5e8;
  --warn: #b45309;
  --warn-soft: #fff6eb;
  --ok: #157f2f;
  --ok-soft: #e9f7ee;
  --error: #b91c1c;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e10;
    --fg: #f3f3f3;
    --muted: #9aa1aa;
    --surface: #17191c;
    --border: #2a2d32;
    --primary-soft: #12283a;
    --warn: #f59e0b;
    --warn-soft: #2a1f0d;
    --ok: #4ade80;
    --ok-soft: #0f2a19;
    --error: #f87171;
    color-scheme: dark;
  }
  .brand img { filter: brightness(1.15); }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, 'Helvetica Neue', Helvetica, -apple-system, system-ui, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: 1.65rem; margin: 0 0 8px; }
h2 { font-size: 1.3rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 26px 0 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
p { margin: 0 0 12px; }
.wrap { width: 100%; max-width: 640px; margin: 0 auto; padding: 0 18px; }
.narrow { padding-top: 22px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.meta { display: block; color: var(--muted); font-size: 0.85rem; line-height: 1.45; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--bg); padding: 8px 12px; z-index: 10; }

/* ----- header: logo + Log in, tools as tabs ----- */
.top { background: var(--bg); border-bottom: 1px solid var(--border); padding-top: env(safe-area-inset-top); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); }
.brand img { height: 30px; width: auto; display: block; }
.brand-sub { font-size: 0.78rem; color: var(--muted); border-left: 1px solid var(--border); padding-left: 10px; }
.tabs { display: flex; gap: 4px; padding-bottom: 10px; }
.tabs a {
  flex: 1; text-align: center; padding: 8px 4px; border-radius: 999px;
  font-size: 0.88rem; font-weight: 600; color: var(--muted); background: var(--surface); white-space: nowrap;
}
.tabs a[aria-current="page"] { background: var(--primary); color: #fff; }

/* ----- buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 18px; border-radius: var(--radius);
  background: var(--primary); color: #fff !important; border: 1px solid var(--primary);
  font: inherit; font-weight: 650; text-align: center; cursor: pointer;
}
.btn:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; color: var(--primary) !important; }
.btn-outline:hover { background: var(--primary-soft); }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: 0.9rem; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: wait; }
.actions { display: grid; gap: 10px; margin: 18px 0; }
.actions .btn { width: 100%; }

/* ----- home ----- */
.hero { background: linear-gradient(180deg, var(--primary-soft), var(--bg)); padding: 26px 0 8px; }
.eyebrow { display: block; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.74rem; color: var(--primary); font-weight: 700; margin: 0 0 6px; }
.lead { font-size: 1rem; color: var(--muted); }
.stat { color: var(--muted); font-size: 0.92rem; }
.stat strong { color: var(--fg); }
.cards { display: grid; gap: 12px; margin-top: 12px; }
.card { display: block; border: 1px solid var(--border); border-radius: 14px; padding: 16px; color: var(--fg); background: var(--bg); }
.card:active { background: var(--surface); }
.card h2 { margin: 0 0 6px; font-size: 1.08rem; }
.card p { color: var(--muted); font-size: 0.94rem; margin-bottom: 8px; }
.more { color: var(--primary); font-weight: 650; font-size: 0.94rem; }
.why { margin-top: 26px; }
.why h2 { font-size: 1.15rem; }
.why ul { padding-left: 1.1rem; margin: 0; }
.why li { margin: 0 0 10px; font-size: 0.95rem; }

/* ----- forms ----- */
.field { display: block; margin: 0 0 14px; font-weight: 600; font-size: 0.93rem; }
.field input, .field select, .field textarea, .search input {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; font-weight: 400; font-size: 16px; /* 16px stops iOS zooming in */
  color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
  -webkit-appearance: none; appearance: none;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px;
}
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31, 123, 176, 0.2);
}
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.84rem; margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.form-error { color: var(--error); font-weight: 600; font-size: 0.93rem; }
.note { background: var(--surface); border-radius: var(--radius); padding: 10px 12px; color: var(--muted); }
.fine { font-size: 0.78rem; color: var(--muted); margin-top: 10px; }
.hp { position: absolute; left: -5000px; height: 0; overflow: hidden; }
.search { display: grid; gap: 10px; margin: 16px 0 6px; }
.search input { margin-top: 0; }
.context-card {
  display: grid; gap: 2px; background: var(--primary-soft); border-radius: var(--radius);
  padding: 12px 14px; margin: 4px 0 16px;
}
.context-card .eyebrow { margin: 0; }

/* ----- loading ----- */
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.93rem; margin: 10px 0; }
.loading[hidden] { display: none; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- fee calculator ----- */
.wizard fieldset { border: 0; padding: 0; margin: 22px 0 0; min-width: 0; scroll-margin-top: 120px; }
#fee-result { scroll-margin-top: 16px; }
.wizard legend { font-weight: 700; font-size: 1.02rem; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; padding: 0; }
.step { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 0.85rem; }
.choices { display: grid; gap: 8px; }
.choice { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.choice span {
  display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; background: var(--bg); font-size: 0.97rem; line-height: 1.35;
}
.choice small { display: block; color: var(--muted); margin-top: 2px; font-size: 0.82rem; }
.choice input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(31, 123, 176, 0.35); }
.picked-row { display: none; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border-radius: var(--radius); padding: 10px 12px; }
.picked { font-weight: 600; font-size: 0.95rem; }
.change { flex: none; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 650; font-size: 0.9rem; padding: 6px 2px; cursor: pointer; }
.wizard fieldset.done .choices { display: none; }
.wizard fieldset.done .picked-row { display: flex; }
.wizard fieldset.done legend { margin-bottom: 6px; color: var(--muted); font-size: 0.92rem; }
.wizard fieldset.done .step { background: var(--ok); }

/* result */
.result { margin-top: 22px; border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.total { font-size: 2.1rem; font-weight: 800; margin: 0 0 8px; letter-spacing: -0.02em; }
.lines { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin-bottom: 10px; }
.lines td { padding: 9px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.lines td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 12px; }
.lines tr.sum td { font-weight: 750; border-bottom: 0; }
details.how { margin: 10px 0 4px; }
details.how summary, details.more-list summary {
  cursor: pointer; color: var(--primary); font-weight: 650; font-size: 0.92rem; padding: 6px 0; list-style: none;
}
details.how summary::-webkit-details-marker, details.more-list summary::-webkit-details-marker { display: none; }
details.how summary::after, details.more-list summary::after { content: ' ▾'; }
details[open].how summary::after, details[open].more-list summary::after { content: ' ▴'; }
details.how ul { padding-left: 1.1rem; margin: 6px 0 0; }
details.how p { margin: 6px 0 0; }

/* ----- address lookup ----- */
.results { margin-top: 18px; transition: opacity 0.2s; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px; }
.summary > div { background: var(--surface); border-radius: var(--radius); padding: 10px 12px; color: var(--muted); font-size: 0.85rem; }
.big { display: block; font-size: 1.45rem; font-weight: 800; color: var(--fg); line-height: 1.15; }
.big.warn { color: var(--warn); }
.callout { background: var(--primary-soft); border-radius: 14px; padding: 14px 16px; margin: 14px 0; }
.callout p { margin: 0 0 12px; font-size: 0.95rem; }
.callout .btn { width: 100%; }
.ok { color: var(--ok); font-weight: 600; background: var(--ok-soft); border-radius: var(--radius); padding: 10px 12px; }
.violations, .permits { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.violations li {
  display: grid; gap: 2px; border-left: 3px solid var(--warn); background: var(--warn-soft);
  padding: 10px 12px; border-radius: 0 var(--radius) var(--radius) 0;
}
.violations strong { font-size: 0.95rem; }
.loc { font-size: 0.88rem; }
.pcard { display: grid; gap: 4px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.pcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pcard-top strong { font-size: 0.97rem; line-height: 1.3; }
.pcard .desc {
  margin: 2px 0 0; font-size: 0.9rem; color: var(--fg);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.pcard .badge { justify-self: start; }
details.more-list { margin-top: 8px; }
details.more-list > ul { margin-top: 8px; }
.source { margin-top: 18px; }
.pill { flex: none; display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-muted { background: var(--surface); color: var(--muted); }
.badge { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.badge-brand { background: var(--primary); color: #fff; }

/* ----- footer ----- */
.foot { border-top: 1px solid var(--border); margin-top: 40px; padding: 22px 0 calc(28px + env(safe-area-inset-bottom)); background: var(--surface); }
.foot-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-bottom: 16px; }
.foot-links a { font-weight: 600; font-size: 0.93rem; }
.foot-fine, .foot-brand, .powered { font-size: 0.8rem; color: var(--muted); margin: 0 0 8px; }
.foot-brand strong { color: var(--fg); }
.powered a { color: var(--muted); text-decoration: underline; }

@media (max-width: 360px) {
  .brand-sub { display: none; }
  .tabs a { font-size: 0.8rem; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ----- new development ----- */
.subtabs { margin: 14px 0 4px; padding-bottom: 0; }
.pcard .meta a { font-weight: 600; }
