/* ============================================================
   Maven Auth — design system
   Shared by login / signup / reset auth surfaces and the
   site-wide authentication modal.
   Tokens first; components below. No per-page hacks.
   ============================================================ */

:root {
    /* Brand — black canvas + gold. Deliberately constant: auth surfaces are
       the Maven ID brand home and never retint with site themes, so we
       always read as Maven gold rather than drifting toward other brands. */
    --maven-gold: #BF953F;
    --maven-gold-light: #FCF6BA;
    --maven-gold-deep: #B38728;
    --maven-blue: #4A90E2;

    /* Surfaces */
    --auth-bg: #060a13;
    --auth-surface: rgba(255, 255, 255, 0.03);
    --auth-surface-hover: rgba(255, 255, 255, 0.06);
    --auth-border: rgba(255, 255, 255, 0.09);
    --auth-border-strong: rgba(255, 255, 255, 0.16);

    /* Type */
    --auth-text: #eef1f7;
    --auth-muted: #8b93a7;
    --auth-faint: #5d6478;

    /* Shape */
    --auth-radius: 14px;
    --auth-radius-lg: 24px;

    /* Elevation */
    --auth-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.75);
}

/* ---------- Page shell ---------- */

.auth-page {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    min-height: calc(100vh - 14rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem 4rem;
    /* Canvas is painted by the body — no box, no edges */
    background: transparent;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 28rem;
    padding: 2.75rem 2.5rem 2.5rem;
    background: linear-gradient(180deg, rgba(17, 23, 38, 0.92), rgba(11, 16, 28, 0.88));
    border: 1px solid var(--auth-border);
    border-top-color: color-mix(in srgb, var(--maven-gold) 32%, transparent);
    border-radius: var(--auth-radius-lg);
    box-shadow: var(--auth-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(22px);
}

/* Soft gold aurora inside the top of the card */
.auth-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(420px 200px at 50% -8%, color-mix(in srgb, var(--maven-gold) 10%, transparent), transparent 70%);
}

/* ---------- Turnstile ---------- */

.cf-turnstile {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

/* ---------- Brand ---------- */

/* Light themes: auth-card buttons follow the brand ink color (#605158) */
[data-color-scheme="light"] .auth-btn-primary {
    background: linear-gradient(135deg, #7D6361 0%, #5F4A48 100%);
    color: #ffffff;
    box-shadow: 0 10px 26px -8px rgba(125, 99, 97, 0.5);
}

[data-color-scheme="light"] .auth-btn-primary:hover:not(:disabled) {
    background: #5F4A48;
    box-shadow: 0 14px 32px -8px rgba(125, 99, 97, 0.6);
}


/* Distressed ink mark on light themes, gold lockup on dark ones */
.brand-logo-light { display: none !important; }
.brand-logo-dark { display: block !important; }
[data-color-scheme="light"] .brand-logo-light { display: block !important; }
[data-color-scheme="light"] .brand-logo-dark { display: none !important; }


.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin-bottom: 1.6rem;
}

.auth-brand-lockup {
    display: block;
    width: min(215px, 64%);
    height: auto;
    margin: 0 auto;
    filter: drop-shadow(0 10px 26px color-mix(in srgb, var(--maven-gold) 20%, transparent));
}

/* Legacy mark + wordmark pair (kept for compatibility) */
.auth-brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.auth-brand-word {
    height: 30px;
    width: auto;
    object-fit: contain;
    display: block;
}

.auth-kicker {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--maven-gold);
    text-align: center;
    margin-bottom: 1rem;
    white-space: nowrap;
}

/* ---------- Typography ---------- */

.auth-title {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    text-align: center;
    color: var(--auth-text);
    margin: 0 0 0.5rem;
}

.auth-subtitle {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--auth-muted);
    text-align: center;
    margin: 0 0 1.75rem;
}

/* ---------- Form ---------- */

.auth-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--auth-muted);
    margin-bottom: 0.4rem;
}

.auth-hint {
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--auth-faint);
    margin-top: 0.4rem;
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-wrap > svg,
.auth-input-wrap > i {
    position: absolute;
    left: 0.95rem;
    width: 1rem;
    height: 1rem;
    color: var(--auth-faint);
    pointer-events: none;
}

.auth-input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.6rem;
    font-size: 0.9rem;
    color: var(--auth-text);
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-input::placeholder {
    color: var(--auth-faint);
}

.auth-input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--maven-gold) 65%, transparent);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--maven-gold) 16%, transparent);
}

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

/* Keep autofilled values readable on the dark surface */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-text);
    -webkit-box-shadow: 0 0 0 1000px #101828 inset;
    transition: background-color 9999s ease-in-out 0s;
}

.auth-input-action {
    position: absolute;
    right: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-faint);
    background: none;
    border: 0;
    padding: 0.25rem;
    cursor: pointer;
    transition: color 0.15s ease;
}

.auth-input-action:hover {
    color: var(--auth-text);
}

/* Native checkbox/radio tint follows the active theme */
.auth-remember input[type="checkbox"],
.auth-terms-checkbox {
    accent-color: var(--maven-gold);
}

/* ---------- Buttons ---------- */

.auth-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.95rem 1rem;
    border: 0;
    border-radius: var(--auth-radius);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #100c02;
    background: linear-gradient(135deg, var(--maven-gold) 0%, var(--maven-gold-light) 52%, var(--maven-gold-deep) 100%);
    box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--maven-gold) 45%, transparent);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.auth-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px -8px color-mix(in srgb, var(--maven-gold) 55%, transparent);
    filter: brightness(1.05);
}

.auth-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

/* ---------- Social providers ---------- */

.auth-social-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.auth-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.85rem 0.75rem;
    font-size: 0.86rem;
    font-weight: 500;
    color: #d7dce8;
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, color 0.16s ease;
}

.auth-social:hover {
    border-color: var(--auth-border-strong);
    background: var(--auth-surface-hover);
    color: #fff;
    transform: translateY(-1px);
}

.auth-social:focus-visible,
.auth-social--hero:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--maven-gold) 70%, transparent);
    outline-offset: 2px;
}

.auth-social--wide {
    grid-column: span 2;
}

/* Maven ID — hero sign-in option, full width above the grid */
.auth-social--hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    width: 100%;
    padding: 1rem 0.75rem;
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #eaf1ff;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.06));
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: var(--auth-radius);
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 28px -14px rgba(59, 130, 246, 0.55);
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

/* The real Maven lockup (wings + wordmark) on the hero button — small */
.auth-hero-mark {
    height: 20px;
    width: auto;
    flex-shrink: 0;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.auth-social--hero:hover {
    transform: translateY(-1px);
    border-color: rgba(59, 130, 246, 0.7);
    color: #fff;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.26), rgba(59, 130, 246, 0.09));
    box-shadow: 0 14px 32px -12px rgba(59, 130, 246, 0.6);
}

/* Apple — polished "coming soon" state */
.auth-social--soon {
    opacity: 0.62;
}

.auth-social--soon:hover {
    transform: none;
    background: var(--auth-surface);
    border-color: var(--auth-border);
    color: #d7dce8;
}

.auth-social-badge {
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--maven-gold);
    border: 1px solid color-mix(in srgb, var(--maven-gold) 45%, transparent);
    border-radius: 999px;
    padding: 0.14rem 0.5rem;
    margin-left: 0.15rem;
}

/* ---------- Divider ---------- */

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--auth-faint);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    height: 1px;
    flex-grow: 1;
    background: linear-gradient(90deg, transparent, var(--auth-border));
}

.auth-divider::after {
    background: linear-gradient(90deg, var(--auth-border), transparent);
}

/* ---------- Alerts ---------- */

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.45;
    margin-bottom: 1.25rem;
    text-align: left;
}

.auth-alert svg,
.auth-alert i {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.auth-alert--error {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.28);
}

.auth-alert--success {
    color: #86efac;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.28);
}

.auth-alert--warning {
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.28);
}

/* ---------- Modal ---------- */

.auth-modal-close {
    position: sticky;
    top: 0.75rem;
    align-self: flex-end;
    /* Cancel its own layout height so the card content stays put */
    margin-bottom: -2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    color: var(--auth-faint);
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    z-index: 2;
    transition: color 0.15s ease, background 0.15s ease;
}

.auth-modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.auth-modal-close svg,
.auth-modal-close i {
    width: 1.15rem;
    height: 1.15rem;
}

/* ---------- Toast ---------- */

.auth-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    z-index: 9999;
    background: rgba(17, 26, 46, 0.95);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #93c5fd;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s;
    opacity: 0;
    pointer-events: none;
    max-width: min(92vw, 480px);
    text-align: center;
}

/* ---------- Footer links ---------- */

.auth-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.1rem;
    font-size: 0.78rem;
}

.auth-link {
    color: var(--maven-gold);
    font-weight: 700;
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: #c6ccd8;
    cursor: pointer;
    user-select: none;
}

/* Toggle-account row (modal) / footers */
.auth-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.6rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--auth-border);
    font-size: 0.82rem;
    color: var(--auth-muted);
    text-align: center;
}

.auth-foot a,
.auth-foot button {
    color: var(--maven-gold);
    font-weight: 700;
    text-decoration: none;
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.auth-foot a:hover,
.auth-foot button:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- Auth pages inside the app shell ---------- */

/* The app shell paints html/body with theme colors. Auth pages get ONE
   seamless black canvas: the ambient glow lives on the body (full page,
   no edges), the auth surface itself is transparent, and html is pinned
   so overscroll never flashes the theme color. */
html:has(.auth-page) {
    background: var(--auth-bg) !important;
}

body:has(.auth-page) {
    background:
        radial-gradient(1100px 560px at 82% -12%, color-mix(in srgb, var(--maven-gold) 13%, transparent), transparent 62%),
        radial-gradient(900px 480px at 8% 112%, rgba(74, 144, 226, 0.10), transparent 58%),
        radial-gradient(700px 380px at 50% 46%, color-mix(in srgb, var(--maven-gold) 4%, transparent), transparent 70%),
        var(--auth-bg) !important;
}

/* ---------- Modal viewport fit ---------- */

.auth-overlay {
    padding: 1rem;
}

.auth-overlay .auth-card {
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.auth-overlay .auth-card::-webkit-scrollbar {
    width: 6px;
}

.auth-overlay .auth-card::-webkit-scrollbar-track {
    background: transparent;
}

.auth-overlay .auth-card::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
    .auth-card {
        padding: 2rem 1.5rem;
    }
    .auth-social-grid {
        grid-template-columns: 1fr;
    }
    .auth-social--wide,
    .auth-social--hero {
        grid-column: auto;
    }
}

/* Short screens (laptops) — keep the whole card within reach */
@media (max-height: 820px) {
    .auth-page {
        padding: 1.75rem 1rem 2.5rem;
    }
    .auth-card {
        padding: 2.25rem 2.25rem 2rem;
    }
    .auth-brand {
        margin-bottom: 1.2rem;
    }
    .auth-brand-lockup {
        width: min(190px, 58%);
    }
    .auth-kicker {
        margin-bottom: 0.8rem;
    }
    .auth-subtitle {
        margin-bottom: 1.4rem;
    }
    .auth-divider {
        margin: 1.15rem 0;
    }
    .auth-social--hero {
        padding: 0.85rem 0.75rem;
    }
    .auth-social {
        padding: 0.68rem 0.75rem;
    }
    .auth-foot {
        margin-top: 1.2rem;
        padding-top: 1rem;
    }
    .auth-links {
        margin-top: 0.9rem;
    }
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
    .auth-btn-primary,
    .auth-social,
    .auth-social--hero {
        transition: none;
    }
    .auth-social:hover,
    .auth-social--hero:hover,
    .auth-btn-primary:hover:not(:disabled) {
        transform: none;
    }
}
