/* =============================================================================
   Visual novo (card 978926) — movimento

   Regras das skills do Emil Kowalski (emil-design-eng, apple-design): resposta
   imediata, curvas próprias (nunca ease-in na entrada), menos de 300 ms, origem
   coerente com o gesto, e tudo desligado com "reduzir movimento". Um único
   momento orquestrado ao abrir a página; o resto responde ao que a pessoa faz.
   Só age com <html data-ui="next">.
   ============================================================================= */

html[data-ui="next"] body[data-theme="air"] {
    --air-ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1);
    --air-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

/* Abertura da página: o conteúdo sobe 6px e aparece, uma vez. Preenchimento só para trás
   (backwards): com "both" a animação de transform segue em vigor depois de acabar, e o
   Chrome trata o container como bloco de contenção dos filhos position: fixed — os
   modais do Bootstrap abriam deslocados para dentro da área de conteúdo. */
@keyframes air-page-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

html[data-ui="next"] body[data-theme="air"] .page-content > .container-fluid {
    animation: air-page-in 240ms var(--air-ease-out-quint) backwards;
}

/* Botões: resposta ao toque (escala 0,97 no clique, volta com mola curta). */
html[data-ui="next"] body[data-theme="air"] .btn {
    transition: background-color 140ms var(--air-ease-out-quint), border-color 140ms var(--air-ease-out-quint),
        color 140ms var(--air-ease-out-quint), transform 120ms var(--air-ease-out-quint);
}

html[data-ui="next"] body[data-theme="air"] .btn:active:not(:disabled) {
    transform: scale(0.97);
}

/* Menus suspensos: surgem do ponto de onde saem (origem no topo).
   O tema posiciona o menu com top:100% e anula o translate do Popper com a animação em
   fill-mode both (DropDownSlide). Sem o "both", o translate inline do Popper voltava ao
   fim da animação e o menu do usuário descia 72px além do topo. */
@keyframes air-pop-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: translateY(0); }
}

html[data-ui="next"] body[data-theme="air"] .dropdown-menu.show {
    transform-origin: top center;
    animation: air-pop-in 180ms var(--air-ease-out-quint) both;
}

/* Modais: entram com escala curta e a curva de saída rápida. */
html[data-ui="next"] body[data-theme="air"] .modal.fade .modal-dialog {
    transform: translateY(8px) scale(0.97);
    transition: transform 240ms var(--air-ease-out-quint), opacity 200ms var(--air-ease-out-quint);
    opacity: 0;
}

html[data-ui="next"] body[data-theme="air"] .modal.show .modal-dialog {
    transform: none;
    opacity: 1;
}

/* Painéis laterais (offcanvas, colunas, filtros salvos): curva de gaveta. */
html[data-ui="next"] body[data-theme="air"] .offcanvas {
    transition: transform 280ms var(--air-ease-drawer), visibility 280ms;
}

/* Painel de filtros das listagens: desce do toolbar quando aberto. */
@keyframes air-drop-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}

html[data-ui="next"] body[data-theme="air"] .listing-filters-panel,
html[data-ui="next"] body[data-theme="air"] .projects-filters-panel {
    animation: air-drop-in 200ms var(--air-ease-out-quint);
}

/* Abas: o sublinhado corre com a curva, em vez de trocar seco. */
html[data-ui="next"] body[data-theme="air"] .nav-tabs .nav-link,
html[data-ui="next"] body[data-theme="air"] .form-tabs .nav-link {
    transition: color 160ms var(--air-ease-out-quint), border-color 200ms var(--air-ease-out-quint);
}

/* Linhas de tabela: destaque acompanha o cursor sem atraso perceptível. */
html[data-ui="next"] body[data-theme="air"] table.table > tbody > tr > * {
    transition: background-color 120ms var(--air-ease-out-quint);
}

/* Carregamento de página (air-progress.init.js, divisão aprovada em 25/09): linha fina no
   topo para o que troca de página; botão "enviando" para download e envio. */
@keyframes air-progress-trickle {
    0% { transform: scaleX(0); }
    20% { transform: scaleX(0.35); }
    60% { transform: scaleX(0.7); }
    100% { transform: scaleX(0.9); }
}

html[data-ui="next"] body[data-theme="air"] .air-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10800;
    width: 100%;
    height: 3px;
    /* Preto e branco nos dois temas (o lima sumia no claro; o José pediu o mesmo no escuro):
       barra branca em "difference" — preta sobre fundo claro, branca sobre fundo escuro, e
       sempre visível sobre a caixa preta da marca no canto esquerdo. */
    background: #ffffff;
    mix-blend-mode: difference;
    transform: scaleX(0);
    transform-origin: left center;
    opacity: 0;
    pointer-events: none;
}

html[data-ui="next"] body[data-theme="air"] .air-progress.is-running {
    opacity: 1;
    animation: air-progress-trickle 6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes air-busy-spin {
    to { transform: rotate(360deg); }
}

html[data-ui="next"] body[data-theme="air"] .btn[aria-busy="true"] {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

html[data-ui="next"] body[data-theme="air"] .btn[aria-busy="true"] > * {
    visibility: hidden;
}

html[data-ui="next"] body[data-theme="air"] .btn[aria-busy="true"]::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid currentColor;
    border-color: var(--air-on-accent, #fff) var(--air-on-accent, #fff) var(--air-on-accent, #fff) transparent;
    border-radius: 50%;
    animation: air-busy-spin 700ms linear infinite;
}

html[data-ui="next"] body[data-theme="air"] .btn-outline-secondary[aria-busy="true"]::after,
html[data-ui="next"] body[data-theme="air"] .btn-secondary[aria-busy="true"]::after {
    border-color: var(--air-ink-strong) var(--air-ink-strong) var(--air-ink-strong) transparent;
}

@media (prefers-reduced-motion: reduce) {
    html[data-ui="next"] body[data-theme="air"] *,
    html[data-ui="next"] body[data-theme="air"] *::before,
    html[data-ui="next"] body[data-theme="air"] *::after {
        animation-duration: 0ms !important;
        transition-duration: 0ms !important;
    }
}
