/* ================================================================
   FX WEALTH TRACKER — LIQUID ARCHITECTURE
   Intake & threshold stylesheet (forms, login, register).

   Same material world as the dashboard: pale mineral field,
   engraved lines, cavities that open, lens-like focus states.
   Forms are not boxes on a page — they are recesses cut into
   the surface where information is deposited.
   ================================================================ */

:root {
    --canvas:        #F3F5F7;
    --surface:       #E9EDF1;
    --surface-deep:  #DDE3E9;
    --ink:           #18202A;
    --ink-2:         #66717E;
    --ink-3:         #98A3B0;
    --line:          rgba(42, 56, 72, 0.14);
    --line-faint:    rgba(42, 56, 72, 0.07);
    --line-strong:   rgba(42, 56, 72, 0.26);
    --white-edge:    rgba(255, 255, 255, 0.85);

    --asset:         #6AAFFF;
    --currency:      #A68CF0;
    --interaction:   #65D9E7;
    --positive:      #48BFA3;
    --negative:      #E97974;
    --uncertainty:   #AAB4C3;

    --asset-ink:       #2160BE;
    --currency-ink:    #6847CC;
    --interaction-ink: #0C7E94;
    --positive-ink:    #14795F;
    --negative-ink:    #BC4740;

    --grotesk: 'Inter', 'SF Pro Text', -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--grotesk);
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
    background:
        radial-gradient(1300px 900px at 18% -10%, rgba(166, 140, 240, 0.07), transparent 60%),
        radial-gradient(1100px 760px at 88% 8%,  rgba(106, 175, 255, 0.09), transparent 58%),
        radial-gradient(1400px 900px at 55% 115%, rgba(101, 217, 231, 0.06), transparent 62%),
        var(--canvas);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

::selection { background: rgba(106, 175, 255, 0.28); color: var(--ink); }

:focus-visible {
    outline: 2px solid var(--asset-ink);
    outline-offset: 3px;
    border-radius: 3px;
}

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--canvas); }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #C6CFD8, #B2BDC8);
    border-radius: 8px;
    border: 2px solid var(--canvas);
}

#terrain {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ---------------------------------------------------------------
   Shared instruments
   --------------------------------------------------------------- */

.calib {
    margin: 0;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}

.calib::before {
    content: "";
    display: inline-block;
    width: 22px;
    height: 1px;
    margin-right: 10px;
    vertical-align: 4px;
    background: linear-gradient(90deg, var(--line-strong), transparent);
}

@keyframes settle {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   INTAKE — the add-position surface
   ================================================================ */

.page-container {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0 auto;
    padding: 90px 28px 120px;
}

.form-card {
    animation: settle 0.8s 0.05s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    padding-bottom: 30px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 0 var(--white-edge);
    flex-wrap: wrap;
}

.form-header h1,
.form-card h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 54px);
    font-weight: 260;
    letter-spacing: -0.035em;
    line-height: 1;
    color: var(--ink);
}

.form-header h1::before {
    content: "05 · INTAKE";
    display: block;
    margin-bottom: 16px;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.24em;
    color: var(--ink-2);
}

/* ----------------------------------------------------------------
   Section cavities — recesses cut into the surface
   ---------------------------------------------------------------- */

.section-box {
    position: relative;
    margin: 34px 0;
    padding: 30px 34px 26px;
    border-radius: 3px 3px 30px 3px;
    background: linear-gradient(180deg, rgba(221, 227, 233, 0.4), rgba(233, 237, 241, 0.18));
    box-shadow:
        inset 0 2px 7px rgba(42, 56, 72, 0.08),
        inset 0 -1px 0 rgba(255, 255, 255, 0.8),
        inset 1px 0 0 rgba(42, 56, 72, 0.05);
    transition: opacity 0.5s ease, box-shadow 0.5s ease, filter 0.5s ease;
}

.section-box h3 {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 22px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink);
}

.section-box h3::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
    box-shadow: 0 1px 0 var(--white-edge);
}

/* a disabled cavity recedes into the material */
.disabled-section {
    opacity: 0.4;
    filter: saturate(0.4);
    box-shadow:
        inset 0 1px 3px rgba(42, 56, 72, 0.05),
        inset 0 -1px 0 rgba(255, 255, 255, 0.6);
}

.disabled-section h3,
.disabled-section label,
.disabled-section small { color: var(--ink-3); }

.disabled-section input,
.disabled-section select,
.disabled-section textarea {
    color: var(--ink-3);
    cursor: not-allowed;
}

/* ----------------------------------------------------------------
   Fields — engraved, not boxed
   ---------------------------------------------------------------- */

.field-group { margin-bottom: 24px; }
.field-group:last-child { margin-bottom: 4px; }

.field-group label,
.auth-card label {
    display: block;
    margin-bottom: 7px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-2);
}

.field-group small {
    display: block;
    margin-top: 7px;
    color: var(--ink-2);
    font-size: 12px;
    line-height: 1.6;
}

.form-input,
input,
select,
textarea {
    width: 100%;
    padding: 10px 2px 11px;
    border: 0;
    border-bottom: 1px solid var(--line-strong);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font-family: var(--grotesk);
    font-size: 16px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' fill='none' stroke='%2318202A' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    padding-right: 30px;
    cursor: pointer;
}

select option { background: #fff; color: var(--ink); }

/* focus — the lens settles on the field */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-bottom-color: var(--asset-ink);
    box-shadow: 0 1px 0 var(--asset-ink), 0 10px 22px -14px rgba(33, 96, 190, 0.45);
}

input::placeholder,
textarea::placeholder { color: var(--ink-3); font-weight: 400; }

input[type="date"] { color-scheme: light; }

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--asset-ink);
    border: 0;
}

/* errors — coral channel */

.field-error {
    color: var(--negative-ink);
    font-size: 12.5px;
    font-weight: 550;
    margin-top: 5px;
}

.field-error ul,
.field-error .errorlist {
    margin: 0;
    padding: 0;
    list-style: none;
    background: none;
    border: none;
}

.form-errors,
.errorlist {
    margin: 0 0 24px;
    padding: 15px 18px 14px;
    border-radius: 3px 3px 16px 3px;
    list-style: none;
    background: linear-gradient(180deg, rgba(233, 121, 116, 0.09), rgba(233, 121, 116, 0.03));
    box-shadow:
        inset 0 2px 5px rgba(188, 71, 64, 0.1),
        inset 0 -1px 0 rgba(255, 255, 255, 0.7),
        inset 2px 0 0 var(--negative);
    color: var(--negative-ink);
    font-size: 13px;
    font-weight: 550;
    line-height: 1.6;
}

.form-errors ul { margin: 6px 0 0; padding-left: 18px; }

/* ----------------------------------------------------------------
   Actions
   ---------------------------------------------------------------- */

.btn-primary {
    display: block;
    width: 100%;
    margin-top: 34px;
    padding: 17px 24px;
    border: 0;
    border-radius: 2px 2px 20px 2px;
    background: var(--ink);
    color: #F3F5F7;
    font-family: var(--grotesk);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 22px 40px -20px rgba(24, 32, 42, 0.65);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease, background 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: #26313E;
    box-shadow: 0 30px 52px -22px rgba(24, 32, 42, 0.7);
}

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 10.5px;
    font-weight: 750;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    transition: gap 0.4s cubic-bezier(0.22, 1, 0.36, 1), color 0.3s ease;
}

.primary-button { color: var(--asset-ink); }
.primary-button:hover { gap: 15px; color: var(--ink); }

.primary-button::before,
.secondary-button::before {
    content: "";
    width: 13px;
    height: 13px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    box-shadow: 4px 4px 0 -2.5px currentColor;
}

.secondary-button { color: var(--ink-2); }
.secondary-button:hover { gap: 15px; color: var(--ink); }

/* auto-lookup toggle — a small instrument shelf */

.auto-lookup-toggle {
    padding: 16px 18px;
    border-radius: 2px 2px 14px 2px;
    background: rgba(106, 175, 255, 0.07);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        inset 2px 0 0 var(--asset),
        inset 0 0 0 1px rgba(33, 96, 190, 0.08);
}

.toggle-row {
    display: flex !important;
    align-items: flex-start;
    gap: 13px;
    cursor: pointer;
    margin: 0 !important;
}

.toggle-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 3px 0 0;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-text { display: block; }

.toggle-text strong {
    display: block;
    margin-bottom: 3px;
    font-size: 13.5px;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
}

.toggle-text small {
    display: block;
    color: var(--ink-2);
    font-size: 12px;
    line-height: 1.55;
}

/* ================================================================
   THRESHOLD — login & register
   ================================================================ */

.auth-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(380px, 47%) 1fr;
    min-height: 100vh;
}

/* the landscape side — copy floats on the material, no panel */
.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px clamp(30px, 4.5vw, 70px) 40px;
}

.auth-logo {
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ink);
    line-height: 1.5;
}

.auth-logo small {
    display: block;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.28em;
    color: var(--ink-3);
}

.auth-brand-copy { max-width: 480px; }

.auth-eyebrow {
    margin: 0 0 20px;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-2);
}

.auth-eyebrow::before {
    content: "";
    display: inline-block;
    width: 22px;
    height: 1px;
    margin-right: 10px;
    vertical-align: 4px;
    background: linear-gradient(90deg, var(--line-strong), transparent);
}

.auth-brand-copy h2 {
    margin: 0;
    font-size: clamp(34px, 3.8vw, 56px);
    font-weight: 240;
    letter-spacing: -0.035em;
    line-height: 1.04;
    color: var(--ink);
}

.auth-brand-copy h2 em,
.auth-brand-copy h2 i {
    font-style: normal;
    font-weight: 550;
}

.auth-brand-copy p {
    margin: 22px 0 0;
    max-width: 400px;
    color: var(--ink-2);
    font-size: 14px;
    line-height: 1.75;
}

.auth-footnote {
    margin: 0;
    font-size: 9.5px;
    font-weight: 650;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-3);
}

/* the form side — a tensioned membrane */
.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px clamp(24px, 4vw, 64px);
    background: linear-gradient(200deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.22) 55%, rgba(221, 227, 233, 0.3));
    -webkit-backdrop-filter: blur(16px) saturate(1.05);
    backdrop-filter: blur(16px) saturate(1.05);
    border-left: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        inset 1px 0 0 rgba(42, 56, 72, 0.06),
        -40px 0 80px -60px rgba(42, 56, 72, 0.35);
}

.auth-card {
    width: min(430px, 100%);
    animation: settle 0.8s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-card h1 {
    margin: 14px 0 8px;
    font-size: clamp(30px, 3.2vw, 42px);
    font-weight: 260;
    letter-spacing: -0.03em;
    line-height: 1.08;
    color: var(--ink);
}

.auth-subtitle {
    margin: 0 0 40px;
    color: var(--ink-2);
    font-size: 13.5px;
}

.auth-card form div { margin-bottom: 22px; }

/* Django password help text — quiet marginal notes */
.auth-card .helptext,
.auth-card form ul {
    display: block;
    margin: 7px 0 0;
    padding-left: 16px;
    color: var(--ink-3);
    font-size: 11.5px;
    line-height: 1.6;
}

.auth-switch {
    margin: 34px 0 0;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    box-shadow: 0 -1px 0 var(--white-edge) inset;
    color: var(--ink-2);
    font-size: 13px;
}

.auth-switch a {
    color: var(--asset-ink);
    font-weight: 650;
    border-bottom: 1px solid rgba(33, 96, 190, 0.3);
    padding-bottom: 1px;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.auth-switch a:hover { color: var(--ink); border-color: var(--ink); }

/* ================================================================
   THE VAULT DOOR — entry as part of the document
   ================================================================ */

/* quiet text submit — ink, underline on hover; no filled pill */
.vault-submit {
    display: inline-block;
    margin-top: 34px;
    padding: 8px 0 6px;
    background: none;
    border: 0;
    border-bottom: 1px solid transparent;
    font-family: var(--grotesk);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.3s ease, color 0.3s ease, letter-spacing 0.4s ease;
}

.vault-submit:hover {
    border-bottom-color: var(--ink);
    letter-spacing: 0.3em;
}

.vault-submit:disabled {
    color: var(--ink-3);
    border-bottom-color: transparent;
    cursor: default;
}

.vault-link {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--asset-ink);
    border: 0 !important;
    transition: color 0.3s ease;
}

.vault-link:hover { color: var(--ink); }

/* the cover splits along its centerline and folds outward in 3D */
.vault-door {
    position: fixed;
    z-index: 60;
    perspective: 1200px;
    pointer-events: none;
}

.vault-half {
    position: absolute;
    inset: 0;
    transition: transform 0.35s cubic-bezier(0.5, 0, 0.75, 0.4), opacity 0.35s ease-in;
    will-change: transform, opacity;
}

.vault-half--left  { clip-path: inset(0 50% 0 0); transform-origin: left center; }
.vault-half--right { clip-path: inset(0 0 0 50%); transform-origin: right center; }

.vault-door.open .vault-half--left  { transform: rotateY(-78deg); opacity: 0; }
.vault-door.open .vault-half--right { transform: rotateY(78deg);  opacity: 0; }

/* the room beyond the door — the landscape draws slightly nearer */
body.vault-opening .auth-shell,
body.vault-opening #terrain {
    transition: transform 0.5s ease, filter 0.5s ease;
    transform: scale(1.035);
    filter: brightness(1.04);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }

    .auth-brand {
        min-height: 0;
        padding: 34px 28px 38px;
        gap: 30px;
    }

    .auth-brand-copy h2 { font-size: 30px; }
    .auth-footnote { display: none; }

    .auth-panel {
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.9);
        box-shadow: inset 0 1px 0 rgba(42, 56, 72, 0.06);
        padding: 44px 24px 70px;
    }

    .page-container { padding-top: 60px; }
    .section-box { padding: 24px 22px 20px; }

    .form-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: more) {
    :root {
        --line:        rgba(42, 56, 72, 0.4);
        --line-faint:  rgba(42, 56, 72, 0.28);
        --line-strong: rgba(42, 56, 72, 0.6);
        --ink-2:       #3D4854;
        --ink-3:       #566270;
    }
}
