{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "login-glass-card",
  "type": "registry:component",
  "title": "Login Glass Card",
  "description": "A frosted sign-in card floating over a slowly drifting mesh gradient and glassy orbs, with provider buttons, email and password fields, validation and a success state.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "auth",
    "login",
    "glassmorphism",
    "mesh gradient",
    "sign in",
    "form",
    "social login"
  ],
  "docs": "https://hyperblur.dev/effects/login-glass-card",
  "files": [
    {
      "path": "registry/hyperblur/login-glass-card.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/login-glass-card.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface LoginGlassCardLink {\n  label: string;\n  href: string;\n}\n\nexport interface LoginGlassCardProvider {\n  id: string;\n  label: string;\n}\n\nexport interface LoginGlassCardValues {\n  email: string;\n  password: string;\n  remember: boolean;\n}\n\nexport interface LoginGlassCardProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\" | \"onSubmit\"> {\n  brand?: string;\n  title?: string;\n  subtitle?: string;\n  providers?: LoginGlassCardProvider[];\n  defaultEmail?: string;\n  forgot?: LoginGlassCardLink;\n  signup?: LoginGlassCardLink;\n  submitLabel?: string;\n  successMessage?: string;\n  onSubmit?: (values: LoginGlassCardValues) => boolean | void | Promise<boolean | void>;\n  onProviderClick?: (id: string) => void;\n  accent?: string;\n}\n\nconst css = `\n.hb-qh1 {\n  --hb-qh1-accent: #8b5cf6;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  overflow: hidden;\n  isolation: isolate;\n  container-type: inline-size;\n  background: #07070b;\n  color: #ededed;\n  font-family: inherit;\n  padding: clamp(64px, 10cqw, 120px) 20px;\n}\n.hb-qh1 *, .hb-qh1 *::before, .hb-qh1 *::after { box-sizing: border-box; }\n.hb-qh1-mesh { position: absolute; inset: -20%; z-index: -2; filter: blur(60px); opacity: .9; }\n.hb-qh1-blob { position: absolute; border-radius: 50%; mix-blend-mode: screen; }\n.hb-qh1-blob-a { width: 52%; height: 60%; left: 8%; top: 6%; background: radial-gradient(circle, var(--hb-qh1-accent), transparent 68%); animation: hb-qh1-drift-a 18s ease-in-out infinite alternate; }\n.hb-qh1-blob-b { width: 46%; height: 56%; right: 6%; top: 18%; background: radial-gradient(circle, #2f7bff, transparent 66%); opacity: .75; animation: hb-qh1-drift-b 22s ease-in-out infinite alternate; }\n.hb-qh1-blob-c { width: 44%; height: 50%; left: 30%; bottom: 0; background: radial-gradient(circle, #ec4899, transparent 66%); opacity: .5; animation: hb-qh1-drift-c 26s ease-in-out infinite alternate; }\n.hb-qh1-veil { position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse 70% 60% at 50% 45%, transparent, rgba(7,7,11,.72) 80%), linear-gradient(to bottom, rgba(7,7,11,.2), rgba(7,7,11,.6)); }\n.hb-qh1-orb { position: absolute; z-index: -1; border-radius: 50%; background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.9), rgba(255,255,255,.18) 30%, color-mix(in srgb, var(--hb-qh1-accent) 40%, transparent) 62%, transparent 72%); box-shadow: inset 0 0 12px rgba(255,255,255,.18); animation: hb-qh1-float var(--hb-qh1-d, 12s) ease-in-out var(--hb-qh1-delay, 0s) infinite alternate; }\n.hb-qh1-inner { position: relative; max-width: 1120px; margin: 0 auto; display: grid; place-items: center; }\n.hb-qh1-card {\n  position: relative;\n  width: 100%;\n  max-width: 420px;\n  padding: 32px 30px 26px;\n  border-radius: 22px;\n  background: linear-gradient(160deg, rgba(255,255,255,.11), rgba(255,255,255,.04));\n  border: 1px solid rgba(255,255,255,.14);\n  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 30px 80px -20px rgba(0,0,0,.6), 0 0 0 1px rgba(0,0,0,.2);\n  backdrop-filter: blur(22px) saturate(150%);\n  -webkit-backdrop-filter: blur(22px) saturate(150%);\n  animation: hb-qh1-rise .8s cubic-bezier(.2,.7,.2,1) both;\n}\n.hb-qh1-card::before { content: \"\"; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(120deg, rgba(255,255,255,.14), transparent 30%); mask: linear-gradient(#000, transparent 50%); }\n.hb-qh1-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; margin-bottom: 18px; background: linear-gradient(140deg, var(--hb-qh1-accent), color-mix(in srgb, var(--hb-qh1-accent) 40%, #0a0a0a)); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 8px 24px -6px var(--hb-qh1-accent); }\n.hb-qh1-title { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -.02em; font-weight: 600; }\n.hb-qh1-sub { margin: 8px 0 22px; color: rgba(237,237,237,.66); font-size: 14px; line-height: 1.5; }\n.hb-qh1-social { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }\n.hb-qh1-prov { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border-radius: 11px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05); color: #ededed; font: inherit; font-size: 13px; cursor: pointer; transition: background .2s, border-color .2s, transform .2s; }\n.hb-qh1-prov:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); transform: translateY(-1px); }\n.hb-qh1-prov:focus-visible, .hb-qh1-btn:focus-visible, .hb-qh1-link:focus-visible, .hb-qh1-eye:focus-visible { outline: 2px solid var(--hb-qh1-accent); outline-offset: 2px; }\n.hb-qh1-prov span { display: none; }\n.hb-qh1-div { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: rgba(237,237,237,.45); font-size: 12px; }\n.hb-qh1-div::before, .hb-qh1-div::after { content: \"\"; flex: 1; height: 1px; background: rgba(255,255,255,.12); }\n.hb-qh1-form { display: grid; gap: 14px; }\n.hb-qh1-field { display: grid; gap: 6px; }\n.hb-qh1-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }\n.hb-qh1-label { font-size: 13px; color: rgba(237,237,237,.8); font-weight: 500; }\n.hb-qh1-wrap { position: relative; }\n.hb-qh1-input { width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14); background: rgba(10,10,14,.45); color: #ededed; font: inherit; font-size: 14px; outline: none; transition: border-color .2s, box-shadow .2s, background .2s; }\n.hb-qh1-input::placeholder { color: rgba(237,237,237,.35); }\n.hb-qh1-input:focus { border-color: color-mix(in srgb, var(--hb-qh1-accent) 80%, white); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-qh1-accent) 25%, transparent); background: rgba(10,10,14,.6); }\n.hb-qh1-input[aria-invalid=\"true\"] { border-color: #f87171; box-shadow: 0 0 0 4px rgba(248,113,113,.15); }\n.hb-qh1-pw { padding-right: 46px; }\n.hb-qh1-eye { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: rgba(237,237,237,.6); cursor: pointer; }\n.hb-qh1-eye:hover { color: #fff; background: rgba(255,255,255,.08); }\n.hb-qh1-err { margin: 0; font-size: 12px; color: #fca5a5; }\n.hb-qh1-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(237,237,237,.72); cursor: pointer; }\n.hb-qh1-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--hb-qh1-accent); }\n.hb-qh1-link { color: color-mix(in srgb, var(--hb-qh1-accent) 55%, white); font-size: 13px; text-decoration: none; border-radius: 4px; }\n.hb-qh1-link:hover { text-decoration: underline; }\n.hb-qh1-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 46px; margin-top: 4px; border: 0; border-radius: 12px; font: inherit; font-size: 14px; font-weight: 600; color: #fff; cursor: pointer; background: linear-gradient(180deg, color-mix(in srgb, var(--hb-qh1-accent) 85%, white), var(--hb-qh1-accent)); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 10px 30px -10px var(--hb-qh1-accent); transition: transform .2s, filter .2s; overflow: hidden; }\n.hb-qh1-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }\n.hb-qh1-btn:disabled { cursor: progress; filter: saturate(.8); transform: none; }\n.hb-qh1-btn::after { content: \"\"; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.3) 50%, transparent 70%); transform: translateX(-100%); transition: transform .7s; }\n.hb-qh1-btn:hover::after { transform: translateX(100%); }\n.hb-qh1-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: hb-qh1-turn .7s linear infinite; }\n.hb-qh1-alert { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 13px; background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.3); color: #fecaca; }\n.hb-qh1-foot { margin: 20px 0 0; text-align: center; font-size: 13px; color: rgba(237,237,237,.6); }\n.hb-qh1-done { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 18px 0 6px; animation: hb-qh1-rise .5s ease both; }\n.hb-qh1-ok { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--hb-qh1-accent) 22%, transparent); border: 1px solid color-mix(in srgb, var(--hb-qh1-accent) 50%, transparent); }\n.hb-qh1-ok path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: hb-qh1-draw .5s .15s ease forwards; }\n@container (min-width: 420px) { .hb-qh1-prov span { display: inline; } }\n@keyframes hb-qh1-drift-a { to { transform: translate(18%, 12%) scale(1.15); } }\n@keyframes hb-qh1-drift-b { to { transform: translate(-22%, 10%) scale(.9); } }\n@keyframes hb-qh1-drift-c { to { transform: translate(10%, -18%) scale(1.2); } }\n@keyframes hb-qh1-float { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(var(--hb-qh1-x, 10px), var(--hb-qh1-y, -30px), 0); } }\n@keyframes hb-qh1-rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }\n@keyframes hb-qh1-turn { to { transform: rotate(360deg); } }\n@keyframes hb-qh1-draw { to { stroke-dashoffset: 0; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-qh1 *, .hb-qh1 *::before, .hb-qh1 *::after { animation: none !important; transition: none !important; }\n  .hb-qh1-ok path { stroke-dashoffset: 0; }\n}\n`;\n\nfunction hash(n: number) {\n  let x = (n + 1) * 2654435761;\n  x = (x ^ (x >>> 15)) >>> 0;\n  x = Math.imul(x, 2246822519) >>> 0;\n  return ((x ^ (x >>> 13)) >>> 0) / 4294967295;\n}\n\nconst orbs = Array.from({ length: 7 }, (_, i) => {\n  const size = 18 + Math.round(hash(i) * 46);\n  return {\n    size,\n    left: (6 + hash(i + 11) * 88).toFixed(2),\n    top: (8 + hash(i + 23) * 80).toFixed(2),\n    d: (9 + hash(i + 31) * 9).toFixed(2),\n    delay: (-hash(i + 41) * 8).toFixed(2),\n    x: (-30 + hash(i + 51) * 60).toFixed(1),\n    y: (-50 + hash(i + 61) * 30).toFixed(1),\n  };\n});\n\nfunction Glyph({ id }: { id: string }) {\n  if (id === \"code\") {\n    return (\n      <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n        <path d=\"M5.5 4.5 2 8l3.5 3.5M10.5 4.5 14 8l-3.5 3.5\" />\n      </svg>\n    );\n  }\n  if (id === \"device\") {\n    return (\n      <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n        <rect x=\"4.5\" y=\"1.8\" width=\"7\" height=\"12.4\" rx=\"1.8\" />\n        <path d=\"M7 12h2\" />\n      </svg>\n    );\n  }\n  return (\n    <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n      <path d=\"M8 1.8 13 3.7v4c0 3-2 5.2-5 6.5-3-1.3-5-3.5-5-6.5v-4L8 1.8Z\" />\n      <path d=\"m5.8 8 1.7 1.7L10.4 6.6\" />\n    </svg>\n  );\n}\n\nfunction wait(result: unknown) {\n  return result instanceof Promise ? result : new Promise<unknown>((resolve) => setTimeout(() => resolve(result), 900));\n}\n\nexport function LoginGlassCard({\n  brand = \"Lumen\",\n  title = \"Welcome back\",\n  subtitle = \"Sign in to pick up where your team left off.\",\n  providers = [\n    { id: \"sso\", label: \"Single sign-on\" },\n    { id: \"code\", label: \"Code host\" },\n    { id: \"device\", label: \"This device\" },\n  ],\n  defaultEmail = \"\",\n  forgot = { label: \"Forgot password?\", href: \"#forgot\" },\n  signup = { label: \"Create an account\", href: \"#signup\" },\n  submitLabel = \"Sign in\",\n  successMessage = \"Signed in. Redirecting to your workspace.\",\n  onSubmit,\n  onProviderClick,\n  accent = \"#8b5cf6\",\n  className = \"\",\n  style,\n  ...rest\n}: LoginGlassCardProps) {\n  const uid = React.useId();\n  const [email, setEmail] = React.useState(defaultEmail);\n  const [password, setPassword] = React.useState(\"\");\n  const [remember, setRemember] = React.useState(true);\n  const [show, setShow] = React.useState(false);\n  const [errors, setErrors] = React.useState<{ email?: string; password?: string }>({});\n  const [status, setStatus] = React.useState<\"idle\" | \"loading\" | \"error\" | \"success\">(\"idle\");\n\n  function validate() {\n    const next: { email?: string; password?: string } = {};\n    if (!email.trim()) next.email = \"Enter your email address.\";\n    else if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email.trim())) next.email = \"That email doesn't look right.\";\n    if (!password) next.password = \"Enter your password.\";\n    else if (password.length < 8) next.password = \"Passwords are at least 8 characters.\";\n    return next;\n  }\n\n  async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {\n    event.preventDefault();\n    if (status === \"loading\") return;\n    const next = validate();\n    setErrors(next);\n    if (next.email || next.password) return;\n    setStatus(\"loading\");\n    try {\n      const result = await wait(onSubmit ? onSubmit({ email: email.trim(), password, remember }) : true);\n      setStatus(result === false ? \"error\" : \"success\");\n    } catch {\n      setStatus(\"error\");\n    }\n  }\n\n  return (\n    <section className={`hb-qh1 ${className}`} style={{ \"--hb-qh1-accent\": accent, ...style } as React.CSSProperties} {...rest}>\n      <style href=\"hb-login-glass-card\" precedence=\"default\">{css}</style>\n      <div className=\"hb-qh1-mesh\" aria-hidden=\"true\">\n        <div className=\"hb-qh1-blob hb-qh1-blob-a\" />\n        <div className=\"hb-qh1-blob hb-qh1-blob-b\" />\n        <div className=\"hb-qh1-blob hb-qh1-blob-c\" />\n      </div>\n      <div className=\"hb-qh1-veil\" aria-hidden=\"true\" />\n      {orbs.map((o, i) => (\n        <span\n          key={i}\n          className=\"hb-qh1-orb\"\n          aria-hidden=\"true\"\n          style={{ width: o.size, height: o.size, left: `${o.left}%`, top: `${o.top}%`, \"--hb-qh1-d\": `${o.d}s`, \"--hb-qh1-delay\": `${o.delay}s`, \"--hb-qh1-x\": `${o.x}px`, \"--hb-qh1-y\": `${o.y}px` } as React.CSSProperties}\n        />\n      ))}\n      <div className=\"hb-qh1-inner\">\n        <div className=\"hb-qh1-card\">\n          <div className=\"hb-qh1-mark\" aria-hidden=\"true\">\n            <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\">\n              <path d=\"M10 2 17 6v8l-7 4-7-4V6l7-4Z\" fill=\"none\" stroke=\"#fff\" strokeWidth=\"1.6\" strokeLinejoin=\"round\" />\n              <circle cx=\"10\" cy=\"10\" r=\"2.6\" fill=\"#fff\" />\n            </svg>\n          </div>\n          {status === \"success\" ? (\n            <div className=\"hb-qh1-done\" role=\"status\">\n              <div className=\"hb-qh1-ok\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n                  <path d=\"m6 12.5 4 4 8-9\" fill=\"none\" stroke=\"#fff\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n                </svg>\n              </div>\n              <h2 className=\"hb-qh1-title\">Welcome to {brand}</h2>\n              <p className=\"hb-qh1-sub\" style={{ margin: 0 }}>{successMessage}</p>\n            </div>\n          ) : (\n            <>\n              <h2 className=\"hb-qh1-title\">{title}</h2>\n              <p className=\"hb-qh1-sub\">{subtitle}</p>\n              {providers.length > 0 && (\n                <>\n                  <div className=\"hb-qh1-social\">\n                    {providers.map((p) => (\n                      <button key={p.id} type=\"button\" className=\"hb-qh1-prov\" aria-label={`Continue with ${p.label}`} onClick={() => onProviderClick?.(p.id)}>\n                        <Glyph id={p.id} />\n                        <span>{p.label}</span>\n                      </button>\n                    ))}\n                  </div>\n                  <div className=\"hb-qh1-div\">or with email</div>\n                </>\n              )}\n              <form className=\"hb-qh1-form\" noValidate onSubmit={handleSubmit}>\n                {status === \"error\" && (\n                  <p className=\"hb-qh1-alert\" role=\"alert\">That email and password don&apos;t match an account.</p>\n                )}\n                <div className=\"hb-qh1-field\">\n                  <label className=\"hb-qh1-label\" htmlFor={`${uid}-email`}>Email</label>\n                  <input\n                    id={`${uid}-email`}\n                    className=\"hb-qh1-input\"\n                    type=\"email\"\n                    autoComplete=\"email\"\n                    placeholder=\"you@company.com\"\n                    value={email}\n                    aria-invalid={errors.email ? true : undefined}\n                    aria-describedby={errors.email ? `${uid}-email-err` : undefined}\n                    onChange={(e) => {\n                      setEmail(e.target.value);\n                      if (errors.email) setErrors((s) => ({ ...s, email: undefined }));\n                    }}\n                  />\n                  {errors.email && <p className=\"hb-qh1-err\" id={`${uid}-email-err`}>{errors.email}</p>}\n                </div>\n                <div className=\"hb-qh1-field\">\n                  <div className=\"hb-qh1-row\">\n                    <label className=\"hb-qh1-label\" htmlFor={`${uid}-pw`}>Password</label>\n                    <a className=\"hb-qh1-link\" href={forgot.href}>{forgot.label}</a>\n                  </div>\n                  <div className=\"hb-qh1-wrap\">\n                    <input\n                      id={`${uid}-pw`}\n                      className=\"hb-qh1-input hb-qh1-pw\"\n                      type={show ? \"text\" : \"password\"}\n                      autoComplete=\"current-password\"\n                      placeholder=\"••••••••\"\n                      value={password}\n                      aria-invalid={errors.password ? true : undefined}\n                      aria-describedby={errors.password ? `${uid}-pw-err` : undefined}\n                      onChange={(e) => {\n                        setPassword(e.target.value);\n                        if (errors.password) setErrors((s) => ({ ...s, password: undefined }));\n                      }}\n                    />\n                    <button type=\"button\" className=\"hb-qh1-eye\" aria-label={show ? \"Hide password\" : \"Show password\"} aria-pressed={show} onClick={() => setShow((s) => !s)}>\n                      <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n                        <path d=\"M1.5 8S4 3.5 8 3.5 14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8Z\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.4\" />\n                        <circle cx=\"8\" cy=\"8\" r=\"2\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.4\" />\n                        {show && <path d=\"M2.5 13.5 13.5 2.5\" stroke=\"currentColor\" strokeWidth=\"1.4\" strokeLinecap=\"round\" />}\n                      </svg>\n                    </button>\n                  </div>\n                  {errors.password && <p className=\"hb-qh1-err\" id={`${uid}-pw-err`}>{errors.password}</p>}\n                </div>\n                <label className=\"hb-qh1-check\">\n                  <input type=\"checkbox\" checked={remember} onChange={(e) => setRemember(e.target.checked)} />\n                  Keep me signed in for 30 days\n                </label>\n                <button type=\"submit\" className=\"hb-qh1-btn\" disabled={status === \"loading\"} aria-busy={status === \"loading\"}>\n                  {status === \"loading\" && <span className=\"hb-qh1-spin\" aria-hidden=\"true\" />}\n                  {status === \"loading\" ? \"Signing in\" : submitLabel}\n                </button>\n              </form>\n              <p className=\"hb-qh1-foot\">\n                New to {brand}? <a className=\"hb-qh1-link\" href={signup.href}>{signup.label}</a>\n              </p>\n            </>\n          )}\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}