/* Authentication modal. */

body.pm-modal-open {
    overflow: hidden;
}

.pm-auth-overlay {
    position: fixed;
    z-index: var(--pm-z-auth);
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(9, 7, 5, .52);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--pm-duration-slow) ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.pm-auth-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.pm-auth-modal {
    position: relative;
    width: min(100%, 460px);
    max-height: min(760px, calc(100dvh - 40px));
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--pm-line-soft);
    border-radius: var(--pm-radius-xl);
    background: var(--pm-popover-bg);
    box-shadow: var(--pm-shadow-modal);
    opacity: 0;
    transform: translateY(14px) scale(.985);
    transition: opacity var(--pm-duration-slow) ease,
                transform 420ms var(--pm-ease-emphasized);
    scrollbar-width: thin;
    scrollbar-color: var(--pm-line-strong) transparent;
}

.pm-auth-content {
    position: relative;
    width: 100%;
    max-height: min(760px, calc(100dvh - 40px));
    overflow-x: hidden;
    overflow-y: auto;
    padding: 32px;
    scrollbar-width: thin;
    scrollbar-color: var(--pm-line-strong) transparent;
}

.pm-auth-showcase {
    display: none;
}

.pm-auth-overlay.is-open .pm-auth-modal {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.pm-auth-close {
    position: absolute;
    z-index: 3;
    top: 14px;
    right: 14px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--pm-text-muted);
    cursor: pointer;
    transition: background-color var(--pm-duration-fast) ease,
                color var(--pm-duration-fast) ease;
}

.pm-auth-close:hover {
    background: var(--pm-surface-hover);
    color: var(--pm-text);
}

.pm-auth-close svg {
    width: 18px;
    height: 18px;
}

.pm-auth-step {
    min-width: 0;
}

.pm-auth-step.is-hidden,
.pm-auth-form.is-hidden {
    display: none;
}

.pm-auth-step.is-visible,
.pm-auth-form.is-active {
    display: block;
}

.pm-auth-primary.is-hidden,
.pm-auth-recovery.is-hidden {
    display: none;
}

.pm-auth-step.is-visible {
    animation: pmAuthStepIn 340ms var(--pm-ease-emphasized);
}

.pm-auth-form.is-entering {
    animation: pmAuthFormIn 300ms var(--pm-ease-emphasized);
}

@keyframes pmAuthStepIn {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pmAuthFormIn {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

.pm-auth-brand-icon {
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    overflow: hidden;
    margin: 5px auto 18px;
    border-radius: 0;
    padding: 2px;
    border: 0;
    background: transparent;
    color: var(--pm-brand);
}

.pm-auth-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: none;
}

html.is-dark .pm-auth-brand-icon img,
body.is-dark .pm-auth-brand-icon img {
    filter: none;
}

.pm-auth-title,
.pm-auth-form-title {
    margin: 0;
    color: var(--pm-text);
    font-weight: var(--pm-weight-bold);
    letter-spacing: -.02em;
    line-height: 1.2;
    text-align: center;
}

.pm-auth-title {
    font-size: 25px;
}

.pm-auth-subtitle {
    max-width: 330px;
    margin: 8px auto 0;
    color: var(--pm-text-secondary);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.pm-auth-email-row {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    min-height: 52px;
    margin-top: 24px;
    padding: 4px 4px 4px 13px;
    border: 1px solid transparent;
    border-radius: var(--pm-radius-md);
    background: var(--pm-control-bg);
    transition: border-color var(--pm-duration-fast) ease,
                background-color var(--pm-duration-fast) ease,
                box-shadow var(--pm-duration-fast) ease;
}

.pm-auth-email-row:focus-within {
    border-color: var(--pm-brand-border);
    background: var(--pm-surface-raised);
    box-shadow: 0 0 0 3px var(--pm-brand-soft);
}

.pm-auth-email-row.is-error {
    border-color: var(--pm-red-border);
    box-shadow: 0 0 0 3px var(--pm-red-soft);
}

.pm-auth-email-icon {
    width: 19px;
    height: 19px;
    color: var(--pm-text-muted);
}

.pm-auth-input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--pm-text);
    font-size: 14px;
}

.pm-auth-input::placeholder {
    color: var(--pm-text-muted);
}

.pm-auth-submit {
    min-height: 40px;
    border: 1px solid var(--pm-brand);
    border-radius: var(--pm-radius-sm);
    background: var(--pm-brand);
    color: var(--pm-text-on-brand);
    cursor: pointer;
    font-size: 14px;
    font-weight: var(--pm-weight-semibold);
    transition: background-color var(--pm-duration-fast) ease,
                border-color var(--pm-duration-fast) ease,
                transform var(--pm-duration-fast) ease;
}

.pm-auth-submit:hover {
    border-color: var(--pm-brand-hover);
    background: var(--pm-brand-hover);
}

.pm-auth-submit:active {
    transform: translateY(1px);
}

.pm-auth-submit:disabled {
    cursor: wait;
    opacity: .7;
}

.pm-auth-error {
    max-height: 0;
    overflow: hidden;
    margin: 0;
    color: var(--pm-red);
    font-size: 12px;
    opacity: 0;
    transition: max-height var(--pm-duration-normal) ease,
                margin var(--pm-duration-normal) ease,
                opacity var(--pm-duration-normal) ease;
}

.pm-auth-error.is-visible {
    max-height: 36px;
    margin: 6px 2px 0;
    opacity: 1;
}

.pm-auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    margin: 22px 0;
}

.pm-auth-divider span {
    height: 1px;
    background: var(--pm-line-soft);
}

.pm-auth-divider b {
    color: var(--pm-text-muted);
    font-size: 12px;
    font-weight: var(--pm-weight-medium);
}

.pm-auth-socials {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.pm-auth-social {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: var(--pm-radius-sm);
    background: var(--pm-control-bg);
    color: var(--pm-text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: var(--pm-weight-medium);
    transition: border-color var(--pm-duration-fast) ease,
                background-color var(--pm-duration-fast) ease,
                color var(--pm-duration-fast) ease;
}

.pm-auth-social:hover {
    border-color: transparent;
    background: var(--pm-surface-hover);
    color: var(--pm-text);
}

.pm-auth-social.is-unavailable {
    border-color: var(--pm-red-border);
    background: var(--pm-red-soft);
    color: var(--pm-red);
}

.pm-auth-social svg {
    width: 18px;
    height: 18px;
}

.pm-auth-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 22px;
    color: var(--pm-text-secondary);
    font-size: 13px;
}

.pm-auth-switch button,
.pm-auth-forgot {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--pm-brand);
    cursor: pointer;
    font-size: inherit;
    font-weight: var(--pm-weight-semibold);
}

.pm-auth-switch button:hover,
.pm-auth-forgot:hover {
    color: var(--pm-brand-hover);
}

.pm-auth-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 13px;
    color: var(--pm-text-muted);
    font-size: 12px;
}

.pm-auth-links a {
    text-decoration: none;
}

.pm-auth-links a:hover {
    color: var(--pm-text-secondary);
}

.pm-auth-form-head {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 8px;
    align-items: center;
    margin-bottom: 20px;
}

.pm-auth-form-title {
    font-size: 19px;
}

.pm-auth-back {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--pm-text-muted);
    cursor: pointer;
}

.pm-auth-back:hover {
    background: var(--pm-surface-hover);
    color: var(--pm-text);
}

.pm-auth-back svg {
    width: 18px;
    height: 18px;
}

.pm-auth-loading {
    display: none;
    min-height: 180px;
    place-items: center;
}

.pm-auth-loading.is-visible {
    display: grid;
}

.pm-auth-spinner,
.pm-auth-btn-spinner {
    width: 26px;
    height: 26px;
    border: 2px solid var(--pm-brand-soft-hover);
    border-top-color: var(--pm-brand);
    border-radius: 50%;
    animation: pmAuthSpin .72s linear infinite;
}

.pm-auth-btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
}

@keyframes pmAuthSpin {
    to { transform: rotate(360deg); }
}

.pm-auth-form {
    position: relative;
    margin-top: 24px;
}

.pm-auth-recovery .pm-auth-form {
    margin-top: 0;
}

.pm-auth-field {
    display: block;
}

.pm-auth-field + .pm-auth-field {
    margin-top: 14px;
}

.pm-auth-field > span {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 7px;
    color: var(--pm-text-secondary);
    font-size: 12px;
    font-weight: var(--pm-weight-medium);
}

.pm-auth-field > span svg {
    width: 16px;
    height: 16px;
    color: var(--pm-text-muted);
}

.pm-auth-field > span em {
    margin-left: auto;
    color: var(--pm-text-muted);
    font-size: 12px;
    font-style: normal;
    font-weight: var(--pm-weight-regular);
}

.pm-auth-field > .pm-auth-input,
.pm-auth-password {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--pm-line);
    border-radius: var(--pm-radius-sm);
    background: var(--pm-control-bg);
    transition: border-color var(--pm-duration-fast) ease,
                background-color var(--pm-duration-fast) ease,
                box-shadow var(--pm-duration-fast) ease;
}

.pm-auth-field > .pm-auth-input:focus,
.pm-auth-password:focus-within {
    border-color: var(--pm-brand-border);
    background: var(--pm-surface-raised);
    box-shadow: 0 0 0 3px var(--pm-brand-soft);
}

.pm-auth-password {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pm-auth-password .pm-auth-input {
    flex: 1;
}

.pm-auth-password-toggle {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--pm-text-muted);
    cursor: pointer;
}

.pm-auth-password-toggle:hover {
    background: var(--pm-surface-hover);
    color: var(--pm-text);
}

.pm-auth-password-toggle svg {
    width: 18px;
    height: 18px;
}

.pm-auth-password-toggle .pm-eye-closed,
.pm-auth-password-toggle.is-active .pm-eye-open {
    display: none;
}

.pm-auth-password-toggle.is-active .pm-eye-closed {
    display: block;
}

.pm-auth-consents {
    display: grid;
    gap: 11px;
    margin-top: 17px;
}

.pm-auth-check {
    display: grid;
    grid-template-columns: 17px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
    cursor: pointer;
}

.pm-auth-check input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.pm-auth-check-box {
    position: relative;
    width: 17px;
    height: 17px;
    margin-top: 1px;
    border: 1px solid var(--pm-line-strong);
    border-radius: 5px;
    background: var(--pm-control-bg);
    transition: border-color var(--pm-duration-fast) ease,
                background-color var(--pm-duration-fast) ease;
}

.pm-auth-check input:checked + .pm-auth-check-box {
    border-color: var(--pm-brand);
    background: var(--pm-brand);
}

.pm-auth-check input:checked + .pm-auth-check-box::after {
    position: absolute;
    top: 3px;
    left: 5px;
    width: 4px;
    height: 7px;
    border-right: 2px solid var(--pm-text-on-brand);
    border-bottom: 2px solid var(--pm-text-on-brand);
    content: "";
    transform: rotate(45deg);
}

.pm-auth-check input:focus-visible + .pm-auth-check-box {
    outline: 2px solid rgba(var(--pm-brand-rgb), .62);
    outline-offset: 2px;
}

.pm-auth-check-text {
    color: var(--pm-text-secondary);
    font-size: 12px;
    line-height: 1.55;
}

.pm-auth-check-text a {
    color: var(--pm-brand);
}

.pm-auth-check-text b {
    color: var(--pm-red);
}

.pm-auth-submit {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pm-auth-forgot {
    display: block;
    margin: 14px auto 0;
    font-size: 12px;
}

.pm-auth-recovery-copy {
    margin: 0 0 18px;
    color: var(--pm-text-secondary);
    font-size: 14px;
    line-height: 1.55;
}

.pm-auth-action-page {
    display: grid;
    min-height: 100dvh;
    place-items: center;
    padding: 24px;
    background: var(--pm-page-bg);
    color: var(--pm-text);
}

.pm-auth-action-card {
    width: min(440px, 100%);
    padding: 32px;
    border: 1px solid var(--pm-line-soft);
    border-radius: var(--pm-radius-lg);
    background: var(--pm-surface);
    box-shadow: 0 20px 54px rgba(0, 0, 0, .14);
    text-align: center;
}

.pm-auth-action-logo {
    width: 52px;
    height: 52px;
    margin-bottom: 18px;
    padding: 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    object-fit: contain;
}

.pm-auth-action-card h1 {
    margin: 0;
    font-size: 24px;
}

.pm-auth-action-card p {
    margin: 10px 0 24px;
    color: var(--pm-text-secondary);
    font-size: 14px;
    line-height: 1.55;
}

.pm-auth-action-form {
    display: grid;
    gap: 14px;
    text-align: left;
}

.pm-auth-action-form label span {
    display: block;
    margin-bottom: 7px;
    color: var(--pm-text-secondary);
    font-size: 13px;
    font-weight: var(--pm-weight-medium);
}

.pm-auth-action-form input {
    width: 100%;
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid var(--pm-line);
    border-radius: var(--pm-radius-sm);
    background: var(--pm-control-bg);
    color: var(--pm-text);
}

.pm-auth-action-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--pm-radius-sm);
    background: var(--pm-brand);
    color: var(--pm-text-on-brand);
    cursor: pointer;
    font: inherit;
    font-weight: var(--pm-weight-semibold);
    text-decoration: none;
}

.pm-auth-action-message {
    padding: 10px 12px;
    border-radius: var(--pm-radius-sm);
    background: var(--pm-positive-soft);
    color: var(--pm-positive);
    font-size: 13px;
}

.pm-auth-action-message.is-error {
    background: var(--pm-red-soft);
    color: var(--pm-red);
}

.pm-auth-form-message {
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0 11px;
    border-radius: var(--pm-radius-sm);
    font-size: 12px;
    line-height: 1.45;
    opacity: 0;
    transition: max-height var(--pm-duration-normal) ease,
                margin var(--pm-duration-normal) ease,
                padding var(--pm-duration-normal) ease,
                opacity var(--pm-duration-normal) ease;
}

.pm-auth-form-message.is-error,
.pm-auth-form-message.is-success {
    max-height: 72px;
    margin-bottom: 13px;
    padding-top: 9px;
    padding-bottom: 9px;
    opacity: 1;
}

.pm-auth-form-message.is-error {
    background: var(--pm-red-soft);
    color: var(--pm-red);
}

.pm-auth-form-message.is-success {
    background: var(--pm-positive-soft);
    color: var(--pm-positive);
}

html.is-dark .pm-auth-overlay {
    background: rgba(0, 0, 0, .58);
}

html.is-dark .pm-auth-modal {
    background: var(--pm-popover-bg);
}

@media (min-width: 900px) {
    .pm-auth-modal {
        width: min(960px, calc(100vw - 40px));
        height: min(650px, calc(100dvh - 40px));
        max-height: 650px;
        display: grid;
        grid-template-columns: minmax(360px, 44%) minmax(0, 56%);
    }

    .pm-auth-showcase {
        position: relative;
        isolation: isolate;
        display: flex;
        min-width: 0;
        min-height: 0;
        flex-direction: column;
        overflow: hidden;
        padding: 30px 32px;
        background:
            radial-gradient(circle at 74% 42%, rgba(255, 138, 31, .32), transparent 34%),
            linear-gradient(145deg, #23150c 0%, #160f0a 54%, #0d0b09 100%);
        color: #fff8ef;
    }

    .pm-auth-showcase::before {
        position: absolute;
        z-index: -1;
        inset: 0;
        background-image:
            linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
        background-size: 30px 30px;
        content: "";
        mask-image: linear-gradient(to bottom, #000, transparent 78%);
    }

    .pm-auth-showcase-brand {
        position: relative;
        z-index: 2;
        display: flex;
        align-items: center;
        gap: 10px;
        color: #fff8ef;
        font-size: 16px;
        font-weight: var(--pm-weight-bold);
        letter-spacing: -.02em;
    }

    .pm-auth-showcase-logo {
        display: grid;
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        place-items: center;
        padding: 2px;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .pm-auth-showcase-logo img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .pm-auth-showcase-copy {
        position: relative;
        z-index: 2;
        width: min(100%, 330px);
        margin-top: 28px;
    }

    .pm-auth-showcase-eyebrow {
        display: inline-flex;
        min-height: 25px;
        align-items: center;
        padding: 0 10px;
        border: 1px solid rgba(255, 167, 79, .3);
        border-radius: 999px;
        background: rgba(255, 138, 31, .12);
        color: #ffb15f;
        font-size: 11px;
        font-weight: var(--pm-weight-semibold);
        letter-spacing: .08em;
        text-transform: uppercase;
    }

    .pm-auth-showcase-copy h2 {
        max-width: 310px;
        margin: 14px 0 0;
        color: #fff8ef;
        font-size: clamp(27px, 2.4vw, 34px);
        font-weight: var(--pm-weight-bold);
        letter-spacing: -.035em;
        line-height: 1.04;
    }

    .pm-auth-showcase-copy p {
        max-width: 300px;
        margin: 11px 0 0;
        color: rgba(255, 244, 232, .67);
        font-size: 13px;
        line-height: 1.55;
    }

    .pm-auth-showcase-art {
        position: absolute;
        z-index: 1;
        right: -62px;
        bottom: -68px;
        left: -48px;
        height: 468px;
        pointer-events: none;
    }

    .pm-auth-showcase-art::before {
        position: absolute;
        inset: 32% 18% 6%;
        border-radius: 50%;
        background: rgba(255, 112, 10, .2);
        filter: blur(40px);
        content: "";
    }

    .pm-auth-showcase-art img {
        position: relative;
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center bottom;
        opacity: 0;
        transform: translateY(10px) scale(.985);
        transition: opacity 360ms ease, transform 520ms var(--pm-ease-emphasized);
    }

    .pm-auth-showcase-art img.is-loaded {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    .pm-auth-content {
        height: 100%;
        max-height: none;
        padding: 42px 44px 36px;
    }

    .pm-auth-brand-icon {
        display: none;
    }

    .pm-auth-title,
    .pm-auth-subtitle {
        max-width: none;
        margin-right: 0;
        margin-left: 0;
        text-align: left;
    }

    .pm-auth-title {
        padding-right: 30px;
        font-size: 29px;
    }
}

@media (min-width: 900px) and (max-height: 680px) {
    .pm-auth-showcase-copy {
        margin-top: 20px;
    }

    .pm-auth-showcase-art {
        bottom: -58px;
        height: 390px;
    }

    .pm-auth-content {
        padding-top: 32px;
        padding-bottom: 30px;
    }
}

@media (max-width: 520px) {
    .pm-auth-overlay {
        align-items: end;
        padding: 0;
    }

    .pm-auth-modal {
        width: 100%;
        max-height: min(88dvh, 760px);
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 18px 18px 0 0;
        transform: translateY(32px);
    }

    .pm-auth-content {
        max-height: min(88dvh, 760px);
        padding: 24px 18px calc(22px + env(safe-area-inset-bottom));
    }

    .pm-auth-title {
        font-size: 22px;
    }

    .pm-auth-socials {
        grid-template-columns: 1fr 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pm-auth-modal,
    .pm-auth-step.is-visible,
    .pm-auth-form.is-entering,
    .pm-auth-spinner,
    .pm-auth-btn-spinner {
        animation: none;
        transition-duration: 1ms;
    }
}
