/* TidyTuck animated phone: real app screens cycling inside a phone, with floating cards that match
   each moment. Pure CSS, silent, 18 s loop (6 screens x 3 s). Used on the home page and tidytuck.html.
   Only transform and opacity animate, so everything runs on the GPU. */
.tt-demo { --loop: 18s; --ease: cubic-bezier(0.45, 0.05, 0.25, 1); position: relative; width: 520px; max-width: 100%; height: 660px; margin: 0 auto;
  font-family: inherit; color: #1b2230; }

/* Soft light behind the phone: a gradient that is fully transparent before its own edge, so nothing can cut it off */
.tt-demo-glow { position: absolute; inset: -30px -70px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(140, 120, 217, 0.5) 25%, rgba(128, 136, 221, 0.36) 45%, rgba(114, 152, 225, 0.2) 63%,
    rgba(107, 162, 227, 0.09) 79%, rgba(105, 165, 227, 0.03) 90%, rgba(105, 165, 227, 0) 100%); }

.tt-phone { position: absolute; left: 50%; top: 18px; width: 300px; padding: 12px; margin-left: -150px; border-radius: 50px; background: #1b1d22;
  box-shadow: 0 40px 80px rgba(27, 34, 48, 0.28), inset 0 0 0 2px #3a3d45; will-change: transform;
  animation: ttFloat 8s ease-in-out infinite; }
@keyframes ttFloat { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -10px, 0); } }

.tt-screen { position: relative; width: 276px; aspect-ratio: 1320 / 2868; border-radius: 38px; overflow: hidden; background: #f2f2f7; transform: translateZ(0); }
/* Each screen fades in on top of the one before, which only fades out once it is covered: no flash between screens */
.tt-screen .scr { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; will-change: opacity, transform;
  animation: ttScreen var(--loop) infinite; animation-delay: var(--d); }
@keyframes ttScreen {
  0% { opacity: 0; transform: scale(1.025); animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1); }
  4% { opacity: 1; transform: scale(1); }
  21% { opacity: 1; transform: scale(1); animation-timing-function: ease-in-out; }
  24.5% { opacity: 0; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}

/* Taps on the real screen: + on home, then Search my iPhone */
.tt-screen .tap { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; opacity: 0; will-change: transform, opacity;
  border: 3px solid rgba(58, 109, 176, 0.9); background: rgba(255, 255, 255, 0.5); animation: var(--a) var(--loop) infinite; }
.tt-screen .t1 { left: 50%; top: 95.4%; --a: ttTap1; }
.tt-screen .t2 { left: 50%; top: 54.6%; --a: ttTap2; }
@keyframes ttTap1 { 0%, 11% { opacity: 0; transform: scale(0.5); } 12.5% { opacity: 1; transform: scale(0.7); animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1); }
  16.5% { opacity: 0; transform: scale(1.7); } 100% { opacity: 0; transform: scale(1.7); } }
@keyframes ttTap2 { 0%, 27.5% { opacity: 0; transform: scale(0.5); } 29% { opacity: 1; transform: scale(0.7); animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1); }
  33% { opacity: 0; transform: scale(1.7); } 100% { opacity: 0; transform: scale(1.7); } }

/* Floating cards around the phone */
.tt-demo .fl { position: absolute; opacity: 0; will-change: transform, opacity; backface-visibility: hidden;
  animation: var(--a) var(--loop) var(--ease) infinite; }
.fl-card { background: rgba(255, 255, 255, 0.97); border-radius: 18px; box-shadow: 0 16px 36px rgba(27, 34, 48, 0.15), 0 0 0 1px rgba(27, 34, 48, 0.05); }

/* 6–9 s: receipts from the photo library glide into the phone */
.fl-rc { width: 92px; padding: 10px 10px 16px; background: #fffdf8; font: 600 7.5px ui-monospace, Menlo, monospace; color: #444; line-height: 1.5;
  box-shadow: 0 10px 22px rgba(27, 34, 48, 0.16); clip-path: polygon(0 0, 100% 0, 100% 94%, 90% 100%, 80% 94%, 70% 100%, 60% 94%, 50% 100%, 40% 94%, 30% 100%, 20% 94%, 10% 100%, 0 94%); }
.fl-rc b { display: block; font: 800 8.5px -apple-system, system-ui, sans-serif; letter-spacing: 0.08em; text-align: center; margin-bottom: 3px; color: #1b2230; }
.fl-rc i { display: block; height: 10px; margin-top: 5px; background: repeating-linear-gradient(90deg, #333 0 1.5px, transparent 1.5px 3px, #333 3px 4px, transparent 4px 6px); }
.fl-rc.r1 { left: 0; top: 150px; --a: ttRc1; }
.fl-rc.r2 { left: 18px; top: 300px; --a: ttRc2; }
.fl-rc.r3 { left: -6px; top: 440px; --a: ttRc3; }
@keyframes ttRc1 { 0%, 32% { opacity: 0; transform: translate3d(-34px, 8px, 0) rotate(-14deg); } 36% { opacity: 1; transform: translate3d(0, 0, 0) rotate(-10deg); }
  38.5% { opacity: 1; transform: translate3d(8px, 3px, 0) rotate(-8deg); } 45.5% { opacity: 0.85; transform: translate3d(150px, 60px, 0) rotate(8deg) scale(0.5); }
  48%, 100% { opacity: 0; transform: translate3d(166px, 66px, 0) rotate(10deg) scale(0.34); } }
@keyframes ttRc2 { 0%, 34% { opacity: 0; transform: translate3d(-34px, -6px, 0) rotate(10deg); } 38% { opacity: 1; transform: translate3d(0, 0, 0) rotate(6deg); }
  40.5% { opacity: 1; transform: translate3d(8px, -1px, 0) rotate(4deg); } 47.5% { opacity: 0.85; transform: translate3d(140px, -20px, 0) rotate(-6deg) scale(0.5); }
  50%, 100% { opacity: 0; transform: translate3d(156px, -24px, 0) rotate(-8deg) scale(0.34); } }
@keyframes ttRc3 { 0%, 36% { opacity: 0; transform: translate3d(-34px, 6px, 0) rotate(-6deg); } 40% { opacity: 1; transform: translate3d(0, 0, 0) rotate(-12deg); }
  42.5% { opacity: 1; transform: translate3d(8px, -4px, 0) rotate(-10deg); } 49.5% { opacity: 0.85; transform: translate3d(160px, -110px, 0) rotate(6deg) scale(0.5); }
  52%, 100% { opacity: 0; transform: translate3d(176px, -120px, 0) rotate(8deg) scale(0.34); } }

/* 9–12 s: the total lands beside the phone */
.fl-count { right: -8px; top: 230px; display: flex; align-items: center; gap: 10px; padding: 12px 16px; --a: ttCount; }
.fl-count strong { font-size: 34px; letter-spacing: -0.04em; line-height: 1; background: linear-gradient(100deg, #69a5e3, #3a6db0 45%, #8c78d9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.fl-count span { font-size: 13px; font-weight: 700; line-height: 1.2; }
@keyframes ttCount { 0%, 51% { opacity: 0; transform: translate3d(26px, 0, 0) scale(0.9); } 55.5% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  63.5% { opacity: 1; transform: translate3d(0, -4px, 0) scale(1); } 67.5%, 100% { opacity: 0; transform: translate3d(0, -14px, 0) scale(0.98); } }

/* 12–15 s: the details glide onto the item page, and the return window pops out */
.fl-chip { left: -10px; display: flex; gap: 8px; align-items: baseline; padding: 9px 13px; font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.fl-chip small { font-size: 9.5px; letter-spacing: 0.12em; color: #3a6db0; }
.fl-chip.c1 { top: 360px; --a: ttChip1; }
.fl-chip.c2 { top: 410px; --a: ttChip2; }
.fl-chip.c3 { top: 460px; --a: ttChip3; }
@keyframes ttChip1 { 0%, 66% { opacity: 0; transform: translate3d(-34px, 0, 0); } 69.5% { opacity: 1; transform: translate3d(0, 0, 0); }
  71.5% { opacity: 1; transform: translate3d(6px, 0, 0); } 76.5% { opacity: 0.9; transform: translate3d(130px, 6px, 0) scale(0.85); }
  79%, 100% { opacity: 0; transform: translate3d(148px, 6px, 0) scale(0.72); } }
@keyframes ttChip2 { 0%, 67.5% { opacity: 0; transform: translate3d(-34px, 0, 0); } 71% { opacity: 1; transform: translate3d(0, 0, 0); }
  73% { opacity: 1; transform: translate3d(6px, 0, 0); } 78% { opacity: 0.9; transform: translate3d(130px, 6px, 0) scale(0.85); }
  80.5%, 100% { opacity: 0; transform: translate3d(148px, 6px, 0) scale(0.72); } }
@keyframes ttChip3 { 0%, 69% { opacity: 0; transform: translate3d(-34px, 0, 0); } 72.5% { opacity: 1; transform: translate3d(0, 0, 0); }
  74.5% { opacity: 1; transform: translate3d(6px, 0, 0); } 79.5% { opacity: 0.9; transform: translate3d(130px, 6px, 0) scale(0.85); }
  82%, 100% { opacity: 0; transform: translate3d(148px, 6px, 0) scale(0.72); } }
.fl-days { right: -14px; top: 300px; padding: 14px 18px; border-radius: 20px; color: #fff; background: linear-gradient(120deg, #69a5e3, #8c78d9);
  box-shadow: 0 18px 36px rgba(140, 120, 217, 0.36); --a: ttDays; }
.fl-days b { display: block; font-size: 24px; letter-spacing: -0.03em; line-height: 1.05; }
.fl-days span { font-size: 12px; font-weight: 600; opacity: 0.92; }
@keyframes ttDays { 0%, 70% { opacity: 0; transform: translate3d(0, 10px, 0) scale(0.82) rotate(-7deg); } 74.5% { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(-4deg); }
  81% { opacity: 1; transform: translate3d(0, -3px, 0) scale(1) rotate(-4deg); } 85%, 100% { opacity: 0; transform: translate3d(0, -12px, 0) scale(0.97) rotate(-4deg); } }

/* 15–18 s: a reminder arrives */
.fl-note { right: -20px; top: 70px; width: 250px; display: flex; gap: 10px; align-items: center; padding: 11px 13px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.97); --a: ttNote; }
.fl-note img { width: 34px; height: 34px; border-radius: 8px; }
.fl-note div { font-size: 11px; line-height: 1.3; color: #5d6676; }
.fl-note div b { display: block; color: #1b2230; font-size: 12.5px; }
@keyframes ttNote { 0%, 84.5% { opacity: 0; transform: translate3d(0, -26px, 0) scale(0.97); } 89% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  96% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } 99.5%, 100% { opacity: 0; transform: translate3d(0, -12px, 0) scale(0.99); } }

/* The cards reach a little past the demo; clip sideways overflow at the page edge, never at the section */
body { overflow-x: clip; }

/* Phones: scale the whole scene (zoom also shrinks its layout box) */
@media (max-width: 600px) {
  .tt-demo { width: 420px; zoom: 0.8; }
}
@media (max-width: 380px) { .tt-demo { zoom: 0.74; } }
@media (prefers-reduced-motion: reduce) {
  .tt-demo *, .tt-phone { animation: none !important; }
  .tt-screen .scr:first-of-type { opacity: 1; }
  .tt-demo .fl { display: none; }
}
@media (prefers-color-scheme: dark) {
  .fl-card { background: rgba(32, 38, 52, 0.97); box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06); color: #eef1f6; }
  .fl-chip small { color: #9cc6f0; }
  .fl-note { background: rgba(32, 38, 52, 0.97); }
  .fl-note div { color: #aab4c3; }
  .fl-note div b { color: #eef1f6; }
}
