/* Begex auth — split portal gate */

:root {
    --auth-ink: #141416;
    --auth-ink-soft: #2a2a2e;
    --auth-panel: #f3f4f6;
    --auth-line: rgba(20, 20, 22, 0.12);
    --auth-muted: #5c5f68;
    --auth-accent: #9a1f2e;
    --auth-accent-deep: #751622;
    --auth-accent-soft: rgba(154, 31, 46, 0.12);
    --auth-ok: #1f6b4a;
    --auth-danger: #9a1f2e;
    --auth-font-display: "Syne", "Segoe UI", sans-serif;
    --auth-font-body: "Source Sans 3", "Segoe UI", sans-serif;
    --auth-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
    margin: 0;
    min-height: 100%;
}

body.auth-body {
    font-family: var(--auth-font-body);
    color: var(--auth-ink);
    background: var(--auth-ink);
    -webkit-font-smoothing: antialiased;
}

.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(22rem, 0.8fr);
}

/* ——— Visual plane (brand) ——— */

.auth-visual {
    position: relative;
    overflow: hidden;
    color: #f5f5f5;
    background:
        radial-gradient(120% 80% at 8% 92%, rgba(154, 31, 46, 0.38), transparent 55%),
        radial-gradient(80% 60% at 88% 8%, rgba(255, 255, 255, 0.05), transparent 50%),
        linear-gradient(155deg, #070708 0%, #151518 46%, #0d0d10 100%);
    padding: clamp(2rem, 5vw, 4.5rem);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    isolation: isolate;
}

.auth-visual__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 88%);
    animation: auth-grid-drift 28s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.auth-visual__beam {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(196, 58, 74, 0.08) 50%,
        transparent 60%
    );
    animation: auth-beam 10s var(--auth-ease) infinite;
    pointer-events: none;
    z-index: 0;
}

.auth-visual__door {
    position: absolute;
    inset: 10% 14% auto auto;
    width: min(40vw, 340px);
    aspect-ratio: 3 / 4;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    transform: rotate(7deg);
    opacity: 0.5;
    z-index: 0;
    animation: auth-door-float 9s var(--auth-ease) infinite alternate;
}

.auth-visual__door::before {
    content: "";
    position: absolute;
    inset: 10% 14%;
    border: 1px solid rgba(154, 31, 46, 0.55);
}

.auth-visual__door::after {
    content: "";
    position: absolute;
    top: 48%;
    right: 18%;
    width: 18%;
    height: 2px;
    background: rgba(154, 31, 46, 0.75);
}

.auth-visual__glow {
    position: absolute;
    width: 52%;
    height: 52%;
    left: -10%;
    bottom: -14%;
    background: radial-gradient(circle, rgba(154, 31, 46, 0.5), transparent 68%);
    filter: blur(10px);
    animation: auth-glow-pulse 7s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

.auth-visual__content {
    position: relative;
    z-index: 1;
    max-width: 36rem;
    animation: auth-rise 0.9s var(--auth-ease) both;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
    color: inherit;
    margin-bottom: 1.5rem;
    transition: transform 0.35s var(--auth-ease), opacity 0.35s ease;
}

.auth-brand:hover {
    transform: translateY(-2px);
    opacity: 0.96;
}

.auth-brand__logo {
    display: block;
    width: auto;
    height: auto;
    max-width: min(100%, 22rem);
    max-height: clamp(3.25rem, 8vw, 5.5rem);
    object-fit: contain;
    filter: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.45));
}

.auth-brand--logo .auth-brand__logo {
    max-width: min(100%, 28rem);
    max-height: clamp(4.25rem, 11vw, 7rem);
}

.auth-brand--mark .auth-brand__logo {
    display: none;
}

.auth-brand__mark {
    font-family: var(--auth-font-display);
    font-weight: 800;
    font-size: clamp(3rem, 7vw, 5rem);
    letter-spacing: 0.06em;
    line-height: 0.95;
    text-transform: uppercase;
}

.auth-brand__mark span {
    color: #c43a4a;
}

.auth-visual__rule {
    width: 3.5rem;
    height: 3px;
    margin: 0 0 1.25rem;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--auth-accent), transparent);
    animation: auth-rule 1.1s var(--auth-ease) 0.15s both;
}

.auth-visual__headline {
    margin: 0 0 0.8rem;
    font-family: var(--auth-font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 3.3vw, 2.45rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
    max-width: 15ch;
}

.auth-visual__text {
    margin: 0;
    color: rgba(245, 245, 245, 0.72);
    font-size: 1.06rem;
    line-height: 1.55;
    max-width: 34ch;
}

/* ——— Form panel ——— */

.auth-panel {
    position: relative;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(154, 31, 46, 0.05), transparent 45%),
        linear-gradient(180deg, #fcfcfd 0%, var(--auth-panel) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: clamp(1.75rem, 4vw, 3.25rem);
    animation: auth-panel-in 0.75s var(--auth-ease) both;
}

.auth-panel::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(
        180deg,
        transparent 8%,
        var(--auth-accent) 35%,
        var(--auth-accent-deep) 65%,
        transparent 92%
    );
    opacity: 0.85;
}

.auth-panel__main {
    width: min(100%, 24.5rem);
    margin: 0 auto;
    padding: 0.5rem 0 1rem;
}

.auth-panel__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.85rem;
    color: var(--auth-accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    animation: auth-rise 0.7s var(--auth-ease) 0.05s both;
}

.auth-panel__eyebrow::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 1px;
    background: var(--auth-accent);
    box-shadow: 0 0 0 3px var(--auth-accent-soft);
}

.auth-panel__title {
    margin: 0 0 0.4rem;
    font-family: var(--auth-font-display);
    font-size: clamp(1.7rem, 2.5vw, 1.95rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    animation: auth-rise 0.7s var(--auth-ease) 0.1s both;
}

.auth-panel__lead {
    margin: 0 0 1.85rem;
    color: var(--auth-muted);
    font-size: 0.98rem;
    line-height: 1.45;
    animation: auth-rise 0.7s var(--auth-ease) 0.16s both;
}

.auth-form {
    display: grid;
    gap: 1.15rem;
}

.auth-form > * {
    animation: auth-rise 0.65s var(--auth-ease) both;
}

.auth-form > *:nth-child(1) { animation-delay: 0.2s; }
.auth-form > *:nth-child(2) { animation-delay: 0.26s; }
.auth-form > *:nth-child(3) { animation-delay: 0.32s; }
.auth-form > *:nth-child(4) { animation-delay: 0.38s; }
.auth-form > *:nth-child(5) { animation-delay: 0.44s; }

.auth-field {
    display: grid;
    gap: 0.4rem;
}

.auth-label {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--auth-ink-soft);
}

.auth-input,
.auth-input-wrap input {
    width: 100%;
    border: 1px solid var(--auth-line);
    background: #fff;
    color: var(--auth-ink);
    border-radius: 0.7rem;
    padding: 0.9rem 1rem;
    font: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s var(--auth-ease);
}

.auth-input:hover,
.auth-input-wrap input:hover {
    border-color: rgba(20, 20, 22, 0.22);
}

.auth-input:focus,
.auth-input-wrap input:focus {
    outline: none;
    border-color: rgba(154, 31, 46, 0.55);
    box-shadow: 0 0 0 4px var(--auth-accent-soft);
    transform: translateY(-1px);
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap input {
    padding-right: 4.25rem;
}

.auth-toggle-password {
    position: absolute;
    top: 50%;
    right: 0.4rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--auth-muted);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.45rem 0.6rem;
    cursor: pointer;
    border-radius: 0.45rem;
}

.auth-toggle-password:hover {
    color: var(--auth-accent);
    background: var(--auth-accent-soft);
}

.auth-error {
    margin: 0;
    color: var(--auth-danger);
    font-size: 0.86rem;
}

.auth-status {
    margin: 0 0 1rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.55rem;
    background: rgba(31, 107, 74, 0.08);
    color: var(--auth-ok);
    font-size: 0.92rem;
    font-weight: 600;
}

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

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--auth-muted);
    font-size: 0.92rem;
    cursor: pointer;
    user-select: none;
}

.auth-check input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--auth-accent);
}

.auth-link {
    color: var(--auth-muted);
    font-size: 0.92rem;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.auth-link:hover {
    color: var(--auth-accent);
    border-bottom-color: rgba(154, 31, 46, 0.4);
}

.auth-submit {
    appearance: none;
    border: 0;
    width: 100%;
    margin-top: 0.2rem;
    border-radius: 0.75rem;
    padding: 1rem 1.2rem;
    background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-accent-deep) 100%);
    color: #fff;
    font-family: var(--auth-font-display);
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s var(--auth-ease), box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow: 0 12px 28px rgba(117, 22, 34, 0.3);
}

.auth-submit::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.2) 48%, transparent 62%);
    transform: translateX(-120%);
    transition: transform 0.55s var(--auth-ease);
}

.auth-submit:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow: 0 16px 34px rgba(117, 22, 34, 0.34);
}

.auth-submit:hover::after {
    transform: translateX(120%);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-submit.is-loading {
    pointer-events: none;
    filter: saturate(0.9);
}

.auth-submit.is-loading::after {
    animation: auth-sweep 1.1s var(--auth-ease) infinite;
}

.auth-panel__foot {
    position: absolute;
    left: clamp(1.75rem, 4vw, 3.25rem);
    right: clamp(1.75rem, 4vw, 3.25rem);
    bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--auth-muted);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.auth-panel__foot span {
    opacity: 0.85;
}

.auth-help {
    margin: 0 0 1.25rem;
    color: var(--auth-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

@keyframes auth-rise {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes auth-panel-in {
    from {
        opacity: 0;
        transform: translateX(18px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes auth-grid-drift {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(0, -72px, 0); }
}

@keyframes auth-door-float {
    from { transform: rotate(7deg) translateY(0); }
    to { transform: rotate(5deg) translateY(-12px); }
}

@keyframes auth-glow-pulse {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50% { opacity: 0.95; transform: scale(1.08); }
}

@keyframes auth-beam {
    0%, 100% { opacity: 0.25; transform: translateX(-8%); }
    50% { opacity: 0.7; transform: translateX(8%); }
}

@keyframes auth-rule {
    from { opacity: 0; width: 0; }
    to { opacity: 1; width: 3.5rem; }
}

@keyframes auth-sweep {
    from { transform: translateX(-120%); }
    to { transform: translateX(120%); }
}

@media (max-width: 960px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 34vh;
        padding: 1.4rem 1.25rem 1.5rem;
        justify-content: flex-end;
    }

    .auth-visual__door {
        inset: 8% 6% auto auto;
        width: min(46vw, 170px);
        opacity: 0.35;
    }

    .auth-brand {
        margin-bottom: 0.85rem;
    }

    .auth-brand__mark {
        font-size: clamp(2rem, 9vw, 2.8rem);
    }

    .auth-brand--logo .auth-brand__logo {
        max-height: 3.6rem;
    }

    .auth-visual__headline {
        max-width: none;
        font-size: clamp(1.35rem, 5.5vw, 1.75rem);
    }

    .auth-visual__text {
        font-size: 0.95rem;
        max-width: 42ch;
    }

    .auth-panel {
        min-height: auto;
        flex: 1;
        justify-content: flex-start;
        padding-bottom: 3.5rem;
    }

    .auth-panel::before {
        width: 100%;
        height: 3px;
        top: 0;
        bottom: auto;
        background: linear-gradient(
            90deg,
            transparent 5%,
            var(--auth-accent) 40%,
            var(--auth-accent-deep) 70%,
            transparent 95%
        );
    }

    .auth-panel__main {
        padding-top: 0.35rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-visual__grid,
    .auth-visual__door,
    .auth-visual__glow,
    .auth-visual__beam,
    .auth-visual__content,
    .auth-visual__rule,
    .auth-panel,
    .auth-panel__eyebrow,
    .auth-panel__title,
    .auth-panel__lead,
    .auth-form > *,
    .auth-submit::after {
        animation: none !important;
        transition: none !important;
    }
}
