/* Sign in (design: pen.dev "Portal / Sign in v5.1" and "Portal mobile / Sign in v5.1").
   A red hero panel carrying an endless route, community totals, and the form on plain
   black. Below 900px the hero stacks above the form. */
.auth-page {
    --auth-red-soft: #f87171;
    --auth-text-2: #b8c1ce;
    --auth-warm: #d9c8c6;
    --auth-placeholder: #6b7788;

    min-height: 100vh;
    margin: 0;
    background: var(--wd-bg);
    color: var(--wd-text);
    font-family: var(--wd-font);
}
.auth-page *, .auth-page *::before, .auth-page *::after { box-sizing: border-box; }

.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 860fr) minmax(400px, 580fr);
    min-height: 100vh;
}

/* Hero panel */
.auth-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    padding: 56px 64px 64px;
    overflow: hidden;
    background: linear-gradient(45deg, #602022 0%, #1a0c0d 55%, var(--wd-bg) 100%);
}
.auth-hero > :not(.auth-route) { position: relative; }

.auth-route { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.auth-route path { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.auth-route__glow { stroke: var(--wd-red); stroke-width: 9; opacity: .4; }
.auth-route__line { stroke: var(--wd-red-hot); stroke-width: 2.5; }
.auth-route--narrow { display: none; }

.auth-brand { display: inline-flex; align-items: center; gap: 12px; align-self: flex-start; color: var(--wd-text); text-decoration: none; }
.auth-logo { display: block; width: 34px; height: 34px; border-radius: 8px; }
.auth-wordmark { font-size: 20px; font-weight: 900; letter-spacing: .125em; }
.auth-wordmark span { color: var(--wd-red); }

.auth-hero__copy { display: flex; flex-direction: column; gap: 20px; max-width: 640px; margin-top: clamp(1rem, 6vh, 3.5rem); }
.auth-eyebrow { color: var(--wd-red); font: 400 12px var(--wd-font-mono); letter-spacing: .2em; text-transform: uppercase; }
.auth-eyebrow--soft { color: var(--auth-red-soft); }
.auth-title { max-width: 5.4em; margin: 0; font-size: clamp(3rem, 5.8vw, 84px); font-weight: 900; line-height: 1; letter-spacing: -.015em; }
.auth-tagline { max-width: 520px; margin: 0; color: var(--auth-warm); font-size: 17px; line-height: 1.55; }
.auth-links { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 10px; }
.auth-link { display: inline-flex; gap: .45rem; color: var(--auth-text-2); font-size: 14px; font-weight: 500; text-decoration: none; }
.auth-link--primary { color: var(--auth-red-soft); font-weight: 600; }
.auth-link:hover { color: var(--wd-text); }
.auth-link:focus-visible, .auth-brand:focus-visible { outline: 0; border-radius: 4px; box-shadow: var(--wd-focus); }

/* Community totals: same pattern as the Discover totals */
.auth-stats { display: flex; margin: 0; }
.auth-stats > div { display: flex; flex-direction: column; padding: 4px 28px 4px 22px; border-left: 1px solid var(--wd-border-control); }
.auth-stats dt { order: 2; margin-top: 8px; color: var(--auth-text-2); font: 400 11px var(--wd-font-mono); letter-spacing: .1em; text-transform: uppercase; }
.auth-stats dd { display: flex; align-items: baseline; gap: 6px; margin: 0; font: 500 36px/1 var(--wd-font-mono); letter-spacing: -.02em; }
.auth-stats small { color: var(--wd-muted); font-size: 13px; letter-spacing: 0; }

/* Form column */
.auth-panel { display: flex; flex-direction: column; padding: 56px 80px 64px; }
.auth-panel__bar { display: flex; justify-content: flex-end; min-height: 34px; align-items: center; }
.auth-panel__body { display: flex; flex: 1; flex-direction: column; justify-content: center; width: 100%; max-width: 420px; margin: 0 auto; padding: 2rem 0; }

.auth-form-head { margin-bottom: 22px; }
.auth-form-head h2 { margin: 22px 0 0; font-size: 30px; font-weight: 800; line-height: 1.15; }
.auth-form-head p { margin: 22px 0 0; color: var(--wd-muted); font-size: 14px; line-height: 1.4; }

.auth-page .form-fields { display: flex; flex-direction: column; gap: 22px; margin-bottom: 22px; }
.auth-page .form-group label { display: block; margin-bottom: 6px; color: var(--auth-text-2); font-size: 13px; }
.auth-page .form-group input {
    width: 100%;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--wd-border-control);
    border-radius: var(--wd-radius-control);
    background: var(--wd-surface-raised);
    color: var(--wd-text);
    font: 400 14px var(--wd-font);
}
.auth-page .form-group input::placeholder { color: var(--auth-placeholder); }
.auth-page .form-group input:focus { outline: 0; border-color: var(--wd-red); box-shadow: var(--wd-focus); }

.auth-page .login-btn {
    width: 100%;
    min-height: 42px;
    padding: 0 20px;
    border: 1px solid var(--wd-red);
    border-radius: var(--wd-radius-pill);
    background: var(--wd-red);
    color: var(--wd-text);
    font: 600 14px var(--wd-font);
    cursor: pointer;
    transition: background-color .18s ease, box-shadow .18s ease;
}
.auth-page .login-btn:hover { background: #f05252; box-shadow: 0 8px 22px rgba(239, 68, 68, .2); }
.auth-page .login-btn:focus-visible { outline: 0; box-shadow: var(--wd-focus); }
.auth-page .login-btn:disabled { opacity: .6; cursor: default; box-shadow: none; }

.auth-page .form-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 22px; }
.auth-page .remember-me { display: inline-flex; align-items: center; gap: 8px; color: var(--wd-muted); font-size: 13px; cursor: pointer; }
.auth-page .remember-me input { width: 16px; height: 16px; margin: 0; accent-color: var(--wd-red); }
.auth-page .forgot-link { display: inline-flex; gap: .4rem; color: var(--auth-red-soft); font-size: 13px; font-weight: 500; text-decoration: none; }
.auth-page .forgot-link:hover { color: var(--wd-text); }
.auth-page .forgot-link:focus-visible { outline: 0; border-radius: 4px; box-shadow: var(--wd-focus); }

.auth-page .error-message,
.auth-page .success-message { display: none; margin-top: 18px; padding: 12px 14px; border: 1px solid; border-radius: var(--wd-radius-control); font-size: 13px; line-height: 1.45; }
.auth-page .error-message { border-color: rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .08); color: #fca5a5; }
.auth-page .success-message { border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .08); color: #6ee7b7; }
.auth-page .reset-panel .error-message,
.auth-page .reset-panel .success-message { margin: 0 0 18px; }
.auth-page .info-message { margin-bottom: 22px; padding: 12px 14px; border: 1px solid var(--wd-border-control); border-radius: var(--wd-radius-control); background: var(--wd-surface); color: var(--auth-text-2); font-size: 13px; line-height: 1.5; }
.auth-page .recovery-code { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--wd-border-control); }
.auth-page .recovery-code h3 { margin: 0 0 18px; font-size: 18px; font-weight: 800; }

.auth-page .loading { display: none; margin-top: 18px; color: var(--wd-muted); font-size: 13px; text-align: center; }
.auth-page .spinner { display: inline-block; width: 18px; height: 18px; margin-bottom: 6px; border: 2px solid var(--wd-border-control); border-top-color: var(--wd-red); border-radius: 50%; animation: auth-spin 1s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
    .auth-hero { padding: 48px 40px 56px; }
    .auth-panel { padding: 48px 40px 56px; }
}

@media (max-width: 900px) {
    .auth-layout { position: relative; grid-template-columns: 1fr; min-height: 0; }
    .auth-hero { gap: 0; min-height: 600px; padding: 22px 20px 150px; background: linear-gradient(30deg, #602022 0%, #1a0c0d 60%, var(--wd-bg) 100%); }
    .auth-route--wide { display: none; }
    .auth-route--narrow { display: block; }
    .auth-logo { width: 28px; height: 28px; border-radius: 7px; }
    .auth-wordmark { font-size: 16px; }
    .auth-hero__copy { gap: 14px; margin-top: 46px; }
    .auth-eyebrow { font-size: 11px; }
    .auth-title { font-size: clamp(2.4rem, 11.8vw, 4rem); }
    .auth-tagline { font-size: 15px; line-height: 1.5; }
    .auth-links { padding-top: 4px; }
    .auth-stats { margin-top: 28px; }
    .auth-stats > div { padding: 2px 16px 2px 14px; }
    .auth-stats dt { margin-top: 6px; font-size: 9.5px; letter-spacing: .08em; }
    .auth-stats dd { font-size: 24px; gap: 4px; }
    .auth-stats small { font-size: 11px; }

    /* The language control moves up into the hero, next to the brand */
    .auth-panel { padding: 28px 20px 40px; }
    .auth-panel__bar { position: absolute; top: 22px; right: 20px; min-height: 28px; }
    .auth-panel__body { max-width: 520px; padding: 0; }
    .auth-form-head h2 { margin-top: 18px; font-size: 24px; }
    .auth-form-head p { margin-top: 18px; }
    .auth-page .form-fields { gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-page *, .auth-page *::before, .auth-page *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
