/* GearRoom motion: calm, Apple-like movement layered over style.css. */
:root {
  --ease-out: cubic-bezier(.22,1,.36,1);
  --ease-spring: cubic-bezier(.34,1.4,.64,1);
  --ease-in: cubic-bezier(.4,0,1,1);
  --dur-1: 120ms;
  --dur-2: 220ms;
  --dur-3: 380ms;
}

/* Page enter: children rise in, staggered. */
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } }
.page-enter > * { animation: rise-in var(--dur-3) var(--ease-out) both; }
.page-enter > :nth-child(1) { animation-delay: 0ms; }
.page-enter > :nth-child(2) { animation-delay: 30ms; }
.page-enter > :nth-child(3) { animation-delay: 60ms; }
.page-enter > :nth-child(4) { animation-delay: 90ms; }
.page-enter > :nth-child(5) { animation-delay: 120ms; }
.page-enter > :nth-child(6) { animation-delay: 150ms; }
.page-enter > :nth-child(7) { animation-delay: 180ms; }
.page-enter > :nth-child(8) { animation-delay: 210ms; }
.page-enter .gear-grid > *, .page-enter .grid.stats > * { animation: rise-in var(--dur-3) var(--ease-out) both; }
.page-enter .gear-grid > :nth-child(1), .page-enter .grid.stats > :nth-child(1) { animation-delay: 0ms; }
.page-enter .gear-grid > :nth-child(2), .page-enter .grid.stats > :nth-child(2) { animation-delay: 25ms; }
.page-enter .gear-grid > :nth-child(3), .page-enter .grid.stats > :nth-child(3) { animation-delay: 50ms; }
.page-enter .gear-grid > :nth-child(4), .page-enter .grid.stats > :nth-child(4) { animation-delay: 75ms; }
.page-enter .gear-grid > :nth-child(5), .page-enter .grid.stats > :nth-child(5) { animation-delay: 100ms; }
.page-enter .gear-grid > :nth-child(6), .page-enter .grid.stats > :nth-child(6) { animation-delay: 125ms; }
.page-enter .gear-grid > :nth-child(7), .page-enter .grid.stats > :nth-child(7) { animation-delay: 150ms; }
.page-enter .gear-grid > :nth-child(8), .page-enter .grid.stats > :nth-child(8) { animation-delay: 175ms; }
.page-enter .gear-grid > :nth-child(9), .page-enter .grid.stats > :nth-child(9) { animation-delay: 200ms; }
.page-enter .gear-grid > :nth-child(10), .page-enter .grid.stats > :nth-child(10) { animation-delay: 225ms; }
.page-enter .gear-grid > :nth-child(11), .page-enter .grid.stats > :nth-child(11) { animation-delay: 250ms; }
.page-enter .gear-grid > :nth-child(12), .page-enter .grid.stats > :nth-child(12) { animation-delay: 275ms; }

/* Modals: backdrop fades, panel springs. */
@keyframes ov-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(.96); } }
@keyframes ov-out { to { opacity: 0; } }
@keyframes modal-out { to { opacity: 0; transform: scale(.97); } }
.overlay {
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  backdrop-filter: blur(6px) saturate(140%);
  animation: ov-in var(--dur-2) var(--ease-out);
}
.overlay .modal { animation: modal-in var(--dur-3) var(--ease-spring); }
.overlay.closing { animation: ov-out var(--dur-2) var(--ease-in) forwards; }
.overlay.closing .modal { animation: modal-out var(--dur-2) var(--ease-in) forwards; }

/* Toasts: spring in from the right, slide out again. */
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
.toast { animation: toast-in var(--dur-2) var(--ease-spring); }
.toast.leaving { animation: toast-out var(--dur-2) var(--ease-in) forwards; }

/* Buttons: snappy press, soft glow on primary. */
.btn { transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }

/* Cards: gentle lift on hover. */
.card { transition: box-shadow var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out); }
a.card:hover, .card.hoverable:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(16,24,40,.14); }

/* Photo cards: lift, photo breathes, selection ring. */
.gcard { transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out); }
.gcard:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(16,24,40,.12); }
.gcard-photo img { transition: transform var(--dur-3) var(--ease-out); }
.gcard:hover .gcard-photo img { transform: scale(1.04); }
.gcard.is-selected { box-shadow: 0 0 0 2px var(--accent); }

/* Nav and tabs: soft colour shifts. */
.nav a, .tabs a, .tabs button { transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out); }

/* Inputs: focus ring glows in. */
input, select, textarea { transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }

/* Skeleton: quiet shimmer while data loads. */
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--gray-soft), color-mix(in srgb, var(--gray-soft) 50%, var(--panel)), var(--gray-soft));
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}

/* Pills and table rows: colour fades. */
.pill { transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out); }
tbody tr { transition: background-color var(--dur-1) var(--ease-out); }

/* Stat numbers: stable width while counting. */
.stat-num { font-variant-numeric: tabular-nums; }

/* Reduced motion: everything settles instantly. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .btn:active:not(:disabled), a.card:hover, .card.hoverable:hover, .gcard:hover { transform: none !important; }
}

/* Phones: dialogs are bottom sheets, so they slide up and back down. */
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@media (max-width: 860px) {
  .overlay .modal { animation: sheet-up var(--dur-3) var(--ease-out) both; }
  .overlay.closing .modal { animation: sheet-down var(--dur-2) var(--ease-in) forwards; }
}
@media (prefers-reduced-motion: reduce) {
  .overlay .modal, .overlay.closing .modal { animation-duration: .01ms; }
}
