/* ============================================================================
   VCAP — Auth (Sign in / Register)
   ----------------------------------------------------------------------------
   Beta split-screen: info panel left, form panel right, on the landing-page
   ambience (aura pools + top lift + grain) with the brand-green CTA.
   Built on the console tokens (console-theme.css) for surfaces, spacing,
   fields and buttons.
   ========================================================================== */

.beta-auth {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    background: #000;
    overflow-x: clip;
    isolation: isolate;
}
/* faint film grain over the page, same treatment as the landing page */
.beta-auth::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: .05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}
.beta-top, .beta-grid, .beta-foot { position: relative; z-index: 2; }
/* Coalesce ambient canvas — fixed backdrop above the page bg, below content */
.beta-coalesce {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}
/* landing-page ambience restored ON TOP of the Coalesce canvas:
   aura pools + top lift + vignette sit above the particles (canvas z-0,
   this overlay z-1) so the old gradient mood reads over the effect */
.beta-auth::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(680px 560px at 86% 5%,  rgba(57, 243, 104, .07), transparent 68%),
        radial-gradient(720px 620px at 10% 26%, rgba(146, 154, 210, .055), transparent 70%),
        radial-gradient(700px 600px at 92% 52%, rgba(57, 243, 104, .05),  transparent 70%),
        radial-gradient(760px 640px at 8% 74%,  rgba(146, 154, 210, .05), transparent 72%),
        radial-gradient(720px 620px at 88% 95%, rgba(57, 243, 104, .06),  transparent 70%),
        radial-gradient(ellipse 72% 42% at 50% -8%, rgba(255,255,255,.045), transparent 60%),
        radial-gradient(130% 90% at 50% 42%, transparent 58%, rgba(0,0,0,.55) 100%);
    pointer-events: none;
}

/* top bar: brand left, beta badge right */
.beta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-7);
}
.beta-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    color: var(--ink);
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: .01em;
}
.beta-brand .mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--primary);
    color: var(--primary-ink);
    display: grid;
    place-items: center;
}
.beta-brand .mark svg { width: 18px; height: 18px; display: block; }
.beta-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--mono);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .12em;
    color: var(--ink-2);
    border: none;
    background: transparent;
    padding: 0;
}
/* badge sits right-aligned above the form panel, divided from it by a rule */
.beta-side {
    width: 100%;
    max-width: 440px;
    justify-self: end;
    display: flex;
    flex-direction: column;
}
.beta-badge-row { display: flex; justify-content: flex-end; margin-bottom: var(--space-4); }
.beta-sep { border: none; border-top: 1px solid var(--line); margin: 0 0 var(--space-5); }
.beta-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

/* split grid */
.beta-grid {
    flex: 1;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: var(--space-8);
    align-items: center;
    padding: var(--space-6) var(--space-7) var(--space-8);
}
.beta-info { max-width: 520px; }

/* left: info panel */
.beta-info h1 {
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(2.6rem, 5.5vw, 3.75rem);
    letter-spacing: .05em;
    line-height: 1.08;
    color: var(--ink);
    margin: 0 0 var(--space-3);
}
.beta-eyebrow {
    display: inline-block;
    font-family: var(--mono);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: var(--space-3);
    border: 1px solid var(--primary-line);
    background: var(--primary-soft);
    border-radius: 999px;
    padding: .35rem .8rem;
}
.beta-lede { color: var(--ink-2); font-size: var(--text-base); line-height: 1.6; margin: 0 0 var(--space-6); max-width: 52ch; }

.beta-info h1 .beta-hl { display: block; color: var(--primary); }
.beta-phase {
    margin-bottom: var(--space-6);
    max-width: none;
    border: 1px solid var(--line-2);
    border-radius: var(--r-lg);
    background: rgba(255, 255, 255, .03);
    padding: var(--space-5);
}
.beta-phase-head {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-2);
    margin-bottom: var(--space-2);
}
.beta-bar {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    overflow: hidden;
}
.beta-bar > span {
    display: block;
    width: 33%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-strong), var(--primary));
    box-shadow: 0 0 12px var(--primary-glow);
}
.beta-phase-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--ink-2);
}
.beta-live { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--primary); }
/* bottom trust row: equal slots, each with a green check */
.beta-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: .04em;
    color: var(--ink-2);
}
.beta-tag {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    white-space: nowrap;
}
.beta-tag svg {
    width: 15px;
    height: 15px;
    flex: none;
    color: var(--primary);
}

/* right: form panel — same translucent treatment as .beta-phase, one step more opaque */
.beta-panel {
    position: relative;
    width: 100%;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--line-2);
    border-radius: var(--r-xl);
    padding: var(--space-7);
    box-shadow: var(--shadow-modal), inset 0 1px 0 rgba(255, 255, 255, .04);
    animation: auth-in .5s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes auth-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
/* ---- entrance + ambient motion (engagement) ---- */
.beta-info > * { animation: beta-rise .65s cubic-bezier(.22, 1, .36, 1) both; }
.beta-info > *:nth-child(2) { animation-delay: .08s; }
.beta-info > *:nth-child(3) { animation-delay: .16s; }
.beta-info > *:nth-child(4) { animation-delay: .24s; }
.beta-info > *:nth-child(5) { animation-delay: .32s; }
.beta-badge-row { animation: beta-rise .55s cubic-bezier(.22, 1, .36, 1) both; }
.beta-sep { animation: beta-grow .7s ease .15s both; transform-origin: right center; }
@keyframes beta-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes beta-grow { from { opacity: 0; transform: scaleX(.4); } to { opacity: 1; transform: none; } }
/* progress bar fills in, then shimmers */
.beta-bar > span { animation: beta-fill 1.1s cubic-bezier(.22, 1, .36, 1) .35s both; position: relative; overflow: hidden; }
.beta-bar > span::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .45) 50%, transparent 80%);
    transform: translateX(-100%);
    animation: beta-shimmer 2.8s ease-in-out 1.6s infinite;
}
@keyframes beta-fill { from { width: 0; } to { width: 33%; } }
@keyframes beta-shimmer { 0% { transform: translateX(-100%); } 55%, 100% { transform: translateX(100%); } }
/* live dot pulse */
.beta-dot { animation: beta-ping 2.2s ease-in-out infinite; }
@keyframes beta-ping { 0%, 100% { box-shadow: 0 0 0 0 rgba(57, 243, 104, .45); } 50% { box-shadow: 0 0 0 6px rgba(57, 243, 104, 0); } }
/* headline accent glow */
.beta-info h1 .beta-hl { animation: beta-glow 3.2s ease-in-out 1s infinite; }
@keyframes beta-glow { 0%, 100% { text-shadow: 0 0 0 rgba(57, 243, 104, 0); } 50% { text-shadow: 0 0 22px rgba(57, 243, 104, .45); } }
/* trust tags pop in, then lift on hover */
.beta-tag { animation: beta-pop .5s cubic-bezier(.22, 1, .36, 1) both; transition: color .15s, transform .15s; }
.beta-tags .beta-tag:nth-child(2) { animation-delay: .4s; }
.beta-tags .beta-tag:nth-child(3) { animation-delay: .48s; }
.beta-tag:hover { color: var(--ink); transform: translateY(-1px); }
@keyframes beta-pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
/* phase card + CTA micro-interactions */
.beta-phase { transition: border-color .2s, box-shadow .2s, transform .2s; }
.beta-phase:hover { border-color: var(--primary-line); box-shadow: 0 0 24px rgba(57, 243, 104, .12); transform: translateY(-2px); }
.auth-btn { transition: background .15s, border-color .15s, transform .15s, box-shadow .15s; }
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(57, 243, 104, .35); }
.auth-btn:active { transform: none; }
.beta-panel input, .beta-panel select { transition: border-color .15s, box-shadow .15s, background .15s, transform .15s; }
.beta-panel input:focus, .beta-panel select:focus { transform: translateY(-1px); }
.beta-panel h2 {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.6rem;
    letter-spacing: -.01em;
    color: var(--ink);
    margin: 0 0 var(--space-5);
}
.beta-panel-sub { color: var(--ink-2); font-size: var(--text-sm); margin: calc(-1 * var(--space-4)) 0 var(--space-5); line-height: 1.5; }

/* footer */
.beta-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-7);
    border-top: 1px solid var(--line);
    font-size: var(--text-xs);
    color: var(--ink-3);
}
.beta-foot nav { display: flex; gap: var(--space-5); }
.beta-foot a {
    color: var(--ink-3);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: .08em;
}
.beta-foot a:hover { color: var(--ink); }

/* legacy centered card (kept for any page still using .auth) */
.auth {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    background:
        radial-gradient(680px 560px at 86% 5%,  rgba(57, 243, 104, .07), transparent 68%),
        radial-gradient(720px 620px at 10% 26%, rgba(146, 154, 210, .055), transparent 70%),
        radial-gradient(700px 600px at 92% 52%, rgba(57, 243, 104, .05),  transparent 70%),
        radial-gradient(760px 640px at 8% 74%,  rgba(146, 154, 210, .05), transparent 72%),
        radial-gradient(720px 620px at 88% 95%, rgba(57, 243, 104, .06),  transparent 70%),
        #000;
    overflow: hidden;
}

/* brand mark, fixed top-left */
.auth-logo {
    position: fixed;
    top: var(--space-6);
    left: var(--space-6);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    color: var(--ink);
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: .01em;
    z-index: 3;
}
.auth-logo .mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--primary);
    color: var(--primary-ink);
    display: grid;
    place-items: center;
}
.auth-logo .mark svg { width: 18px; height: 18px; display: block; }

/* the card */
.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 408px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-xl);
    padding: var(--space-7);
    box-shadow: var(--shadow-modal), inset 0 1px 0 rgba(255, 255, 255, .04);
    animation: auth-in .5s cubic-bezier(.22, 1, .36, 1) both;
}

.auth-head { margin-bottom: var(--space-6); }
.auth-eyebrow {
    display: inline-block;
    font-family: var(--mono);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: var(--space-3);
}
.auth-head h1 {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.6rem;
    letter-spacing: -.01em;
    color: var(--ink);
    margin: 0 0 var(--space-2);
}
.auth-head p { color: var(--ink-2); font-size: var(--text-sm); margin: 0; line-height: 1.5; }

/* fields — same language as the app .input */
.field { margin-bottom: var(--space-4); }
.field > label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--ink-2);
    margin-bottom: var(--space-2);
}
.field > label .opt { color: var(--ink-3); font-weight: 400; }
.auth-hint { font-size: var(--text-xs); color: var(--ink-3); margin: var(--space-2) 0 0; }
.auth-card input:disabled,
.beta-panel input:disabled,
.beta-panel select:disabled { opacity: .62; cursor: not-allowed; }
.control { position: relative; }
.beta-panel input,
.beta-panel select,
.auth-card input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .7rem .85rem;
    color: var(--ink);
    font-size: var(--text-base);
    font-family: var(--font);
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.beta-panel input::placeholder { color: var(--ink-3); }
.auth-card input::placeholder { color: var(--ink-3); }
.beta-panel input:focus,
.beta-panel select:focus,
.auth-card input:focus {
    border-color: var(--primary-line);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(57, 243, 104, .1);
}
.control.pw input { padding-right: 44px; }
.pw-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px;
    display: grid; place-items: center;
    background: none; border: none; cursor: pointer;
    color: var(--ink-3); border-radius: 8px;
    transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--ink); background: var(--raised); }
.pw-toggle svg { width: 18px; height: 18px; }

/* remember me — the checkbox must escape the text-input sizing above, and the
   whole row is a label so the hit area is the row, not a 18px box */
.auth-remember { margin: calc(-1 * var(--space-2)) 0 var(--space-1); }
.auth-remember .auth-remember-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--ink-2);
    margin-bottom: 0;
    margin-top: 12px;
    cursor: pointer;
}
.auth-remember input[type=checkbox] {
    width: 18px;
    height: 18px;
    flex: none;
    padding: 0;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
    border-radius: 4px;
}
.auth-remember-label span { display: inline-flex; align-items: center; min-height: 18px; line-height: 1.25; }
/* tooltip for the "Keep me signed in" label (title attr is the fallback) */
.remember-tip { position: relative; vertical-align: middle; }
.remember-tip:hover::after,
.remember-tip:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    max-width: 240px;
    padding: .45rem .65rem;
    font-size: var(--text-xs);
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    line-height: 1.45;
    color: var(--ink);
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    border-radius: 8px;
    box-shadow: var(--shadow-modal);
    z-index: 5;
    pointer-events: none;
    white-space: normal;
}

/* primary button — solid brand green, same as the app CTAs */
.auth-btn {
    width: 100%;
    margin-top: var(--space-2);
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    padding: .8rem 1.25rem;
    border: 1px solid var(--primary);
    border-radius: 10px;
    background: var(--primary);
    color: var(--primary-ink);
    font-family: var(--font);
    font-weight: 600; font-size: var(--text-base);
    cursor: pointer; position: relative; overflow: hidden;
    transition: background .15s, border-color .15s;
}
.auth-btn:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.auth-btn svg { width: 16px; height: 16px; }
.auth-btn.loading { pointer-events: none; }
.btn-text { transition: opacity .2s; }
.btn-loader {
    position: absolute; top: 50%; left: 50%;
    width: 18px; height: 18px; margin: -9px 0 0 -9px;
    border: 2px solid rgba(5, 33, 15, .35); border-top-color: var(--primary-ink);
    border-radius: 50%; opacity: 0;
    animation: auth-spin .8s linear infinite; transition: opacity .2s;
}
.auth-btn.loading .btn-text { opacity: 0; }
.auth-btn.loading .btn-loader { opacity: 1; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* ghost button (register wallet skip) */
.auth-btn-ghost {
    background: transparent;
    color: var(--ink-2);
    border: 1px solid var(--line);
    margin-top: .5rem;
}
.auth-btn-ghost:hover { background: var(--raised); border-color: var(--line-2); color: var(--ink); }

/* switch link */
.auth-switch { margin-top: var(--space-6); text-align: center; font-size: var(--text-sm); color: var(--ink-2); }
.auth-switch a { color: var(--primary); text-decoration: none; font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

/* error */
.error-message {
    display: flex; align-items: center; gap: var(--space-2);
    color: var(--danger); font-size: var(--text-sm); font-weight: 500;
    margin-bottom: var(--space-4);
    background: var(--danger-soft);
    padding: .7rem .85rem; border-radius: 10px;
    border: 1px solid var(--danger-line);
}
/* Aligned to the top now that the message can carry a reset link and a reference code
   beneath it; vertically centring against a two-line body reads as misaligned. */
.error-message { align-items: flex-start; }
.error-message svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

/* Route to the reset flow, shown only for an expired password — the one refusal the
   user can clear without involving support. */
.error-action {
    display: inline-block; margin-top: .4rem;
    color: var(--danger); font-weight: 600;
    text-decoration: underline;
}
.error-action:hover { color: var(--ink); }

/* The catalog code, so support can find the exact occurrence. Monospaced and selectable. */
.error-ref {
    margin-top: .35rem; font-size: var(--text-xs);
    color: var(--ink-3); font-weight: 400;
}
.error-ref code {
    font-family: var(--mono); color: var(--ink-2);
    user-select: all;
}

/* validation error list */
.error-list {
    list-style: none; padding: 0; margin: .75rem 0 0;
    color: var(--danger); font-size: var(--text-sm);
}
.error-list li {
    padding: .4rem .75rem;
    border-left: 3px solid var(--danger);
    background: rgba(255,0,0,0.05);
    margin-bottom: .35rem;
    border-radius: 0 6px 6px 0;
}
.error-list:empty { display: none; }

/* success (register) */
.success-message { text-align: center; padding: var(--space-2) 0; }
.success-icon {
    width: 56px; height: 56px; margin: 0 auto var(--space-4);
    border-radius: 50%;
    background: var(--primary-soft); border: 1px solid var(--primary-line);
    display: grid; place-items: center; color: var(--primary);
}
.success-icon svg { width: 26px; height: 26px; }
.success-message h3 {
    font-family: var(--display);
    font-weight: 600; font-size: 1.25rem; color: var(--ink); margin: 0 0 var(--space-2);
}
.success-message p { color: var(--ink-2); font-size: var(--text-sm); margin: 0 0 var(--space-6); line-height: 1.5; }

/* responsive */
@media (max-width: 900px) {
    .beta-grid { grid-template-columns: 1fr; gap: var(--space-6); max-width: 640px; }
    .beta-info { max-width: none; }
    .beta-side { justify-self: stretch; max-width: none; }
    .beta-info h1 { font-size: 2.4rem; }
}
@media (max-width: 460px) {
    .auth { padding: var(--space-5); }
    .auth-card { padding: var(--space-6); }
    .auth-logo { top: var(--space-5); left: var(--space-5); }
    .auth-head h1 { font-size: 1.4rem; }
    .beta-top { padding: var(--space-4) var(--space-5); }
    .beta-grid { padding: var(--space-4) var(--space-5) var(--space-6); }
    .beta-panel { padding: var(--space-6); }
    .beta-foot { flex-direction: column; gap: var(--space-3); text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
    .auth-card, .beta-panel, .beta-info > *, .beta-badge-row, .beta-sep, .beta-tag { animation: none; }
    .beta-bar > span, .beta-bar > span::after { animation: none; }
    .beta-dot, .beta-info h1 .beta-hl { animation: none; }
    .btn-loader { animation: none; }
    .auth-btn:hover, .beta-phase:hover, .beta-tag:hover { transform: none; }
}
