/* ==========================================================================
   auth.css — shared chrome for the standalone auth / funnel pages
   (login, request-access, forgot/reset password, accept-terms, security,
    join, change-password, logout).

   Linked AFTER global.css by each of those pages. This replaces the ~150-line
   <style> block every one of them used to duplicate (same reset, body,
   geometric background, top-nav, card, form, buttons, footer). One source of
   truth -> the pages render provably identically, and the navy surfaces are
   centralized here so a future light theme can override them in one place.

   Selectors mirror the classes the pages already use (card container comes in
   three flavours: .login-container / .form-container / .card / .logout-container;
   header as .login-header / .form-header / .card-header) so this is a drop-in
   replacement — no markup renames required. Reuses global.css tokens; gold
   accents stay literal (theme-independent), navy surfaces use tokens.
   ========================================================================== */

:root {
    /* Page-scoped overrides these pages set on top of global.css canonical tokens.
       ⚠ ANTI-PATTERN (do not copy): re-declaring a global token (--border-color)
       in an unscoped :root here beats global.css's :root[data-theme=light] block
       by load order — this exact mechanism caused the "Settings stay dark in
       light mode" bug (2026-06-28), patched by the re-assert block below. The
       durable fix (rename to --auth-* and update usages) is tracked in the UI
       polish plan Phase 7; until then, any NEW token here must be --auth-*-named. */
    --blueprint-card-bg: linear-gradient(135deg, rgba(20, 38, 66, 0.72) 0%, rgba(12, 24, 44, 0.85) 100%);
    --accent-hover: #d8bd66;                     /* lighter gold hover (on-brand) */
    --border-color: rgba(201, 168, 76, 0.15);    /* gold-tinted border for the funnel */
}

/* LIGHT-THEME overrides for the auth/settings pages. These tokens are page-scoped
   above (auth.css loads AFTER global.css), so global.css's :root[data-theme=light]
   block can't reach them — this is the root cause of Settings staying dark in
   light mode (multi-agent audit 2026-06-28). Re-assert the surface tokens light. */
:root[data-theme="light"] {
    --blueprint-card-bg: #ffffff;                /* white card (was dark navy gradient) */
    --accent-hover: #946f24;                      /* light-mode gold hover */
    --border-color: #e4e7eb;                      /* neutral light border (was gold-tinted) */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans, 'Calibri', 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif);
    line-height: 1.6;
    color: var(--primary-text);
    background: var(--bg-primary);
    min-height: 100vh;
    position: relative;
}

/* Geometric gold background — matches the homepage atmosphere */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.18;
    background:
        linear-gradient(135deg, rgba(201, 168, 76, 0.4) 0%, transparent 50%),
        linear-gradient(225deg, rgba(160, 126, 46, 0.3) 0%, transparent 50%),
        linear-gradient(-45deg, rgba(201, 168, 76, 0.3) 0%, transparent 40%);
    background-size: 100% 100%;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.14;
    background-image:
        linear-gradient(30deg, transparent 40%, rgba(201, 168, 76, 0.15) 40%, rgba(201, 168, 76, 0.15) 60%, transparent 60%),
        linear-gradient(150deg, transparent 40%, rgba(160, 126, 46, 0.12) 40%, rgba(160, 126, 46, 0.12) 60%, transparent 60%),
        linear-gradient(-30deg, transparent 45%, rgba(201, 168, 76, 0.1) 45%, rgba(201, 168, 76, 0.1) 55%, transparent 55%);
    background-size: 400px 400px, 350px 350px, 300px 300px;
    background-position: 0 0, 100px 100px, 200px 50px;
    pointer-events: none;
}

/* ====== Top navigation (matches index.html) ====== */
#reuw-top-nav {
    position: sticky;
    top: 0;
    z-index: var(--z-app-header, 1100);
    background: linear-gradient(135deg, rgba(10, 22, 40, 0.95) 0%, rgba(15, 32, 56, 0.98) 100%);
    border-bottom: 1px solid rgba(201, 168, 76, 0.15);
    padding: 0.875rem 0;
    box-shadow: 0 1px 3px rgba(201, 168, 76, 0.1), 0 4px 12px rgba(0, 0, 0, 0.3);
    overflow: visible;
    backdrop-filter: blur(10px);
}

.accent-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(201, 168, 76, 0.3) 20%, rgba(201, 168, 76, 0.6) 50%, rgba(201, 168, 76, 0.3) 80%, transparent 100%);
    pointer-events: none;
}

.nav-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 3rem;
    padding-right: 3rem;
    position: relative;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.15s ease;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    position: relative;
    z-index: 5;
}
.logo:hover { background: rgba(201, 168, 76, 0.1); }
/* Brand frieze in the settings nav — 28px matches the wordmark height the
   frieze replaced (2026-07-13), so the header height doesn't jump. Legacy
   pages (terms/privacy/contact) size their logo img inline and are unaffected. */
.logo img { height: 28px; width: auto; display: block; }

/* ====== Layout ====== */
.main {
    padding: 4rem 0;
    position: relative;
    z-index: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ====== Card (covers every page's container class) ====== */
.login-container,
.form-container,
.card,
.logout-container {
    max-width: 500px;
    margin: 0 auto;
    background: var(--blueprint-card-bg);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

/* ====== Card header ====== */
.login-header,
.form-header,
.card-header {
    text-align: center;
    margin-bottom: 2rem;
}
.login-header h1, .login-header h2,
.form-header h1, .form-header h2,
.card-header h1, .card-header h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}
.login-header p,
.form-header p,
.card-header p {
    color: var(--secondary-text);
    font-size: 0.95rem;
}

/* ====== Form ====== */
.form-group { margin-bottom: 1.5rem; }
.form-group label {
    display: block;
    font-weight: 500;
    color: var(--primary-text);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: var(--font-sans, 'Calibri', sans-serif);
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary-text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: rgba(155, 165, 180, 0.5); }
.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--secondary-text);
    font-size: 0.85rem;
}

/* ====== Button ====== */
.btn {
    padding: 0.875rem 2rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    width: 100%;
    font-family: var(--font-sans, 'Calibri', sans-serif);
    letter-spacing: 0.02em;
}
.btn-primary {
    background: var(--accent-color);
    color: #ffffff;
    border: 1px solid var(--accent-color);
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(201, 168, 76, 0.3);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ====== Alerts ====== */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.95rem;
}
.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.alert-info {
    background: rgba(201, 168, 76, 0.15);
    color: var(--accent-color);
    border: 1px solid rgba(201, 168, 76, 0.3);
}

/* ====== Footer links ====== */
.form-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}
.form-footer p {
    color: var(--secondary-text);
    font-size: 0.9rem;
}
.form-footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}
.form-footer a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ====== Info / demo badge ====== */
.demo-info {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.demo-info strong { color: #fbbf24; }
.demo-info code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}
.demo-info a {
    color: var(--accent-color);
    text-decoration: underline;
    font-weight: 600;
}

/* ====== Inline auth CTA (e.g. "Have a beta code? Register" on /login) ======
   Purpose-built so the register CTA no longer borrows the amber .demo-info
   "demo badge" styling. Clean navy-tinted box, gold link. */
.auth-cta {
    text-align: center;
    font-size: 0.9rem;
    color: var(--secondary-text);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.7rem 1rem;
    margin-bottom: 1.5rem;
}
.auth-cta a {
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: none;
}
.auth-cta a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ====== Responsive ====== */
@media (max-width: 768px) {
    .nav-container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    .login-container,
    .form-container,
    .card,
    .logout-container {
        padding: 2rem 1.5rem;
    }
    .login-header h1, .login-header h2,
    .form-header h1, .form-header h2,
    .card-header h1, .card-header h2 {
        font-size: 1.5rem;
    }
}
