/* LUPA Soluções — Microinterações e animações
   Filosofia: rápido, sutil, com easing natural. Nada de bounce/wobble. */

/* ── Smooth scroll ────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ── Reduced motion: respeitamos sempre ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Focus ring acessível e discreto ─────────────────────── */
:focus-visible {
  outline: 2px solid #2c3d8c;
  outline-offset: 2px;
  border-radius: 6px;
}
button:focus-visible,
a:focus-visible {
  outline-offset: 3px;
}

/* ── Selection ────────────────────────────────────────────── */
::selection {
  background-color: rgba(44, 61, 140, 0.22);
  color: inherit;
}

/* ── Tipografia: balance pra títulos curtos ─────────────────*/
h1, h2 { text-wrap: balance; }

/* ── Entrada de página: fade subtle (todo .page-enter) ───── */
.page-enter {
  animation: lupaPageEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes lupaPageEnter {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Fade-up stagger (hero, cards iniciais) ──────────────── */
.fade-up {
  opacity: 0;
  transform: translateY(8px);
  animation: lupaFadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.fade-up-delay-1 { animation-delay: 60ms; }
.fade-up-delay-2 { animation-delay: 120ms; }
.fade-up-delay-3 { animation-delay: 180ms; }
.fade-up-delay-4 { animation-delay: 240ms; }
.fade-up-delay-5 { animation-delay: 300ms; }

@keyframes lupaFadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Card hover lift (sutil) ─────────────────────────────── */
.card-lift {
  transition:
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 180ms ease-out;
}
@media (hover: hover) and (pointer: fine) {
  .card-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -10px rgba(15, 23, 42, 0.12);
  }
  .dark .card-lift:hover {
    box-shadow: 0 6px 24px -12px rgba(0, 0, 0, 0.6);
  }
}

/* ── Button press feedback (suave) ──────────────────────── */
.btn-press {
  transition:
    transform 100ms ease-out,
    background-color 150ms ease,
    box-shadow 150ms ease,
    color 150ms ease;
  will-change: transform;
}
.btn-press:active { transform: scale(0.98); }

/* ── Theme toggle: rotação discreta ──────────────────────── */
.theme-toggle svg {
  transition: transform 350ms cubic-bezier(0.22, 1, 0.36, 1);
}
.theme-toggle:hover svg { transform: rotate(12deg); }
.theme-toggle:active svg { transform: rotate(-12deg) scale(0.92); }

/* ── HTMX loading ─────────────────────────────────────────── */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }
.htmx-request button[type="submit"] { opacity: 0.65; cursor: wait; }

/* ── Spinner pequeno ──────────────────────────────────────── */
.lupa-spinner {
  width: 1rem; height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: lupaSpin 600ms linear infinite;
  display: inline-block;
}
@keyframes lupaSpin { to { transform: rotate(360deg); } }

/* ── Bottom nav: indicador animado ───────────────────────── */
.bottom-nav-item { position: relative; transition: color 150ms ease; }
.bottom-nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: #2c3d8c;
  border-radius: 0 0 3px 3px;
  animation: lupaSlideDown 250ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes lupaSlideDown {
  from { width: 0; opacity: 0; }
  to   { width: 24px; opacity: 1; }
}

/* ── Input erro: shake breve ─────────────────────────────── */
.input-error {
  animation: lupaShake 280ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes lupaShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* ── Logo: pulse inicial discreto ─────────────────────────── */
.logo-pulse {
  animation: lupaLogoIn 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes lupaLogoIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Min touch target 44×44 (a11y) ───────────────────────── */
.tap-target { min-width: 44px; min-height: 44px; }

/* ── Line clamp helper (sem plugin) ──────────────────────── */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Scrollbar discreta (desktop) ────────────────────────── */
@media (hover: hover) {
  *::-webkit-scrollbar { width: 10px; height: 10px; }
  *::-webkit-scrollbar-track { background: transparent; }
  *::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
  }
  *::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.5); background-clip: padding-box; }
}
