/* Home Base MN — shared styles
   Mobile-first. System fonts (no downloads). WCAG 2.2 AA contrast. */

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #efebe2;
  --ink: #1b2430;
  --muted: #4a5563;
  --line: #d6d0c2;
  --brand: #1f3a5f;
  --brand-ink: #ffffff;
  --brand-soft: #e3eaf3;
  --call: #1d6b45;
  --call-ink: #ffffff;
  --accent: #e0a526;
  --crisis: #7a1f1f;
  --crisis-ink: #ffffff;
  --urgent-bg: #fbeaea;
  --urgent-line: #b33a3a;
  --info-bg: #e8f1ec;
  --info-line: #2f7d55;
  --verify-bg: #fff3d1;
  --verify-ink: #6b4200;
  --focus: #0b5fff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 45, .08), 0 2px 8px rgba(20, 30, 45, .06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161c;
    --surface: #1b212a;
    --surface-2: #232a35;
    --ink: #eef1f5;
    --muted: #b7c0cc;
    --line: #36404d;
    --brand: #8fb4e3;
    --brand-ink: #0e1a2b;
    --brand-soft: #22324a;
    --call: #5cc495;
    --call-ink: #08251a;
    --accent: #e7b54a;
    --crisis: #8f2a2a;
    --crisis-ink: #ffffff;
    --urgent-bg: #3a1c1c;
    --urgent-line: #e07a7a;
    --info-bg: #17322a;
    --info-line: #5cc495;
    --verify-bg: #3d3110;
    --verify-ink: #ffd98a;
    --focus: #7fb0ff;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #12161c;
  --surface: #1b212a;
  --surface-2: #232a35;
  --ink: #eef1f5;
  --muted: #b7c0cc;
  --line: #36404d;
  --brand: #8fb4e3;
  --brand-ink: #0e1a2b;
  --brand-soft: #22324a;
  --call: #5cc495;
  --call-ink: #08251a;
  --accent: #e7b54a;
  --crisis: #8f2a2a;
  --crisis-ink: #ffffff;
  --urgent-bg: #3a1c1c;
  --urgent-line: #e07a7a;
  --info-bg: #17322a;
  --info-line: #5cc495;
  --verify-bg: #3d3110;
  --verify-ink: #ffd98a;
  --focus: #7fb0ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.125rem; /* 18px */
  line-height: 1.55;
}

img { max-width: 100%; height: auto; }

a { color: var(--brand); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: 8px; top: -60px;
  background: var(--surface); color: var(--ink);
  padding: 10px 14px; border-radius: 8px; z-index: 100;
  border: 2px solid var(--focus);
}
.skip-link:focus { top: 8px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Top strips ---------- */

.proto-banner {
  background: var(--verify-bg); color: var(--verify-ink);
  font-size: .9rem; padding-block: 6px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); text-align: center;
  border-bottom: 1px solid var(--line);
}

.crisis {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: var(--crisis); color: var(--crisis-ink);
  font-size: .95rem;
}
.crisis .wrap {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  align-items: center; justify-content: center;
  padding-top: 8px; padding-bottom: 8px;
}
.crisis a { color: var(--crisis-ink); font-weight: 700; }
.crisis strong { font-weight: 700; }

/* ---------- Header / nav ---------- */

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { flex-wrap: wrap;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-top: 10px; padding-bottom: 10px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-size: 1.1rem;
}
.brand small { display: block; font-weight: 500; font-size: .75rem; color: var(--muted); }

.site-header { position: relative; }
.nav-toggle {
  display: none; font: inherit; font-weight: 700; cursor: pointer;
  padding: 10px 16px; min-height: 44px; border-radius: 10px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
}
.nav-toggle[aria-expanded="true"] { border-color: var(--brand); }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.nav li a {
  display: block; padding: 10px 12px; border-radius: 8px;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: 1rem;
}
.nav li a:hover { background: var(--surface-2); }
.nav li a[aria-current="page"] { background: var(--brand-soft); }

@media (max-width: 959px) {
  .site-header .wrap { flex-wrap: wrap; }
  .js .nav-toggle { display: inline-flex; align-items: center; }
  .js .nav ul {
    display: none; position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); top: 100%;
    flex-direction: column; padding: 8px; z-index: 60;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
  }
  .js .nav.open ul { display: flex; }
  .nav li a { padding: 12px 14px; font-size: 1.05rem; }
  html:not(.js) .nav { width: 100%; }
}

/* ---------- Layout ---------- */

.wrap { max-width: 60rem; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.narrow { max-width: 44rem; }

main { padding-bottom: 48px; }

section { margin: 36px 0; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 3.6vw, 1.8rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.lead { font-size: 1.25rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .92rem; }

.hero { padding: 28px 0 8px; }
.hero h1 { max-width: 22ch; }

.page-head { padding: 28px 0 0; }

.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }
a.card { display: block; text-decoration: none; color: var(--ink); }
a.card:hover { border-color: var(--brand); }
a.card .go { color: var(--brand); font-weight: 700; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border-radius: 10px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; text-align: center;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-call { background: var(--call); color: var(--call-ink); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); }
.btn-lg { font-size: 1.2rem; min-height: 56px; }
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
@media (max-width: 520px) { .btn-row .btn { flex: 1 1 100%; } }

/* ---------- Callouts ---------- */

.callout { border-left: 6px solid var(--brand); background: var(--brand-soft); padding: 14px 16px; border-radius: 8px; margin: 16px 0; }
.callout-urgent { border-left-color: var(--urgent-line); background: var(--urgent-bg); }
.callout-info { border-left-color: var(--info-line); background: var(--info-bg); }
.callout > :last-child { margin-bottom: 0; }

.verify {
  display: inline-block; background: var(--verify-bg); color: var(--verify-ink);
  font-size: .78rem; font-weight: 700; padding: 1px 6px; border-radius: 4px;
  vertical-align: middle; letter-spacing: .02em;
}

.tag {
  display: inline-block; font-size: .8rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
}

/* ---------- Lists ---------- */

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps > li {
  counter-increment: step; position: relative;
  padding: 0 0 18px 52px; min-height: 40px;
}
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -2px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 800;
}
.checklist { padding-left: 1.2em; }
.checklist li { margin-bottom: .4em; }

.phone-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.phone-list li {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; align-items: center;
}
.phone-list .label { font-weight: 700; }
.phone-list .sub { display: block; font-weight: 400; color: var(--muted); font-size: .92rem; }
.phone-list a { font-weight: 800; white-space: nowrap; }

/* ---------- Chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chips a, .chips button {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none;
  font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.chips a:hover, .chips button:hover { border-color: var(--brand); }
.chips button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---------- Forms & wizard ---------- */

label, .label { display: block; font-weight: 700; margin: 0 0 6px; }
.hint { display: block; color: var(--muted); font-size: .95rem; font-weight: 400; margin-top: 2px; }
input[type="text"], input[type="tel"], input[type="email"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 52px;
}
textarea { min-height: 120px; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
.field { margin: 0 0 18px; }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 800; font-size: 1.3rem; margin-bottom: 12px; padding: 0; }

.choices { display: grid; gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span {
  display: block; padding: 14px 16px 14px 52px; min-height: 56px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--surface);
  font-weight: 600; cursor: pointer; position: relative;
}
.choice span::before {
  content: ""; position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border: 2px solid var(--muted); border-radius: 50%; background: var(--surface);
}
.choice input[type="checkbox"] + span::before { border-radius: 6px; }
.choice input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.choice input:checked + span::before { background: var(--brand); border-color: var(--brand); box-shadow: inset 0 0 0 4px var(--surface); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice small { display: block; font-weight: 400; color: var(--muted); }

.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.progress > div { height: 100%; background: var(--brand); width: 0; transition: width .25s ease; }
.progress-label { font-size: .92rem; color: var(--muted); margin-bottom: 18px; }

.wizard-step[hidden] { display: none; }
.wizard-nav { display: flex; gap: 10px; justify-content: space-between; margin-top: 22px; }
.wizard-nav .btn { flex: 1; }
.error { color: var(--urgent-line); font-weight: 700; margin-top: 8px; }

/* ---------- Obstacle Buster ---------- */

.obstacle {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin: 0 0 12px; box-shadow: var(--shadow);
}
.obstacle > summary {
  cursor: pointer; list-style: none; padding: 16px 48px 16px 18px;
  font-weight: 800; font-size: 1.1rem; position: relative; min-height: 56px;
}
.obstacle > summary::-webkit-details-marker { display: none; }
.obstacle > summary::after {
  content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-size: 1.6rem; font-weight: 400; color: var(--brand);
}
.obstacle[open] > summary::after { content: "–"; }
.obstacle[open] > summary { border-bottom: 1px solid var(--line); }
.obstacle .body { padding: 14px 18px 18px; }
.obstacle dt { font-weight: 800; margin-top: 12px; }
.obstacle dd { margin: 4px 0 0; }

/* ---------- Triage ---------- */

.triage { background: var(--surface); border: 2px solid var(--brand); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.triage h2 { font-size: 1.35rem; }
.triage .q[hidden] { display: none; }
.triage .result[hidden] { display: none; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 1rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }

/* ---------- Partner placeholders ---------- */

.logo-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.logo-slot {
  border: 2px dashed var(--line); border-radius: 10px; min-height: 80px;
  display: grid; place-items: center; color: var(--muted); font-size: .9rem; text-align: center; padding: 8px;
}

/* ---------- Footer ---------- */

.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 1rem; }
.site-footer h2 { font-size: 1.1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0 0 16px; }
.site-footer li { margin: 6px 0; }

/* ---------- Motion & print ---------- */

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

@media print {
  .proto-banner, .site-header nav, .skip-link, .no-print, .wizard-nav, .site-footer nav { display: none !important; }
  .crisis { position: static; background: none; color: #000; border: 2px solid #000; }
  .crisis a { color: #000; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .card, .obstacle, .phone-list li { box-shadow: none; break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; word-break: break-all; }
}
