/* Megavale Docs · movimento. Tudo é desligado para quem pede "reduzir movimento" no sistema. */

/* Transicao suave entre paginas (Chrome/Edge/Safari recentes); o resto navega normalmente */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
::view-transition-old(root) { animation: mv-fade-out .16s ease both; }
::view-transition-new(root) { animation: mv-fade-in .3s ease both; }
::view-transition-group(topbar) { animation-duration: .25s; }

@keyframes mv-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes mv-fade-out { to { opacity: 0; } }
@keyframes mv-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes mv-pop { from { opacity: 0; transform: translateY(-6px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes mv-spin { to { transform: rotate(360deg); } }
@keyframes mv-icon { from { opacity: 0; transform: rotate(-70deg) scale(.6); } to { opacity: 1; transform: none; } }
@keyframes mv-flash { 0% { background-color: color-mix(in srgb, var(--blue, #3498db) 11%, transparent); } 100% { background-color: transparent; } }
@keyframes mv-shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }

/* Entrada da pagina inicial */
.hero-inner > * { animation: mv-up .7s cubic-bezier(.2, .7, .2, 1) both; }
.hero-inner > :nth-child(2) { animation-delay: .08s; }
.hero-inner > :nth-child(3) { animation-delay: .16s; }
.hero-inner > :nth-child(4) { animation-delay: .24s; }
.tabs { animation: mv-up .6s .3s cubic-bezier(.2, .7, .2, 1) both; }
.doc-hero-inner > * { animation: mv-up .6s cubic-bezier(.2, .7, .2, 1) both; }
.doc-hero-inner > :nth-child(2) { animation-delay: .06s; }
.doc-hero-inner > :nth-child(3) { animation-delay: .12s; }
.doc-hero-inner > :nth-child(4) { animation-delay: .18s; }
.doc-hero-inner > :nth-child(5) { animation-delay: .24s; }
.error-page > * { animation: mv-up .6s cubic-bezier(.2, .7, .2, 1) both; }
.error-page > :nth-child(2) { animation-delay: .08s; }
.error-page > :nth-child(3) { animation-delay: .16s; }
.error-page > :nth-child(4) { animation-delay: .24s; }

/* Cartoes e blocos: aparecem ao entrar no ecra (so se o JS correr) */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .55s ease, transform .55s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i, 0) * 45ms); }
.js .reveal.in { opacity: 1; transform: none; }
/* depois de aparecer, o hover volta a ser imediato */
.js .card.reveal.in { transition: transform .18s, box-shadow .18s, border-color .18s, opacity .2s; transition-delay: 0s; }

/* Resposta ao toque/clique */
.card, .btn, .tab, .icon-btn, .select select, .theme-pop button, .theme-pop a { transition: transform .18s cubic-bezier(.2, .7, .2, 1), box-shadow .18s, background-color .2s, border-color .2s, filter .2s, color .2s; }
.card:active, .btn:active, .tab:active, .icon-btn:active { transform: scale(.97); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.tab:hover { transform: translateY(-2px); }

/* Menu do tema */
.theme-pop { transform-origin: top right; animation: mv-pop .16s ease-out; }
.theme-menu .ic { animation: mv-icon .35s cubic-bezier(.2, .7, .2, 1); }
.theme-pop button .check, .theme-pop a .check { transition: opacity .15s, transform .15s; opacity: 0; transform: scale(.5); visibility: visible !important; }
.theme-pop button[aria-pressed="true"] .check, .theme-pop a[aria-checked="true"] .check { opacity: 1; transform: none; }

/* Mudanca de tema: as cores passam suavemente (classe posta so durante a mudanca) */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
    transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease, box-shadow .35s ease !important;
}

/* Selo copiado */
.btn.done { animation: mv-pop .3s ease-out; }

/* Pagina de documentacao: carregamento e entrada do conteudo */
.loading {
    position: relative; margin: 60px auto; max-width: 320px; padding: 22px 20px 22px 64px; text-align: left; border-radius: 14px;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--blue) 14%, transparent), transparent) 0 0 / 200% 100%;
    animation: mv-shimmer 1.6s linear infinite; border: 1px solid var(--border);
}
.loading::before {
    content: ""; position: absolute; left: 22px; top: 50%; width: 24px; height: 24px; margin-top: -12px; border-radius: 50%;
    border: 3px solid color-mix(in srgb, var(--blue) 25%, transparent); border-top-color: var(--blue); animation: mv-spin .8s linear infinite;
}
#redoc.ready .redoc-wrap { animation: mv-fade-in .5s ease both; }
#redoc.ready .menu-content ul[role="menu"] > li { animation: mv-up .45s cubic-bezier(.2, .7, .2, 1) both; }
#redoc.ready .menu-content ul[role="menu"] > li:nth-child(n+2) { animation-delay: .04s; }
#redoc.ready .menu-content ul[role="menu"] > li:nth-child(n+4) { animation-delay: .08s; }
#redoc.ready .menu-content ul[role="menu"] > li:nth-child(n+7) { animation-delay: .12s; }
.flash-target { animation: mv-flash 1.1s ease-out; }
#redoc .menu-content label, #redoc .react-tabs__tab { transition: background-color .15s, color .15s, transform .15s; }
#redoc .react-tabs__tab:active { transform: scale(.96); }
body.leaving { opacity: 0; transition: opacity .18s ease; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    .js .reveal { opacity: 1; transform: none; }
    @view-transition { navigation: none; }
}

/* Mudança de idioma sem recarregar: o conteúdo novo entra com um desvanecimento curto (o "reduzir movimento" desliga-o acima) */
@keyframes mv-lang-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
body.lang-swap > :not(script) { animation: mv-lang-in .3s ease-out both; }
