/* swift_polish.css — shared AAA-feel polish for the new pages.
 *
 * Loaded by each new template via:
 *   <link rel="stylesheet" href="/static/swift_polish.css">
 *
 * Applies:
 *   - Subtle staggered entry animations on top-level main children
 *   - Spring-curve hover lifts on cards
 *   - Better keyboard-focus visibility
 *   - Smooth scrolling
 *   - prefers-reduced-motion respect
 */

@keyframes swiftFadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main > * {
  animation: swiftFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Stagger top-level elements so the page feels alive without strobing */
main > *:nth-child(1) { animation-delay: 0; }
main > *:nth-child(2) { animation-delay: 0.05s; }
main > *:nth-child(3) { animation-delay: 0.09s; }
main > *:nth-child(4) { animation-delay: 0.13s; }
main > *:nth-child(5) { animation-delay: 0.16s; }
main > *:nth-child(6) { animation-delay: 0.18s; }
main > *:nth-child(7) { animation-delay: 0.2s; }

/* Card-class hover lift — spring curve for that iOS-bouncy feel. */
.card,
.bucket-card,
.stat-card,
.count-card,
.summary-card,
.lender-card,
.notif-item,
.template-card,
.section {
  transition:
    transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.bucket-card:hover,
.template-card:hover,
.section:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

/* iOS-style tap feedback: scale slightly inward on press. */
.btn:active,
button:active,
.card-actions button:active {
  transform: scale(0.97);
  transition: transform 0.06s ease-in;
}

/* Better keyboard-focus visibility (a11y) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue, #3b82f6);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Smooth scroll within the page (e.g., when navigating anchors) */
html {
  scroll-behavior: smooth;
}

/* Spinner — used by JS loading states */
@keyframes swiftSpin {
  to { transform: rotate(360deg); }
}
.swift-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: swiftSpin 0.7s linear infinite;
  vertical-align: middle;
}

/* Skeleton loader — for cards that load async */
@keyframes swiftSkeleton {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.swift-skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: swiftSkeleton 1.5s infinite linear;
  border-radius: 4px;
}

/* Respect motion preferences */
@media (prefers-reduced-motion: reduce) {
  main > *,
  .card,
  .bucket-card,
  .stat-card,
  .count-card,
  .summary-card,
  .lender-card,
  .notif-item,
  .template-card,
  .section,
  .btn:active,
  button:active {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}
