/* Sign-in and registration: one card over a rising balance line. Tokens come from theme.css. */

html {
    height: 100%;
}

body {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow-x: clip;
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--line-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--line-soft) 1px, transparent 1px),
        linear-gradient(color-mix(in srgb, var(--line-soft) 45%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--line-soft) 45%, transparent) 1px, transparent 1px);
    background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
    background-position: center;
}

/* Edges fall away so the card and the line carry the page. */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(120% 90% at 50% 45%, transparent 35%, color-mix(in srgb, var(--bg) 85%, transparent) 100%);
    pointer-events: none;
}

/* Rising balance line */
.auth-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.auth-chart {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.auth-chart-tall {
    display: none;
}

.auth-chart-area {
    animation: auth-fade 1.2s ease-out 0.5s both;
}

.auth-chart-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 65%, transparent));
    animation: auth-draw 1.6s cubic-bezier(0.65, 0, 0.35, 1) both;
}

.auth-chart-points circle {
    fill: var(--bg);
    stroke: var(--accent);
    stroke-width: 4;
    animation: auth-fade 0.4s ease-out 1.3s both;
}

.auth-chart-points circle.is-live {
    fill: var(--accent);
    filter: drop-shadow(0 0 12px var(--accent));
    animation: auth-fade 0.4s ease-out 1.5s both, auth-live 2.4s ease-in-out 2s infinite;
}

@keyframes auth-draw {
    from { stroke-dashoffset: 1; }
    to { stroke-dashoffset: 0; }
}

@keyframes auth-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes auth-live {
    50% { opacity: 0.45; }
}

/* Card */
main {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    width: min(400px, 100%);
    padding: 30px 30px 24px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(var(--accent), var(--accent)) top left / 100% 2px no-repeat,
        color-mix(in srgb, var(--surface) 86%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
    box-shadow: 0 30px 80px -30px color-mix(in srgb, var(--shadow) 85%, transparent);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
}

.auth-brand img {
    display: block;
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
}

.auth-brand h1 {
    min-width: 0;
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.005em;
    overflow-wrap: anywhere;
}

.auth-lead {
    margin-top: 6px;
    color: var(--ink-3);
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

form label {
    margin-top: 12px;
    color: var(--ink-3);
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

form label:first-child {
    margin-top: 0;
}

form input {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-input);
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

form input:hover {
    border-color: var(--line-strong);
}

form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}

form input:-webkit-autofill {
    box-shadow: 0 0 0 1000px var(--surface-input) inset;
    -webkit-text-fill-color: var(--ink);
}

form input[type="submit"] {
    margin-top: 20px;
    border-color: transparent;
    background: var(--accent);
    color: var(--on-accent);
    cursor: pointer;
    font-weight: 650;
}

form input[type="submit"]:hover {
    background: var(--accent-strong);
}

form input[type="submit"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.auth-switch {
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
    color: var(--ink-3);
    font-size: 14px;
}

.auth-switch a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--accent-text);
    font-weight: 650;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.error {
    margin-bottom: 16px;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--neg);
    border-radius: var(--radius-sm);
    background: var(--surface-input);
    color: var(--neg-text);
    font-size: 14px;
    font-weight: 500;
}

@media (max-width: 700px), (orientation: portrait) {
    .auth-chart-wide {
        display: none;
    }

    .auth-chart-tall {
        display: block;
    }
}

@media (max-width: 700px) {
    main {
        padding: 26px 22px 18px;
    }

    .auth-brand h1 {
        font-size: 32px;
    }

    .auth-brand img {
        width: 48px;
        height: 48px;
    }

    form input {
        min-height: 48px;
        font-size: 16px;
    }
}

@media (max-height: 650px) {
    body {
        align-items: flex-start;
    }
}
