<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Project Inquiry</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&amp;display=swap" rel="stylesheet">
<style>
  :root{
    --paper:#FFFFFF;
    --paper-deep:#F5F4F0;
    --ink:#FF0000;
    --ink-soft:#999966;
    --line:#DAD5C8;
    --blue:#999966;
    --blue-deep:#7D7D4F;
    --clay:#999966;
    --good:#6E7A4B;
    --neutral:#8A7F68;
    --low:#FF0000;
  }
  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;}
  body{
    background:var(--paper);
    color:var(--ink);
    font-family:'Inter',sans-serif;
    -webkit-font-smoothing:antialiased;
    min-height:100vh;
  }
  .wrap{
    max-width:880px;
    width:100%;
    margin:0 auto;
    padding:56px 32px 96px;
  }
  .titleblock{
    border-bottom:1px solid var(--line);
    padding-bottom:22px;
    margin-bottom:36px;
  }
  .eyebrow{
    font-size:13px;
    color:var(--ink-soft);
    letter-spacing:0.02em;
    margin-bottom:10px;
  }
  h1{
    font-family:'Inter',sans-serif;
    font-weight:700;
    font-size:38px;
    line-height:1.2;
    margin:0 0 14px;
    letter-spacing:-0.01em;
    color:#000000;
  }
  .sub{
    font-size:16.5px;
    color:var(--ink-soft);
    line-height:1.65;
    max-width:56ch;
  }
  .ruler{display:flex; gap:6px; margin:28px 0 40px;}
  .tick{flex:1; height:3px; background:var(--line); border-radius:2px; transition:background 0.3s ease;}
  .tick.done{background:var(--blue);}
  .step{display:none;}
  .step.active{display:block; animation:rise 0.35s ease;}
  @keyframes rise{ from{opacity:0; transform:translateY(6px);} to{opacity:1; transform:translateY(0);} }
  .q{margin-bottom:28px;}
  label.qlabel{display:block; font-size:16.5px; font-weight:500; margin-bottom:12px; line-height:1.5; color:#FFFFFF;}
  .hint{font-size:14px; color:var(--ink-soft); margin-top:-7px; margin-bottom:11px; line-height:1.5;}
  input[type="text"], input[type="email"], input[type="tel"], input[type="number"], textarea, select{
    width:100%; font-family:'Inter',sans-serif; font-size:16.5px; color:var(--ink);
    background:var(--paper-deep); border:1px solid var(--line); border-radius:3px;
    padding:14px 16px; outline:none; transition:border-color 0.2s ease;
  }
  textarea{min-height:88px; resize:vertical;}
  input:focus, textarea:focus, select:focus{border-color:var(--blue);}
  select{appearance:none; cursor:pointer;}
  .options{display:flex; flex-direction:column; gap:8px;}
  .opt{
    border:1px solid var(--line); background:var(--paper-deep); border-radius:3px;
    padding:14px 16px; cursor:pointer; font-size:16px; display:flex; align-items:center; gap:10px;
    transition:border-color 0.15s ease, background 0.15s ease;
  }
  .opt:hover{border-color:var(--blue);}
  .opt input{margin:0; accent-color:var(--blue);}
  .opt.selected{border-color:var(--blue); background:#EFEEE2;}
  .row{display:flex; gap:14px;}
  @media (max-width:520px){
    .row{flex-direction:column; gap:0;}
    .wrap{padding:36px 20px 72px;}
    h1{font-size:28px;}
  }
  .row > .q{flex:1;}
  .nav{
    display:flex; justify-content:space-between; align-items:center;
    margin-top:40px; padding-top:24px; border-top:1px solid var(--line);
  }
  button{
    font-family:'Inter',sans-serif; font-size:14.5px; font-weight:500; border-radius:3px;
    padding:12px 22px; cursor:pointer; border:1px solid transparent; transition:opacity 0.15s ease;
  }
  button:hover{opacity:0.85;}
  .btn-primary{background:var(--blue-deep); color:var(--paper); margin-left:auto;}
  .btn-ghost{background:var(--blue-deep); color:var(--paper); border-color:transparent;}
  .btn-ghost:disabled{opacity:0.3; cursor:default;}
  .error{font-size:13px; color:var(--low); margin-top:8px; display:none;}
  #resultStep{display:none;}
  .result-badge{display:inline-block; font-size:13px; padding:6px 12px; border-radius:20px; margin-bottom:20px; color:var(--paper);}
  .badge-good{background:var(--good);}
  .badge-neutral{background:var(--neutral);}
  .badge-low{background:var(--low);}
  .result-msg{font-family:'Inter',sans-serif; font-size:22px; font-weight:700; line-height:1.4; margin-bottom:18px; color:var(--clay);}
  .result-body{font-size:16.5px; line-height:1.65; color:var(--ink-soft); max-width:56ch; margin-bottom:32px;}
  .sent-note{font-size:13px; color:var(--ink-soft); margin-top:14px;}
</style>


<div class="wrap">

  <div class="titleblock">
    <h1>Tell us about your project</h1>
    <div class="sub">A few questions to help us understand your project and get back to you with a useful answer. Takes about three minutes.</div>
  </div>

  <div class="ruler" id="ruler"></div>

  <form id="intakeForm">

    <!-- STEP 1 -->
    <div class="step active" data-step="1">
      <div class="q">
        <label class="qlabel">Your name</label>
        <input type="text" name="name" required="">
      </div>
      <div class="row">
        <div class="q">
          <label class="qlabel">Email</label>
          <input type="email" name="email" required="">
        </div>
        <div class="q">
          <label class="qlabel">Phone <span class="hint" style="display:inline">(optional)</span></label>
          <input type="tel" name="phone">
        </div>
      </div>
      <div class="q">
        <label class="qlabel">Where's the project located?</label>
        <select name="location" required="">
          <option value="">Select one</option>
          <option value="livingston">Livingston County</option>
          <option value="sgenesee">South Genesee County</option>
          <option value="annarbor">Ann Arbor</option>
          <option value="southlyon">South Lyon</option>
          <option value="eOakland">East Oakland County</option>
          <option value="wOakland">West Oakland County</option>
          <option value="michigan">Elsewhere in Michigan</option>
          <option value="other">Out of State</option>
        </select>
      </div>
      <div class="q">
        <label class="qlabel">What type of project is this?</label>
        <select name="projectType" required="">
          <option value="">Select one</option>
          <option value="newhome">New single-family home</option>
          <option value="wholehouse">Whole house remodel</option>
          <option value="addition">Addition</option>
          <option value="kitchen">Kitchen</option>
          <option value="bathroom">Bathroom</option>
          <option value="vacation">Vacation / cottage home</option>
          <option value="historic">Historic building</option>
          <option value="porchdeck">Porch / deck</option>
          <option value="otherroom">Other single room</option>
          <option value="tenantlease">Tenant lease / build-out</option>
          <option value="commercial">Commercial project</option>
          <option value="misc">Something else</option>
        </select>
      </div>
    </div>

    <!-- STEP 2 -->
    <div class="step" data-step="2">
      <div class="q">
        <label class="qlabel">What's got you thinking about working with an architect right now? <span class="hint" style="display:inline">(optional)</span></label>
        <textarea name="motivation"></textarea>
      </div>
      <div class="q">
        <label class="qlabel">Tell us a bit about the project you have in mind <span class="hint" style="display:inline">(optional)</span></label>
        <textarea name="projectDesc"></textarea>
      </div>
      <div class="row">
        <div class="q">
          <label class="qlabel">Existing size <span class="hint" style="display:inline">(sq ft, if known — optional)</span></label>
          <input type="number" name="existSF" min="0">
        </div>
        <div class="q">
          <label class="qlabel">Target size <span class="hint" style="display:inline">(sq ft, if known — optional)</span></label>
          <input type="number" name="propSF" min="0">
        </div>
      </div>
      <div class="q">
        <label class="qlabel">How did you hear about us? <span class="hint" style="display:inline">(optional)</span></label>
        <select name="referral">
          <option value="">Select one</option>
          <option value="pastclient">I'm a past client</option>
          <option value="clientref">Referred by a past client</option>
          <option value="builderef">My builder recommended you</option>
          <option value="website">Your website</option>
          <option value="jobsite">A job site sign</option>
          <option value="websearch">Web search</option>
          <option value="yellowpages">Yellow Pages / directory</option>
          <option value="other">Other</option>
        </select>
      </div>
    </div>

    <!-- STEP 3 -->
    <div class="step" data-step="3">
      <div class="q">
        <label class="qlabel">How flexible is your timeline for getting started?</label>
        <div class="options" data-name="timeline">
          <label class="opt"><input type="radio" name="timeline" value="flexible"> We're flexible — happy to wait for the right fit</label>
          <label class="opt"><input type="radio" name="timeline" value="neutral"> Somewhere in between, no strong deadline</label>
          <label class="opt"><input type="radio" name="timeline" value="firm"> We have a fairly firm deadline we need to hit</label>
        </div>
      </div>
      <div class="q">
        <label class="qlabel">When are you hoping to begin construction? <span class="hint" style="display:inline">(optional)</span></label>
        <select name="constructionStart">
          <option value="">Select one</option>
          <option value="asap">As soon as possible</option>
          <option value="6-12mo">6–12 months out</option>
          <option value="1-2yr">1–2 years out</option>
          <option value="flexible">Flexible / not sure yet</option>
        </select>
      </div>
      <div class="q">
        <label class="qlabel">What's your approximate budget for this project?</label>
        <select name="budget" required="">
          <option value="">Select one</option>
          <option value="u100">Under $100k</option>
          <option value="100-250">$100k – $250k</option>
          <option value="250-500">$250k – $500k</option>
          <option value="500-1m">$500k – $1M</option>
          <option value="1mplus">$1M+</option>
          <option value="unsure">Not sure yet</option>
        </select>
      </div>
    </div>

    <!-- STEP 4 -->
    <div class="step" data-step="4">
      <div class="q">
        <label class="qlabel">Any kids at home we should be designing around?</label>
        <div class="options" data-name="kids">
          <label class="opt"><input type="radio" name="kids" value="yes"> Yes</label>
          <label class="opt"><input type="radio" name="kids" value="no"> No</label>
        </div>
      </div>
      <div class="q">
        <label class="qlabel">Have you been through a residential design or building project before?</label>
        <div class="options" data-name="experience">
          <label class="opt"><input type="radio" name="experience" value="yes"> Yes</label>
          <label class="opt"><input type="radio" name="experience" value="no"> No, this is our first</label>
        </div>
      </div>
      <div class="q">
        <label class="qlabel">Do you already have a builder or contractor in mind?</label>
        <div class="options" data-name="builder">
          <label class="opt"><input type="radio" name="builder" value="yes"> Yes</label>
          <label class="opt"><input type="radio" name="builder" value="no"> Not yet</label>
        </div>
      </div>
      <div class="q">
        <label class="qlabel">Are you planning to act as your own builder?</label>
        <div class="options" data-name="ownerBuild">
          <label class="opt"><input type="radio" name="ownerBuild" value="yes"> Yes</label>
          <label class="opt"><input type="radio" name="ownerBuild" value="no"> No</label>
        </div>
      </div>
      <div class="q">
        <label class="qlabel">Are you drawn to a particular architectural style? <span class="hint" style="display:inline">(contemporary, farmhouse, historic, etc.)</span></label>
        <div class="options" data-name="uniqueStyle">
          <label class="opt"><input type="radio" name="uniqueStyle" value="yes"> Yes, we have a style in mind</label>
          <label class="opt"><input type="radio" name="uniqueStyle" value="no"> Not particularly / open to ideas</label>
        </div>
      </div>
    </div>

    <div class="error" id="stepError">Please fill in the required fields before continuing.</div>

    <div class="nav">
      <button type="button" class="btn-ghost" id="backBtn">Back</button>
      <button type="button" class="btn-primary" id="nextBtn">Continue</button>
    </div>
  </form>

  <!-- RESULTS -->
  <div id="resultStep">
    <div id="resultBadge" class="result-badge">Reviewed</div>
    <div class="result-msg" id="resultMsg"></div>
    <div class="result-body" id="resultBody"></div>
    <button type="button" class="btn-primary" id="sendBtn">Send my answers</button>
    <div class="sent-note" id="sentNote">This sends everything you've shared straight to us.</div>
  </div>

</div>

<script>
/* ============================================================
   CONFIG — edit these to fit the firm
   ============================================================ */
const STUDIO_EMAIL = "mccotterarchitecture@gmail.com"; // used only as a backup if Formspree ever fails
const STUDIO_NAME  = "the studio";          // used in messages below
// Formspree endpoint (e.g. "https://formspree.io/f/xxxxxxxx"). Leave blank
// to fall back to opening a pre-filled email in the visitor's own mail app —
// which only works if they have one configured, so filling this in is strongly recommended.
const FORMSPREE_ENDPOINT = "https://formspree.io/f/mjyvqree";

/* Point values below are pulled directly from the McCotter paper
   intake form. Tune freely — especially the "other" fallbacks,
   which aren't on the original form and are just reasonable guesses. */

const LOCATION_SCORE = {
  livingston: 10, sgenesee: 8, annarbor: 7, southlyon: 7,
  eOakland: 5, wOakland: 7, michigan: 5, other: 3 // "other" not on paper form — a guess
};

const SOURCE_SCORE = {
  pastclient: 10, clientref: 8, builderef: 7, website: 6,
  jobsite: 5, websearch: 3, yellowpages: 2, other: 2
};

const TYPE_SCORE = {
  newhome: 10, wholehouse: 8, addition: 7, kitchen: 6, vacation: 6,
  bathroom: 5, historic: 5, porchdeck: 4, otherroom: 3,
  tenantlease: 3, misc: 3, commercial: 2
};

// Willing to Wait (+4) / Tight Timeline (-3) from the Miscellaneous section
const TIMELINE_MOD = { flexible: 4, neutral: 0, firm: -3 };

// Realistic Budget (3-5) on the paper form — simplified here to
// "gave a concrete number" vs "not sure yet". Tune against real
// project-type minimums once you've seen a few submissions.
function budgetScore(budget){ return budget === "unsure" ? 3 : 5; }

const BUILT_BEFORE_BONUS = 5;   // Has built before
const KIDS_BONUS = 3;           // Family with Children
const OWNER_BUILD_PENALTY = -3; // Building Themselves
const UNIQUE_STYLE_BONUS = 2;   // Unique Design Style

// Max possible ≈ 10+10+10+4+5+5+3+2 = 49. Thresholds below are a
// starting estimate — tune after seeing how real submissions score.
const GOOD_THRESHOLD = 33;

/* ============================================================
   Step navigation
   ============================================================ */
const steps = Array.from(document.querySelectorAll(".step"));
let current = 0;
const ruler = document.getElementById("ruler");
steps.forEach(() => {
  const t = document.createElement("div");
  t.className = "tick";
  ruler.appendChild(t);
});
const ticks = Array.from(ruler.children);
function updateRuler(){ ticks.forEach((t, i) => t.classList.toggle("done", i <= current)); }
updateRuler();

document.querySelectorAll(".opt").forEach(opt => {
  opt.addEventListener("click", () => {
    const name = opt.querySelector("input").name;
    document.querySelectorAll(`input[name="${name}"]`).forEach(i => i.closest(".opt").classList.remove("selected"));
    opt.classList.add("selected");
  });
});

function currentStepEl(){ return steps[current]; }

function validateStep(){
  const el = currentStepEl();
  const required = el.querySelectorAll("[required]");
  for (const field of required){ if (!field.value.trim()) return false; }
  const radioGroups = new Set(Array.from(el.querySelectorAll('.options')).map(o => o.dataset.name));
  for (const name of radioGroups){
    const checked = el.querySelector(`input[name="${name}"]:checked`);
    if (!checked) return false;
  }
  return true;
}

document.getElementById("nextBtn").addEventListener("click", () => {
  if (!validateStep()){
    document.getElementById("stepError").style.display = "block";
    return;
  }
  document.getElementById("stepError").style.display = "none";
  if (current < steps.length - 1){
    steps[current].classList.remove("active");
    current++;
    steps[current].classList.add("active");
    updateRuler();
    document.getElementById("backBtn").disabled = false;
    if (current === steps.length - 1){ document.getElementById("nextBtn").textContent = "See what's next"; }
  } else {
    submitForm();
  }
  window.scrollTo({top:0, behavior:"smooth"});
});

document.getElementById("backBtn").addEventListener("click", () => {
  if (current > 0){
    steps[current].classList.remove("active");
    current--;
    steps[current].classList.add("active");
    updateRuler();
    document.getElementById("nextBtn").textContent = "Continue";
  }
  document.getElementById("backBtn").disabled = current === 0;
});
document.getElementById("backBtn").disabled = true;

/* ============================================================
   Scoring + submission
   ============================================================ */
function getVal(name){
  const form = document.getElementById("intakeForm");
  const field = form.elements[name];
  if (!field) return "";
  if (field instanceof RadioNodeList){
    for (const f of field){ if (f.checked) return f.value; }
    return "";
  }
  return field.value;
}

function submitForm(){
  const data = {
    name: getVal("name"), email: getVal("email"), phone: getVal("phone"),
    location: getVal("location"), projectType: getVal("projectType"),
    motivation: getVal("motivation"), projectDesc: getVal("projectDesc"),
    existSF: getVal("existSF"), propSF: getVal("propSF"), referral: getVal("referral"),
    timeline: getVal("timeline"), constructionStart: getVal("constructionStart"), budget: getVal("budget"),
    kids: getVal("kids"), experience: getVal("experience"), builder: getVal("builder"),
    ownerBuild: getVal("ownerBuild"), uniqueStyle: getVal("uniqueStyle"),
  };

  const score =
    (LOCATION_SCORE[data.location] || 0) +
    (SOURCE_SCORE[data.referral] || 0) +
    (TYPE_SCORE[data.projectType] || 0) +
    (TIMELINE_MOD[data.timeline] || 0) +
    budgetScore(data.budget) +
    (data.experience === "yes" ? BUILT_BEFORE_BONUS : 0) +
    (data.kids === "yes" ? KIDS_BONUS : 0) +
    (data.ownerBuild === "yes" ? OWNER_BUILD_PENALTY : 0) +
    (data.uniqueStyle === "yes" ? UNIQUE_STYLE_BONUS : 0);

  let tier, badgeClass, headline, body;
  if (score >= GOOD_THRESHOLD){
    tier = "Great fit";
    badgeClass = "badge-good";
    headline = "This is definitely the type of work we enjoy.";
    body = `We'll take a closer look at what you've shared and get back to you within a few days to talk about next steps — likely meeting at the property to walk through it together.`;
  } else {
    tier = "Possible fit";
    badgeClass = "badge-neutral";
    headline = "Thanks for the thoughtful answers.";
    body = `We'll take a look at your details and follow up soon to talk timing and see if it makes sense to move forward.`;
  }

  document.getElementById("resultBadge").textContent = tier;
  document.getElementById("resultBadge").className = "result-badge " + badgeClass;
  document.getElementById("resultMsg").textContent = headline;
  document.getElementById("resultBody").textContent = body;

  document.getElementById("intakeForm").style.display = "none";
  document.getElementById("resultStep").style.display = "block";

  const subject = `Project inquiry — ${data.name} (score ${score}, ${tier})`;
  const lines = [
    `Score: ${score} — ${tier}`, ``,
    `Name: ${data.name}`, `Email: ${data.email}`, `Phone: ${data.phone}`,
    `Location: ${data.location}`, `Project type: ${data.projectType}`, ``,
    `Why now: ${data.motivation}`, `Project description: ${data.projectDesc}`,
    `Existing SF: ${data.existSF}`, `Target SF: ${data.propSF}`,
    `Heard about us via: ${data.referral}`, ``,
    `Timeline flexibility: ${data.timeline}`, `Hoping to start construction: ${data.constructionStart}`,
    `Budget: ${data.budget}`, ``,
    `Kids at home: ${data.kids}`, `Done this before: ${data.experience}`,
    `Builder in mind: ${data.builder}`, `Planning to owner-build: ${data.ownerBuild}`,
    `Drawn to a particular style: ${data.uniqueStyle}`, ``,
    `--- OFFICE USE — fill in before filing ---`,
    `Wants multiple bids? `,
    `Mentioned friends who'd do it cheaper? `,
    `Gut feeling adjustment: `,
  ];

  function openMailFallback(){
    const body2 = encodeURIComponent(lines.join("\n"));
    window.location.href = `mailto:${STUDIO_EMAIL}?subject=${encodeURIComponent(subject)}&body=${body2}`;
  }

  document.getElementById("sendBtn").onclick = () => {
    const sendBtn = document.getElementById("sendBtn");
    const note = document.getElementById("sentNote");

    if (!FORMSPREE_ENDPOINT){
      // No delivery endpoint configured yet — fall back to the visitor's own mail app.
      note.textContent = "Opening your email app now — if nothing happens, please email us directly.";
      openMailFallback();
      return;
    }

    sendBtn.disabled = true;
    sendBtn.textContent = "Sending…";
    note.textContent = "";

    fetch(FORMSPREE_ENDPOINT, {
      method: "POST",
      headers: { "Content-Type": "application/json", "Accept": "application/json" },
      body: JSON.stringify({ subject, message: lines.join("\n"), ...data, score, tier })
    })
      .then(res => {
        if (res.ok){
          sendBtn.textContent = "Sent";
          note.textContent = "Thanks — we've received your answers and will be in touch soon.";
        } else {
          throw new Error("Formspree request failed");
        }
      })
      .catch(() => {
        sendBtn.disabled = false;
        sendBtn.textContent = "Send my answers";
        note.textContent = "Couldn't send automatically — opening your email app as a backup.";
        openMailFallback();
      });
  };
}
</script>