/* ═══════════════════════════════════════════════════════════
   IoTFIY — Premium Motion & Brand Experience
   ═══════════════════════════════════════════════════════════ */

:root {
  --motion-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --motion-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --glow-indigo: rgba(99, 102, 241, 0.45);
  --glow-violet: rgba(139, 92, 246, 0.35);
  --glow-cyan: rgba(34, 211, 238, 0.25);
}

/* ── Scroll progress ── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 10001;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.06);
}

.scroll-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #a855f7, #22d3ee);
  box-shadow: 0 0 20px var(--glow-indigo);
  transition: width 0.08s linear;
}

/* ── Custom cursor (desktop) ── */
.motion-cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 99999;
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity 0.4s ease;
}

body.cursor-ready .motion-cursor {
  opacity: 1;
}

.motion-cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s var(--motion-ease);
}

.motion-cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  transition: transform 0.35s var(--motion-ease), width 0.35s, height 0.35s, margin 0.35s, border-color 0.35s;
}

body.cursor-hover .motion-cursor-dot {
  transform: scale(2.5);
}

body.cursor-hover .motion-cursor-ring {
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-color: rgba(167, 139, 250, 0.8);
}

@media (hover: none), (max-width: 1024px) {
  .motion-cursor { display: none !important; }
  body.index-page { cursor: auto; }
}

/* ── Aurora mesh canvas ── */
.motion-mesh {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
}

body.mesh-ready .motion-mesh {
  opacity: 1;
}

/* ── Premium dark hero ── */
.index-page .hero.hero-premium {
  background: #030712;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: 140px 0 100px;
  overflow: hidden;
}

.index-page .hero.hero-premium::before,
.index-page .hero.hero-premium::after {
  display: none;
}

.hero-premium .hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black 20%, transparent 75%);
  animation: gridDrift 40s linear infinite;
  pointer-events: none;
}

@keyframes gridDrift {
  from { transform: translateY(0); }
  to { transform: translateY(60px); }
}

.hero-premium .hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  animation: orbFloat 12s ease-in-out infinite;
}

.hero-premium .hero-orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35) 0%, transparent 70%);
  top: -10%;
  right: -5%;
}

.hero-premium .hero-orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.3) 0%, transparent 70%);
  bottom: 0;
  left: -10%;
  animation-delay: -4s;
}

.hero-premium .hero-orb-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.2) 0%, transparent 70%);
  top: 40%;
  left: 40%;
  animation-delay: -8s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

.hero-premium .container {
  position: relative;
  z-index: 2;
  transition: transform 0.1s linear, opacity 0.1s linear, filter 0.1s linear;
  will-change: transform, opacity;
}

.hero-premium .floating-element {
  display: none;
}

/* Hero typography — cinematic reveal */
.hero-premium .hero-badge {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(129, 140, 248, 0.25);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(20px);
  animation: heroFadeUp 0.8s var(--motion-ease) 0.2s forwards;
}

.hero-premium .hero-title {
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: #fff;
  background: none;
  -webkit-text-fill-color: unset;
  margin-bottom: 1.5rem;
}

.hero-premium .hero-title::after {
  display: none;
}

.hero-premium .hero-title .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  margin-right: 0.22em;
}

.hero-premium .hero-title .word-inner {
  display: inline-block;
  opacity: 0;
  transform: translateY(110%);
  animation: wordReveal 0.9s var(--motion-ease) forwards;
}

.hero-premium .hero-title .word-accent .word-inner {
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #22d3ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes wordReveal {
  to { opacity: 1; transform: translateY(0); }
}

.hero-premium .hero-subtitle {
  color: rgba(203, 213, 225, 0.85);
  font-size: 1.15rem;
  max-width: 520px;
  opacity: 0;
  transform: translateY(24px);
  animation: heroFadeUp 0.9s var(--motion-ease) 0.9s forwards;
}

.hero-premium .hero-buttons {
  opacity: 0;
  transform: translateY(24px);
  animation: heroFadeUp 0.9s var(--motion-ease) 1.1s forwards;
}

.hero-premium .hero-stats {
  border-top-color: rgba(255, 255, 255, 0.08);
  opacity: 0;
  animation: heroFadeUp 0.9s var(--motion-ease) 1.3s forwards;
}

.hero-premium .stat-number {
  color: #fff;
  font-size: 2rem;
}

.hero-premium .stat-label {
  color: rgba(148, 163, 184, 0.9);
}

@keyframes heroFadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* Hero CTA buttons — glow */
.hero-premium .btn-primary-custom {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform 0.4s var(--motion-ease), box-shadow 0.4s;
}

.hero-premium .btn-primary-custom:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 60px rgba(99, 102, 241, 0.5), 0 20px 40px rgba(0,0,0,0.3);
}

.hero-premium .btn-secondary-custom {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  backdrop-filter: blur(8px);
}

.hero-premium .btn-secondary-custom:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(167, 139, 250, 0.5);
  color: #fff;
}

/* 3D hero card */
.hero-card-tilt {
  perspective: 1200px;
  transform-style: preserve-3d;
}

.hero-card-tilt .iot-control-center {
  background: rgba(15, 23, 42, 0.75) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  border: 1px solid rgba(129, 140, 248, 0.2) !important;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.05) inset,
    0 25px 80px rgba(0, 0, 0, 0.5),
    0 0 60px rgba(99, 102, 241, 0.15) !important;
  transform-style: preserve-3d;
  transition: transform 0.1s linear, box-shadow 0.4s ease;
  will-change: transform;
}

.hero-card-tilt .iot-control-center h4,
.hero-card-tilt .iot-control-center span {
  color: #e2e8f0 !important;
}

.hero-card-tilt .live-metrics {
  background: rgba(99, 102, 241, 0.08) !important;
  border: 1px solid rgba(99, 102, 241, 0.12);
}

.hero-card-glow {
  position: absolute;
  inset: -2px;
  border-radius: 27px;
  background: linear-gradient(135deg, rgba(99,102,241,0.4), rgba(168,85,247,0.3), rgba(34,211,238,0.2));
  filter: blur(20px);
  opacity: 0.6;
  z-index: -1;
  animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.98); }
  50% { opacity: 0.7; transform: scale(1.02); }
}

.hero-image {
  opacity: 0;
  transform: translateX(40px) rotateY(-8deg);
  animation: heroCardEnter 1.2s var(--motion-ease) 0.6s forwards;
}

@media (min-width: 992px) {
  .index-page .hero-image {
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }

  .index-page .hero-visual-container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
  }
}

@keyframes heroCardEnter {
  to { opacity: 1; transform: translateX(0) rotateY(0); }
}

/* Scroll hint */
.hero-scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(148, 163, 184, 0.7);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0;
  animation: heroFadeUp 0.8s var(--motion-ease) 1.6s forwards;
  z-index: 3;
}

.hero-scroll-hint .chevron {
  width: 24px;
  height: 24px;
  border-right: 2px solid rgba(129, 140, 248, 0.6);
  border-bottom: 2px solid rgba(129, 140, 248, 0.6);
  transform: rotate(45deg);
  animation: chevronBounce 2s ease-in-out infinite;
}

@keyframes chevronBounce {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.5; }
  50% { transform: rotate(45deg) translateY(8px); opacity: 1; }
}

/* ── Marquee trust strip ── */
.trust-strip-marquee {
  background: linear-gradient(90deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  padding: 0;
  overflow: hidden;
  border-bottom: 1px solid rgba(99, 102, 241, 0.15);
  position: relative;
}

.trust-strip-marquee::before,
.trust-strip-marquee::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 120px;
  z-index: 2;
  pointer-events: none;
}

.trust-strip-marquee::before {
  left: 0;
  background: linear-gradient(90deg, #0f172a, transparent);
}

.trust-strip-marquee::after {
  right: 0;
  background: linear-gradient(-90deg, #0f172a, transparent);
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marqueeScroll 35s linear infinite;
  padding: 22px 0;
}

.marquee-track:hover {
  animation-play-state: paused;
}

.marquee-content {
  display: flex;
  align-items: center;
  gap: 4rem;
  padding-right: 4rem;
}

.marquee-item {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.marquee-item i {
  color: #c9a227;
  font-size: 1rem;
}

.marquee-divider {
  width: 4px;
  height: 4px;
  background: rgba(129, 140, 248, 0.5);
  border-radius: 50%;
}

@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ── Scroll reveal system ── */
.motion-reveal {
  opacity: 0;
  transform: translateY(70px) scale(0.96);
  filter: blur(10px);
  transition:
    opacity 1s var(--motion-ease),
    transform 1s var(--motion-ease),
    filter 1s var(--motion-ease);
  will-change: opacity, transform, filter;
}

.motion-reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.motion-reveal-left {
  opacity: 0;
  transform: translateX(-80px);
  filter: blur(8px);
  transition: opacity 1s var(--motion-ease), transform 1s var(--motion-ease), filter 1s var(--motion-ease);
}

.motion-reveal-left.is-visible {
  opacity: 1;
  transform: translateX(0);
  filter: blur(0);
}

.motion-reveal-right {
  opacity: 0;
  transform: translateX(80px);
  filter: blur(8px);
  transition: opacity 1s var(--motion-ease), transform 1s var(--motion-ease), filter 1s var(--motion-ease);
}

.motion-reveal-right.is-visible {
  opacity: 1;
  transform: translateX(0);
  filter: blur(0);
}

.motion-scale {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.9s var(--motion-ease), transform 0.9s var(--motion-ease);
}

.motion-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Stagger children */
.motion-stagger > * {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s var(--motion-ease), transform 0.7s var(--motion-ease);
}

.motion-stagger.is-visible > *:nth-child(1) { transition-delay: 0.05s; }
.motion-stagger.is-visible > *:nth-child(2) { transition-delay: 0.12s; }
.motion-stagger.is-visible > *:nth-child(3) { transition-delay: 0.19s; }
.motion-stagger.is-visible > *:nth-child(4) { transition-delay: 0.26s; }
.motion-stagger.is-visible > *:nth-child(5) { transition-delay: 0.33s; }
.motion-stagger.is-visible > *:nth-child(6) { transition-delay: 0.4s; }

.motion-stagger.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Section parallax layers */
.motion-parallax-wrap {
  position: relative;
  overflow: hidden;
}

.motion-parallax-bg {
  position: absolute;
  inset: -20% 0;
  pointer-events: none;
  will-change: transform;
  transition: transform 0.1s linear;
}

/* Premium section headings */
.motion-heading {
  position: relative;
}

.motion-heading .heading-line {
  display: block;
  overflow: hidden;
}

.motion-heading .heading-line-inner {
  display: inline-block;
  transform: translateY(100%);
  transition: transform 1s var(--motion-ease);
}

.motion-heading.is-visible .heading-line-inner {
  transform: translateY(0);
}

/* Magnetic button wrapper */
.magnetic-wrap {
  display: inline-block;
  transition: transform 0.3s var(--motion-ease);
}

/* Premium cards on scroll */
.index-page .service-card,
.index-page .product-card,
.index-page .feature-card,
.index-page .tech-card {
  border-radius: 20px !important;
  position: relative;
  overflow: hidden;
}

.index-page .service-card::before,
.index-page .product-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.index-page .service-card:hover::before,
.index-page .product-card:hover::before {
  opacity: 1;
}

/* Portfolio items — dramatic hover */
.portfolio-item.motion-card {
  transition: transform 0.5s var(--motion-ease), box-shadow 0.5s !important;
}

.portfolio-item.motion-card:hover {
  transform: translateY(-12px) scale(1.02) !important;
  box-shadow: 0 30px 60px rgba(99, 102, 241, 0.2) !important;
}

/* Header morph on scroll */
.index-page .header {
  transition: background 0.4s, box-shadow 0.4s, padding 0.4s, backdrop-filter 0.4s;
}

.index-page .header.header-over-hero:not(.scrolled) {
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
  box-shadow: none !important;
}

.index-page .header.header-over-hero:not(.scrolled) .navmenu ul li a {
  color: rgba(255, 255, 255, 0.88) !important;
}

.index-page .header.header-over-hero:not(.scrolled) .logo img {
  filter: brightness(0) invert(1);
}

.index-page .header.scrolled {
  background: rgba(3, 7, 18, 0.85) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  border-bottom-color: rgba(99, 102, 241, 0.15) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
}

.index-page .header.scrolled .navmenu ul li a {
  color: rgba(226, 232, 240, 0.9) !important;
}

.index-page .header.scrolled .logo img {
  filter: brightness(0) invert(1);
}

/* Section divider wave */
.section-wave {
  position: relative;
  height: 80px;
  margin-top: -1px;
  overflow: hidden;
}

.section-wave svg {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 80px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .motion-reveal,
  .motion-reveal-left,
  .motion-reveal-right,
  .motion-scale,
  .motion-stagger > *,
  .hero-premium .hero-title .word-inner,
  .hero-premium .hero-badge,
  .hero-premium .hero-subtitle,
  .hero-premium .hero-buttons,
  .hero-premium .hero-stats,
  .hero-image,
  .marquee-track {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}
