/* Finetabz site motion layer: the same language as the promo video.
 * Living background, word-by-word headlines, scroll choreography, floating UI chips,
 * live AI demos. Everything here is decoration; with reduced motion it all stands still. */

/* ---------- Living background (canvas drawn by motion.js) ---------- */
#fx-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.motion main, .motion .site-footer { position: relative; z-index: 1; }
.motion .hero, .motion .page-hero { background: transparent; }
.motion body { background: var(--ground); }

/* ---------- Scroll progress + glass header ---------- */
#fx-progress { position: absolute; left: 0; bottom: -1px; height: 3px; width: 100%; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, #14896f, #4fd1a8 50%, #f4a62a); box-shadow: 0 0 12px rgba(79, 209, 168, .6); }
.site-header { transition: background-color .3s, box-shadow .3s; }
.motion .site-header.scrolled { background: rgba(255, 255, 255, .72); box-shadow: 0 10px 30px rgba(16, 25, 21, .08); }

/* ---------- Headlines: words rise out of a mask ---------- */
.sw { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.sw > span { display: inline-block; transform: translateY(110%); transition: transform .9s cubic-bezier(.16, 1, .3, 1); transition-delay: calc(var(--w, 0) * 55ms + 80ms); }
.split-in .sw > span { transform: none; }

/* ---------- Scroll reveal ---------- */
.rv { opacity: 0; transform: translateY(34px) scale(.98); transition: opacity .8s cubic-bezier(.16, 1, .3, 1), transform .9s cubic-bezier(.16, 1, .3, 1);
  transition-delay: calc(var(--i, 0) * 80ms); will-change: transform, opacity; }
.rv.in { opacity: 1; transform: none; }
.rv-pop { transform: scale(.86); }
.rv-left { transform: translateX(-46px); }
.rv-right { transform: translateX(46px); }

/* ---------- Hero ---------- */
.hero-stage { perspective: 1600px; }
.hero-stage .terminal { transform-style: preserve-3d; transition: transform .25s ease-out; }
.hero-stage .terminal-screen, .page-terminal .terminal-screen { position: relative; overflow: hidden; }
.hero-stage .terminal-screen::after, .page-terminal .terminal-screen::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .28) 50%, transparent 62%); background-size: 260% 100%;
  animation: glint 6s ease-in-out 1.2s infinite; mix-blend-mode: screen; }
@keyframes glint { 0%, 55% { background-position: 140% 0; } 85%, 100% { background-position: -40% 0; } }
.hero-orb { position: absolute; z-index: -1; left: 30%; top: 8%; width: 70%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 209, 168, .38), rgba(20, 137, 111, .12) 45%, transparent 70%); filter: blur(6px); animation: orb 9s ease-in-out infinite; }
@keyframes orb { 50% { transform: translate(-4%, 5%) scale(1.08); } }
.float-chip { position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: 9px; white-space: nowrap;
  padding: 9px 15px 9px 9px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--ink);
  font-size: 13.5px; font-weight: 800; box-shadow: 0 16px 36px rgba(16, 25, 21, .14), 0 2px 6px rgba(16, 25, 21, .06);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: bob 5s ease-in-out infinite; }
.float-chip .fc-ic { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; background: var(--brand-soft); color: var(--brand); }
.float-chip.saff .fc-ic { background: var(--amber-soft); color: var(--amber-text); }
.fc-1 { right: -2%; top: 30px; animation-delay: -1s; }
.fc-2 { right: 4%; top: 48%; animation-delay: -2.6s; }
.fc-3 { left: 34%; bottom: -26px; animation-delay: -3.8s; }
@keyframes bob { 50% { translate: 0 -10px; } }
.fc-wrap { position: absolute; inset: 0; pointer-events: none; transition: transform .3s ease-out; }
@media (max-width: 999px) { .fc-2 { display: none; } .fc-1 { right: 0; top: 6px; } }
@media (max-width: 520px) { .float-chip { font-size: 11.5px; padding: 6px 11px 6px 6px; } .float-chip .fc-ic { width: 22px; height: 22px; } .fc-3 { left: 30%; bottom: -34px; } }

/* ---------- Strip: a moving ticker ---------- */
.motion .strip { overflow: hidden; }
.motion .strip-row { display: flex; width: max-content; max-width: none; gap: 56px; padding-inline: 28px; animation: ticker 30s linear infinite; }
.motion .strip-row li { flex: none; font-size: 16px; }
.motion .strip:hover .strip-row { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ---------- Promo: a glowing, turning frame ---------- */
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.promo-frame { isolation: isolate; }
.promo-glow { position: relative; max-width: 1188px; margin: 0 auto; padding: 4px; border-radius: 32px;
  background: conic-gradient(from var(--ang), #14896f, #4fd1a8, #f4a62a, #14896f 60%, #4fd1a8, #14896f); animation: spin 8s linear infinite; }
.promo-glow::before { content: ''; position: absolute; inset: 10px; z-index: -1; border-radius: 40px; background: inherit; filter: blur(34px); opacity: .55; }
.promo-glow .promo-frame { box-shadow: none; }
@keyframes spin { to { --ang: 360deg; } }
@media (max-width: 640px) { .promo-glow { border-radius: 21px; padding: 3px; } }

/* ---------- Cards: a light that follows the cursor ---------- */
.spot { position: relative; isolation: isolate; transition: transform .35s cubic-bezier(.16, 1, .3, 1), box-shadow .35s; }
.spot::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(79, 209, 168, .16), transparent 45%); }
.spot:hover::after { opacity: 1; }
.spot:hover { box-shadow: 0 26px 60px rgba(16, 25, 21, .12); }
.btn-primary, .btn-accent { position: relative; overflow: hidden; }
.btn-primary::after, .btn-accent::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%); background-size: 250% 100%; background-position: 160% 0; }
.btn-primary:hover::after, .btn-accent:hover::after { transition: background-position .8s ease; background-position: -60% 0; }
.btn { transition: background-color .15s, border-color .15s, transform .25s cubic-bezier(.16, 1, .3, 1), box-shadow .15s; }

/* ---------- Offline timeline: the line draws, the dots light up ---------- */
.motion .timeline li::before { transform: scale(0); transition: transform .5s cubic-bezier(.34, 1.56, .64, 1); transition-delay: calc(var(--i, 0) * 350ms + 200ms); }
.motion .timeline.in li::before { transform: scale(1); }
.motion .timeline li:not(:last-child)::after { transform-origin: top; transform: scaleY(0); transition: transform .5s ease; transition-delay: calc(var(--i, 0) * 350ms + 450ms); }
.motion .timeline.in li:not(:last-child)::after { transform: scaleY(1); }
.motion .timeline.in .t-ok::before { animation: pulse 2s ease-out 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(79, 209, 168, .55); } 100% { box-shadow: 0 0 0 16px rgba(79, 209, 168, 0); } }

/* ---------- Built-in AI: three live demos ---------- */
.ai-sec { position: relative; }
.ai-grid { display: grid; gap: 22px; }
.ai-card { background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 18px 18px 26px; overflow: hidden; }
.ai-card h3 { font-size: 21px; margin: 22px 8px 6px; }
.ai-card p { margin: 0 8px; color: var(--ink-2); font-size: 15.5px; }
.ai-demo { position: relative; height: 270px; border-radius: 20px; background: #f6f4ee; overflow: hidden;
  background-image: radial-gradient(rgba(16, 25, 21, .08) 1.2px, transparent 1.3px); background-size: 18px 18px; }
.ai-demo * { animation-play-state: paused !important; }
.ai-card.in .ai-demo * { animation-play-state: running !important; }
.ai-badge { position: absolute; left: 12px; top: 12px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: #fff; font-size: 12px; font-weight: 800; color: var(--amber-text); box-shadow: 0 6px 16px rgba(16, 25, 21, .08); }
/* invoice */
.db-cam { position: absolute; left: 14px; top: 46px; width: 38%; bottom: 14px; border-radius: 16px; background: #0e1b18; overflow: hidden; }
.db-paper { position: absolute; left: 12%; right: 12%; top: 12%; bottom: 12%; background: #fbfaf6; border-radius: 4px; transform: rotate(-3deg); padding: 10px 9px;
  font-family: var(--font-num); font-size: 8.5px; line-height: 1.5; color: #3d4844; display: flex; flex-direction: column; gap: 6px; }
.db-paper b { font-size: 8.5px; }
.db-paper i { display: block; height: 5px; border-radius: 3px; background: #d8d4ca; }
.db-paper i:nth-child(odd) { width: 80%; }
.db-beam { position: absolute; left: 6px; right: 6px; height: 40px; top: -40px; background: linear-gradient(180deg, rgba(79, 209, 168, 0), rgba(79, 209, 168, .4)); border-bottom: 2px solid #5fe0b8;
  box-shadow: 0 4px 12px rgba(95, 224, 184, .7); animation: beam 6s ease-in-out infinite; }
@keyframes beam { 0% { top: -40px; opacity: 0; } 6% { opacity: 1; } 34% { top: 100%; opacity: 1; } 38%, 100% { top: 100%; opacity: 0; } }
.db-table { position: absolute; left: calc(38% + 28px); right: 14px; top: 46px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.db-h { font-size: 12px; font-weight: 800; color: var(--ink-2); margin-bottom: 2px; }
.db-row, .db-tot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; background: #fff; border-radius: 10px; padding: 7px 9px;
  opacity: 0; animation: rowin 6s cubic-bezier(.16, 1, .3, 1) infinite; animation-delay: calc(var(--d) * 300ms); }
.db-row span, .db-tot span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-row em { font-style: normal; font-size: 10.5px; color: var(--brand); background: var(--brand-soft); padding: 2px 6px; border-radius: 999px; }
.db-tot { background: var(--brand); color: #fff; margin-top: auto; }
@keyframes rowin { 0%, 22% { opacity: 0; transform: translateX(-26px); } 30%, 88% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: none; } }
/* ask */
.da-in { position: absolute; left: 14px; right: 14px; top: 46px; height: 40px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line);
  display: flex; align-items: center; padding: 0 12px; font-size: 13px; font-weight: 700; overflow: hidden; }
.da-type { display: inline-block; white-space: nowrap; overflow: hidden; width: 0; border-right: 2px solid var(--brand); animation: type 7s steps(25) infinite; }
@keyframes type { 0%, 4% { width: 0; } 26%, 30% { width: 25ch; } 31%, 100% { width: 0; border-color: transparent; } }
.da-q { position: absolute; right: 14px; top: 98px; background: var(--brand); color: #fff; font-size: 12.5px; font-weight: 700; padding: 8px 12px; border-radius: 14px 14px 4px 14px;
  opacity: 0; animation: qin 7s ease infinite; }
@keyframes qin { 0%, 30% { opacity: 0; transform: translateY(8px); } 34%, 92% { opacity: 1; transform: none; } 98%, 100% { opacity: 0; } }
.da-a { position: absolute; left: 14px; right: 14px; top: 140px; bottom: 14px; background: #fff; border-radius: 14px 14px 14px 4px; padding: 10px 12px;
  font-size: 12.5px; font-weight: 600; opacity: 0; animation: ain 7s ease infinite; }
@keyframes ain { 0%, 40% { opacity: 0; transform: translateY(10px); } 45%, 92% { opacity: 1; transform: none; } 98%, 100% { opacity: 0; } }
.da-bar { display: grid; grid-template-columns: 84px 1fr 22px; align-items: center; gap: 8px; margin-top: 7px; font-size: 11.5px; font-weight: 700; }
.da-bar i { display: block; height: 10px; border-radius: 5px; background: var(--c); width: 0; animation: bar 7s cubic-bezier(.16, 1, .3, 1) infinite; animation-delay: calc(var(--d) * 150ms); }
@keyframes bar { 0%, 47% { width: 0; } 60%, 92% { width: var(--w); } 100% { width: var(--w); } }
/* room */
.dr-photo { position: absolute; left: 14px; top: 46px; bottom: 14px; width: 44%; border-radius: 14px; overflow: hidden; }
.dr-photo img { width: 100%; height: 100%; object-fit: cover; }
.dr-photo::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(95, 224, 184, .6) 1px, transparent 1px), linear-gradient(90deg, rgba(95, 224, 184, .6) 1px, transparent 1px);
  background-size: 22px 22px; opacity: 0; animation: grid 6s ease infinite; }
.dr-photo::after { content: ''; position: absolute; left: 0; right: 0; height: 50px; top: -50px; background: linear-gradient(180deg, rgba(20, 137, 111, 0), rgba(20, 137, 111, .5)); border-bottom: 2px solid #5fe0b8; animation: beam 6s ease-in-out infinite; }
@keyframes grid { 0%, 4% { opacity: 0; } 12%, 34% { opacity: .9; } 44%, 100% { opacity: 0; } }
.dr-plan { position: absolute; right: 14px; top: 46px; bottom: 14px; width: calc(56% - 42px); border-radius: 14px; background: #f1f8f5; border: 1.5px solid #d6ece4;
  background-image: linear-gradient(#e1f0ea 1px, transparent 1px), linear-gradient(90deg, #e1f0ea 1px, transparent 1px); background-size: 16px 16px; }
.dr-plan i { position: absolute; width: 22%; aspect-ratio: 1; border-radius: 50%; background: #fff; border: 2.5px solid var(--brand); box-shadow: 0 0 0 5px #bfe3d7;
  transform: scale(0); animation: tpop 6s cubic-bezier(.34, 1.56, .64, 1) infinite; animation-delay: calc(var(--d) * 120ms); }
.dr-plan i.sq { border-radius: 6px; }
@keyframes tpop { 0%, 38% { transform: scale(0); } 46%, 90% { transform: scale(1); } 97%, 100% { transform: scale(0); } }
.ai-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
.ai-more li { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 800; font-size: 14px; }
.ai-more li::before { content: '✦'; color: var(--saffron); }
@media (min-width: 900px) { .ai-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Cursor glow (desktop) ---------- */
#fx-cursor { position: fixed; left: 0; top: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%; pointer-events: none; z-index: 0;
  background: radial-gradient(circle, rgba(79, 209, 168, .14), transparent 60%); transition: opacity .4s; opacity: 0; }

/* ---------- Reduced motion: everything stands still and visible ---------- */
@media (prefers-reduced-motion: reduce) {
  .rv, .sw > span { opacity: 1 !important; transform: none !important; transition: none !important; }
  .float-chip, .hero-orb, .promo-glow, .motion .strip-row, .hero-stage .terminal-screen::after, .page-terminal .terminal-screen::after { animation: none !important; }
  .ai-demo * { animation: none !important; opacity: 1 !important; transform: none !important; }
  .db-beam, .dr-photo::after, .dr-photo::before { display: none; }
  .da-type { width: auto; border: 0; } .da-bar i { width: var(--w); }
  #fx-cursor { display: none; }
}
