/* =============================================================
   Monisy - Global animation system
   Respects existing design tokens (aurora orbs, glassmorphism,
   cyan/purple/pink/blue palette). Pure transform + opacity
   animations, GPU-accelerated.
   ============================================================= */

/* --- A) SCROLL REVEAL ------------------------------------------- */
/* Source of truth: mirror of AUTO_REVEAL_SELECTORS in animations.js.
   These selectors are hidden on load and fade in via IntersectionObserver
   which adds .is-visible when they enter the viewport. JS no longer
   adds a .reveal class at init (removed to cut main-thread batch work). */
.reveal,
.fade-up,
.feature-card, .ai-card, .theme-card, .pricing-card, .faq-item,
.section-label, .section-title, .section-subtitle,
.about-body h2, .about-body p, .value-card, .stats, .about-cta,
.legal-section,
.section-card, .contact-card,
.blog-card, .blog-hero h1, .blog-hero p,
.article-header .tag, .article-header h1, .article-header .meta,
.article-body h2, .article-body h3, .article-body blockquote,
.article-body .highlight-box, .cta-box {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.reveal.is-visible,
.fade-up.is-visible,
.fade-up.visible,
.feature-card.is-visible, .ai-card.is-visible, .theme-card.is-visible, .pricing-card.is-visible, .faq-item.is-visible,
.section-label.is-visible, .section-title.is-visible, .section-subtitle.is-visible,
.about-body h2.is-visible, .about-body p.is-visible, .value-card.is-visible, .stats.is-visible, .about-cta.is-visible,
.legal-section.is-visible,
.section-card.is-visible, .contact-card.is-visible,
.blog-card.is-visible, .blog-hero h1.is-visible, .blog-hero p.is-visible,
.article-header .tag.is-visible, .article-header h1.is-visible, .article-header .meta.is-visible,
.article-body h2.is-visible, .article-body h3.is-visible, .article-body blockquote.is-visible,
.article-body .highlight-box.is-visible, .cta-box.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* --- B) HOVER LIFT --------------------------------------------- */
.hover-lift {
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.hover-lift:hover {
  transform: scale(1.03);
  box-shadow: 0 20px 60px rgba(0, 229, 204, 0.18);
}
.hover-glow-purple:hover { box-shadow: 0 20px 60px rgba(168, 85, 247, 0.2); }
.hover-glow-pink:hover { box-shadow: 0 20px 60px rgba(236, 72, 153, 0.2); }

/* Icon drop-shadow on hover (for logos / nav icons) */
.hover-icon {
  transition: filter 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hover-icon:hover {
  filter: drop-shadow(0 0 12px rgba(0, 229, 204, 0.6));
  transform: scale(1.08);
}

/* --- C) FLOATING TILES ----------------------------------------- */
.floating-tiles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

.float-tile {
  position: absolute;
  will-change: transform;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.float-tile .tile-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.05rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: tileFloat 7s ease-in-out infinite;
  will-change: transform;
  opacity: 0.92;
}

.tile-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: rgba(0, 229, 204, 0.12);
  color: #00E5CC;
}
.tile-icon svg { width: 20px; height: 20px; }
.float-tile.tile-expense .tile-icon {
  background: rgba(236, 72, 153, 0.14);
  color: #ff8fa3;
}
.float-tile.tile-income .tile-icon {
  background: rgba(0, 229, 204, 0.16);
  color: #00E5CC;
}
.float-tile.tile-sub .tile-icon {
  background: rgba(168, 85, 247, 0.14);
  color: #c78bff;
}

.tile-body {
  display: flex; flex-direction: column;
  line-height: 1.2;
}
.tile-label {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tile-amount {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 2px;
}
.tile-amount.neg { color: #ff8fa3; }
.tile-amount.pos { color: #00E5CC; }
.tile-amount.sub { color: #c78bff; }

/* Default tile positions (override per-page with inline style if needed) */
.tile-1 { top: 14%; left: 6%; }
.tile-2 { top: 18%; right: 7%; }
.tile-3 { bottom: 22%; left: 9%; }
.tile-4 { bottom: 16%; right: 6%; }

.float-tile.tile-1 .tile-inner { animation-delay: 0s; }
.float-tile.tile-2 .tile-inner { animation-delay: 1.8s; }
.float-tile.tile-3 .tile-inner { animation-delay: 3.6s; }
.float-tile.tile-4 .tile-inner { animation-delay: 5.4s; }

@keyframes tileFloat {
  0%, 100% { transform: translateY(0) rotate(-1.2deg); }
  50%      { transform: translateY(-22px) rotate(1.2deg); }
}

/* Variant for about / delete-data: softer, decorative */
.float-tile.tile-soft .tile-inner {
  opacity: 0.72;
  padding: 0.55rem 0.85rem;
}
.float-tile.tile-soft .tile-icon { width: 28px; height: 28px; }
.float-tile.tile-soft .tile-icon svg { width: 16px; height: 16px; }

/* About-header: tiles positioned around the app icon (mid-height of header) */
.about-header .tile-1 { top: 38%; left: 4%; right: auto; bottom: auto; }
.about-header .tile-2 { top: 38%; right: 4%; left: auto; bottom: auto; }
@media (max-width: 768px) {
  .about-header .tile-1 { top: 32%; left: 2%; }
  .about-header .tile-2 { top: 32%; right: 2%; }
}

/* Responsive: hide secondary tiles on small screens */
@media (max-width: 768px) {
  .float-tile.tile-2,
  .float-tile.tile-4 { display: none; }
  .float-tile .tile-inner { padding: 0.6rem 0.85rem; transform: scale(0.9); transform-origin: top left; }
  .tile-icon { width: 30px; height: 30px; }
  .tile-icon svg { width: 16px; height: 16px; }
}
@media (max-width: 480px) {
  .floating-tiles { display: none; }
}

/* --- D) CURSOR GLOW (hero only) -------------------------------- */
.cursor-glow {
  position: absolute;
  top: 0; left: 0;
  width: 520px; height: 520px;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 204, 0.10), rgba(168, 85, 247, 0.04) 40%, transparent 65%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
  will-change: transform;
}
.cursor-glow.is-active { opacity: 1; }

/* --- E) MAGNETIC BUTTONS --------------------------------------- */
.magnetic {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.magnetic:hover {
  transform: scale(1.05);
  box-shadow: 0 16px 50px rgba(0, 229, 204, 0.25);
}

/* --- F) ANIMATED TEXT GRADIENT --------------------------------- */
.text-gradient-anim {
  background: linear-gradient(
    135deg,
    #00E5CC 0%,
    #A855F7 30%,
    #EC4899 60%,
    #3B82F6 85%,
    #00E5CC 100%
  );
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: gradientShift 8s ease-in-out infinite;
  will-change: background-position;
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* --- G1) BRAND GLOW (logo wordmark pulse) --------------------- */
.brand-glow {
  text-shadow:
    0 0 20px rgba(0, 229, 204, 0.40),
    0 0 40px rgba(0, 229, 204, 0.20);
  animation: brandPulse 4s ease-in-out infinite;
  transition: text-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: text-shadow;
}
.brand-glow:hover {
  text-shadow:
    0 0 28px rgba(0, 229, 204, 0.75),
    0 0 56px rgba(0, 229, 204, 0.45),
    0 0 90px rgba(168, 85, 247, 0.22);
}
@keyframes brandPulse {
  0%, 100% {
    text-shadow:
      0 0 20px rgba(0, 229, 204, 0.40),
      0 0 40px rgba(0, 229, 204, 0.20);
  }
  50% {
    text-shadow:
      0 0 28px rgba(0, 229, 204, 0.55),
      0 0 55px rgba(0, 229, 204, 0.28);
  }
}

/* --- G) BADGE / SOCIAL ICON HOVER ------------------------------ */
.social-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s;
}
.social-icon:hover {
  transform: translateY(-3px) scale(1.1);
  color: var(--accent-cyan);
}

/* --- I) BREADCRUMBS (blog articles) --------------------------- */
/* Explicit overrides: the bare `nav{}` rule in page <style> blocks
   applies position:fixed to all <nav>. We need to cancel that here
   since .breadcrumbs is a <nav> element that should flow inline. */
.breadcrumbs {
  position: static;
  top: auto;
  left: auto;
  right: auto;
  z-index: auto;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: none;
  transition: none;
  max-width: 720px;
  margin: 0 auto;
  padding: 6rem 2rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.breadcrumbs + .article-header {
  padding-top: 1.5rem;
}
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
}
.breadcrumbs li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.breadcrumbs li + li::before {
  content: "/";
  color: var(--text-secondary);
  opacity: 0.5;
}
.breadcrumbs a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: opacity 0.2s;
}
.breadcrumbs a:hover { opacity: 0.8; }
.breadcrumbs [aria-current="page"] { color: var(--text-secondary); }

/* --- J) RELATED ARTICLES (blog articles) ---------------------- */
.related-articles {
  max-width: 720px;
  margin: 4rem auto 2rem;
  padding: 2rem 2rem 0;
  border-top: 1px solid var(--border-glass);
}
.related-articles > h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1.2rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.related-card:hover {
  border-color: rgba(0, 229, 204, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 229, 204, 0.08);
}
.related-card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}
.related-card p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0;
}
@media (max-width: 768px) {
  .breadcrumbs { padding: 5rem 1.2rem 0; font-size: 0.8rem; }
  .related-articles { padding: 2rem 1.2rem 0; margin: 3rem auto 1rem; }
  .related-articles > h2 { font-size: 1.2rem; }
  .related-grid { grid-template-columns: 1fr; gap: 0.8rem; }
}

/* --- K) VISUALLY HIDDEN (a11y) -------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- H) REDUCED MOTION ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .reveal, .fade-up,
  .feature-card, .ai-card, .theme-card, .pricing-card, .faq-item,
  .section-label, .section-title, .section-subtitle,
  .about-body h2, .about-body p, .value-card, .stats, .about-cta,
  .legal-section,
  .section-card, .contact-card,
  .blog-card, .blog-hero h1, .blog-hero p,
  .article-header .tag, .article-header h1, .article-header .meta,
  .article-body h2, .article-body h3, .article-body blockquote,
  .article-body .highlight-box, .cta-box {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .float-tile .tile-inner,
  .text-gradient-anim,
  .cursor-glow,
  .hover-lift,
  .magnetic,
  .hover-icon,
  .social-icon {
    animation: none !important;
    transition: none !important;
  }
  /* Keep brand glow visible but static (no pulse) */
  .brand-glow {
    animation: none !important;
  }
  .hover-lift:hover,
  .magnetic:hover,
  .hover-icon:hover,
  .social-icon:hover {
    transform: none !important;
  }
}
