/* ═══════════════════════════════════════════════════════════════
   WENSIE POLISH LAYER — world-class motion, depth & micro-detail
   Loaded last; refines landing, auth, and app flows.
   ═══════════════════════════════════════════════════════════════ */

/* ── Global refinements ───────────────────────────────────────── */
::selection { background: rgba(255,107,71,0.22); color: var(--navy); }

body {
  text-rendering: optimizeLegibility;
}

/* Subtle grain for warmth on landing + auth */
.landing-only::after,
.auth-page::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

/* Focus visibility — accessible & on-brand */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── Landing hero: staggered entrance ─────────────────────────── */
@keyframes heroRise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes heroFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.hero-app .hero-eyebrow { animation: heroRise 0.6s cubic-bezier(0.22,1,0.36,1) 0.05s both; }
.hero-app h1            { animation: heroRise 0.7s cubic-bezier(0.22,1,0.36,1) 0.15s both; }
.hero-app .hero-sub     { animation: heroRise 0.7s cubic-bezier(0.22,1,0.36,1) 0.28s both; }
.hero-app .form-wrap    { animation: heroRise 0.7s cubic-bezier(0.22,1,0.36,1) 0.40s both; }
.hero-app .counter-row  { animation: heroRise 0.7s cubic-bezier(0.22,1,0.36,1) 0.52s both; }
.hero-app .hero-shops   { animation: heroFade 0.9s ease 0.70s both; }
.hero-app .floaters     { animation: heroFade 1.2s ease 0.55s both; }

/* Hero headline: tighter, more editorial */
.hero-app h1 {
  letter-spacing: -0.035em;
  font-weight: 900;
}
.hero-app h1 em {
  position: relative;
  font-style: italic;
  color: var(--coral);
}
.hero-app h1 em::after {
  content: '';
  position: absolute;
  left: -2%;
  bottom: 0.04em;
  width: 104%;
  height: 0.28em;
  background: linear-gradient(90deg, rgba(255,107,71,0.25), rgba(255,139,110,0.35));
  border-radius: 999px;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: left;
  animation: underlineSweep 0.7s cubic-bezier(0.22,1,0.36,1) 0.9s forwards;
}
@keyframes underlineSweep { to { transform: scaleX(1); } }

/* Floating product cards: gentle drift */
@keyframes floatDrift {
  0%, 100% { transform: translateY(0) rotate(var(--tilt, 0deg)); }
  50%      { transform: translateY(-10px) rotate(var(--tilt, 0deg)); }
}
.float-card { animation: floatDrift 5.5s ease-in-out infinite; }
.float-card.f1 { --tilt: -2deg; animation-delay: 0s; }
.float-card.f2 { --tilt: 1.5deg; animation-delay: 1.2s; }
.float-card.f3 { --tilt: -1deg; animation-delay: 2.4s; }
.float-card.f4 { --tilt: 2deg; animation-delay: 0.8s; }

.float-card {
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1), box-shadow 0.3s;
}
.float-card:hover {
  animation-play-state: paused;
  transform: translateY(-6px) scale(1.04) rotate(0deg) !important;
  box-shadow: 0 18px 50px rgba(26,43,74,0.18);
  z-index: 5;
}

/* Hero CTA: magnetic feel */
.btn-cta {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s;
}
.btn-cta:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 30px rgba(255,107,71,0.42);
}
.btn-cta:active { transform: translateY(0) scale(0.98); }
.btn-cta::after {
  content: '';
  position: absolute;
  top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}
.btn-cta:hover::after { left: 130%; }

/* Shop logos: marquee-feel hover lift */
.shop-logo {
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s, background 0.25s;
  cursor: default;
}
.shop-logo:hover {
  transform: translateY(-3px) scale(1.06);
  background: #fff;
  box-shadow: 0 8px 20px rgba(26,43,74,0.10);
}

/* ── Scroll-reveal (driven by delight.js) ─────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.65s cubic-bezier(0.22,1,0.36,1), transform 0.65s cubic-bezier(0.22,1,0.36,1);
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}
.reveal-stagger > * { transition-delay: calc(var(--ri, 0) * 90ms); }

/* Feature cards: lift + icon pop */
.feature-card {
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1), box-shadow 0.3s, border-color 0.3s;
}
.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 44px rgba(26,43,74,0.12);
  border-color: rgba(255,107,71,0.25);
}
.feature-card:hover .feature-emoji {
  transform: scale(1.18) rotate(-6deg);
}
.feature-emoji {
  display: inline-block;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

/* Steps: connected line + number pulse */
.step .step-number {
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s;
}
.step:hover .step-number {
  transform: scale(1.12);
  box-shadow: 0 8px 24px rgba(255,107,71,0.35);
}

/* ── Auth page: cinematic entrance ────────────────────────────── */
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-card {
  animation: authCardIn 0.55s cubic-bezier(0.22,1,0.36,1) both;
  position: relative;
  z-index: 2;
}
.auth-card > * { animation: heroRise 0.5s cubic-bezier(0.22,1,0.36,1) both; }
.auth-card > *:nth-child(1) { animation-delay: 0.08s; }
.auth-card > *:nth-child(2) { animation-delay: 0.13s; }
.auth-card > *:nth-child(3) { animation-delay: 0.18s; }
.auth-card > *:nth-child(4) { animation-delay: 0.23s; }
.auth-card > *:nth-child(5) { animation-delay: 0.28s; }
.auth-card > *:nth-child(6) { animation-delay: 0.33s; }
.auth-card > *:nth-child(7) { animation-delay: 0.38s; }
.auth-card > *:nth-child(8) { animation-delay: 0.43s; }
.auth-card > *:nth-child(9) { animation-delay: 0.48s; }

/* Inputs: refined focus ring */
.auth-card input,
.create-form input,
.create-form textarea,
.input-group input,
.input-group textarea {
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.auth-card input:focus,
.create-form input:focus,
.create-form textarea:focus,
.input-group input:focus,
.input-group textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(255,107,71,0.12);
  background: #fff;
  outline: none;
}

/* ── App-wide: page transitions & micro-interactions ──────────── */
/* app-additions.css owns the .app-main page transition (appMainSlide).
   No additional transform-based animation here to avoid conflicting rules. */

/* Buttons: tactile press everywhere */
.app-mode .btn {
  transition: transform 0.15s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
}
.app-mode .btn:hover { transform: translateY(-1px); }
.app-mode .btn:active { transform: translateY(1px) scale(0.98); }
.app-mode .btn-primary:hover { box-shadow: 0 6px 18px rgba(255,107,71,0.35); }

/* FAB: breathe + pop */
@keyframes fabBreathe {
  0%, 100% { box-shadow: 0 6px 20px rgba(255,107,71,0.40); }
  50%      { box-shadow: 0 6px 28px rgba(255,107,71,0.60); }
}
.fab {
  animation: fabBreathe 2.6s ease-in-out infinite;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.fab:hover { transform: scale(1.1) rotate(90deg); }
.fab:active { transform: scale(0.94); }

/* Item rows: smooth hover */
.item-row, .all-item-row {
  transition: transform 0.2s cubic-bezier(0.22,1,0.36,1), box-shadow 0.2s, border-color 0.2s;
}
.item-row:hover, .all-item-row:hover {
  transform: translateX(3px);
  box-shadow: 0 6px 18px rgba(26,43,74,0.08);
}

/* Occasion picker: springy selection */
.occ-opt .occ-box {
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.occ-opt:hover .occ-box { transform: translateY(-3px); }
.occ-opt input:checked + .occ-box {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 22px rgba(255,107,71,0.25);
}
.occ-opt .occ-icon {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.occ-opt input:checked + .occ-box .occ-icon { transform: scale(1.25) rotate(-8deg); }

/* Priority options: same springy feel */
.prio-opt .prio-box { transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s; }
.prio-opt:hover .prio-box { transform: translateY(-2px); }
.prio-opt input:checked + .prio-box { transform: translateY(-2px) scale(1.03); box-shadow: 0 6px 16px rgba(26,43,74,0.12); }

/* Flow tabs: sliding underline feel */
.flow-tab {
  position: relative;
  transition: color 0.2s, background 0.25s, transform 0.15s;
}
.flow-tab:active { transform: scale(0.97); }

/* Toast: bouncier entrance */
@keyframes toastPop {
  0%   { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.92); }
  60%  { opacity: 1; transform: translateX(-50%) translateY(-4px) scale(1.02); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.toast.show { animation: toastPop 0.45s cubic-bezier(0.34,1.56,0.64,1) both; }

/* Modal: spring in */
.modal-overlay.show .modal-sheet {
  animation: modalSpring 0.4s cubic-bezier(0.34,1.4,0.64,1) both;
}
@keyframes modalSpring {
  from { opacity: 0; transform: translateY(36px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Progress bars: shimmer while filling */
.progress-fill {
  position: relative;
  overflow: hidden;
  transition: width 0.6s cubic-bezier(0.22,1,0.36,1);
}
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
  animation: shimmer 1.8s ease-in-out infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(200%); }
}

/* Empty states: gentle bob on icon */
@keyframes emptyBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.empty-state .es-icon {
  display: inline-block;
  animation: emptyBob 2.8s ease-in-out infinite;
}

/* Claimed badge: satisfying pop when appearing */
@keyframes claimPop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.claimed-badge { animation: claimPop 0.4s cubic-bezier(0.34,1.56,0.64,1) both; }

/* Skeleton shimmer for loading states */
.skeleton {
  background: linear-gradient(90deg, #f1f0ee 25%, #faf9f7 50%, #f1f0ee 75%);
  background-size: 200% 100%;
  animation: skeletonWave 1.4s ease-in-out infinite;
  border-radius: 10px;
}
@keyframes skeletonWave {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Bottom nav active: springy icon */
.nav-item .ni { transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1); }
.nav-item:active .ni { transform: scale(0.85); }
.nav-item.active .ni { transform: translateY(-2px) scale(1.12); }

/* Share nudge banner */
@keyframes nudgeIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.share-nudge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(120deg, #FFF5F0 0%, #FFEDE5 100%);
  border: 1.5px solid rgba(255,107,71,0.25);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 14px 0;
  animation: nudgeIn 0.5s cubic-bezier(0.22,1,0.36,1) both;
}
.share-nudge .sn-emoji { font-size: 28px; flex-shrink: 0; }
.share-nudge .sn-body { flex: 1; }
.share-nudge .sn-body strong { display: block; color: var(--navy); font-size: 14px; }
.share-nudge .sn-body p { margin: 0; font-size: 13px; color: var(--muted); }

/* Reduced motion: respect user preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
