/* ═══════════════════════════════════════════════════
   FOLHAS DO HÁBITO — Cenas de Upada de Classe
   v9.0 — Entrada coreografada por stagger
   ═══════════════════════════════════════════════════ */

/* ── Overlay base ───────────────────────────────── */
.rankup-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.9s cubic-bezier(0.25, 0.8, 0.3, 1);
    pointer-events: none;
    overflow: hidden;
    --rankup-color: #ffffff;
    --rankup-glow: rgba(255, 255, 255, 0.7);
}

.rankup-overlay.active {
    pointer-events: all;
    background: rgba(4, 8, 6, 0.94);
}

/* Vinheta tingida pela cor da classe */
.rankup-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        var(--rankup-glow) 0%,
        transparent 55%
    );
    opacity: 0;
    transition: opacity 1.4s cubic-bezier(0.25, 0.8, 0.3, 1);
    mix-blend-mode: screen;
    filter: blur(40px);
}
.rankup-overlay.active .rankup-vignette {
    opacity: 0.35;
}

/* Toasts atrás do overlay quando ele estiver ativo */
body.rankup-open .toast-notification {
    z-index: 1 !important;
}
body.rankup-open { overflow: hidden; }

/* ── v10: VÍDEO da cinematic (Remotion → mp4, 1:1 quadrado) ── */
.rankup-video {
    width: min(92vw, 92vh);
    height: min(92vw, 92vh);
    max-width: 760px;
    max-height: 760px;
    object-fit: contain;
    border-radius: 18px;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.6s ease, transform 0.6s ease;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.rankup-overlay.active .rankup-video {
    opacity: 1;
    transform: scale(1);
}

/* Botão saltar / continuar */
.rankup-skip {
    position: absolute;
    bottom: 6%;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 28px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.rankup-skip:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}
.rankup-skip[hidden] { display: none; }

/* Canvas de partículas */
#rankupCanvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 99998;
}

/* ── Container da cena ──────────────────────────── */
.rankup-scene {
    position: relative;
    text-align: center;
    max-width: 600px;
    padding: 56px 44px;
    z-index: 2;
    --rankup-color: #ffffff;
    --rankup-glow: rgba(255, 255, 255, 0.7);
}

/* ── Stages — entrada coreografada ──────────────── */
.rankup-stage {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity 0.9s cubic-bezier(0.2, 0.85, 0.3, 1),
        transform 0.9s cubic-bezier(0.2, 0.85, 0.3, 1);
}
.rankup-overlay.active .rankup-stage {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger por etapa (delays acumulados) */
.rankup-overlay.active .rankup-stage-1 { transition-delay: 0.10s; }
.rankup-overlay.active .rankup-stage-2 { transition-delay: 0.30s; }
.rankup-overlay.active .rankup-stage-3 { transition-delay: 0.85s; }
.rankup-overlay.active .rankup-stage-4 { transition-delay: 1.05s; }
.rankup-overlay.active .rankup-stage-5 { transition-delay: 1.25s; }
.rankup-overlay.active .rankup-stage-6 { transition-delay: 1.45s; }
.rankup-overlay.active .rankup-stage-7 { transition-delay: 1.85s; }

/* ── Eyebrow (etiqueta superior) ────────────────── */
.rankup-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 700;
    margin-bottom: 22px;
    position: relative;
    display: inline-block;
}
.rankup-eyebrow::before,
.rankup-eyebrow::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 28px;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}
.rankup-eyebrow::before { right: calc(100% + 14px); }
.rankup-eyebrow::after  { left:  calc(100% + 14px); }

/* ── Badge (a letra da classe) + bloom de fundo ── */
.rankup-stage-2 {
    position: relative;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rankup-bloom {
    position: absolute;
    width: 280px;
    height: 280px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.4);
    background: radial-gradient(
        circle,
        var(--rankup-glow) 0%,
        transparent 65%
    );
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0;
    transition:
        opacity 1.4s cubic-bezier(0.2, 0.85, 0.3, 1),
        transform 1.4s cubic-bezier(0.2, 0.85, 0.3, 1);
    transition-delay: 0.30s;
    pointer-events: none;
}
.rankup-overlay.active .rankup-bloom {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: rankupBreathe 4s ease-in-out 1.7s infinite;
}

.rankup-badge {
    position: relative;
    display: inline-block;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 6rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -4px;
    color: var(--rankup-color);
    filter:
        drop-shadow(0 0 30px var(--rankup-glow))
        drop-shadow(0 0 60px var(--rankup-glow));
    animation: rankupPulse 2.4s ease-in-out 1.5s infinite;
}

.rankup-badge-shake {
    animation:
        rankupShake 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97) 0.55s,
        rankupPulse 2.4s ease-in-out 1.5s infinite;
}

/* ── Título principal ───────────────────────────── */
.rankup-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 14px;
    line-height: 1.3;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 40px rgba(0, 0, 0, 0.5);
}

/* ── Linha de "X dias" ──────────────────────────── */
.rankup-days {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 26px;
    font-weight: 500;
    letter-spacing: 0.3px;
}
.rankup-days strong {
    color: var(--rankup-color);
    font-weight: 700;
    text-shadow: 0 0 12px var(--rankup-glow);
}

/* ── Divisor com gradiente ──────────────────────── */
.rankup-divider {
    width: 80px;
    height: 1px;
    margin: 0 auto 28px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--rankup-color),
        transparent
    );
    box-shadow: 0 0 12px var(--rankup-glow);
    transform-origin: center;
    transform: scaleX(0);
    transition: transform 0.9s cubic-bezier(0.2, 0.85, 0.3, 1);
    transition-delay: 1.25s;
}
.rankup-overlay.active .rankup-stage-5 .rankup-divider {
    transform: scaleX(1);
}

/* ── Mensagem (citação) ─────────────────────────── */
.rankup-message {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.18rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.88);
    margin-bottom: 38px;
    font-style: italic;
    padding: 0 12px;
    text-shadow: 0 2px 30px rgba(0, 0, 0, 0.4);
}

/* ── Botão ──────────────────────────────────────── */
.rankup-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 36px;
    border-radius: 50px;
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    background: transparent;
    color: var(--rankup-color);
    border: 1.5px solid var(--rankup-color);
    box-shadow:
        0 0 0 0 var(--rankup-glow),
        inset 0 0 24px transparent;
    transition:
        transform 0.3s cubic-bezier(0.2, 0.85, 0.3, 1),
        box-shadow 0.4s ease,
        background 0.3s ease;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}
.rankup-btn::after {
    content: '→';
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}
.rankup-btn:hover {
    transform: translateY(-2px);
    background: var(--rankup-glow);
    color: #060a08;
    box-shadow:
        0 8px 32px var(--rankup-glow),
        inset 0 0 24px rgba(255, 255, 255, 0.2);
}
.rankup-btn:hover::after {
    transform: translateX(4px);
}

/* ═══════════════════════════════════════════════════
   CENA SSS — typewriter solene
   ═══════════════════════════════════════════════════ */
.rankup-scene.rankup-sss {
    max-width: 720px;
}

.rankup-sss-badge {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 7rem;
    font-weight: 900;
    letter-spacing: -6px;
    color: #fff;
    line-height: 1;
    margin-bottom: 44px;
    filter:
        drop-shadow(0 0 50px rgba(255, 255, 255, 0.95))
        drop-shadow(0 0 100px rgba(255, 255, 255, 0.5));
    opacity: 0;
    transform: scale(0.7);
    transition:
        opacity 1.6s cubic-bezier(0.2, 0.85, 0.3, 1),
        transform 1.6s cubic-bezier(0.2, 0.85, 0.3, 1);
    animation: rankupBreathe 5s ease-in-out 2s infinite;
}
.rankup-overlay.active .rankup-sss-badge {
    opacity: 1;
    transform: scale(1);
}

.rankup-sss-line {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 20px;
    font-style: italic;
    min-height: 1.5em;
}

.rankup-typewriter {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid rgba(255, 255, 255, 0.7);
    width: 0;
    animation:
        typing 3.4s steps(36, end) 1.8s forwards,
        blink 0.8s step-end infinite 5.2s;
    vertical-align: bottom;
}

.rankup-sss-days {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 30px;
    opacity: 0;
    transition: opacity 1.2s ease;
    transition-delay: 5.2s;
}
.rankup-sss-days strong {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
}
.rankup-overlay.active .rankup-sss-days { opacity: 1; }

.rankup-sss-hint {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.25);
    margin-top: 50px;
    opacity: 0;
    transition: opacity 1.2s ease;
    transition-delay: 6s;
    animation: rankupFadePulse 3s ease-in-out 6.5s infinite;
}
.rankup-overlay.active .rankup-sss-hint { opacity: 1; }

/* ═══════════════════════════════════════════════════
   ANIMAÇÕES (keyframes)
   ═══════════════════════════════════════════════════ */
@keyframes rankupPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.03); }
}

@keyframes rankupBreathe {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.75; }
}

@keyframes rankupShake {
    0%, 100% { transform: translateX(0); }
    15%      { transform: translateX(-6px) rotate(-1deg); }
    30%      { transform: translateX(6px)  rotate(1deg); }
    45%      { transform: translateX(-4px) rotate(-0.5deg); }
    60%      { transform: translateX(4px)  rotate(0.5deg); }
    75%      { transform: translateX(-2px); }
}

@keyframes typing {
    from { width: 0; }
    to   { width: 100%; }
}

@keyframes blink {
    50% { border-color: transparent; }
}

@keyframes rankupFadePulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 0.7; }
}

/* ── Responsivo ─────────────────────────────────── */
@media (max-width: 640px) {
    .rankup-scene { padding: 40px 24px; }
    .rankup-badge { font-size: 4.5rem; }
    .rankup-title { font-size: 1.5rem; }
    .rankup-message { font-size: 1.02rem; }
    .rankup-bloom { width: 220px; height: 220px; }
    .rankup-sss-badge { font-size: 5rem; }
    .rankup-sss-line { font-size: 1.15rem; }
}

/* ── Respeito a quem reduziu animações ──────────── */
@media (prefers-reduced-motion: reduce) {
    .rankup-stage,
    .rankup-bloom,
    .rankup-divider,
    .rankup-sss-badge,
    .rankup-sss-days,
    .rankup-sss-hint {
        transition-duration: 0.3s !important;
        transition-delay: 0s !important;
    }
    .rankup-badge,
    .rankup-badge-shake,
    .rankup-bloom,
    .rankup-sss-badge {
        animation: none !important;
    }
    .rankup-typewriter {
        animation: none !important;
        width: 100% !important;
        border-right: none !important;
    }
}
