/**
 * login.css
 *
 * Public log-in + sign-up page (URL: /login). Owns the BEM block
 * `login-page__*`. Theme tokens, the universal reset, the body baseline,
 * and the button system are pulled in from `shared/browser/`. This file
 * only adds the auth card layout, tab pills, form-field styles, and the
 * page-specific radial gradient backdrop.
 */

/* The login page replaces the flat canvas backdrop with a soft brand
   gradient so the auth card has a hero feeling. design_tokens.css sets the
   default body background to var(--canvas); we override it here. */
body {
    background:
        radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--iris) 16%, transparent) 0%, transparent 60%),
        radial-gradient(circle at 80% 100%, color-mix(in srgb, var(--violet) 14%, transparent) 0%, transparent 55%),
        var(--canvas);
}

/* ---------- Layout ---------- */
.login-page__main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    gap: 24px;
}

.login-page__top-bar {
    width: 100%;
    max-width: 440px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.login-page__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.14s ease, color 0.14s ease;
}
.login-page__brand:hover,
.login-page__brand:focus-visible {
    color: var(--iris);
    transform: scale(1.04);
}

.login-page__brand-logo {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}
.login-page__brand-logo-img {
    width: 28px;
    height: 28px;
    display: block;
    object-fit: contain;
}

.login-page__brand-name {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.01em;
}

/* ---------- Card ---------- */
.login-page__card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: 24px;
    box-shadow: var(--shadow-pop);
    padding: 24px 24px 20px;
}

.login-page__tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: var(--surface-2);
    border-radius: 999px;
    margin-bottom: 20px;
}

.login-page__tabs[hidden] {
    display: none;
}

.login-page__tab {
    appearance: none;
    border: 0;
    background: transparent;
    font: inherit;
    font-family: 'Inter Tight', 'Inter', sans-serif;
    font-weight: 600;
    color: var(--text-2);
    height: 36px;
    padding: 0 16px;
    border-radius: 999px;
    cursor: pointer;
    /* Explicitly center the label so the active pill's text sits dead-center
       in the 36px height. Without this, the button falls back to default
       inline-baseline rendering and the "dark thing" looked offset
       vertically in some browsers. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.login-page__tab:hover {
    color: var(--text);
}
.login-page__tab--active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-soft);
}

/* ---------- Form ----------
   Use :not([hidden]) so the HTML `hidden` attribute on the inactive tab
   actually hides the form. A bare `display: flex` would override the
   user-agent `[hidden] { display: none }` rule and both forms (and both
   Turnstile widgets) would render at once. */
.login-page__form:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-page__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-page__name-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.login-page__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.login-page__input {
    appearance: none;
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--hairline-2);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.login-page__input:hover {
    border-color: color-mix(in srgb, var(--iris) 40%, var(--hairline-2));
}
.login-page__input:focus {
    outline: none;
    border-color: var(--iris);
    box-shadow: 0 0 0 3px var(--iris-tint);
    background: var(--surface);
}
/* Show the invalid border only after the user has interacted with the input. */
.login-page__input:user-invalid {
    border-color: color-mix(in srgb, var(--red) 50%, var(--hairline-2));
}

@media (max-width: 520px) {
    .login-page__name-grid {
        grid-template-columns: 1fr;
    }
}

.login-page__hint {
    font-size: 12px;
    color: var(--text-3);
}

.login-page__text-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--iris);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    min-height: 32px;
    padding: 0;
    text-align: center;
    cursor: pointer;
}
.login-page__text-button:hover {
    color: var(--violet);
    text-decoration: underline;
}
.login-page__text-button:focus-visible {
    outline: 3px solid var(--iris-tint);
    outline-offset: 3px;
    border-radius: 8px;
}

/* ---------- Turnstile slot ---------- */
.login-page__turnstile-slot {
    min-height: 65px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ---------- Error message ---------- */
.login-page__error {
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--red-tint);
    border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
    color: var(--red);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}
.login-page__error--success {
    background: color-mix(in srgb, var(--green) 14%, transparent);
    border-color: color-mix(in srgb, var(--green) 30%, transparent);
    color: var(--green);
}

.login-page__message {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
}
.login-page__message--info {
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    color: var(--text-2);
}
.login-page__message--success {
    background: color-mix(in srgb, var(--green) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
    color: var(--green);
}
.login-page__message--warning {
    background: color-mix(in srgb, var(--amber) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
    color: var(--amber);
}
.login-page__message--error {
    background: var(--red-tint);
    border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
    color: var(--red);
}

/* ---------- Legal small print ---------- */
.login-page__legal {
    color: var(--text-3);
    font-size: 12px;
    text-align: center;
    margin: 0;
    max-width: 440px;
}
.login-page__legal a {
    color: var(--text-2);
    text-decoration: underline;
}
.login-page__legal a:hover {
    color: var(--text);
}
