@import url('brand-house.css');

/* Splash in-app (browser / carregamento inicial) */
html:not(.auth-ok) body {
    visibility: hidden;
}

.app-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #3DAAEB;
    transition: opacity 0.28s ease-out, visibility 0.28s ease-out;
}

.app-splash.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── Fundo em camadas (mesma linguagem visual do index/login) ── */
.app-splash__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.app-splash__gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        165deg,
        #52B8F4 0%,
        #45B0F0 18%,
        #3DAAEB 42%,
        #359FD9 68%,
        #2E96D6 100%
    );
}

.app-splash__texture {
    position: absolute;
    inset: 0;
    opacity: 0.32;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 12px,
        rgba(255, 255, 255, 0.07) 12px,
        rgba(255, 255, 255, 0.07) 24px
    );
}

.app-splash__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(48px);
    opacity: 0.55;
}

.app-splash__glow--1 {
    width: min(72vw, 320px);
    height: min(72vw, 320px);
    top: 18%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.22);
    animation: app-splash-glow-center 4s ease-in-out infinite alternate;
}

.app-splash__glow--2 {
    width: min(50vw, 220px);
    height: min(50vw, 220px);
    bottom: 12%;
    right: -8%;
    background: rgba(30, 122, 184, 0.35);
    animation: app-splash-glow-side 4s ease-in-out infinite alternate;
    animation-delay: -2s;
}

@keyframes app-splash-glow-center {
    from { opacity: 0.4; transform: translateX(-50%) scale(0.94); }
    to   { opacity: 0.65; transform: translateX(-50%) scale(1.06); }
}

@keyframes app-splash-glow-side {
    from { opacity: 0.35; transform: scale(0.92); }
    to   { opacity: 0.55; transform: scale(1.08); }
}

/* ── Conteúdo central ── */
.app-splash__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2.5vh, 16px);
    padding: 24px 28px;
    text-align: center;
}

.app-splash__content--enter {
    animation: app-splash-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes app-splash-enter {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.app-splash__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 8px 16px 4px;
    overflow: visible;
}

.app-splash__brand .brand-house-mark--theme-splash {
    width: clamp(140px, 42vw, 192px);
    filter:
        drop-shadow(0 12px 28px rgba(0, 0, 0, 0.22))
        drop-shadow(0 0 24px rgba(255, 255, 255, 0.14));
}

.app-splash__name {
    margin: 0;
    color: #fff;
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: clamp(24px, 7vw, 32px);
    font-weight: 800;
    letter-spacing: 0.18em;
    line-height: 1;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.app-splash__tagline {
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: clamp(12px, 3.4vw, 14px);
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Animação das janelas mais rápida só na splash */
.app-splash .brand-house-mark--animated .bh-window {
    animation-duration: 1.5s;
}

.app-splash .brand-house-mark--animated .bh-window--1  { animation-delay: 0s; }
.app-splash .brand-house-mark--animated .bh-window--2  { animation-delay: 0.09s; }
.app-splash .brand-house-mark--animated .bh-window--3  { animation-delay: 0.18s; }
.app-splash .brand-house-mark--animated .bh-window--4  { animation-delay: 0.27s; }
.app-splash .brand-house-mark--animated .bh-window--5  { animation-delay: 0.36s; }
.app-splash .brand-house-mark--animated .bh-window--6  { animation-delay: 0.45s; }
.app-splash .brand-house-mark--animated .bh-window--7  { animation-delay: 0.54s; }
.app-splash .brand-house-mark--animated .bh-window--8  { animation-delay: 0.63s; }
.app-splash .brand-house-mark--animated .bh-window--9  { animation-delay: 0.72s; }
.app-splash .brand-house-mark--animated .bh-window--10 { animation-delay: 0.81s; }
.app-splash .brand-house-mark--animated .bh-window--11 { animation-delay: 0.9s; }
.app-splash .brand-house-mark--animated .bh-window--12 { animation-delay: 0.99s; }
.app-splash .brand-house-mark--animated .bh-window--13 { animation-delay: 1.08s; }
.app-splash .brand-house-mark--animated .bh-window--14 { animation-delay: 1.17s; }
.app-splash .brand-house-mark--animated .bh-window--15 { animation-delay: 1.26s; }
.app-splash .brand-house-mark--animated .bh-window--16 { animation-delay: 1.35s; }

/* ── Barra de progresso sutil ── */
.app-splash__progress {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    width: min(120px, 32vw);
    height: 3px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    overflow: hidden;
}

.app-splash__progress-bar {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.92);
    transform-origin: left center;
    transform: scaleX(0);
    animation: app-splash-progress 1.1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes app-splash-progress {
    to { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
    .app-splash__content--enter,
    .app-splash__glow,
    .app-splash__progress-bar {
        animation: none !important;
    }

    .app-splash__progress-bar {
        transform: scaleX(0.65);
    }
}
