<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: en }}">
	{%- include head.html -%}
	<body>
		{%- include header.html -%}
		<div class="container">
			<main>
				<section class="capsule-header">
					<div class="center">
						<div class="capsule">contact</div>
					</div>
					<br>
					<h2 class="gradient-text center hero-header">tell us about your biggest security challenges</h2>
				</section>
				<section class="flex-container" style="margin-top: 80px">
					<div class="flex-container-inner">
						<div class="form-container card">
							<form onsubmit="return validateForm()" action="/submit-email" method="post">
								<div class="form-flex-container">
									<div>
										<label for="name" class="form-label">Your name</label>
										<input type="text" id="name" name="name" class="form-input">
									</div>
								</div>

								<label for="email" class="form-label required">Your email</label>
								<input placeholder="Enter your business email..." type="email" id="email" name="email" class="form-input" required>

								<label for="company-name" class="form-label">Company name</label>
								<input type="text" id="company-name" name="company-name" class="form-input">

								<label for="service" class="form-label required">What service are you interested in?</label>
								<select id="service" name="service" class="form-select" required>
									<option value="" disabled selected>Select option</option>
									<option value="software-security-assessment">Security assessment</option>
									<option value="retained">Retainer / Fractional CISO</option>
									<option value="engineering">Software engineering</option>
									<option value="digital-asset-custody">Digital asset custody</option>
									<option value="general-inquiry">General inquiry</option>
								</select>

								<label for="help" class="form-label required">How can we help?</label>
								<textarea id="help" name="help" class="form-textarea" required></textarea>

								<div id="other-field" style="display:none;">
									<input type="text" id="other-source" name="other-source" class="form-input" placeholder="Please specify">
								</div>

								<!-- TODO: add captcha of some sort -->

								<button type="submit" class="contact-button">Submit</button>
								<p class="center submit-policy">We respect your privacy. The information you provide will only be used to respond to your inquiry and will never be shared externally.</p>
							</form>
						</div>
					</div>
				</section>

				{% include companies-carousel.html hide_title='true' %}
			</main>
			<br />
		</div>
		{%- include footer.html -%}
	</body>

	<script>
		function toggleOtherField() {
			var hearAbout = document.getElementById('hear-about').value;
			var otherField = document.getElementById('other-field');
			if (hearAbout === 'other') {
				otherField.style.display = 'block';
				document.getElementById('other-source').required = true;
			} else {
				otherField.style.display = 'none';
				document.getElementById('other-source').required = false;
			}
		}

		function validateForm() {
			var inquiryType = document.getElementById('inquiry-type');
			var services = document.getElementById('services');
			var hearAbout = document.getElementById('hear-about');

			if (inquiryType.value === "") {
				alert("Please select a valid Inquiry Type");
				return false;
			}
			if (services.value === "") {
				alert("Please select a valid Service you are interested in");
				return false;
			}
			return true;
		}
	</script>
</html>
