<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>This domain is for sale!</title>
  <style>
    body {
      min-height: 100vh; 
      display: flex; 
      flex-direction: column; 
      justify-content: center; 
      align-items: center;
      font-family: system-ui, sans-serif; 
      background: #fafbfc; 
      margin: 0;
    }
    .container {
      background: #fff;
      padding: 2em 1.5em 2em 1.5em;
      border-radius: 1em;
      box-shadow: 0 2px 16px #0001;
      max-width: 380px;
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      box-sizing: border-box;
    }
    h1 { 
      margin: 0 0 1.2em 0; 
      font-size: 1.4em; 
      text-align: center;
    }
    form { 
      width: 100%; 
      display: flex; 
      flex-direction: column; 
      gap: 1em; 
    }
    label { 
      font-weight: 500; 
      display: flex; 
      flex-direction: column; 
      gap: 0.3em; 
    }
    input, textarea {
      width: 100%; 
      padding: 0.8em 1em; 
      border-radius: 0.5em; 
      border: 1px solid #ccc; 
      font-size: 1em;
      box-sizing: border-box;
      margin-top: 0.15em;
    }
    textarea { 
      min-height: 80px; 
      resize: vertical; 
    }
    button {
      background: #2353f1;
      color: #fff;
      border: none;
      padding: 0.8em;
      border-radius: 0.5em;
      font-size: 1em;
      cursor: pointer;
      font-weight: bold;
      margin-top: 0.2em;
      transition: background 0.18s;
    }
    button:hover, button:focus {
      background: #183fc1;
    }
    #confirmation {
      margin-top: 1.3em;
      color: #228833;
      font-weight: 600;
      text-align: center;
      display: none;
    }
    @media (max-width: 480px) {
      .container { 
        padding: 1.2em 0.8em 1.2em 0.8em; 
        max-width: 97vw;
      }
      h1 { font-size: 1.12em; }
    }
  </style>
  <script src="https://www.google.com/recaptcha/api.js?render=6Lcj8n0rAAAAAIetSm5gbxzVHmBO0g6zNEWv_CMK"></script>
</head>
<body>
  <div class="container">
    <h1>This domain is for sale.<br>Get in touch if you're interested.</h1>
    <form id="contactForm" autocomplete="off">
      <label>
        Your Email
        <input type="email" name="sender" required autocomplete="email">
      </label>
      <label>
        Subject
        <input type="text" name="subject" required maxlength="120">
      </label>
      <label>
        Message
        <textarea name="body" required maxlength="2000"></textarea>
      </label>
      <button type="submit">Send</button>
    </form>
    <div id="confirmation">Thank you, your request was forwarded.<br>We will get back to you shortly!</div>
  </div>
  <script>
    const recaptchaSiteKey = '6Lcj8n0rAAAAAIetSm5gbxzVHmBO0g6zNEWv_CMK';
    const form = document.getElementById('contactForm');
    const confirmation = document.getElementById('confirmation');
    form.onsubmit = async (e) => {
      e.preventDefault();
      grecaptcha.ready(async function() {
        const token = await grecaptcha.execute(recaptchaSiteKey, {action: 'submit'});
        const data = {
          sender: form.sender.value,
          subject: form.subject.value,
          body: form.body.value,
          recaptcha: token
        };
        await fetch('/api/contact', {
          method: 'POST',
          headers: {'Content-Type': 'application/json'},
          body: JSON.stringify(data)
        });
        form.style.display = 'none';
        confirmation.style.display = 'block';
      });
    };
  </script>
</body>
</html>