/* Auth Telon — theatrical curtain entrance for auth screens.
   Layered as a fixed backdrop behind the navbar/main content so the
   navbar stays usable. Animations: dolly-in, house-light fade,
   spotlight, dust motes, two curtains opening, valance with tassels.
   The auth-card fades in once the curtains finish opening. */

.auth-telon-world {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    perspective: 1600px;
    transform-origin: 50% 55%;
    animation: auth-telon-dolly-in 1.4s cubic-bezier(0.22, 0.61, 0.36, 1) 0s both;
}

@keyframes auth-telon-dolly-in {
    0%   { transform: translateZ(-380px) translateY(40px); filter: brightness(0.18) blur(3px); }
    35%  { transform: translateZ(-260px) translateY(22px); filter: brightness(0.32) blur(2px); }
    70%  { transform: translateZ(-60px)  translateY(6px);  filter: brightness(0.7)  blur(0.4px); }
    100% { transform: translateZ(0)      translateY(0);    filter: brightness(1)   blur(0); }
}

.auth-telon-stage {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 55% 70% at 50% 55%, #000 50%, #060108 80%, #0a0414 100%),
        #000;
}

.auth-telon-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 35% 50% at 50% 48%, rgba(186, 158, 255, 0.06), transparent 65%),
        radial-gradient(ellipse 80% 40% at 50% 100%, rgba(132, 85, 239, 0.08), transparent 70%);
}

.auth-telon-spotlight {
    position: absolute;
    left: 50%;
    top: 0;
    width: 120vw;
    height: 130vh;
    transform: translate(-50%, -10%);
    pointer-events: none;
    background: radial-gradient(ellipse 28% 38% at 50% 52%, rgba(255, 236, 190, 0.22) 0%, rgba(186, 158, 255, 0.10) 35%, rgba(0, 0, 0, 0) 65%);
    mix-blend-mode: screen;
    opacity: 0;
    animation: auth-telon-spot-on 0.9s ease-out 0.7s both;
}

@keyframes auth-telon-spot-on {
    0%   { opacity: 0;   transform: translate(-50%, -10%) scale(0.6); }
    60%  { opacity: 0.9; }
    100% { opacity: 0.85; transform: translate(-50%, -10%) scale(1); }
}

.auth-telon-motes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    animation: auth-telon-motes-in 0.8s ease-out 1.0s both;
    background:
        radial-gradient(circle 1px at 22% 38%, rgba(255, 236, 190, 0.7), transparent 60%),
        radial-gradient(circle 1px at 68% 24%, rgba(255, 236, 190, 0.5), transparent 60%),
        radial-gradient(circle 1px at 47% 62%, rgba(255, 236, 190, 0.6), transparent 60%),
        radial-gradient(circle 1px at 82% 70%, rgba(255, 236, 190, 0.4), transparent 60%),
        radial-gradient(circle 1px at 33% 80%, rgba(255, 236, 190, 0.5), transparent 60%),
        radial-gradient(circle 1px at 58% 18%, rgba(255, 236, 190, 0.6), transparent 60%);
}

@keyframes auth-telon-motes-in {
    to { opacity: 0.8; }
}

.auth-telon-curtain {
    position: absolute;
    top: 0;
    height: 100vh;
    width: 55vw;
    pointer-events: none;
    will-change: transform;
}

.auth-telon-curtain svg {
    display: block;
    height: 100%;
    width: 100%;
    overflow: visible;
}

.auth-telon-curtain-left {
    left: 0;
    animation: auth-telon-open-left 1.6s cubic-bezier(0.55, 0.05, 0.25, 1) 1.3s both;
}

.auth-telon-curtain-right {
    right: 0;
    animation: auth-telon-open-right 1.6s cubic-bezier(0.55, 0.05, 0.25, 1) 1.3s both;
}

@keyframes auth-telon-open-left {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-32vw); }
}

@keyframes auth-telon-open-right {
    0%   { transform: scaleX(-1) translateX(0); }
    100% { transform: scaleX(-1) translateX(-32vw); }
}

.auth-telon-valance {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20vh;
    max-height: 220px;
    pointer-events: none;
    filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.55));
}

.auth-telon-valance svg {
    display: block;
    width: 100%;
    height: 100%;
}

.auth-telon-houselights {
    position: fixed;
    inset: 0;
    z-index: 8;
    pointer-events: none;
    background: radial-gradient(ellipse 70% 60% at 50% 55%, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.92) 70%, #000 100%);
    animation: auth-telon-house-fade 1.0s ease-out 0s both;
}

@keyframes auth-telon-house-fade {
    0%   { opacity: 1; }
    60%  { opacity: 0.55; }
    100% { opacity: 0; }
}

/* Make sure the auth content sits above the curtain backdrop. The
   auth-page gets extra top padding so the card clears the navbar and
   the valance silhouette visible below it. */
.auth-telon-active .auth-page {
    position: relative;
    z-index: 4;
    padding-top: clamp(8rem, 22vh, 16rem);
}

/* Reveal the auth card after the curtains finish opening (3.0s + 3.2s). */
.auth-telon-active .auth-card {
    animation: auth-telon-card-reveal 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 2.5s both;
}

@keyframes auth-telon-card-reveal {
    0%   { opacity: 0; transform: translateY(14px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Once the curtain has played in this session (or the user prefers
   reduced motion), skip the entire animation and pin everything to its
   final state — curtains parked open, lights up, card visible. */
.auth-telon-skip .auth-telon-world,
.auth-telon-skip .auth-telon-spotlight,
.auth-telon-skip .auth-telon-motes,
.auth-telon-skip .auth-telon-curtain-left,
.auth-telon-skip .auth-telon-curtain-right,
.auth-telon-skip .auth-telon-houselights,
.auth-telon-skip .auth-card {
    animation: none !important;
}

.auth-telon-skip .auth-telon-curtain-left  { transform: translateX(-32vw); }
.auth-telon-skip .auth-telon-curtain-right { transform: scaleX(-1) translateX(-32vw); }
.auth-telon-skip .auth-telon-houselights   { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
    .auth-telon-world,
    .auth-telon-spotlight,
    .auth-telon-motes,
    .auth-telon-curtain-left,
    .auth-telon-curtain-right,
    .auth-telon-houselights,
    .auth-telon-active .auth-card {
        animation: none !important;
    }

    .auth-telon-curtain-left  { transform: translateX(-32vw); }
    .auth-telon-curtain-right { transform: scaleX(-1) translateX(-32vw); }
    .auth-telon-houselights   { opacity: 0; }
}
