/* auth.css — marketing-aligned authentication surfaces */

@layer modules {
    .auth-body {
        min-height: 100dvh;
        overflow-x: clip;
        background: var(--bg-surface);
    }

    .auth-shell {
        min-height: 100dvh;
        display: grid;
        grid-template-columns: minmax(24rem, 0.9fr) minmax(34rem, 1.1fr);
    }

    .auth-story {
        position: relative;
        min-height: 100dvh;
        padding: clamp(2rem, 4vw, 4.5rem);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        border-right: 1px solid var(--border-color);
        background: var(--accent-primary);
        color: var(--marketing-ink);
    }

    .auth-story::after {
        content: "";
        position: absolute;
        right: -16rem;
        bottom: -19rem;
        width: 36rem;
        height: 36rem;
        border: 1px solid color-mix(in oklch, var(--marketing-ink), transparent 64%);
        border-radius: 50%;
        box-shadow: 0 0 0 5rem color-mix(in oklch, var(--marketing-ink), transparent 94%),
                    0 0 0 10rem color-mix(in oklch, var(--marketing-ink), transparent 96%);
        pointer-events: none;
    }

    .auth-story__logo { position: relative; z-index: 1; }

    .auth-story__copy {
        position: relative;
        z-index: 1;
        width: min(35rem, 100%);
        margin-top: clamp(5rem, 13vh, 9rem);
    }

    .auth-eyebrow {
        margin: 0 0 1.1rem;
        font-size: 0.7rem;
        font-weight: 800;
        letter-spacing: 0.11em;
        text-transform: uppercase;
    }

    .auth-story__copy h2 {
        max-width: 11ch;
        font-size: clamp(2.65rem, 5.2vw, 5.75rem);
        font-weight: 700;
        line-height: 0.96;
        letter-spacing: -0.065em;
    }

    .auth-story__copy > p:last-child {
        max-width: 31rem;
        margin-top: 1.5rem;
        font-size: clamp(1rem, 1.3vw, 1.2rem);
        line-height: 1.55;
    }

    .auth-story__visual {
        position: relative;
        z-index: 2;
        width: min(33rem, 94%);
        min-height: 19rem;
        margin: clamp(3rem, 7vh, 5rem) 0 0;
        overflow: hidden;
        border: 1px solid var(--marketing-ink);
        border-radius: var(--radius-md);
        background: var(--marketing-paper);
        box-shadow: 0.75rem 0.75rem 0 color-mix(in oklch, var(--marketing-ink), transparent 82%);
    }

    .auth-story__visual > img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 700ms cubic-bezier(0.2, 0.7, 0.2, 1);
    }

    .auth-story__visual:hover > img { transform: scale(1.025); }

    .auth-story__caption {
        position: absolute;
        top: 1rem;
        left: 1rem;
        max-width: 17rem;
        padding: 0.65rem 0.75rem;
        border-radius: var(--radius-md);
        background: color-mix(in oklch, var(--marketing-ink), transparent 10%);
        color: var(--marketing-paper);
        font-size: 0.68rem;
        font-weight: 700;
        line-height: 1.4;
    }

    .auth-visual__sheet {
        position: absolute;
        right: 1rem;
        bottom: 1rem;
        width: min(20rem, calc(100% - 2rem));
        padding: 1.25rem;
        border: 1px solid var(--marketing-ink);
        background: color-mix(in oklch, var(--marketing-paper), transparent 4%);
    }
    .auth-visual__label { display: block; color: var(--text-muted); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
    .auth-visual__sheet strong { display: block; margin-top: 0.4rem; font-family: var(--font-display); font-size: 1rem; }
    .auth-visual__line { width: 100%; height: 0.45rem; margin-top: 1.15rem; background: var(--marketing-mist); }
    .auth-visual__line--short { width: 62%; margin-top: 0.45rem; }
    .auth-visual__status { display: inline-flex; margin-top: 1.2rem; padding: 0.32rem 0.55rem; background: color-mix(in oklch, var(--accent-primary), white 64%); font-size: 0.65rem; font-weight: 800; text-transform: uppercase; }

    .auth-story__foot {
        position: relative;
        z-index: 1;
        margin-top: auto;
        padding-top: 2rem;
        font-size: 0.72rem;
        font-weight: 600;
    }

    .auth-main {
        min-width: 0;
        min-height: 100dvh;
        padding: clamp(1.5rem, 3.5vw, 3.5rem) clamp(1.5rem, 7vw, 7.5rem) 1.5rem;
        display: flex;
        flex-direction: column;
        background: var(--bg-surface);
    }

    .auth-main__top {
        min-height: 2rem;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .auth-mobile-logo { display: none; }

    .auth-back-link {
        color: var(--text-main);
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.03em;
        text-transform: uppercase;
    }

    .auth-back-link::before { content: "←"; margin-right: 0.5rem; }

    .auth-main__content {
        width: min(30rem, 100%);
        margin: auto;
        padding-block: 3rem;
        animation: auth-enter 480ms ease both;
    }

    .auth-main__foot {
        color: var(--text-muted);
        font-size: 0.68rem;
    }

    .auth-flash:empty { display: none; }

    .auth-panel { width: 100%; }

    .auth-header { margin-bottom: 2rem; }

    .auth-header h1,
    .auth-panel > h2 {
        margin-bottom: 0.75rem;
        color: var(--text-main);
        font-size: clamp(2.35rem, 4.5vw, 4.4rem);
        font-weight: 700;
        line-height: 0.98;
        letter-spacing: -0.065em;
    }

    .auth-header p,
    .auth-intro {
        max-width: 28rem;
        color: var(--text-muted);
        font-size: 0.95rem;
        line-height: 1.55;
    }

    .auth-form,
    .auth-panel > form {
        display: flex;
        flex-direction: column;
        gap: 1.15rem;
    }

    .auth-form fieldset {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding-top: 1.25rem;
        border-top: 1px solid var(--border-color);
    }

    .auth-form fieldset:first-of-type { padding-top: 0; border-top: 0; }

    .auth-form legend {
        margin-bottom: 0.9rem;
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .auth-form .form-group label,
    .auth-panel .field label {
        color: var(--text-main);
        font-size: 0.76rem;
        font-weight: 700;
    }

    .auth-form .form-group input:not([type="checkbox"]),
    .auth-panel .field input:not([type="checkbox"]) {
        width: 100%;
        min-height: 3.35rem;
        padding: 0.85rem 0;
        border: 0;
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
        background: transparent;
        color: var(--text-main);
        font-size: 1rem;
    }

    .auth-form .form-group input:not([type="checkbox"]):focus,
    .auth-panel .field input:not([type="checkbox"]):focus {
        border-bottom-color: var(--focus-ring);
        box-shadow: 0 2px 0 var(--focus-ring);
    }

    .auth-form .form-group input[aria-invalid="true"] {
        border-bottom-color: var(--danger);
        box-shadow: 0 1px 0 var(--danger);
    }

    .field-error {
        margin-top: 0.45rem;
        color: var(--danger);
        font-size: 0.75rem;
        font-weight: 700;
        line-height: 1.4;
    }

    .auth-form .form-actions,
    .auth-panel .actions { margin-top: 0.5rem; }

    .auth-form .btn,
    .auth-panel .actions input[type="submit"] {
        min-height: 3rem;
    }

    .auth-panel .actions input[type="submit"] {
        width: 100%;
        padding: 0.75rem 1.25rem;
        border: 1px solid var(--marketing-ink);
        border-radius: var(--radius-full);
        background: var(--marketing-ink);
        color: var(--marketing-paper);
        font-family: var(--font-sans);
        font-size: 0.75rem;
        font-weight: 800;
        text-transform: uppercase;
        cursor: pointer;
    }

    .auth-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    .auth-row .form-group { flex: 0 1 auto; }

    .checkbox-label { color: var(--text-muted); font-size: 0.78rem; }
    .checkbox-label input { width: 1rem; height: 1rem; flex: 0 0 auto; accent-color: var(--focus-ring); }

    .auth-inline-link {
        color: var(--text-main);
        font-size: 0.76rem;
        font-weight: 700;
        text-decoration: underline;
        text-underline-offset: 0.2em;
    }

    .auth-links {
        margin-top: 1.5rem;
        padding-top: 1.25rem;
        border-top: 1px solid var(--border-color);
    }

    .auth-links p { color: var(--text-muted); font-size: 0.8rem; }
    .auth-links p + p { margin-top: 0.55rem; }
    .auth-links a { color: var(--text-main); font-weight: 700; text-decoration: underline; text-underline-offset: 0.2em; }

    .auth-panel .field { margin-top: 1rem; }
    .auth-panel .field em { color: var(--text-muted); font-size: 0.75rem; }
    .auth-panel > form + a,
    .auth-panel > form + br + a { display: inline-block; margin-top: 1.25rem; color: var(--text-main); font-size: 0.8rem; font-weight: 700; }

    @keyframes auth-enter {
        from { opacity: 0; transform: translateY(0.75rem); }
        to { opacity: 1; transform: none; }
    }

    @media (max-width: 920px) {
        .auth-shell { grid-template-columns: 1fr; }
        .auth-story { display: none; }
        .auth-main { min-height: 100dvh; padding: 1.25rem clamp(1.25rem, 7vw, 4rem); }
        .auth-main__top { justify-content: space-between; }
        .auth-mobile-logo { display: inline-flex; }
        .auth-main__content { padding-block: 4rem; }
        .auth-main__foot { text-align: center; }
    }

    @media (prefers-reduced-motion: reduce) {
        .auth-story__visual > img { transition: none; }
        .auth-story__visual:hover > img { transform: none; }
        .auth-main__content { animation: none; }
    }

    @media (max-width: 540px) {
        .auth-main { padding-inline: 1.15rem; }
        .auth-main__content { padding-block: 3rem; }
        .auth-header h1,
        .auth-panel > h2 { font-size: 2.55rem; }
        .auth-row { align-items: flex-start; flex-direction: column; }
        .auth-form .form-row { display: grid; grid-template-columns: 1fr; }
    }
}
