:root {
  --bg: #fbf7f0;
  --surface: #ffffff;
  --surface-soft: #f4eee3;
  --ink: #2b2a33;
  --ink-soft: #5d5a66;
  --line: #e6dccb;
  --primary: #1f6f6b;
  --primary-soft: #dcefec;
  --accent: #d9694d;
  --accent-soft: #fbe5dd;
  --gold: #c99a2e;
  --ok: #3d8b5a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 42, 51, 0.05), 0 4px 16px rgba(43, 42, 51, 0.05);
  --font-head: "Fraunces", Georgia, serif;
  --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; }

a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 32px; padding-bottom: 64px; }

.muted { color: var(--ink-soft); }
.small { font-size: 0.9rem; }

/* ---------- Header / footer ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark { color: var(--accent); font-size: 1.4rem; }
.site-header nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-header nav a {
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
}
.site-header nav a:hover { background: var(--surface-soft); color: var(--ink); }
.site-header nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 40px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ---------- Building blocks ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #185955; color: #fff; }
.btn.secondary { background: transparent; color: var(--primary); }
.btn.secondary:hover { background: var(--primary-soft); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 28px; }

input[type="text"], input[type="search"], input[type="date"], input[type="number"], textarea, select {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  max-width: 100%;
}
input:focus, textarea:focus, select:focus, .btn:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent);
  outline-offset: 1px;
}

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--surface-soft);
  color: var(--ink-soft);
}
.pill.accent { background: var(--accent-soft); color: #9a3d26; }
.pill.primary { background: var(--primary-soft); color: var(--primary); }
.pill.gold { background: #f6ebcf; color: #7a5c12; }

.progress {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #3a9b8f);
  border-radius: inherit;
  transition: width 0.3s ease;
}

.notice {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.95rem;
}

/* ---------- Home ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 32px;
}
.hero-intro p { font-size: 1.1rem; color: var(--ink-soft); max-width: 52ch; }
.countdown {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.countdown .big { font-family: var(--font-head); font-size: 3rem; line-height: 1; }
.countdown label { font-size: 0.9rem; opacity: 0.9; }
.countdown input { width: 100%; }
.countdown .progress { background: rgba(255, 255, 255, 0.2); }
.countdown .progress > span { background: #ffd8a8; }

.next-step { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.next-step:first-of-type { border-top: 0; }
.next-step .when { min-width: 82px; }

.phase-tile h3 { margin-bottom: 4px; }
.phase-tile .progress { margin: 12px 0 6px; }

.section { margin-top: 40px; }
.section > h2 { margin-bottom: 16px; }

/* ---------- Guide ---------- */
.phase { margin-top: 40px; }
.phase-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.phase-head h2 { margin: 0; }
.phase-num {
  font-family: var(--font-head);
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 600;
}
.phase-intro { color: var(--ink-soft); margin: 0 0 16px; max-width: 70ch; }

.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin-bottom: 12px;
}
.step.done { background: #f7faf8; border-color: #cfe5d6; }
.step.done .step-title { text-decoration: line-through; text-decoration-color: rgba(43, 42, 51, 0.35); color: var(--ink-soft); }
.step-check {
  width: 26px;
  height: 26px;
  margin-top: 2px;
  accent-color: var(--ok);
  cursor: pointer;
}
.step-title { font-size: 1.1rem; margin: 0; font-family: var(--font-body); font-weight: 800; letter-spacing: 0; }
.step-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.step-body { grid-column: 2; }
.step-body p { margin: 0.4em 0; }
.step-body ul { margin: 0.4em 0; padding-left: 1.2em; }
.step-body li { margin: 0.2em 0; }
.step-links { margin-top: 8px; font-size: 0.95rem; }
.step-links a { margin-right: 14px; display: inline-block; }
.step-links a::after { content: " ↗"; font-size: 0.8em; }
.step details summary { cursor: pointer; color: var(--primary); font-weight: 700; font-size: 0.95rem; }
.step textarea { width: 100%; min-height: 56px; margin-top: 8px; resize: vertical; font-size: 0.95rem; }
.notes-print { display: none; }

body.hide-done .step.done { display: none; }

/* ---------- Links ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 14px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
}
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.link-group { margin-bottom: 28px; }
.link-item { display: block; padding: 14px 16px; text-decoration: none; color: var(--ink); }
.link-item:hover { border-color: var(--primary); color: var(--ink); }
.link-item strong { color: var(--primary); }
.link-item p { margin: 4px 0 0; font-size: 0.93rem; color: var(--ink-soft); }
.link-item .url { font-size: 0.8rem; color: var(--ink-soft); word-break: break-all; }
.empty { padding: 24px; text-align: center; color: var(--ink-soft); }

/* ---------- Money ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
td input[type="number"] { width: 80px; text-align: right; }
#cost-rows td:first-child { width: 100%; }
td input[type="text"] { width: 100%; }
.total-row td { font-weight: 800; border-bottom: 0; }
.num { text-align: right; white-space: nowrap; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.field input { width: 110px; text-align: right; }
.result { font-family: var(--font-head); font-size: 2rem; color: var(--primary); }
.icon-btn { background: none; border: 0; color: var(--ink-soft); cursor: pointer; font-size: 1.1rem; padding: 4px 8px; }
.icon-btn:hover { color: var(--accent); }

/* ---------- Toolkit ---------- */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.checklist input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--ok); flex: none; }
.checklist label { cursor: pointer; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 8px; }
dl.glossary { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
dl.glossary dt { font-weight: 800; }
dl.glossary dd { margin: 0; color: var(--ink-soft); }
ol.questions li { margin: 6px 0; }

/* ---------- Funded hours ---------- */
.funding-hero { border-left: 5px solid var(--primary); }
.big-list { padding-left: 1.2em; margin: 0 0 12px; }
.big-list li { margin: 8px 0; }
.mini-dl { margin: 12px 0 0; font-size: 0.93rem; }
.mini-dl dt { font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); margin-top: 8px; }
.mini-dl dd { margin: 0; }
.flow { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); counter-reset: flow; }
.flow li { counter-increment: flow; position: relative; padding-top: 18px; }
.flow li::before {
  content: counter(flow);
  position: absolute; top: -12px; left: 18px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 0.85rem;
  display: grid; place-items: center;
}
.flow li p { margin: 4px 0 0; font-size: 0.93rem; color: var(--ink-soft); }
.can { border-top: 4px solid var(--ok); }
.cant { border-top: 4px solid var(--accent); }
.can ul, .cant ul { padding-left: 1.2em; margin: 0; }
.can li, .cant li { margin: 6px 0; }
#calc-funded input { width: 76px; padding: 6px 8px; }
#calc-funded td { padding: 8px 3px; }
#calc-funded td:first-child { font-size: 0.9rem; }

@media (max-width: 720px) {
  body { font-size: 16px; }
  .hero { grid-template-columns: 1fr; }
  dl.glossary { grid-template-columns: 1fr; }
  dl.glossary dd { margin-bottom: 8px; }
  .site-header { position: static; }
}

/* ---------- Print ---------- */
.print-only { display: none; }

@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; line-height: 1.45; }
  .site-header, .site-footer, .no-print, .toolbar, .chips { display: none !important; }
  .print-only { display: block; }
  main.wrap { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #bbb; padding: 10px 12px; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  h1 { font-size: 20pt; }
  h2 { font-size: 15pt; }

  /* Guide prints as a tick-box checklist with everything expanded */
  body.hide-done .step.done { display: grid; }
  .phase { margin-top: 18px; }
  .phase + .phase { break-before: page; }
  .step { margin-bottom: 8px; }
  .step.done { background: none; }
  .step-check { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; border: 1.5px solid #333; border-radius: 3px; }
  .step-check:checked { background: #333; }
  .step details > summary { display: none; }
  .step-links a::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; word-break: break-all; }
  .step textarea { display: none; }
  .notes-print { display: block; font-style: italic; }
  .notes-print:empty { display: none; }
  .pill { border: 1px solid #ccc; background: none !important; color: #333 !important; }

  .checklist input { appearance: none; -webkit-appearance: none; border: 1.5px solid #333; border-radius: 3px; width: 14px; height: 14px; }
  .checklist input:checked { background: #333; }
  .toolkit-section { break-inside: avoid-page; }
}
