<div id="workflow-container">
  <h2>Minor Subdivision Viability Tool</h2>
  <div id="step1" class="step">
    <p><strong>Step 1:</strong> Is the parcel in unincorporated Alamance County or a community that adopted the UDO?</p>
    <button onclick="answer('step1', 'yes', 'step2')">Yes</button>
    <button onclick="answer('step1', 'no', 'result')">No</button>
  </div>

  <div id="step2" class="step" style="display: none;">
    <p><strong>Step 2:</strong> Will the subdivision create 4 or fewer lots with no new public streets?</p>
    <button onclick="answer('step2', 'yes', 'step3')">Yes</button>
    <button onclick="answer('step2', 'no', 'result')">No</button>
  </div>

  <div id="step3" class="step" style="display: none;">
    <p><strong>Step 3:</strong> Enter parcel acreage and number of lots:</p>
    <input type="number" id="acreage" placeholder="Acreage" min="0" step="0.01">
    <input type="number" id="lots" placeholder="Number of Lots" min="1" max="4">
    <p>Are public water and sewer available?</p>
    <button onclick="checkSize(true)">Yes</button>
    <button onclick="checkSize(false)">No</button>
  </div>

  <div id="result" class="result" style="display: none;"></div>
</div>

<style>
  .step, .result {
    margin: 20px 0;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
  }
  button {
    margin: 5px;
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
  }
  button:hover {
    background-color: #0056b3;
  }
  input {
    margin: 5px;
    padding: 5px;
  }
</style>

<script>
  function answer(currentStep, response, nextStep) {
    document.getElementById(currentStep).style.display = 'none';
    if (response === 'no') {
      let result = document.getElementById('result');
      result.style.display = 'block';
      if (currentStep === 'step1') {
        result.innerHTML = '<strong>No Subdivision Possible.</strong> The property is outside Alamance County’s jurisdiction.';
      } else if (currentStep === 'step2') {
        result.innerHTML = '<strong>No Minor Subdivision Possible.</strong> Exceeds minor subdivision limits (4 or fewer lots, no new streets).';
      }
    } else {
      document.get هیات

Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
  No index signature with a parameter of type 'string' was found on type '{}'.ts(7053)id(nextStep).style.display = 'block';
    }
  }

  function checkSize(hasUtilities) {
    let acreage = parseFloat(document.getElementById('acreage').value);
    let lots = parseInt(document.getElementById('lots').value);
    let minSize = hasUtilities ? 0.46 : 1; // 20,000 sq ft = 0.46 acres
    let sizePerLot = acreage / lots;

    document.getElementById('step3').style.display = 'none';
    let result = document.getElementById('result');
    result.style.display = 'block';

    if (isNaN(acreage) || isNaN(lots) || lots > 4 || lots < 1) {
      result.innerHTML = '<strong>Error:</strong> Please enter valid acreage and 1-4 lots.';
    } else if (sizePerLot < minSize) {
      result.innerHTML = '<strong>No Subdivision Possible.</strong> Lots are too small (min ' + minSize + ' acres per lot).';
    } else {
      result.innerHTML = '<strong>Proceed:</strong> Parcel size is sufficient. Next step: Check exceptions or continue.';
      // Add logic here to proceed to Step 4 if desired
    }
  }
</script>