/* ==========================================================================
   Glopy · Screen 01 — Welcome
   Mobile-first, immersive onboarding screen.
   Mission: get the user to press "Empezar". Less is more.
   ========================================================================== */

:root {
    --gl-blue: #1060ff;
    --gl-blue-deep: #0b4ad6;
    --gl-blue-soft: #3d86ff;
    --gl-bg-0: #05070f;
    --gl-bg-1: #0a0e1a;
    --gl-text: #ffffff;
    --gl-text-muted: #aab4cf;
    --gl-radius: 18px;
}

* { box-sizing: border-box; }

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

.welcome-body {
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(120% 90% at 50% 12%, #0d1426 0%, var(--gl-bg-1) 42%, var(--gl-bg-0) 100%);
    color: var(--gl-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow: hidden;
    position: relative;
}

/* Ambient aurora glow behind everything ------------------------------------ */
.welcome-aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(60% 45% at 50% 38%, rgba(16, 96, 255, 0.30) 0%, rgba(16, 96, 255, 0) 70%),
        radial-gradient(40% 30% at 78% 80%, rgba(61, 134, 255, 0.16) 0%, rgba(61, 134, 255, 0) 70%);
    animation: aurora-breathe 7s ease-in-out infinite;
}

/* Layout ------------------------------------------------------------------- */
.welcome-screen {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding: clamp(28px, 7vh, 56px) 28px calc(clamp(28px, 5vh, 44px) + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
}

.welcome-stack {
    flex: 1 1 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(18px, 4vh, 36px);
}

/* GLOPPY wordmark ---------------------------------------------------------- */
.welcome-logo {
    margin: 0;
    font-weight: 900;
    font-size: clamp(2.6rem, 13vw, 4rem);
    letter-spacing: 0.06em;
    line-height: 1;
    background: linear-gradient(180deg, var(--gl-blue-soft) 0%, var(--gl-blue) 55%, var(--gl-blue-deep) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--gl-blue);
    filter: drop-shadow(0 6px 26px rgba(16, 96, 255, 0.55));
}

/* Character ---------------------------------------------------------------- */
.welcome-character {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(180px, 56vw, 260px);
    height: clamp(180px, 56vw, 260px);
}

.welcome-character__glow {
    position: absolute;
    inset: -18%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 45%, rgba(16, 96, 255, 0.55) 0%, rgba(16, 96, 255, 0.15) 45%, rgba(16, 96, 255, 0) 72%);
    filter: blur(6px);
    animation: glow-pulse 3.6s ease-in-out infinite;
}

.welcome-character__img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: float 4s ease-in-out infinite;
    filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.45));
    will-change: transform;
}

/* Copy --------------------------------------------------------------------- */
.welcome-copy {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 22ch;
}

.welcome-title {
    margin: 0;
    font-weight: 700;
    font-size: clamp(1.6rem, 6.2vw, 2.1rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.welcome-wave {
    display: inline-block;
    transform-origin: 70% 70%;
    animation: wave 2.6s ease-in-out infinite;
}

.welcome-subtitle {
    margin: 0 auto;
    font-size: clamp(1rem, 4vw, 1.12rem);
    line-height: 1.5;
    color: var(--gl-text-muted);
    max-width: 24ch;
}

/* CTA ---------------------------------------------------------------------- */
.welcome-cta {
    width: 100%;
    display: flex;
    justify-content: center;
    flex: 0 0 auto;
    padding-top: 12px;
}

.welcome-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80%;
    max-width: 360px;
    min-height: 58px;
    padding: 0 24px;
    border-radius: var(--gl-radius);
    background: linear-gradient(180deg, var(--gl-blue-soft) 0%, var(--gl-blue) 60%, var(--gl-blue-deep) 100%);
    color: #fff;
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
        0 10px 30px rgba(16, 96, 255, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 0.18s ease, box-shadow 0.25s ease, filter 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.welcome-btn:hover {
    filter: brightness(1.05);
    box-shadow:
        0 14px 38px rgba(16, 96, 255, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.welcome-btn:active {
    transform: translateY(1px) scale(0.985);
    box-shadow:
        0 6px 18px rgba(16, 96, 255, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.welcome-btn:focus-visible {
    outline: 3px solid rgba(61, 134, 255, 0.7);
    outline-offset: 3px;
}

/* ==========================================================================
   Entrance animations — total budget under ~1s
   ========================================================================== */
.anim-logo,
.anim-character,
.anim-title,
.anim-subtitle,
.anim-cta {
    opacity: 0;
    animation-fill-mode: forwards;
}

.anim-logo      { animation: enter-fade 0.55s ease-out 0.05s forwards; }
.anim-character { animation: enter-rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.18s forwards; }
.anim-title     { animation: enter-rise 0.55s ease-out 0.42s forwards; }
.anim-subtitle  { animation: enter-rise 0.55s ease-out 0.55s forwards; }
.anim-cta       { animation: enter-rise 0.55s ease-out 0.68s forwards; }

/* The character keeps floating once it has settled in. */
.anim-character .welcome-character__img { animation-delay: 0.83s; }

@keyframes enter-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.75; transform: scale(1); }
    50%      { opacity: 1;    transform: scale(1.05); }
}

@keyframes aurora-breathe {
    0%, 100% { opacity: 0.85; }
    50%      { opacity: 1; }
}

@keyframes wave {
    0%, 60%, 100% { transform: rotate(0deg); }
    10%, 30%      { transform: rotate(14deg); }
    20%           { transform: rotate(-8deg); }
}

/* ==========================================================================
   Large screens (>= 900px): split-hero layout.
   Copy + CTA on the left, a larger floating Gloppy on the right.
   Markup is unchanged — .welcome-stack becomes `display: contents` so its
   children (logo, character, copy) place directly onto the grid.
   ========================================================================== */
@media (min-width: 900px) {
    .welcome-screen {
        max-width: 1120px;
        padding-inline: clamp(40px, 6vw, 80px);
        display: grid;
        align-content: center;
        column-gap: clamp(32px, 6vw, 88px);
        grid-template-columns: 1.05fr 0.95fr;
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "logo      character"
            "copy      character"
            "cta       character";
        text-align: left;
    }

    .welcome-stack { display: contents; }

    .welcome-logo {
        grid-area: logo;
        justify-self: start;
        font-size: clamp(3.4rem, 5vw, 4.8rem);
        margin-bottom: 0.35em;
    }

    .welcome-copy {
        grid-area: copy;
        max-width: none;
        align-items: flex-start;
        gap: 18px;
    }

    .welcome-title  { font-size: clamp(2.2rem, 3.4vw, 3.1rem); }
    .welcome-subtitle {
        margin: 0;
        text-align: left;
        font-size: clamp(1.05rem, 1.4vw, 1.3rem);
        max-width: 30ch;
    }

    .welcome-character {
        grid-area: character;
        align-self: center;
        justify-self: center;
        width: clamp(300px, 34vw, 480px);
        height: clamp(300px, 34vw, 480px);
    }

    .welcome-cta {
        grid-area: cta;
        justify-content: flex-start;
        padding-top: 28px;
    }

    .welcome-btn {
        width: auto;
        min-width: 240px;
        max-width: none;
        padding-inline: 56px;
    }

    /* On desktop the character drifts in from the right for a bit of polish. */
    .anim-character { animation-name: enter-rise-x; }
}

@keyframes enter-rise-x {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Short viewports (small phones / landscape): tighten things up. */
@media (max-height: 680px) {
    .welcome-stack { gap: clamp(12px, 2.5vh, 22px); }
    .welcome-character { width: clamp(150px, 40vh, 220px); height: clamp(150px, 40vh, 220px); }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
    .welcome-aurora,
    .welcome-character__glow,
    .welcome-character__img,
    .welcome-wave {
        animation: none !important;
    }
    .anim-logo,
    .anim-character,
    .anim-title,
    .anim-subtitle,
    .anim-cta {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}
