/* =====================================================================
   Recomp — EFEITOS
   Somente transform/opacity (acelerados pela GPU), curtos e sem
   bloquear a interação. Desligados com "reduzir movimento" do sistema.
   ===================================================================== */
:root {
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px -2px rgba(0,0,0,.06);
  --shadow-md: 0 2px 4px rgba(0,0,0,.04), 0 10px 24px -8px rgba(0,0,0,.16);
  --shadow-lg: 0 12px 40px -8px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.06);
  --shadow-ink: 0 1px 2px rgba(0,0,0,.14), 0 8px 20px -8px rgba(0,0,0,.45);
}
:root[data-theme="dark"] { --shadow-sm: 0 1px 2px rgba(0,0,0,.5); --shadow-md: 0 10px 28px -8px rgba(0,0,0,.7); --shadow-lg: 0 16px 48px -8px rgba(0,0,0,.85); --shadow-ink: 0 8px 22px -8px rgba(255,255,255,.18); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --shadow-sm: 0 1px 2px rgba(0,0,0,.5); --shadow-md: 0 10px 28px -8px rgba(0,0,0,.7); --shadow-lg: 0 16px 48px -8px rgba(0,0,0,.85); --shadow-ink: 0 8px 22px -8px rgba(255,255,255,.18); }
}

button, a, .chip, .tile { touch-action: manipulation; } /* sem atraso de toque */

/* ---------- entrada das telas (cascata) ---------- */
@keyframes rise { from { opacity: 0; transform: translate3d(0, 14px, 0); } to { opacity: 1; transform: none; } }
@keyframes push-in { from { opacity: 0; transform: translate3d(22px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }

.view.anim > :not(:only-child), .view.anim > :only-child > * { animation: rise .46s var(--ease-out) both; }
.view.anim.push > :not(:only-child), .view.anim.push > :only-child > * { animation-name: push-in; animation-duration: .36s; }
.view.anim > :nth-child(2), .view.anim > :only-child > :nth-child(2) { animation-delay: 35ms; }
.view.anim > :nth-child(3), .view.anim > :only-child > :nth-child(3) { animation-delay: 70ms; }
.view.anim > :nth-child(4), .view.anim > :only-child > :nth-child(4) { animation-delay: 105ms; }
.view.anim > :nth-child(5), .view.anim > :only-child > :nth-child(5) { animation-delay: 140ms; }
.view.anim > :nth-child(6), .view.anim > :only-child > :nth-child(6) { animation-delay: 170ms; }
.view.anim > :nth-child(7), .view.anim > :only-child > :nth-child(7) { animation-delay: 200ms; }
.view.anim > :nth-child(8), .view.anim > :only-child > :nth-child(8) { animation-delay: 225ms; }
.view.anim > :nth-child(n+9), .view.anim > :only-child > :nth-child(n+9) { animation-delay: 250ms; }

/* itens de lista, trio e estatísticas entram em sequência */
.view.anim .list > .list-item, .view.anim .trio > *, .view.anim .stat-grid > * { animation: rise .45s var(--ease-out) both; }
.view.anim .list > .list-item:nth-child(1), .view.anim .trio > :nth-child(1), .view.anim .stat-grid > :nth-child(1) { animation-delay: 120ms; }
.view.anim .list > .list-item:nth-child(2), .view.anim .trio > :nth-child(2), .view.anim .stat-grid > :nth-child(2) { animation-delay: 160ms; }
.view.anim .list > .list-item:nth-child(3), .view.anim .trio > :nth-child(3), .view.anim .stat-grid > :nth-child(3) { animation-delay: 200ms; }
.view.anim .list > .list-item:nth-child(4), .view.anim .stat-grid > :nth-child(4) { animation-delay: 235ms; }
.view.anim .list > .list-item:nth-child(5) { animation-delay: 265ms; }
.view.anim .list > .list-item:nth-child(6) { animation-delay: 290ms; }
.view.anim .list > .list-item:nth-child(7) { animation-delay: 310ms; }
.view.anim .list > .list-item:nth-child(n+8) { animation-delay: 330ms; }

/* conteúdo calculado depois da primeira pintura aparece suavemente */
.pa-in, #pa-macros > * { animation: fade-in .35s ease both; }

/* ---------- barras de progresso crescendo ---------- */
@keyframes grow-x { from { transform: scaleX(0); } to { transform: none; } }
.view.anim .bar > i, .view.anim .progress > i, .sheet .bar > i { transform-origin: left center; animation: grow-x .9s var(--ease-out) .18s both; }

/* ---------- gráficos ---------- */
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: none; } }
.chart .s-line { stroke-dasharray: 1; animation: draw 1s var(--ease-out) .1s both; }
.chart circle { animation: fade-in .4s ease .6s both; }
.chart .bar-mark { transform-box: fill-box; transform-origin: bottom; animation: grow-y .55s var(--ease-out) both; transition: opacity .15s; }
@media (hover: hover) { .chart svg:hover .bar-mark { opacity: .55; } .chart svg:hover .bar-mark:hover { opacity: 1; } }
.chart-tip { transition: left .08s linear, top .08s linear; animation: fade-in .12s ease; }

/* ---------- toque e hover ---------- */
.btn, .chip, .seg button, .tile, .add-circle, .round-btn, .icon-btn, .set-check, .avatar,
.keypad button, .scale button, .project-pill, .cal .day, .photo-tile, .check-circle {
  transition: transform .2s var(--ease-out), background-color .2s ease, box-shadow .25s ease, color .2s ease, opacity .2s ease;
}
.btn:active, .chip:active, .tile:active, .add-circle:active, .round-btn:active, .icon-btn:active, .set-check:active,
.avatar:active, .keypad button:active, .scale button:active, .cal .day:active, .seg button:active, .photo-tile:active {
  transform: scale(.95); transition-duration: .08s;
}
.list-item { transition: opacity .15s ease, background-color .2s ease; }
.list-item:active { opacity: .55; }
.list-item .chev { transition: transform .25s var(--ease-out), color .2s; }

/* sombras em camadas */
.btn.primary, .round-btn, .fab { box-shadow: var(--shadow-ink); }
.card { box-shadow: var(--shadow-sm); transition: box-shadow .3s ease; }
.seg button.on { box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 3px 10px -2px rgba(0,0,0,.12); }
.input { transition: background-color .2s ease, box-shadow .2s ease; }
.input:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 8%, transparent); }

@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--surface-3); }
  .btn.primary:hover { background: var(--ink); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,.12), 0 14px 28px -10px rgba(0,0,0,.5); }
  .btn.good:hover { background: var(--accent); transform: translateY(-1px); }
  .btn.ghost:hover { background: var(--surface-2); }
  .round-btn:hover { transform: scale(1.06); box-shadow: 0 16px 32px -10px rgba(0,0,0,.5); }
  .avatar:hover, .add-circle:hover { transform: scale(1.06); }
  .chip:hover, .project-pill:hover { background: var(--surface-3); }
  .chip.on:hover { background: var(--ink); }
  .tile:hover { transform: translateY(-2px); background: var(--surface); box-shadow: var(--shadow-md); }
  .tile.on:hover { background: var(--ink); }
  .card:hover { box-shadow: var(--shadow-md); }
  .list-item:hover .chev { transform: translateX(3px); color: var(--text); }
  a.list-item:hover, button.list-item:hover { background: linear-gradient(90deg, transparent, var(--surface-2) 10%, var(--surface-2) 90%, transparent); }
  .photo-tile img { transition: transform .6s var(--ease-out); }
  .photo-tile:hover img { transform: scale(1.05); }
  .photo-tile.blurred:hover img { transform: scale(1.15); }
  .photo-tile:hover { box-shadow: var(--shadow-md); }
  .cal .day:hover { transform: translateY(-1px); }
  .trio a.card-link .v { transition: transform .3s var(--ease-out); }
  .trio a.card-link:hover .v { transform: translateX(3px); }
  .foot-line a, .link { transition: opacity .2s; }
  .foot-line a:hover, .link:hover { opacity: .6; }
  .links a, .links button { transition: color .2s; }
  .nav-top a { position: relative; transition: color .2s; }
  .nav-top a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; border-radius: 2px; background: currentColor; transform: scaleX(0); transition: transform .3s var(--ease-out); }
  .nav-top a:hover::after { transform: scaleX(.5); }
  .nav-top a.active::after { transform: scaleX(1); }
  .set-check:hover { border-color: var(--accent); color: var(--accent); }
}

/* ---------- topo e navegação: sombra ao rolar ---------- */
.topbar, .page-head.sub, .session-bar { transition: box-shadow .3s ease, border-color .3s ease; }
body.scrolled .topbar { box-shadow: 0 8px 24px -16px rgba(0,0,0,.35); border-bottom-color: transparent; }
body.scrolled .page-head.sub { box-shadow: 0 8px 24px -18px rgba(0,0,0,.35); }
body.scrolled .session-bar { box-shadow: 0 10px 24px -18px rgba(0,0,0,.4); border-bottom-color: transparent; }
.nav-bottom { box-shadow: 0 -8px 24px -18px rgba(0,0,0,.25); border-top-color: transparent; }
.nav-bottom a svg { transition: transform .3s var(--ease-spring); }
.nav-bottom a:active svg { transform: scale(.85); }
.nav-bottom a.tab-pop svg { animation: tab-pop .45s var(--ease-spring); }
@keyframes tab-pop { 0% { transform: scale(.8); } 60% { transform: scale(1.15); } 100% { transform: none; } }

/* ---------- confirmação ("pop" + anel) ---------- */
@keyframes pop { 0% { transform: scale(.7); } 55% { transform: scale(1.15); } 100% { transform: none; } }
@keyframes ring { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } to { box-shadow: 0 0 0 14px transparent; } }
.pop { animation: pop .42s var(--ease-spring), ring .6s ease-out; }
.view.anim .check-circle.on { animation: pop .45s var(--ease-spring) .35s both; }
.set-row, .set-row .input { transition: background-color .35s ease; }

/* ---------- painéis (sheets) ---------- */
@keyframes sheet-in { from { transform: translate3d(0, 100%, 0); } to { transform: none; } }
@keyframes sheet-out { from { transform: none; } to { transform: translate3d(0, 100%, 0); } }
@keyframes dialog-in { from { opacity: 0; transform: translate3d(0, 12px, 0) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes dialog-out { to { opacity: 0; transform: translate3d(0, 8px, 0) scale(.98); } }
.sheet-backdrop { background: rgba(0,0,0,.32); animation: fade-in .22s ease both; }
.sheet { animation: sheet-in .36s var(--ease-out) both; box-shadow: var(--shadow-lg); }
.sheet-backdrop.closing { animation: fade-out .22s ease both; pointer-events: none; }
.sheet-backdrop.closing .sheet { animation: sheet-out .22s cubic-bezier(.4, 0, 1, 1) both; }
.sheet .tile { animation: rise .35s var(--ease-out) both; }
.sheet .tile:nth-child(2) { animation-delay: 30ms; }
.sheet .tile:nth-child(3) { animation-delay: 60ms; }
@media (min-width: 700px) {
  .sheet { animation-name: dialog-in; animation-duration: .26s; }
  .sheet-backdrop.closing .sheet { animation-name: dialog-out; animation-duration: .18s; }
}

/* ---------- toasts, timer, bloqueio ---------- */
@keyframes toast-in { from { opacity: 0; transform: translate3d(0, 16px, 0) scale(.94); } to { opacity: 1; transform: none; } }
.toast { animation: toast-in .38s var(--ease-spring) both; box-shadow: var(--shadow-lg); }
.toast.out { animation: fade-out .2s ease both; }
@keyframes timer-in { from { opacity: 0; transform: translate3d(0, 30px, 0) scale(.96); } to { opacity: 1; transform: none; } }
.rest-timer { animation: timer-in .4s var(--ease-spring) both; transition: background-color .4s ease; }
.rest-timer.over .clock { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.lock .keypad button { animation: rise .4s var(--ease-out) both; }

/* ---------- reduzir movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
