<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shorten URL</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=JetBrains+Mono:ital,wght@0,400;0,500;0,600;1,400&display=swap" rel="stylesheet">
<style>
  :root{
    color-scheme: dark;
    --bg: #070a0f;
    --card: rgba(255,255,255,.06);
    --card2: rgba(255,255,255,.04);
    --border: rgba(255,255,255,.10);
    --text: rgba(255,255,255,.92);
    --muted: rgba(255,255,255,.60);
    --focus: rgba(255,255,255,.22);
    --shadow: 0 18px 55px rgba(0,0,0,.55);
    --radius: 16px;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  body{
    min-height: 100vh;
    display: grid;
    place-items: center;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background:
      radial-gradient(900px 500px at 20% 15%, rgba(255,255,255,.05), transparent 55%),
      radial-gradient(800px 500px at 80% 85%, rgba(255,255,255,.04), transparent 55%),
      var(--bg);
    color: var(--text);
    padding: 24px;
  }

  .card{
    width: 100%;
    max-width: 640px;
    padding: 22px;
  }

  h1{
    font-size: 1.05rem;
    letter-spacing: .2px;
    font-weight: 600;
    margin-bottom: 6px;
  }

  p{
    font-size: .95rem;
    color: var(--muted);
    line-height: 1.35;
  }

  form{
    display: flex;
    gap: 10px;
    margin-top: 16px;
  }

  .field{
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  input[type="url"]{
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    color: var(--text);
    background: rgba(0,0,0,.30);
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    font-family: inherit;
  }

  input[type="url"]::placeholder{
    color: rgba(255,255,255,.38);
  }

  input[type="url"]:focus{
    border-color: var(--focus);
    box-shadow: 0 0 0 4px rgba(255,255,255,.06);
  }

  button{
    flex: 0 0 auto;
    padding: 12px 16px;
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
    background: rgba(255,255,255,.10);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: transform .08s ease, background .15s ease, border-color .15s ease;
    user-select: none;
    white-space: nowrap;
    font-family: inherit;
  }

  button:hover{
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.14);
  }

  button:active{
    transform: scale(.98);
  }
  
  .below{
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

  .back-link{
    display: inline-block;
    font-size: .9rem;
    color: var(--muted);
    text-decoration: none;
  }

  .back-link:hover{
    color: var(--text);
  }
  
  /* mobile: stack */
  @media (max-width: 560px){
    form{ flex-direction: column; }
    button{ width: 100%; }
  }
</style>
</head>

<body>
  <main class="card">
    <form method="POST" action="/">
        <input id="url_str" type="url" name="url_str" placeholder="https://example.com/something/long" required autocomplete="off" autofocus/>
      <input type="hidden" name="csrf_token" value="{{ request.session.csrf_token }}">
      <button type="submit">Shorten</button>
    </form>
    <div class="below">
      <a href="https://harrisonerd.com" target="_blank" class="back-link">erd.sh</a> &middot; <a href="/api/v1" class="back-link">API Docs (v1)</a>
    </div>
  </main>
</body>
</html>

