/* =========================================================================
   LAVACASCADE — css/sections/auth.css
   The sign-in card on billing.lavacascade-hosting.com: login + sign-up
   (one page, includes/partials/auth-switch.php) and both password pages.

   One card split in two halves:
     login    [ image + big text | log in form  ]
     sign-up  [ sign-up form    | image + big text ]
   Switching slides the image panel right and the form side left at the
   same time (js/components/auth-switch.js only flips data-mode; all the
   motion is here). Phones stack the image as a banner over the form.
   ========================================================================= */

/* =========================================
   TUNING: change these to adjust the card and the slide
   ========================================= */
.auth {
    --auth-card-w: 1080px;    /* card width on big screens */
    --auth-card-h: 600px;     /* minimum card height (sign-up can grow it) */
    --auth-slide: 0.8s;       /* how long the swap takes */
    /* ease-in-out (quart): starts and ends gently, so the two halves
       glide past each other instead of snapping */
    --auth-ease: cubic-bezier(0.77, 0, 0.175, 1);
}

/* =========================================
   PAGE: night background with a soft lava glow and the brand dot grid
   ========================================= */
.auth {
    display: grid;
    place-items: center;
    padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1rem, 4vw, 2.5rem);
    background:
        radial-gradient(rgba(246, 242, 250, 0.045) 1px, transparent 1.4px) 0 0 / 5px 5px,
        radial-gradient(ellipse 60% 45% at 50% 0%, rgba(199, 71, 12, 0.16), transparent 70%),
        radial-gradient(ellipse 50% 40% at 50% 100%, rgba(199, 71, 12, 0.08), transparent 70%),
        var(--night-900);
}

/* =========================================
   CARD
   ========================================= */
.auth-card {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(var(--auth-card-w), 100%);
    min-height: var(--auth-card-h);
    /* the sliding halves must never show outside the rounded corners */
    overflow: hidden;
    background: var(--night-800);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
}

/* =========================================
   IMAGE PANEL (absolutely placed over one half, so it can slide)
   ========================================= */
.auth-visual {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 2;   /* above the form side, which slides underneath it */
    display: flex;
    align-items: flex-end;
    width: 50%;
    overflow: hidden;
    background: var(--night-900);
    transition: transform var(--auth-slide) var(--auth-ease);
}

.auth-card[data-mode="signup"] .auth-visual {
    transform: translateX(100%);
}

/* the pictures (one per side, stacked) */
.auth-visual__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--auth-slide) var(--auth-ease);
}

/* darkening: none on the top half so the picture keeps its colors, then
   a fade that gets heavy at the bottom where the text sits, so the white
   text keeps AA contrast even on the bright snowy/forest shots */
.auth-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, rgba(11, 7, 19, 0) 0%, rgba(11, 7, 19, 0) 42%, rgba(11, 7, 19, 0.6) 68%, rgba(11, 7, 19, 0.93) 100%);
    pointer-events: none;
}

/* the footage fallback (no pictures uploaded) already has its own overlay */
.auth-visual__bg::after {
    background: linear-gradient(180deg, rgba(11, 7, 19, 0.3), rgba(11, 7, 19, 0.6));
}

/* the text block (one copy per side, stacked in the same spot) */
.auth-visual__text {
    position: relative;
    z-index: 2;
    display: grid;
    width: 100%;
    padding: clamp(1.75rem, 3.5vw, 2.75rem);
}

.auth-visual__copy {
    grid-area: 1 / 1;   /* every copy sits in the same cell, so they crossfade */
    align-self: end;
    transition: opacity calc(var(--auth-slide) * 0.5) ease, transform calc(var(--auth-slide) * 0.5) ease;
}

.auth-visual__copy .eyebrow {
    color: var(--text-soft);
}

.auth-visual__title {
    margin-top: var(--space-3);
    font-size: clamp(2rem, 3.4vw, 2.75rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.035em;
    color: var(--text-strong);
}

.auth-visual__sub {
    max-width: 36ch;
    margin-top: var(--space-3);
    font-size: var(--fs-lead);
    line-height: 1.55;
    color: var(--text);
}

/* only the open side's picture and text show; the other waits faded out */
.auth-visual [data-side] {
    opacity: 0;
}

.auth-visual__copy[data-side] {
    transform: translateY(8px);
}

.auth-card[data-mode="login"] .auth-visual [data-side="login"],
.auth-card[data-mode="signup"] .auth-visual [data-side="signup"] {
    opacity: 1;
}

.auth-card[data-mode="login"] .auth-visual__copy[data-side="login"],
.auth-card[data-mode="signup"] .auth-visual__copy[data-side="signup"] {
    transform: none;
    /* the incoming line waits until the panel is halfway across */
    transition-delay: calc(var(--auth-slide) * 0.45);
}

/* =========================================
   FORM SIDE (the right half; slides to the left half on sign-up)
   ========================================= */
.auth-forms {
    position: relative;
    z-index: 1;
    grid-column: 2;
    display: grid;   /* both panes share one cell, so the card keeps the taller one's height */
    transition: transform var(--auth-slide) var(--auth-ease);
}

.auth-card[data-mode="signup"] .auth-forms {
    transform: translateX(-100%);
}

.auth-pane {
    grid-area: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    /* kept tight vertically so the taller sign-up form fits a 1080p screen
       without scrolling */
    padding: clamp(1.75rem, 3.2vw, 2.5rem) clamp(1.5rem, 4.5vw, 3.5rem);
    /* fading OUT: right away, then hidden once invisible */
    opacity: 0;
    visibility: hidden;
    transition: opacity calc(var(--auth-slide) * 0.35) ease, visibility 0s linear calc(var(--auth-slide) * 0.35);
}

.auth-pane.is-active {
    opacity: 1;
    visibility: visible;
    /* fading IN: after the outgoing form is gone, as the halves cross */
    transition: opacity calc(var(--auth-slide) * 0.45) ease calc(var(--auth-slide) * 0.45), visibility 0s;
}

.auth-pane__inner {
    width: 100%;
    max-width: 380px;
}

.auth-pane__title {
    font-size: clamp(1.75rem, 2.6vw, 2.15rem);
    letter-spacing: -0.03em;
}

.auth-pane__sub {
    margin-top: var(--space-3);
    color: var(--text-soft);
}

.auth-pane .form {
    gap: var(--space-4);
    margin-top: var(--space-5);
}

.auth-pane__alt {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    font-size: var(--fs-sm);
    line-height: 1.9;
    color: var(--text-muted);
    border-top: 1px solid var(--line);
}

/* =========================================
   SMALL FORM BITS
   ========================================= */

/* label + "Forgot password?" on one line */
.field__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
}

.field__link {
    font-size: var(--fs-xs);
}

.auth__legal {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

/* =========================================
   PHONES + SMALL TABLETS: image as a banner on top, form below, no slide
   (two side-by-side halves don't fit; the forms just crossfade)
   ========================================= */
@media (max-width: 860px) {
    .auth {
        align-items: start;
    }

    .auth-card {
        grid-template-columns: minmax(0, 1fr);
        min-height: 0;
    }

    .auth-visual,
    .auth-card[data-mode="signup"] .auth-visual {
        position: relative;
        width: auto;
        min-height: 210px;
        transform: none;
    }

    /* the banner is short, so the text covers most of it: darken evenly */
    .auth-visual::after {
        background: linear-gradient(180deg, rgba(11, 7, 19, 0.35) 0%, rgba(11, 7, 19, 0.88) 100%);
    }

    /* no room for the eyebrow on a banner; the title says enough */
    .auth-visual__copy .eyebrow {
        display: none;
    }

    .auth-visual__title {
        margin-top: 0;
        font-size: clamp(1.6rem, 6.5vw, 2rem);
    }

    .auth-visual__sub {
        font-size: var(--fs-sm);
    }

    .auth-forms,
    .auth-card[data-mode="signup"] .auth-forms {
        grid-column: 1;
        transform: none;
    }

    /* only the open form takes up room, so the card fits it exactly */
    .auth-pane:not(.is-active) {
        display: none;
    }

    .auth-pane.is-active {
        animation: auth-pane-in 0.35s ease both;
    }
}

@keyframes auth-pane-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

/* =========================================
   REDUCED MOTION: swap instantly, no slide or fades
   ========================================= */
@media (prefers-reduced-motion: reduce) {
    .auth-visual,
    .auth-visual__img,
    .auth-visual__copy,
    .auth-forms,
    .auth-pane,
    .auth-pane.is-active {
        transition: none;
        animation: none;
    }
}
