:root {
    --accent: #5227ff;
    --bg: #0b0b12;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body.dexarengine-holding-page {
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.holding-stage {
    position: fixed;
    inset: 0;
    overflow: hidden;
}

/* Background fills the whole viewport */
.holding-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    user-select: none;
    pointer-events: none;
}

/* Astronaut pinned to the left */
.holding-astronaut {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 100vh;
    width: auto;
    max-width: 55vw;
    object-fit: contain;
    object-position: left bottom;
    z-index: 2;
    user-select: none;
    pointer-events: none;
    animation: holdingFloat 8s ease-in-out infinite;
}

/* DeXaR logo centered in the right half */
.holding-logo {
    position: absolute;
    top: 50%;
    left: 70%;
    transform: translate(-50%, -50%);
    width: min(32vw, 460px);
    height: auto;
    z-index: 3;
    user-select: none;
    pointer-events: none;
    filter: drop-shadow(0 0 30px rgba(82, 39, 255, 0.35));
    animation: holdingFadeIn 1.4s ease 0.2s both;
}

/* Action buttons under the logo */
.holding-actions {
    position: absolute;
    top: calc(50% + min(20vw, 300px));
    left: 70%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 3;
    animation: holdingFadeIn 1.4s ease 0.5s both;
}

.holding-btn {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    font-family: inherit;
    font-size: 13px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    padding: 15px 56px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(14, 12, 28, 0.45);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 4px 18px rgba(0, 0, 0, 0.35);
    transition:
        color 0.6s ease,
        border-color 0.6s ease,
        background 0.6s ease,
        transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.6s ease;
    cursor: pointer;
}

/* Frosted purple reflex — animated sheen that sweeps across on hover */
.holding-btn::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(
        115deg,
        transparent 0%,
        transparent 35%,
        rgba(140, 90, 255, 0.18) 48%,
        rgba(200, 170, 255, 0.38) 52%,
        rgba(140, 90, 255, 0.18) 56%,
        transparent 70%,
        transparent 100%
    );
    background-size: 250% 100%;
    background-position: 120% 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: -1;
    mix-blend-mode: screen;
}

/* Ambient purple glow that fades in on hover */
.holding-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        120% 160% at 50% 120%,
        rgba(82, 39, 255, 0.45) 0%,
        rgba(82, 39, 255, 0.15) 35%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    z-index: -1;
}

.holding-btn:hover {
    color: #fff;
    border-color: rgba(180, 150, 255, 0.5);
    background: rgba(22, 16, 44, 0.55);
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 10px 30px rgba(82, 39, 255, 0.35),
        0 0 0 1px rgba(140, 90, 255, 0.15);
}

.holding-btn:hover::before {
    opacity: 1;
    animation: holdingSheen 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.holding-btn:hover::after {
    opacity: 1;
}

.holding-btn:focus-visible {
    outline: none;
    border-color: rgba(180, 150, 255, 0.7);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 0 0 3px rgba(82, 39, 255, 0.35);
}

@keyframes holdingSheen {
    0%   { background-position: 120% 0; }
    60%  { background-position: -60% 0; }
    100% { background-position: -60% 0; }
}

/* Maxwell footer credit bottom-right */
.holding-footer {
    position: absolute;
    right: 24px;
    bottom: 20px;
    width: auto;
    height: 42px;
    z-index: 4;
    opacity: 0.9;
    user-select: none;
    pointer-events: none;
}

/* Subtle animations */
@keyframes holdingFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

@keyframes holdingFadeIn {
    from { opacity: 0; transform: translate(-50%, -45%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

/* Tablet */
@media (max-width: 1024px) {
    .holding-astronaut { max-width: 60vw; height: 90vh; }
    .holding-logo { left: 72%; width: min(38vw, 360px); }
    .holding-actions { left: 72%; }
}

/* Mobile — stack vertically */
@media (max-width: 700px) {
    .holding-astronaut {
        max-width: 100vw;
        height: 65vh;
        opacity: 0.55;
        object-position: center bottom;
        left: 50%;
        transform: translateX(-50%);
    }
    .holding-logo {
        left: 50%;
        top: 40%;
        width: min(70vw, 320px);
    }
    .holding-actions {
        left: 50%;
        top: calc(40% + min(35vw, 160px));
        gap: 12px;
    }
    .holding-btn {
        font-size: 12px;
        padding: 13px 40px;
        letter-spacing: 0.18em;
    }
    .holding-footer {
        left: 50%;
        right: auto;
        bottom: 16px;
        transform: translateX(-50%);
        height: 32px;
    }
}

/* ═════════════════════════════════════════════════════════════════
   States driven by JS on <body>
   - body.hauth-open      — Portal clicked, login form showing
   - body.hauth-welcoming — login successful, welcome + drift playing
   ═════════════════════════════════════════════════════════════════ */

.holding-logo,
.holding-actions,
.holding-astronaut {
    transition:
        transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
        width     0.7s cubic-bezier(0.22, 1, 0.36, 1),
        opacity   0.5s ease;
}

/* When Portal is clicked: shrink logo, slide up, fade out button */
body.hauth-open .holding-logo {
    top: 20%;
    width: min(18vw, 240px);
}
body.hauth-open .holding-actions {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 14px);
}

/* Welcome phase: astronaut drifts off-screen to the left, rotating subtly */
body.hauth-welcoming .holding-astronaut {
    transition: transform 2.5s cubic-bezier(0.5, 0, 0.5, 1), opacity 2.5s ease;
    transform: translate(-70vw, -4vh) rotate(-3deg);
    opacity: 0.15;
}
body.hauth-welcoming .holding-logo {
    opacity: 0;
    transform: translate(-50%, -30%);
    transition: opacity 0.6s ease 0.3s, transform 1s ease;
}
body.hauth-welcoming .holding-footer {
    opacity: 0;
    transition: opacity 0.6s ease;
}

@media (prefers-reduced-motion: reduce) {
    .holding-logo,
    .holding-actions,
    .holding-astronaut { transition-duration: 0.001s; }
    body.hauth-welcoming .holding-astronaut { transition-duration: 0.001s; }
}
