*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ── */
:root {
    --brand-bg:          #0d0e13;
    --brand-fg:          #f0ece4;
    --brand-accent:      #b8945e;
    --brand-grid:        rgba(184,148,94,0.07);
    --brand-seal-border: rgba(184,148,94,0.28);
    --brand-circle-in:   rgba(184,148,94,0.06);
    --brand-list-fg:     rgba(240,236,228,0.52);

    --form-bg:           #f4efe6;
    --form-fg:           #1a1810;
    --form-secondary:    #6a6255;
    --form-border:       #cdc5b0;
    --form-border-focus: #9a7542;
    --form-placeholder:  #b8ae9c;
    --form-link:         #9a7542;
    --form-eyebrow:      #9a7542;
    --btn-bg:            #7a5e30;
    --btn-bg-hover:      #9a7542;
    --btn-fg:            #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --form-bg:           #0d0e13;
        --form-fg:           #f0ece4;
        --form-secondary:    #8a8272;
        --form-border:       #262838;
        --form-border-focus: #b8945e;
        --form-placeholder:  #3e3c34;
        --form-link:         #b8945e;
        --form-eyebrow:      #b8945e;
        --btn-bg:            #b8945e;
        --btn-bg-hover:      #c9a672;
        --btn-fg:            #0d0e13;
    }
}
:root[data-theme="dark"] {
    --form-bg:           #0d0e13;
    --form-fg:           #f0ece4;
    --form-secondary:    #8a8272;
    --form-border:       #262838;
    --form-border-focus: #b8945e;
    --form-placeholder:  #3e3c34;
    --form-link:         #b8945e;
    --form-eyebrow:      #b8945e;
    --btn-bg:            #b8945e;
    --btn-bg-hover:      #c9a672;
    --btn-fg:            #0d0e13;
}

html, body { height: 100%; }
body {
    background: var(--form-bg);
    color: var(--form-fg);
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    font-weight: 400;
    line-height: 1.5;
    min-height: 100vh;
}

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

/* ── Brand panel ── */
.brand {
    position: relative;
    flex: 0 0 42%;
    background: var(--brand-bg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#brand-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.brand-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 3rem;
    color: var(--brand-fg);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.seal {
    width: 96px; height: 96px;
    border-radius: 50%;
    border: 1px solid var(--brand-seal-border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    position: relative;
    flex-shrink: 0;
}

.seal::before {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 1px solid var(--brand-circle-in);
}

.seal-icon { font-size: 2.6rem; color: var(--brand-accent); line-height: 1; display: block; }
.brand-name {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--brand-fg);
    line-height: 1;
    margin-bottom: 0.5rem;
}
.brand-tagline {
    font-size: 0.7rem; font-weight: 400;
    letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--brand-accent); margin-bottom: 2.75rem;
}
.brand-list { list-style: none; display: flex; flex-direction: column; gap: 1rem; width: 100%; }
.brand-list li {
    font-size: 0.82rem; font-weight: 300;
    color: var(--brand-list-fg);
    display: flex; align-items: center; gap: 0.8rem; text-align: left;
}
.brand-list li::before {
    content: '';
    display: block; flex-shrink: 0;
    width: 18px; height: 1px;
    background: var(--brand-accent); opacity: 0.5;
}

/* ── Form panel ── */
.form-panel {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    overflow: hidden;
}

.lang-switcher {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    letter-spacing: .05em;
}
.lang-switcher-sep { color: var(--form-secondary); }
.lang-switcher-option { color: var(--form-secondary); text-decoration: none; transition: color .15s; }
.lang-switcher-option:hover { color: var(--form-fg); }
.lang-switcher-option.active { color: var(--form-eyebrow); font-weight: 600; }

/* ── View transitions ── */
.view { display: none; width: 100%; max-width: 368px; }
.view.is-visible { display: block; }

.view.is-entering {
    animation: viewEnter 0.38s cubic-bezier(.22,.68,0,1.05) both;
}
.view.is-leaving {
    animation: viewLeave 0.22s ease-in both;
}

@keyframes viewEnter {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}
@keyframes viewLeave {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
    .view.is-entering, .view.is-leaving { animation: none; }
}

/* ── Back button ── */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--form-secondary);
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    margin-bottom: 2.25rem;
    transition: color 0.15s;
    line-height: 1;
}
.btn-back:hover { color: var(--form-link); }
.btn-back svg { flex-shrink: 0; }

/* Mobile logo (hidden on desktop) */
.mobile-logo {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2.25rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--form-fg);
}
.mobile-logo span { color: var(--form-eyebrow); }

/* Eyebrow */
.eyebrow {
    font-size: 0.7rem; font-weight: 500;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--form-eyebrow); margin-bottom: 0.55rem;
}

/* Heading */
.heading {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.8rem; font-weight: 600;
    line-height: 1.04; color: var(--form-fg);
    text-wrap: balance; margin-bottom: 2.5rem;
}

/* Smaller heading for register (more fields) */
.heading-sm {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.2rem; font-weight: 600;
    line-height: 1.04; color: var(--form-fg);
    text-wrap: balance; margin-bottom: 1.75rem;
}

/* Field grid */
.fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.25rem;
}

/* Fields */
.field { margin-bottom: 1.75rem; position: relative; }
.field.full { grid-column: 1 / -1; }

.field label {
    display: block;
    font-size: 0.68rem; font-weight: 500;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--form-secondary);
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}
.field:focus-within label { color: var(--form-border-focus); }

.field input,
.field select {
    display: block; width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1.5px solid var(--form-border);
    border-radius: 0;
    padding: 0.5rem 0;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 1rem; font-weight: 300;
    color: var(--form-fg);
    outline: none;
    transition: border-color 0.2s;
    caret-color: var(--form-border-focus);
    -webkit-appearance: none; appearance: none;
}

.field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236a6255' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    padding-right: 1.25rem;
    cursor: pointer;
}

.field input::placeholder { color: var(--form-placeholder); }
.field input:focus,
.field select:focus { border-bottom-color: var(--form-border-focus); }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 2.25rem; }

/* Password toggle */
.toggle-pwd {
    position: absolute; right: 0; top: 50%;
    transform: translateY(-50%);
    background: none; border: none; padding: 0.2rem;
    cursor: pointer; color: var(--form-secondary);
    display: flex; align-items: center; line-height: 1;
    transition: color 0.15s;
}
.toggle-pwd:hover { color: var(--form-fg); }
.toggle-pwd:focus-visible {
    outline: 2px solid var(--form-border-focus);
    outline-offset: 2px; border-radius: 2px;
}

/* Forgot link */
.form-foot {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2.25rem;
    margin-top: -0.75rem;
}

.forgot {
    font-size: 0.78rem; font-weight: 400;
    color: var(--form-link); background: none; border: none;
    padding: 0; cursor: pointer;
    transition: opacity 0.15s;
    font-family: 'DM Sans', system-ui, sans-serif;
}
.forgot:hover { opacity: 0.72; }

/* Submit button */
.btn-submit {
    display: flex; align-items: center;
    justify-content: center; gap: 0.55rem;
    width: 100%; padding: 0.875rem 1.5rem;
    background: var(--btn-bg); color: var(--btn-fg);
    border: none; border-radius: 2px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 0.82rem; font-weight: 500;
    letter-spacing: 0.1em; text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-bottom: 1.75rem;
}
.btn-submit:hover { background: var(--btn-bg-hover); }
.btn-submit:active { transform: scale(0.985); }
.btn-submit:focus-visible {
    outline: 2px solid var(--form-border-focus);
    outline-offset: 3px;
}
.btn-submit svg { flex-shrink: 0; transition: transform 0.2s; }
.btn-submit:hover svg { transform: translateX(3px); }

/* Alerts */
.alert {
    padding: 0.75rem 1rem; border-radius: 4px;
    font-size: 0.8rem; line-height: 1.5; margin-bottom: 1.5rem;
}
.alert-error {
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.25);
    color: #dc2626;
}
.alert-success {
    background: rgba(34,197,94,.08);
    border: 1px solid rgba(34,197,94,.25);
    color: #15803d;
}

/* Note / bottom link */
.note {
    font-size: 0.78rem; font-weight: 300;
    color: var(--form-secondary); text-align: center; line-height: 1.65;
}
.note button {
    background: none; border: none; padding: 0;
    color: var(--form-link); cursor: pointer;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: inherit; font-weight: 400;
    transition: opacity 0.15s;
}
.note button:hover { opacity: 0.75; }

/* Forgot success state */
.forgot-success {
    text-align: center;
    padding: 2.5rem 0;
}
.forgot-success .check-circle {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: rgba(34,197,94,.1);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.25rem;
}
.forgot-success p {
    font-size: 0.88rem; color: var(--form-secondary);
    line-height: 1.6;
}
.forgot-success strong {
    display: block;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem; font-weight: 600;
    color: var(--form-fg); margin-bottom: 0.5rem;
}

/* ── Responsive ── */
@media (max-width: 780px) {
    .brand { display: none; }
    .form-panel { padding: 2.5rem 1.75rem; align-items: flex-start; padding-top: 3.5rem; }
    .mobile-logo { display: flex; }
    .view { max-width: 100%; }
}

@media (max-width: 400px) {
    .fields-row { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
}
