# SECURE Act 2.0 Student Loan Matching Calculator

A free, interactive web calculator that helps employees and employers understand the financial impact of the SECURE Act 2.0 student loan matching program. This program allows employers to make 401(k) matching contributions based on employee student loan payments.

## 🚀 Live Demo

Visit the calculator at: [https://secure-student-loan.gitlab.io](https://secure-student-loan.gitlab.io)

## 📋 Features

- **Interactive Calculator**: Real-time calculations showing net worth comparison over time
- **Visual Charts**: Dynamic Chart.js visualizations comparing scenarios with and without the program
- **Multiple Personas**: Pre-loaded examples for different professions (teacher, engineer, attorney, etc.)
- **Export Options**: Download results as CSV or print for records
- **Share Functionality**: Share results via Web Share API or clipboard
- **Input Validation**: Comprehensive validation to prevent calculation errors
- **Responsive Design**: Mobile-first design that works on all devices
- **Accessibility**: ARIA labels and semantic HTML for screen reader support

## 🛠️ Technology Stack

- **HTML5**: Semantic markup for accessibility
- **Tailwind CSS**: Utility-first CSS framework (via CDN)
- **Alpine.js**: Lightweight reactive framework for interactivity
- **Chart.js**: Beautiful, responsive charts
- **GitLab Pages**: Static site hosting with CI/CD

## 💻 Local Development

### Prerequisites
- Any modern web browser
- Python (optional, for local server)

### Running Locally

1. Clone the repository:
```bash
git clone https://gitlab.com/your-username/secure-student-loan.git
cd secure-student-loan
```

2. Open directly in browser:
```bash
open index.html  # macOS
xdg-open index.html  # Linux
start index.html  # Windows
```

Or use a local server:
```bash
python -m http.server 8000
# Visit http://localhost:8000
```

## 🚢 Deployment

The site automatically deploys to GitLab Pages when changes are pushed to the `main` branch.

### Manual Deployment

1. Push changes to the main branch:
```bash
git add .
git commit -m "Your commit message"
git push origin main
```

2. GitLab CI/CD will automatically:
   - Copy `index.html` to the `public/` directory
   - Deploy to GitLab Pages

## 📊 How the Calculator Works

### Key Assumptions
- **Investment Returns**: 7% average annual return (historical S&P 500 average)
- **Loan Interest Rate**: 5% annual rate (federal student loan average)
- **Retirement Age**: 65 years old
- **Compound Growth**: Each year's contribution grows from the time it's contributed until retirement

### Calculation Formula

1. **Annual Match Amount**: 
   ```
   min(Monthly Loan Payment × 12, Salary × Match Rate)
   ```

2. **Future Value with Compound Growth**:
   ```
   FV = Σ(Annual Match × (1 + 0.07)^(65 - Current Age - Year))
   ```

3. **Net Worth Comparison**:
   - With Program: Retirement Account Balance - Remaining Loan Balance
   - Without Program: -Remaining Loan Balance (until loans paid off)

## 🤝 Contributing

We welcome contributions! Here's how you can help:

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Test thoroughly in different browsers
5. Commit your changes (`git commit -m 'Add amazing feature'`)
6. Push to your branch (`git push origin feature/amazing-feature`)
7. Open a Merge Request

### Development Guidelines

- Maintain 4-space indentation in HTML
- Use Tailwind utility classes for styling
- Keep all functionality in the single `index.html` file
- Test on mobile devices and different screen sizes
- Ensure accessibility with proper ARIA labels
- Validate inputs to prevent calculation errors

## 📈 Future Enhancements

- [ ] Add inflation adjustment options
- [ ] Include tax implications calculator
- [ ] Add employer cost-benefit analysis
- [ ] Create embeddable widget version
- [ ] Add more detailed amortization schedules
- [ ] Include state-specific student loan programs
- [ ] Add comparison with other retirement strategies

## 📄 License

This project is open source and available under the MIT License.

## 🙏 Acknowledgments

- SECURE Act 2.0 legislation for making this benefit possible
- The millions of Americans managing student debt while trying to save for retirement
- Employers implementing this innovative benefit program

## 📞 Support

For questions, suggestions, or issues:
- Open an issue in the GitLab repository
- Contact via [your-email@example.com]

---

**Disclaimer**: This calculator provides estimates for educational purposes only. Actual results will vary based on your specific loan terms, employer plan details, investment performance, and contribution consistency. Consult with a financial advisor for personalized advice.