/* ========================================
   LOGIN PAGE - split layout: cut-paper illustration + auth form
   Relies on base.css, forms.css for tokens and inputs
   ======================================== */

body {
    overflow: auto; /* login page scrolls, unlike main app */
}

.auth {
    display: grid;
    grid-template-columns: 1fr 560px;
    min-height: 100vh;
}

/* login.js toggles views with the hidden attribute; the display:flex rules
   below (tabs, footer) would otherwise beat the browser's [hidden] style. */
.auth [hidden] {
    display: none;
}

/* ========== ILLUSTRATION ========== */

.auth-art {
    position: relative;
    overflow: hidden;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
}

.auth-art svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.auth-logo {
    position: absolute;
    top: 44px;
    left: 56px;
    z-index: 3;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
}

/* Soft drop shadow so each hill reads as a separate piece of cut paper. */
.auth-art .cut {
    filter: drop-shadow(0 6px 8px var(--paper-drop));
}

/* One-time entrance: layers settle in order (--i sets the stagger). */
.auth-art .in-up {
    opacity: 0;
    animation: auth-up 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(var(--i, 0) * 110ms + 100ms);
}

.auth-art .in-pop {
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    animation: auth-pop 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(var(--i, 0) * 120ms + 100ms);
}

.auth-art .spin {
    transform-box: fill-box;
    transform-origin: center;
    animation: auth-spin 90s linear infinite;
}

.auth-art .spin-r {
    animation-direction: reverse;
    animation-duration: 140s;
}

.auth-art .drift {
    animation: auth-drift 9s ease-in-out infinite;
}

@keyframes auth-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes auth-pop {
    from {
        opacity: 0;
        transform: scale(0.6);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

@keyframes auth-drift {
    50% { transform: translateX(18px) translateY(-6px); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-art .in-up,
    .auth-art .in-pop {
        animation: none;
        opacity: 1;
    }

    .auth-art .spin,
    .auth-art .drift { animation: none; }
}

/* ========== FORM PANEL ========== */

.auth-panel {
    background: var(--bg-secondary);
    padding: 56px 72px;
    display: flex;
    flex-direction: column;
}

.auth-form {
    margin: auto 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-tabs {
    display: flex;
    gap: 26px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.auth-tabs button {
    all: unset;
    cursor: pointer;
    padding: 10px 0;
    font-size: 15px;
    color: var(--text-tertiary);
    transition: color 0.2s ease;
}

.auth-tabs button:hover { color: var(--text-primary); }

.auth-tabs button[aria-selected="true"] {
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: inset 0 -2px var(--accent-primary);
}

.auth-tabs button:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.auth-title {
    font-family: var(--font-serif-body);
    font-style: italic;
    font-weight: 400;
    font-size: 34px;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--text-primary);
}

.auth-text {
    margin: 0;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

.auth-text b { color: var(--text-primary); }

.auth-form .form-input:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 20%, transparent);
}

/* Shared .form-hint sits above its input (negative top margin); here it sits below. */
.auth-form .form-hint {
    margin-top: 6px;
    margin-bottom: 0;
}

/* ========== BUTTONS ========== */

.auth-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.12s ease, transform 0.12s ease;
    background: var(--accent-primary);
    color: var(--text-on-accent);
    border: none;
}

.auth-btn:hover { filter: brightness(1.08); }

.auth-btn:active { transform: scale(0.98); }

.auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auth-form form .auth-btn {
    margin-top: 4px;
}

/* Password label with "Forgot password?" on the right. */
.auth-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.auth-label-row a {
    font-size: 13px;
    color: var(--accent-primary);
    text-decoration: none;
}


/* ========== CODE STEP ========== */

.auth-form .auth-code {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 26px;
    letter-spacing: 0.5em;
    text-align: center;
    padding: 14px;
}

.auth-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.auth-foot a {
    color: var(--accent-primary);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--accent-primary) 35%, transparent);
}

/* Kept after .auth-foot a: stylelint orders selectors by specificity. */
.auth-label-row a:hover { text-decoration: underline; }

.auth-foot a.is-waiting {
    color: var(--text-tertiary);
    border-bottom-color: transparent;
    pointer-events: none;
}

/* Spinner inside the submit button while the captcha is still solving. */
.auth-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: -2px;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--text-on-accent) 40%, transparent);
    border-top-color: var(--text-on-accent);
    animation: auth-spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .auth-spinner { animation: none; }
}

/* ========== MESSAGES ========== */

.auth-error {
    padding: 12px 14px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent-danger) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-danger) 40%, transparent);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}
