:root {
  --ink: #111111;
  --muted: #626260;
  --soft: #7b7b78;
  --canvas: #faf9f6;
  --paper: #ffffff;
  --oat: #dedbd6;
  --sand: #f1eee8;
  --orange: #ff5600;
  --orange-soft: #fff0e8;
  --blue: #0007cb;
  --green: #156b38;
  --green-soft: #e9f7ed;
  --red: #a61b1b;
  --red-soft: #fff0ef;
  --amber: #885700;
  --amber-soft: #fff5d9;
  --violet: #5f3fb5;
  --violet-soft: #f2edff;
  --focus: #0067d9;
  --max: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }

a { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  transform: translateY(-160%);
  background: var(--ink);
  color: white;
  padding: 10px 14px;
  border-radius: 4px;
}

.skip-link:focus { transform: translateY(0); }

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

.site-header {
  width: min(var(--max), calc(100% - 40px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--oat);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 4px;
  background: var(--orange);
  color: white;
  font-weight: 800;
}

nav { display: flex; align-items: center; gap: 22px; }

nav a {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

nav .nav-action {
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 9px 12px;
}

main { overflow: hidden; }

.hero {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  padding: 94px 0 72px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--orange);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.3;
  text-transform: uppercase;
}

h1, h2, h3, p { text-wrap: pretty; }

h1 {
  max-width: 970px;
  margin: 0;
  font-size: clamp(52px, 8vw, 92px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.94;
}

.hero-copy {
  max-width: 780px;
  margin: 32px 0 0;
  color: var(--muted);
  font-size: clamp(19px, 2.2vw, 25px);
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.hero-actions { display: flex; align-items: center; gap: 24px; margin-top: 34px; }

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}

.button:hover { transform: scale(1.035); }
.button:active { transform: scale(0.97); }

.button-primary { background: var(--ink); color: white; }
.button-primary:hover { background: white; color: var(--ink); }
.button:disabled { cursor: wait; opacity: 0.55; transform: none; }

.text-link { font-weight: 700; text-underline-offset: 5px; }

.hero-proof {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 820px;
  margin: 76px 0 0;
  border-top: 1px solid var(--oat);
  border-bottom: 1px solid var(--oat);
}

.hero-proof div { padding: 22px 24px 22px 0; }
.hero-proof div + div { padding-left: 24px; border-left: 1px solid var(--oat); }
.hero-proof dt { font-size: 26px; font-weight: 700; letter-spacing: -0.04em; }
.hero-proof dd { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.workspace {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto 96px;
  border: 1px solid var(--oat);
  border-radius: 8px;
  background: var(--paper);
}

.workspace-intro {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 48px;
  padding: 42px 48px;
  border-bottom: 1px solid var(--oat);
}

.workspace-intro h2, .rules-heading h2, .boundary h2, .result-shell h2, .progress-panel h2 {
  margin: 0;
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}

.workspace-intro > p, .rules-heading > p:last-child, .boundary > p:last-child {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.form-section {
  display: grid;
  grid-template-columns: 80px 1fr;
  border-bottom: 1px solid var(--oat);
  padding: 48px;
}

.section-number {
  color: var(--orange);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.section-content { max-width: 880px; }
.section-content h3 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -0.035em; }
.section-help { max-width: 720px; margin: 10px 0 28px; color: var(--muted); line-height: 1.55; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.field-wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > span:first-child, .field-label { color: var(--ink); font-size: 14px; font-weight: 700; }
.field b { color: var(--orange); }

input, textarea, select {
  width: 100%;
  border: 1px solid #bcb8b2;
  border-radius: 4px;
  background: var(--canvas);
  color: var(--ink);
  padding: 13px 14px;
  line-height: 1.4;
}

textarea { resize: vertical; }
select { min-height: 49px; }
input:hover, textarea:hover, select:hover { border-color: var(--ink); }
input:focus, textarea:focus, select:focus { border-color: var(--focus); background: white; }
input::placeholder, textarea::placeholder { color: #807d78; opacity: 1; }

.money-input {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  border: 1px solid #bcb8b2;
  border-radius: 4px;
  background: var(--canvas);
}

.money-input > span { justify-self: end; color: var(--muted); }
.money-input input { border: 0; background: transparent; }
.money-input:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; background: white; }
.money-input input:focus { outline: 0; }

.hours-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.hours-grid label { display: flex; flex-direction: column; gap: 7px; }
.hours-grid label span { color: var(--muted); font-size: 13px; }

.privacy-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  border-top: 1px solid var(--oat);
  padding-top: 20px;
}

.checkbox-row { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--orange); }
.link-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 32px 48px;
  background: var(--sand);
}

.submit-row p { margin: 2px 0; color: var(--muted); font-size: 13px; }
.submit-row .submit-title { color: var(--ink); font-size: 15px; font-weight: 700; }
.submit-button { flex: 0 0 auto; }
.form-error { margin: 0; border-top: 1px solid #efb9b6; background: var(--red-soft); color: var(--red); padding: 18px 48px; font-weight: 700; }

.progress-panel, .result-shell, .decision-rules, .boundary {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto 96px;
}

.progress-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 28px;
  border: 1px solid var(--oat);
  border-radius: 8px;
  background: white;
  padding: 44px 48px;
}

.progress-panel[hidden], .result-shell[hidden] { display: none; }
.progress-panel h2 { font-size: clamp(30px, 4vw, 44px); }
.progress-panel p:last-child { margin: 10px 0 0; color: var(--muted); }
.progress-spinner { width: 54px; height: 54px; border: 5px solid var(--oat); border-top-color: var(--orange); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-shell { border: 1px solid var(--oat); border-radius: 8px; background: var(--paper); }
.result-hero { display: grid; grid-template-columns: 1fr auto; gap: 28px; padding: 46px 48px; border-bottom: 1px solid var(--oat); }
.result-kicker { margin: 0 0 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.decision-word { margin: 0; font-size: clamp(54px, 8vw, 88px); font-weight: 600; letter-spacing: -0.06em; line-height: 0.92; }
.decision-reason { max-width: 770px; margin: 22px 0 0; font-size: 22px; line-height: 1.4; }
.result-meta { display: grid; align-content: start; min-width: 210px; border-left: 1px solid var(--oat); padding-left: 28px; }
.result-meta div { padding: 12px 0; border-bottom: 1px solid var(--oat); }
.result-meta dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.result-meta dd { margin: 5px 0 0; font-size: 20px; font-weight: 700; }

.result-shell[data-state="DECLINE"] .result-hero { background: var(--red-soft); }
.result-shell[data-state="DECLINE"] .result-kicker, .result-shell[data-state="DECLINE"] .decision-word { color: var(--red); }
.result-shell[data-state="PARK"] .result-hero { background: var(--amber-soft); }
.result-shell[data-state="PARK"] .result-kicker, .result-shell[data-state="PARK"] .decision-word { color: var(--amber); }
.result-shell[data-state="PURSUE"] .result-hero { background: var(--green-soft); }
.result-shell[data-state="PURSUE"] .result-kicker, .result-shell[data-state="PURSUE"] .decision-word { color: var(--green); }
.result-shell[data-state="NEEDS HUMAN CHECK"] .result-hero { background: var(--violet-soft); }
.result-shell[data-state="NEEDS HUMAN CHECK"] .result-kicker, .result-shell[data-state="NEEDS HUMAN CHECK"] .decision-word { color: var(--violet); }

.action-band { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--oat); border-bottom: 1px solid var(--oat); }
.action-item { background: white; padding: 30px 48px; }
.action-item span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.action-item p { margin: 9px 0 0; font-size: 17px; line-height: 1.5; }

.result-section { padding: 40px 48px; border-bottom: 1px solid var(--oat); }
.result-section:last-child { border-bottom: 0; }
.result-section-header { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 22px; }
.result-section h3 { margin: 0; font-size: 28px; letter-spacing: -0.035em; }
.result-section-header p { margin: 0; color: var(--muted); font-size: 13px; }
.identity-line { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 0; }
.identity-line span { color: var(--muted); }
.identity-line strong { color: var(--ink); }

.gate-list { display: grid; gap: 0; border-top: 1px solid var(--oat); }
.gate { display: grid; grid-template-columns: 150px 92px 1fr; gap: 18px; align-items: start; border-bottom: 1px solid var(--oat); padding: 16px 0; }
.gate-name { font-weight: 700; text-transform: capitalize; }
.status-pill { display: inline-flex; width: fit-content; border-radius: 2px; padding: 4px 7px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.status-pass { background: var(--green-soft); color: var(--green); }
.status-fail { background: var(--red-soft); color: var(--red); }
.status-unclear { background: var(--amber-soft); color: var(--amber); }
.gate p { margin: 0; color: var(--muted); line-height: 1.5; }

.finding-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.finding { border: 1px solid var(--oat); border-radius: 6px; background: var(--canvas); padding: 22px; }
.finding-label { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.finding h4 { margin: 0 0 9px; font-size: 20px; text-transform: capitalize; }
.finding p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }

.plain-list { margin: 0; padding-left: 20px; }
.plain-list li { margin: 9px 0; line-height: 1.5; }
.empty-note { margin: 0; color: var(--muted); }

.evidence-list { display: grid; gap: 14px; }
.evidence-card { border: 1px solid var(--oat); border-radius: 6px; padding: 20px; }
.evidence-top { display: flex; justify-content: space-between; gap: 18px; }
.evidence-card h4 { margin: 0; font-size: 17px; line-height: 1.45; }
.evidence-card blockquote { margin: 14px 0; border-left: 3px solid var(--orange); padding-left: 14px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.structured-source-head { display: flex; justify-content: space-between; align-items: start; gap: 24px; margin-bottom: 18px; }
.structured-source-head h4 { margin: 4px 0 0; font-size: 20px; }
.structured-source-head > p { margin: 0; text-align: right; color: var(--muted); }
.structured-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 28px; }
.structured-stats div { border: 1px solid var(--oat); border-radius: 6px; padding: 16px; background: var(--cream); }
.structured-stats span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.structured-stats strong { font-size: 18px; }
.subsection-title { margin: 26px 0 14px; font-size: 18px; }
.structured-grant-list { display: grid; gap: 10px; }
.structured-grant { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 24px; border-top: 1px solid var(--oat); padding: 16px 0; }
.structured-grant h5 { margin: 0 0 6px; font-size: 15px; }
.structured-grant p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.structured-grant-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; font-size: 12px; color: var(--muted); }
.structured-grant-meta strong { color: var(--ink); font-size: 15px; }
.source-caveat { margin: 22px 0 0; padding: 14px 16px; border-left: 3px solid var(--orange); background: var(--cream); color: var(--muted); font-size: 13px; line-height: 1.5; }
.evidence-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; color: var(--muted); font-size: 12px; }
.evidence-link { flex: 0 0 auto; color: var(--blue); font-size: 13px; font-weight: 700; text-underline-offset: 3px; }

.result-tools { display: flex; flex-wrap: wrap; gap: 10px; padding: 24px 48px; background: var(--sand); }
.tool-button { min-height: 42px; border: 1px solid var(--ink); border-radius: 4px; background: white; cursor: pointer; padding: 0 13px; font-size: 13px; font-weight: 700; }
.tool-button:hover { background: var(--ink); color: white; }
.human-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.decision-rules { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 70px; padding-top: 12px; }
.rules-heading { position: sticky; top: 28px; align-self: start; }
.rules-heading > p:last-child { margin-top: 22px; }
.rule-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--oat); border-left: 1px solid var(--oat); }
.rule-grid article { min-height: 260px; border-right: 1px solid var(--oat); border-bottom: 1px solid var(--oat); padding: 26px; }
.rule-grid h3 { margin: 18px 0 10px; font-size: 22px; letter-spacing: -0.03em; line-height: 1.1; }
.rule-grid p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.rule-state { display: inline-flex; border-radius: 2px; padding: 5px 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.rule-state.decline { background: var(--red-soft); color: var(--red); }
.rule-state.park { background: var(--amber-soft); color: var(--amber); }
.rule-state.pursue { background: var(--green-soft); color: var(--green); }
.rule-state.check { background: var(--violet-soft); color: var(--violet); }

.boundary { border-top: 4px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 38px 0 46px; }
.boundary h2 { max-width: 900px; }
.boundary > p:last-child { max-width: 760px; margin-top: 22px; }

footer {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 32px;
  border-top: 1px solid var(--oat);
  padding: 28px 0 42px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

footer p { margin: 0; }

.about-page { width: min(900px, calc(100% - 40px)); margin: 0 auto; padding: 78px 0 96px; }
.about-page h1 { font-size: clamp(50px, 8vw, 82px); }
.about-lede { margin: 28px 0 58px; color: var(--muted); font-size: 23px; line-height: 1.45; }
.about-section { display: grid; grid-template-columns: 180px 1fr; gap: 40px; border-top: 1px solid var(--oat); padding: 34px 0; }
.about-section h2 { margin: 0; font-size: 18px; }
.about-body p, .about-body li { color: var(--muted); font-size: 17px; line-height: 1.62; }
.about-body p:first-child { margin-top: 0; }
.about-body a { color: var(--blue); text-underline-offset: 3px; }

@media (max-width: 850px) {
  .site-header { align-items: flex-start; padding: 18px 0; }
  nav { gap: 13px; flex-wrap: wrap; justify-content: flex-end; }
  nav a:not(.nav-action) { padding-top: 9px; }
  .workspace-intro, .decision-rules { grid-template-columns: 1fr; }
  .rules-heading { position: static; }
  .form-section { grid-template-columns: 50px 1fr; padding: 38px 32px; }
  .result-hero { grid-template-columns: 1fr; }
  .result-meta { grid-template-columns: repeat(3, 1fr); border-left: 0; border-top: 1px solid rgba(17,17,17,0.2); padding: 18px 0 0; }
  .result-meta div { border-bottom: 0; }
}

@media (max-width: 640px) {
  .site-header, .hero, .workspace, .progress-panel, .result-shell, .decision-rules, .boundary, footer, .about-page { width: min(100% - 28px, var(--max)); }
  .site-header { display: block; }
  nav { margin-top: 15px; justify-content: flex-start; }
  nav a:first-child { display: none; }
  .hero { padding: 64px 0 54px; }
  h1 { font-size: clamp(46px, 15vw, 68px); }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 18px; }
  .hero-proof { grid-template-columns: 1fr; margin-top: 54px; }
  .hero-proof div + div { border-left: 0; border-top: 1px solid var(--oat); padding-left: 0; }
  .workspace-intro { padding: 30px 22px; gap: 18px; }
  .form-section { display: block; padding: 34px 22px; }
  .section-number { margin-bottom: 12px; }
  .field-grid, .hours-grid, .finding-grid, .rule-grid, .action-band, .structured-stats, .structured-grant { grid-template-columns: 1fr; }
  .privacy-control, .submit-row, .result-section-header, .evidence-top, .structured-source-head, footer { align-items: flex-start; flex-direction: column; }
  .structured-source-head > p, .structured-grant-meta { text-align: left; align-items: flex-start; }
  .submit-row { padding: 26px 22px; }
  .submit-button { width: 100%; }
  .form-error { padding: 16px 22px; }
  .progress-panel { grid-template-columns: 1fr; padding: 32px 24px; }
  .result-hero, .action-item, .result-section, .result-tools { padding-left: 22px; padding-right: 22px; }
  .result-meta { grid-template-columns: 1fr; }
  .gate { grid-template-columns: 1fr auto; }
  .gate p { grid-column: 1 / -1; }
  .rule-grid { border-left: 0; }
  .rule-grid article { min-height: auto; border-left: 1px solid var(--oat); }
  .about-section { grid-template-columns: 1fr; gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
