/* Account-page composition (AccountLayout + the static-SSR account pages ONLY; linked from
   AccountLayout via HeadContent). Page-layout classes built strictly on design-system tokens
   (README, "Design system") — no raw hex. The dark hero panel carries [data-theme="dark"] in
   the layout markup, so every token below remaps by itself; nothing here branches on theme.
   Loads AFTER ds/styles.css and app.css (HeadOutlet order), so it may specialise both for
   this surface. Control heights run taller than the app-surface defaults on purpose: this is
   a one-form-per-screen surface, sized to match the reference design. */

/* ── Split shell ─────────────────────────────────────────────────────────── */
.auth-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 100dvh;
}

/* ── Hero panel (ink, dark-scoped) ───────────────────────────────────────── */
.auth-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-13);
    padding: var(--space-14) 56px;
    background: var(--surface-page); /* dark scope → sunken ink */
}

/* Decorative glows — soft mint upper-right, faint violet lower-left. */
.auth-hero::before,
.auth-hero::after {
    content: "";
    position: absolute;
    border-radius: var(--radius-pill);
    pointer-events: none;
}

.auth-hero::before {
    width: 540px;
    height: 540px;
    top: -160px;
    right: -180px;
    background: radial-gradient(closest-side, rgba(46, 212, 165, .16), transparent 70%);
}

.auth-hero::after {
    width: 420px;
    height: 420px;
    bottom: -120px;
    left: -140px;
    background: radial-gradient(closest-side, rgba(167, 139, 250, .12), transparent 70%);
}

.auth-hero > * {
    position: relative;
    z-index: 1;
}

.auth-brand {
    display: inline-flex;
    text-decoration: none;
}

.auth-hero-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-9);
    max-width: 460px;
}

.auth-hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: var(--fw-semibold);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--brand-primary);
}

.auth-hero-title {
    font-family: var(--font-display);
    font-weight: var(--fw-medium);
    font-size: clamp(32px, 3.2vw, 48px);
    line-height: 1.08;
    letter-spacing: var(--ls-display);
    color: var(--text-strong);
    text-wrap: balance;
}

.auth-hero-title em {
    font-style: italic;
    color: var(--brand-primary);
}

.auth-hero-copy {
    font: var(--type-lead);
    color: var(--text-body);
    max-width: 420px;
}

.auth-hero-foot {
    display: flex;
    justify-content: space-between;
    gap: var(--space-7);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-subtle);
}

.auth-hero-foot a {
    color: var(--text-subtle);
    text-decoration: none;
}

.auth-hero-foot a:hover {
    color: var(--text-body);
    text-decoration: underline;
}

/* Personal-email notice (email gate hero; violet = system voice, revealed by site.js). */
.personal-notice {
    display: none;
    gap: var(--space-4);
    align-items: flex-start;
    padding: var(--space-6) var(--space-7);
    background: var(--tint-violet-bg);
    border: 1px solid var(--tint-violet-border);
    border-radius: var(--radius-md);
    font-size: var(--fs-body-sm);
    line-height: 1.55;
    color: var(--text-body);
}

.personal-notice.is-visible {
    display: flex;
    animation: zp-rise var(--dur-slow) var(--ease-out) both;
}

.personal-notice svg {
    width: 17px;
    height: 17px;
    flex: none;
    margin-top: 1px;
    color: var(--brand-accent);
}

.personal-notice strong {
    display: block;
    color: var(--text-strong);
    font-weight: var(--fw-semibold);
}

/* ── Form pane ───────────────────────────────────────────────────────────── */
.auth-pane {
    display: flex;
    flex-direction: column;
    padding: var(--space-14) 56px;
    background: var(--surface-primary);
}

.auth-pane-helper {
    display: flex;
    justify-content: flex-end;
    min-height: var(--space-11);
    font: var(--type-body-sm);
    color: var(--text-body);
}

.auth-pane-helper a {
    margin-left: var(--space-2);
    color: var(--text-link);
    text-decoration: none;
    font-weight: var(--fw-medium);
}

.auth-pane-helper a:hover {
    color: var(--text-link-hover);
    text-decoration: underline;
}

.auth-form-col {
    width: 100%;
    max-width: 440px;
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-9);
}

.auth-eyebrow {
    font: var(--type-label);
    letter-spacing: var(--ls-eyebrow);
    text-transform: uppercase;
    color: var(--text-subtle);
}

.auth-form-col h1 {
    font-family: var(--font-display);
    font-weight: var(--fw-medium);
    font-size: 32px;
    line-height: var(--leading-tight);
    letter-spacing: var(--ls-display);
    color: var(--text-strong);
    margin-top: calc(-1 * var(--space-4));
}

.auth-sub {
    font-size: 15px;
    line-height: var(--leading-normal);
    color: var(--text-body);
    margin-top: calc(-1 * var(--space-4));
}

.auth-sub strong {
    color: var(--text-strong);
    font-weight: var(--fw-semibold);
}

/* ── Fields ──────────────────────────────────────────────────────────────── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-7);
}

.auth-field {
    display: flex;
    flex-direction: column;
}

/* Right-aligned trailing link under a field ("Forgot password?"). */
.auth-forgot {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--space-2);
    font: var(--type-body-sm);
}

.auth-field .form-input {
    height: 48px;
    font-size: var(--fs-body);
}

/* Blazor stamps .invalid / .valid.modified on bound inputs; express them in DS terms
   (app.css's template outlines are overridden for this surface). */
.auth-form-col .form-input.invalid {
    outline: none;
    border-color: var(--status-danger);
}

.auth-form-col .form-input.invalid:focus {
    box-shadow: var(--shadow-focus-danger);
}

.auth-form-col .form-input.valid.modified:not([type=checkbox]) {
    outline: none;
    border-color: var(--brand-primary);
    background: var(--surface-secondary);
}

.auth-form-col .validation-message,
.auth-form-col .field-error {
    color: var(--text-danger);
    font-size: var(--fs-label);
    margin-top: var(--space-2);
}

/* Label row that carries a trailing link ("Forgot password?"). */
.auth-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
}

.auth-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    font: var(--type-body-sm);
    color: var(--text-body);
    text-align: center;
}

/* The resend POST nests a form inside the links row; it must read as prose. */
.auth-links form {
    display: inline;
}

.auth-links a,
.auth-inline-link {
    color: var(--text-link);
    font-weight: var(--fw-medium);
    text-decoration: none;
}

.auth-links a:hover,
.auth-inline-link:hover {
    color: var(--text-link-hover);
    text-decoration: underline;
}

.auth-fineprint {
    font-size: var(--text-xs);
    line-height: 1.55;
    color: var(--text-subtle);
    text-align: center;
}

.auth-fineprint strong {
    color: var(--text-body);
    font-weight: var(--fw-semibold);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.auth-submit {
    width: 100%;
    height: 48px;
    font-size: var(--fs-body-sm);
}

.auth-submit.btn-secondary {
    align-self: flex-start;
    width: auto;
    padding: 0 var(--space-9);
}

.auth-linkbtn {
    /* A POST that reads as a link (resend code): strip the .btn box. */
    display: inline;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    font: var(--type-body-sm);
    font-weight: var(--fw-medium);
    color: var(--text-link);
}

.auth-linkbtn:hover {
    color: var(--text-link-hover);
    text-decoration: underline;
}

/* ── Back link ───────────────────────────────────────────────────────────── */
.auth-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    align-self: flex-start;
    font: var(--type-body-sm);
    font-weight: var(--fw-medium);
    color: var(--text-body);
    text-decoration: none;
}

.auth-back:hover {
    color: var(--text-strong);
    text-decoration: none;
}

.auth-back svg {
    width: 15px;
    height: 15px;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.auth-alert {
    display: flex;
    gap: var(--space-4);
    align-items: flex-start;
    padding: var(--space-6) var(--space-7);
    border-radius: var(--radius-md);
    font: var(--type-body-sm);
    line-height: 1.5;
}

.auth-alert svg {
    width: 17px;
    height: 17px;
    flex: none;
    margin-top: 1px;
}

.auth-alert.is-danger {
    background: var(--tint-danger-bg);
    border: 1px solid var(--tint-danger-border);
    color: var(--tint-danger-fg);
}

.auth-alert.is-info {
    background: var(--tint-info-bg);
    border: 1px solid var(--tint-info-border);
    color: var(--tint-info-fg);
}

/* ── Email chip ──────────────────────────────────────────────────────────── */
.auth-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    align-self: flex-start;
    padding: var(--space-3) var(--space-5);
    background: var(--surface-secondary);
    border: var(--rule);
    border-radius: var(--radius-md);
    font-size: var(--fs-body-sm);
    color: var(--text-strong);
}

.auth-chip svg {
    width: 15px;
    height: 15px;
    color: var(--text-subtle);
}

.auth-chip a {
    margin-left: var(--space-2);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--fw-medium);
    color: var(--text-link);
    text-decoration: none;
    transition: var(--transition-control);
}

.auth-chip a:hover {
    color: var(--text-link-hover);
    background: var(--brand-primary-soft);
}

/* ── OTP (six-box progressive enhancement; plain field without JS) ───────── */
.otp-real-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.otp-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    align-items: center;
}

.otp-boxes {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
}

.otp-box.form-input {
    width: 52px;
    height: 60px;
    padding: 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: var(--fw-medium);
    font-variant-numeric: tabular-nums;
}

.otp-box.form-input.is-filled {
    border-color: var(--brand-primary-strong);
}

.otp-countdown {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: var(--ls-chip);
    text-transform: uppercase;
    text-align: center;
    color: var(--text-subtle);
}

/* ── Password enhancement (eye toggle, meter, checklist) ─────────────────── */
.pw-wrap {
    position: relative;
}

.pw-wrap .form-input {
    padding-right: 44px;
}

.pw-toggle {
    position: absolute;
    top: 50%;
    right: var(--space-3);
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-subtle);
    cursor: pointer;
    transition: var(--transition-control);
}

.pw-toggle:hover {
    color: var(--text-strong);
}

.pw-toggle svg {
    width: 17px;
    height: 17px;
}

.pw-toggle .eye-off,
.pw-toggle.is-shown .eye-on {
    display: none;
}

.pw-toggle.is-shown .eye-off {
    display: inline-flex;
}

/* The hollow-circle → filled-check requirement icon. */
.req-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    flex: none;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-pill);
    color: transparent;
    transition: var(--transition-control);
}

.req-icon svg {
    width: 9px;
    height: 9px;
}

.pw-meter {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.pw-meter-track {
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--surface-tertiary);
    overflow: hidden;
}

.pw-meter-fill {
    height: 100%;
    width: 0;
    border-radius: var(--radius-pill);
    background: var(--surface-tertiary);
    transition: width var(--dur-slow) var(--ease-out), background var(--dur-slow) var(--ease-out);
}

.pw-meter[data-level="1"] .pw-meter-fill { width: 25%; background: var(--status-danger); }
.pw-meter[data-level="2"] .pw-meter-fill { width: 50%; background: var(--status-warning); }
.pw-meter[data-level="3"] .pw-meter-fill { width: 75%; background: var(--brand-primary); }
.pw-meter[data-level="4"] .pw-meter-fill { width: 100%; background: var(--status-success); }

.pw-meter-label {
    font-size: var(--fs-label);
    font-weight: var(--fw-medium);
    color: var(--text-subtle);
}

.pw-meter[data-level="1"] .pw-meter-label { color: var(--text-danger); }
.pw-meter[data-level="2"] .pw-meter-label { color: var(--status-warning-text); }
.pw-meter[data-level="3"] .pw-meter-label,
.pw-meter[data-level="4"] .pw-meter-label { color: var(--text-success); }

.pw-checklist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px var(--space-6);
    margin: 0;
    padding: 0;
    list-style: none;
}

.pw-checklist li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-label);
    color: var(--text-subtle);
}

.pw-checklist li.met {
    color: var(--text-success);
}

.pw-checklist li.met .req-icon {
    background: var(--status-success);
    border-color: var(--status-success);
    color: #fff;
}

/* Live match row: hidden until the confirm field has content. */
.pw-match {
    display: none;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    font-size: var(--fs-label);
    color: var(--text-subtle);
}

.pw-match.is-visible {
    display: flex;
}

.pw-match.met {
    color: var(--text-success);
}

.pw-match.met .req-icon {
    background: var(--status-success);
    border-color: var(--status-success);
    color: #fff;
}

.pw-match.unmet {
    color: var(--text-danger);
}

.pw-match.unmet .req-icon {
    background: var(--status-danger);
    border-color: var(--status-danger);
    color: #fff;
}

/* ── Entrances — rise 6px, staggered (DS motion; reduced-motion collapses durations) ── */
.anim {
    animation: zp-rise var(--transition-entrance) both;
}

.anim-1 { animation-delay: .05s; }
.anim-2 { animation-delay: .12s; }
.anim-3 { animation-delay: .22s; }
.anim-4 { animation-delay: .32s; }
.anim-5 { animation-delay: .42s; }

/* ── Small screens: the hero collapses to a brand band ───────────────────── */
@media (max-width: 920px) {
    .auth-split {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto 1fr;
    }

    .auth-hero {
        padding: var(--space-7) var(--space-11);
    }

    .auth-hero-main,
    .auth-hero-foot {
        display: none;
    }

    .auth-pane {
        padding: var(--space-13) var(--space-11);
    }

    .auth-form-col {
        margin-top: var(--space-13);
    }
}

@media (max-width: 720px) {
    .otp-boxes {
        gap: var(--space-2);
    }

    .otp-box.form-input {
        width: 42px;
        height: 52px;
        font-size: 20px;
    }
}
