/* =====================================================
   Syberra — Premium Motion Layer
   Jakub Krehel (primary): production polish, enter recipes
   Jhey Tompkins (secondary): scroll-driven, @property, magnetic
   Emil Kowalski (selective): nav, buttons, restraint on high-freq
   ===================================================== */

/* ── Modern @property registrations for interpolatable gradients ── */
@property --mesh-x {
  syntax: '<percentage>';
  initial-value: 50%;
  inherits: false;
}
@property --mesh-y {
  syntax: '<percentage>';
  initial-value: 50%;
  inherits: false;
}

/* ── Scroll progress bar (Emil: useful + restrained) ─────────── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(var(--scroll-pct, 0));
  background: linear-gradient(90deg, var(--accent), #ff8a95, var(--accent));
  background-size: 200% 100%;
  animation: progressShimmer 3s linear infinite;
  z-index: 1001;
  pointer-events: none;
  will-change: transform;
  box-shadow: 0 0 12px rgba(230, 57, 70, 0.6);
}
@keyframes progressShimmer {
  from { background-position: 0% 50%; }
  to { background-position: -200% 50%; }
}

/* ── Nav: shrink-on-scroll + glass intensifier ───────────────── */
.navbar {
  transition: background 0.4s ease, height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              backdrop-filter 0.4s ease, border-color 0.4s ease;
}
.navbar.is-scrolled {
  height: 60px;
  background: rgba(10, 10, 10, 0.82) !important;
  backdrop-filter: blur(32px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(32px) saturate(1.4) !important;
}
.navbar.is-scrolled .logo-img {
  height: 26px;
  transition: height 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Premium underline: both-sides-grow with elastic ease */
.nav-links a::after {
  left: 50% !important;
  transform: translateX(-50%);
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* ── Hero word reveal (Jakub enter recipe applied to split text) ─ */
.hero-title .word,
.hero-title-geo .word,
.page-header h1 .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(28px);
  filter: blur(10px);
  animation: wordRise 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
/* Preserve gradient-clip on .line-2 by keeping it atomic (word class on parent) */
.hero-title-geo .line-2.word {
  animation: wordRise 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
/* When .highlight gets .word class, compose both animations */
.hero-title .highlight.word {
  animation:
    wordRise 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards,
    gradient-shift 6s ease-in-out infinite 1.2s;
}
@keyframes wordRise {
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* Shimmer sweep on the highlighted word (kept simple, no @property) */
.hero-title .highlight {
  position: relative;
  isolation: isolate;
}

/* ── Hero: mouse-reactive mesh overlay (Jhey: creative CSS) ──── */
.hero {
  --mesh-x: 50%;
  --mesh-y: 50%;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(
      600px circle at var(--mesh-x) var(--mesh-y),
      rgba(230, 57, 70, 0.09),
      transparent 55%
    );
  transition: --mesh-x 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              --mesh-y 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  mix-blend-mode: screen;
}

/* ── Magnetic CTA buttons (Jhey playful, Emil restraint on move) ─ */
.btn {
  --mag-x: 0px;
  --mag-y: 0px;
  transform: translate(var(--mag-x), var(--mag-y));
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.3s, box-shadow 0.35s, border-color 0.3s;
}
.btn:hover {
  transform: translate(var(--mag-x), calc(var(--mag-y) - 3px)) !important;
}

/* Primary button: gradient mesh + shine on hover */
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #ff4d5a 50%, var(--accent) 100%);
  background-size: 200% 200%;
  background-position: 0% 50%;
  transition: background-position 0.8s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.4s;
  position: relative;
  overflow: hidden;
}
.btn-primary:hover {
  background-position: 100% 50%;
  box-shadow:
    0 14px 44px rgba(230, 57, 70, 0.45),
    0 0 0 1px rgba(230, 57, 70, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 80%
  );
  transform: skewX(-20deg);
  transition: left 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.btn-primary:hover::after {
  left: 130%;
}

/* Click ripple feedback on buttons */
.btn {
  position: relative;
}
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.35);
  animation: rippleExpand 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  pointer-events: none;
}
@keyframes rippleExpand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ── Scroll-reveal v2: blur + translate + stagger ──────────── */
/* Use !important to win over existing .fade-in opacity rule */
[data-reveal] {
  opacity: 0 !important;
  transform: translateY(24px);
  filter: blur(6px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              filter 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-reveal="left"] { transform: translateX(-40px); }
[data-reveal="right"] { transform: translateX(40px); }
[data-reveal="scale"] { transform: scale(0.96); }
[data-reveal].in-view {
  opacity: 1 !important;
  transform: translate(0, 0) scale(1) !important;
  filter: blur(0) !important;
}
/* Ensure legacy .fade-in coexists: if it's also .in-view, reveal too */
.fade-in.in-view {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Stagger children via CSS variable delay */
[data-stagger] > * {
  transition-delay: calc(var(--stagger-i, 0) * 80ms);
}

/* ── 3D tilt for showcase / split images ─────────────────── */
.showcase-image,
.split-image,
.stock-photo {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  --tilt-scale: 1;
  transform: perspective(1200px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(var(--tilt-scale));
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.5s ease;
  will-change: transform;
}
.showcase-image:hover,
.split-image:hover,
.stock-photo:hover {
  transform: perspective(1200px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(1.01) !important;
}

/* Specular highlight layer reacts to cursor */
.showcase-image,
.split-image,
.stock-photo {
  position: relative;
  isolation: isolate;
}
.showcase-image::after,
.split-image::after,
.stock-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(
    400px circle at var(--spec-x, 50%) var(--spec-y, 50%),
    rgba(255, 255, 255, 0.14),
    transparent 55%
  );
  mix-blend-mode: overlay;
  z-index: 2;
}
.showcase-image:hover::after,
.split-image:hover::after,
.stock-photo:hover::after {
  opacity: 1;
}

/* ── Section-dark cinematic overlay sweep ────────────────── */
.section-dark {
  position: relative;
  overflow: hidden;
}
.section-dark.in-view::before {
  animation: sectionSweep 1.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes sectionSweep {
  0%   { opacity: 0; transform: translateX(-100%); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(100%); }
}

/* ── Stat counter: character-flip feel (monospace slot) ──── */
.stat-number {
  font-variant-numeric: tabular-nums;
  display: inline-block;
}
.stat-card {
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: -40%; left: -40%;
  width: 180%; height: 180%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(230, 57, 70, 0.25) 30deg,
    transparent 60deg,
    transparent 360deg
  );
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  mask: radial-gradient(circle at center, transparent 40%, black 50%);
  -webkit-mask: radial-gradient(circle at center, transparent 40%, black 50%);
  z-index: 0;
}
.stat-card:hover::after {
  opacity: 0.6;
  animation: spinGlow 5s linear infinite;
}
@keyframes spinGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.stat-card > * {
  position: relative;
  z-index: 1;
}

/* ── Marquee: infinite-scrolling feature row ─────────────── */
.marquee {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 32px 0;
  mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marqueeScroll 38s linear infinite;
  gap: 56px;
  align-items: center;
}
.marquee:hover .marquee-track {
  animation-play-state: paused;
}
.marquee-item {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  opacity: 0.65;
  transition: opacity 0.3s, color 0.3s;
}
.marquee-item:hover {
  opacity: 1;
  color: var(--text-primary);
}
.marquee-item .dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(230, 57, 70, 0.5);
}
@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ── CTA banner: animated border sweep ────────────────────── */
.cta-banner {
  isolation: isolate;
}
.cta-banner::before {
  /* existing ::before handled by style.css keeps its animation */
}
.cta-banner .cta-border-glow {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from 0deg,
    rgba(230, 57, 70, 0.5),
    rgba(255, 138, 149, 0.3),
    rgba(230, 57, 70, 0.5),
    transparent 60%,
    transparent 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spinGlow 14s linear infinite;
  pointer-events: none;
  z-index: 0;
  opacity: 0.8;
}
.cta-banner > * {
  position: relative;
  z-index: 1;
}

/* ── Icon cards: soft float + icon pop ───────────────────── */
.icon-card-icon {
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.35s;
}
.icon-card:hover .icon-card-icon {
  transform: scale(1.12) rotate(-4deg);
}

/* Step number pulses when revealed */
.steps-grid.in-view .step-number {
  animation: stepPulse 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes stepPulse {
  0%   { transform: scale(0.8); box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.35); }
  60%  { transform: scale(1.08); box-shadow: 0 0 0 18px rgba(230, 57, 70, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(230, 57, 70, 0); }
}

/* ── Section label: letter-spacing breathing (subtle) ────── */
.section-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.section-label::before {
  content: '';
  display: inline-block;
  width: 24px; height: 1px;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
}
[data-reveal].in-view .section-label::before,
.fade-in.visible .section-label::before {
  transform: scaleX(1);
}

/* ── Custom cursor dot (Jhey delight, but subtle) ────────── */
@media (pointer: fine) {
  .cursor-dot {
    position: fixed;
    top: 0; left: 0;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.25s cubic-bezier(0.22, 1, 0.36, 1),
                height 0.25s cubic-bezier(0.22, 1, 0.36, 1),
                background 0.25s ease,
                opacity 0.3s ease;
    mix-blend-mode: difference;
    opacity: 0;
  }
  .cursor-dot.is-ready { opacity: 1; }
  .cursor-dot.is-hover-link {
    width: 32px; height: 32px;
    background: transparent;
    border: 1px solid var(--accent);
  }
  .cursor-dot.is-hover-text {
    width: 2px;
    height: 24px;
    border-radius: 1px;
  }
}

/* (Page transition overlay removed) */

/* ── Testimonial gentle hover lift (no infinite loop) ──── */
.testimonial-card {
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.6s ease, border-color 0.4s ease !important;
}

/* ── Pricing featured: static elevation, hover boost ───── */
.pricing-card.featured {
  transform: translateY(-6px);
  box-shadow: 0 24px 70px rgba(230, 57, 70, 0.12);
}
.pricing-card.featured:hover {
  transform: translateY(-10px);
  box-shadow: 0 30px 80px rgba(230, 57, 70, 0.18);
}

/* ── Modern scroll-driven reveals (progressive enhancement) ─ */
@supports (animation-timeline: view()) {
  [data-reveal-scroll] {
    animation: scrollReveal linear both;
    animation-timeline: view();
    animation-range: entry 5% cover 30%;
  }
  @keyframes scrollReveal {
    from {
      opacity: 0;
      transform: translateY(40px);
      filter: blur(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
      filter: blur(0);
    }
  }
}

/* ── Accessibility: respect reduced motion for ALL new effects ─ */
@media (prefers-reduced-motion: reduce) {
  .scroll-progress,
  .hero::after,
  .btn-primary::after,
  .marquee-track,
  .stat-card::after,
  .cta-banner .cta-border-glow {
    animation: none !important;
  }
  [data-reveal],
  [data-reveal-scroll] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
  .hero-title .word {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    animation: none !important;
  }
  .showcase-image,
  .split-image,
  .stock-photo {
    transform: none !important;
  }
  .cursor-dot {
    display: none !important;
  }
  .marquee-track {
    transform: none !important;
  }
}
