{# auth-form override — gilded login/register. Wiring is UNTOUCHABLE and reproduced exactly from builtin auth_blocks.go: single shared #auth-message, /api/auth/login (email,password) and /api/auth/register (username,email,password), hx-target #auth-message. Captcha widget injected from _captcha_widget when captchaEnabled (server enforces). Fields: default_tab, show_social (social omitted — needs Go/site config; graceful). #}
{% if context.isPublicLoggedIn %}
<div data-block-override="art-deco:auth-form" class="auth-form-logged-in mx-auto max-w-md text-center py-8">
  <p class="italic" style="color:hsl(var(--muted-foreground));font-family:var(--font-body, 'Cormorant Garamond', Georgia, serif);">You are signed in as <strong style="color:hsl(var(--foreground));">{{ context.publicUsername }}</strong></p>
  <a href="/account" class="deco-link mt-3 inline-block">My account</a>
</div>
{% else %}
<div data-block-override="art-deco:auth-form" class="auth-form deco-frame mx-auto max-w-md bg-card p-8">
  <div id="auth-message"></div>
  <div class="mb-6 flex border-b border-[hsl(var(--primary)/0.3)]">
    <button type="button" onclick="document.getElementById('login-panel').classList.remove('hidden');document.getElementById('register-panel').classList.add('hidden');this.setAttribute('data-active','1');this.nextElementSibling.removeAttribute('data-active');" data-auth-tab {% if default_tab != "register" %}data-active="1"{% endif %} class="deco-caps flex-1 py-2 text-center text-xs border-b-2 border-transparent data-[active]:border-[hsl(var(--primary))] data-[active]:text-primary">Sign in</button>
    <button type="button" onclick="document.getElementById('register-panel').classList.remove('hidden');document.getElementById('login-panel').classList.add('hidden');this.setAttribute('data-active','1');this.previousElementSibling.removeAttribute('data-active');" data-auth-tab {% if default_tab == "register" %}data-active="1"{% endif %} class="deco-caps flex-1 py-2 text-center text-xs border-b-2 border-transparent data-[active]:border-[hsl(var(--primary))] data-[active]:text-primary">Register</button>
  </div>
  <div id="login-panel" class="{% if default_tab == "register" %}hidden{% endif %}">
    <form hx-post="/api/auth/login" hx-target="#auth-message" hx-swap="innerHTML">
      <div class="mb-3"><label class="deco-caps block text-xs mb-1" style="color:hsl(var(--primary));">Email</label><input type="email" name="email" required class="w-full rounded-none border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:border-[hsl(var(--primary))] focus:ring-1 focus:ring-ring" /></div>
      <div class="mb-4"><label class="deco-caps block text-xs mb-1" style="color:hsl(var(--primary));">Password</label><input type="password" name="password" required class="w-full rounded-none border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:border-[hsl(var(--primary))] focus:ring-1 focus:ring-ring" /></div>
      {% if _captcha_widget %}{{ _captcha_widget|safe }}{% endif %}
      <button type="submit" class="deco-pill w-full" hx-disabled-elt="this">Sign in</button>
      <p class="text-center mt-3 text-sm"><a href="/forgot-password" class="deco-link">Forgot password?</a></p>
    </form>
  </div>
  <div id="register-panel" class="{% if default_tab != "register" %}hidden{% endif %}">
    <form hx-post="/api/auth/register" hx-target="#auth-message" hx-swap="innerHTML">
      <div class="mb-3"><label class="deco-caps block text-xs mb-1" style="color:hsl(var(--primary));">Username</label><input type="text" name="username" required pattern="[a-zA-Z0-9_-]{3,30}" class="w-full rounded-none border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:border-[hsl(var(--primary))] focus:ring-1 focus:ring-ring" /></div>
      <div class="mb-3"><label class="deco-caps block text-xs mb-1" style="color:hsl(var(--primary));">Email</label><input type="email" name="email" required class="w-full rounded-none border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:border-[hsl(var(--primary))] focus:ring-1 focus:ring-ring" /></div>
      <div class="mb-4"><label class="deco-caps block text-xs mb-1" style="color:hsl(var(--primary));">Password</label><input type="password" name="password" required minlength="8" class="w-full rounded-none border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:border-[hsl(var(--primary))] focus:ring-1 focus:ring-ring" /></div>
      {% if _captcha_widget %}{{ _captcha_widget|safe }}{% endif %}
      <button type="submit" class="deco-pill w-full" hx-disabled-elt="this">Create account</button>
    </form>
  </div>
</div>
{% endif %}
