/**
 * VishaTire Cinematic Automotive Animations
 * High Performance GPU Accelerated Transforms & Opacity
 */

/* 1. Precision Wheel Rotation */
@keyframes vt-spin-wheel {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 2. Pulsing Ambient Halo */
@keyframes vt-pulse-glow {
  0%, 100% {
    opacity: 0.35;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.85;
    transform: translate(-50%, -50%) scale(1.18);
  }
}

/* 3. Hotspot High-Tech Radar Ping */
@keyframes vt-radar-wave {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  70% {
    opacity: 0.6;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

/* 4. Button CTA Specular Shine Sweep */
@keyframes vt-shine-sweep {
  0% {
    left: -120%;
  }
  100% {
    left: 180%;
  }
}

.vt-btn-shine::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.28) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  animation: vt-shine-sweep 3.6s infinite ease-in-out;
  pointer-events: none;
}

/* 5. Preloader Mode 1: Tire Inflate & Curtain Reveal */
@keyframes vt-tire-inflate {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  35% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(3.8);
    opacity: 0;
  }
}

/* 6. Preloader Mode 2: Burnout Shake & Drive-Off Left */
@keyframes vt-burnout-shake {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  20% {
    transform: translate(-3px, 2px) rotate(-1deg);
  }
  40% {
    transform: translate(3px, -2px) rotate(1deg);
  }
  60% {
    transform: translate(-2px, -1px) rotate(-0.5deg);
  }
  80% {
    transform: translate(2px, 2px) rotate(0.5deg);
  }
}

@keyframes vt-drive-off-left {
  0% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateX(-140vw) scale(0.9);
    opacity: 0;
  }
}

@keyframes vt-smoke-puff {
  0% {
    transform: scale(0.3) translateY(0);
    opacity: 0.85;
  }
  100% {
    transform: scale(2.4) translateY(-50px);
    opacity: 0;
  }
}

/* 7. Hover Stagger Action Buttons for Product Cards */
.vt-card-action-btn {
  transition: transform 0.24s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s, color 0.2s;
}

.vt-product-card:hover .vt-card-action-btn:nth-child(1) {
  transition-delay: 0.04s;
}

.vt-product-card:hover .vt-card-action-btn:nth-child(2) {
  transition-delay: 0.08s;
}

.vt-product-card:hover .vt-card-action-btn:nth-child(3) {
  transition-delay: 0.12s;
}

/* 8. Shimmer Loading Effect */
@keyframes vt-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.vt-shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0) 100%);
  background-size: 200% 100%;
  animation: vt-shimmer 2s infinite;
}

/* 9. Floating Speed Rings in Hero Section */
@keyframes vt-float-ring {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(3deg);
  }
}

.vt-floating-ring {
  animation: vt-float-ring 6s infinite ease-in-out;
}

/* Page-to-page loading overlay */
.vt-page-loader {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #070b16;
  background-image: radial-gradient(ellipse at 50% 36%, #0d2748 0%, #070b16 58%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.vt-page-loader.is-visible,
.vt-page-loader:not([hidden]) {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: none;
}
.vt-page-loader[hidden] {
  display: none !important;
}
.vt-page-loader.is-visible {
  display: flex !important;
}
.vt-page-loader__glow {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 420px;
  height: 420px;
  margin: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 209, 255, 0.16) 0%, rgba(255, 107, 53, 0.08) 42%, transparent 70%);
  filter: blur(8px);
  pointer-events: none;
  animation: vt-pulse-glow 2.8s ease-in-out infinite;
}
.vt-page-loader__card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 20px;
}
.vt-page-loader__logo {
  max-height: 110px;
  max-width: min(280px, 72vw);
  width: auto;
  height: auto;
  object-fit: contain;
  margin-bottom: 22px;
  filter: drop-shadow(0 10px 32px rgba(0, 209, 255, 0.35));
}
.vt-page-loader__ring {
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  position: relative;
}
.vt-page-loader__ring::before,
.vt-page-loader__ring::after,
.vt-page-loader__ring span {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}
.vt-page-loader__ring::before {
  border-top-color: #00D1FF;
  border-right-color: rgba(0, 209, 255, 0.25);
  animation: vt-spin-wheel 0.9s linear infinite;
}
.vt-page-loader__ring::after {
  inset: 8px;
  border-bottom-color: #FF6B35;
  border-left-color: rgba(255, 107, 53, 0.2);
  animation: vt-spin-wheel 1.25s linear infinite reverse;
}
.vt-page-loader__brand {
  margin: 0 0 6px;
  font-family: var(--vt-font-heading, "Kalameh", "Vazirmatn", sans-serif);
  font-size: 1.35rem;
  font-weight: 900;
  color: #F8FAFC;
  letter-spacing: -0.3px;
}
.vt-page-loader__status {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 800;
  color: #00D1FF;
}
.vt-page-loader__bar {
  width: min(220px, 64vw);
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.vt-page-loader__bar i {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00D1FF, #FF6B35);
  animation: vt-loader-bar 1.15s ease-in-out infinite;
}
@keyframes vt-loader-bar {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

html[data-theme="light"] .vt-page-loader,
html.light-mode .vt-page-loader,
body.light-mode .vt-page-loader {
  background-color: #F8FAFC;
  background-image: radial-gradient(ellipse at 50% 36%, #E2E8F0 0%, #F8FAFC 58%);
}
html[data-theme="light"] .vt-page-loader__brand,
html.light-mode .vt-page-loader__brand,
body.light-mode .vt-page-loader__brand {
  color: var(--vt-primary, #1E3A8A);
}

/* ==========================================================================
   9. Cinematic 404 — burnout wheel, smoke, impact wrench, inflate
   ========================================================================== */
.vt-404-stage {
  position: relative;
  isolation: isolate;
  overflow: visible;
  min-height: calc(100vh - 180px);
  padding: 2.5rem 0 4.5rem;
  text-align: center;
  background:
    radial-gradient(ellipse 80% 50% at 50% 18%, rgba(255, 107, 53, 0.16) 0%, transparent 55%),
    radial-gradient(ellipse 70% 40% at 50% 82%, rgba(0, 209, 255, 0.1) 0%, transparent 60%),
    linear-gradient(180deg, #070b14 0%, #0b111e 48%, #0f172a 100%);
}

.vt-404-asphalt {
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background:
    repeating-linear-gradient(90deg, transparent 0 38px, rgba(226, 232, 240, 0.07) 38px 40px),
    linear-gradient(180deg, transparent 0%, rgba(15, 23, 42, 0.4) 30%, rgba(2, 6, 14, 0.92) 100%);
  pointer-events: none;
  z-index: 0;
}

.vt-404-asphalt::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 28%;
  width: min(72vw, 640px);
  height: 3px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.55), transparent);
  box-shadow: 0 0 18px rgba(0, 209, 255, 0.25);
}

.vt-404-glow {
  position: absolute;
  left: 50%;
  top: 18%;
  width: 280px;
  height: 280px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 107, 53, 0.28) 0%, transparent 68%);
  filter: blur(18px);
  pointer-events: none;
  z-index: 0;
  animation: vt-404-glow-pulse 2.4s ease-in-out infinite;
}

.vt-404-inner {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.vt-404-visual {
  position: relative;
  overflow: visible;
  width: min(300px, 72vw);
  height: min(300px, 72vw);
  margin: 0 auto 0.5rem;
  animation: vt-burnout-shake 0.32s infinite;
}

.vt-404-wheel {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.55));
}

.vt-404-rotor {
  transform-origin: 130px 130px;
  animation: vt-spin-wheel 0.55s linear infinite;
}

.vt-404-inflate {
  transform-origin: 130px 130px;
  animation: vt-404-inflate-pulse 2.8s ease-in-out infinite;
}

.vt-404-sparks {
  animation: vt-torque-flash 0.7s ease-in-out infinite;
}

.vt-404-caliper {
  transform-origin: 178px 82px;
  animation: vt-404-caliper-kick 0.7s ease-in-out infinite;
}

.vt-404-wrench {
  position: absolute;
  z-index: 3;
  width: 42%;
  height: auto;
  top: 8%;
  left: -6%;
  transform-origin: 22px 24px;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.45));
  animation: vt-404-wrench-hit 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite;
}

.vt-404-smoke {
  position: absolute;
  z-index: 1;
  left: -42%;
  right: auto;
  bottom: -12%;
  top: auto;
  width: 95%;
  height: 90%;
  pointer-events: none;
}

.vt-404-smoke span {
  position: absolute;
  bottom: 10%;
  left: 8%;
  width: 88px;
  height: 88px;
  border-radius: 46% 54% 48% 52%;
  background:
    radial-gradient(circle at 40% 40%, rgba(248, 250, 252, 0.92) 0%, rgba(148, 163, 184, 0.5) 38%, rgba(255, 107, 53, 0.18) 58%, transparent 74%);
  filter: blur(5px);
  opacity: 0;
  animation: vt-404-smoke-trail 1.65s ease-out infinite;
}

.vt-404-smoke span:nth-child(2) {
  width: 112px;
  height: 112px;
  bottom: 4%;
  left: 18%;
  animation-delay: 0.28s;
}

.vt-404-smoke span:nth-child(3) {
  width: 138px;
  height: 138px;
  bottom: -6%;
  left: 28%;
  animation-delay: 0.52s;
}

.vt-404-smoke span:nth-child(4) {
  width: 96px;
  height: 96px;
  bottom: 16%;
  left: 4%;
  animation-delay: 0.78s;
}

.vt-404-smoke span:nth-child(5) {
  width: 160px;
  height: 160px;
  bottom: -12%;
  left: 36%;
  animation-delay: 1.04s;
}

.vt-404-code {
  margin: 0.4rem 0 0.35rem;
  font-family: var(--vt-font-display, inherit);
  font-size: clamp(3.6rem, 10vw, 6.2rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow:
    0 0 28px rgba(255, 107, 53, 0.55),
    0 0 48px rgba(0, 209, 255, 0.25);
}

.vt-404-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 0.9rem;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 107, 53, 0.35);
  color: #FFB089;
  font-size: 0.82rem;
  font-weight: 700;
}

.vt-404-status i {
  color: #00D1FF;
  animation: vt-404-wrench-icon 0.7s ease-in-out infinite;
}

.vt-404-title {
  margin: 0 0 0.7rem;
  font-size: clamp(1.25rem, 3.4vw, 1.85rem);
  color: #F8FAFC;
}

.vt-404-desc {
  margin: 0 auto 1.4rem;
  max-width: 36rem;
  color: #94A3B8;
  font-size: 0.98rem;
  line-height: 1.9;
}

.vt-404-search {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto 1.35rem;
  padding: 6px 6px 6px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.vt-404-search > i {
  color: #64748B;
  flex-shrink: 0;
}

.vt-404-search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: #F8FAFC;
  font-size: 0.95rem;
  font-family: inherit;
}

.vt-404-search-input::placeholder {
  color: #64748B;
}

.vt-404-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

@keyframes vt-torque-flash {
  0% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); filter: drop-shadow(0 0 8px #FF6B35); }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes vt-404-inflate-pulse {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.07); }
  60% { transform: scale(1.03); }
}

@keyframes vt-404-wrench-hit {
  0%, 100% { transform: rotate(-18deg) translate(0, 0); }
  35% { transform: rotate(12deg) translate(10px, 8px); }
  50% { transform: rotate(-8deg) translate(2px, 2px); }
}

@keyframes vt-404-wrench-icon {
  0%, 100% { transform: rotate(0deg); }
  40% { transform: rotate(-18deg); }
}

@keyframes vt-404-caliper-kick {
  0%, 100% { transform: rotate(0deg); }
  40% { transform: rotate(-6deg); }
}

@keyframes vt-404-smoke-trail {
  0% {
    transform: scale(0.28) translate(40px, 12px);
    opacity: 0.9;
  }
  55% { opacity: 0.45; }
  100% {
    transform: scale(2.5) translate(-90px, -58px);
    opacity: 0;
  }
}

@keyframes vt-404-glow-pulse {
  0%, 100% { opacity: 0.55; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.12); }
}

html[data-theme="light"] .vt-404-stage,
html.light-mode .vt-404-stage,
body.light-mode .vt-404-stage {
  background:
    radial-gradient(ellipse 80% 50% at 50% 18%, rgba(255, 107, 53, 0.12) 0%, transparent 55%),
    linear-gradient(180deg, #E2E8F0 0%, #F1F5F9 48%, #F8FAFC 100%);
}

html[data-theme="light"] .vt-404-title,
html.light-mode .vt-404-title,
body.light-mode .vt-404-title,
html[data-theme="light"] .vt-404-code,
html.light-mode .vt-404-code,
body.light-mode .vt-404-code {
  color: #0F172A;
  text-shadow: 0 0 20px rgba(255, 107, 53, 0.25);
}

html[data-theme="light"] .vt-404-desc,
html.light-mode .vt-404-desc,
body.light-mode .vt-404-desc {
  color: #475569;
}

html[data-theme="light"] .vt-404-search,
html.light-mode .vt-404-search,
body.light-mode .vt-404-search {
  background: #fff;
  border-color: #CBD5E1;
}

html[data-theme="light"] .vt-404-search-input,
html.light-mode .vt-404-search-input,
body.light-mode .vt-404-search-input {
  color: #0F172A;
}

html[data-theme="light"] .vt-404-status,
html.light-mode .vt-404-status,
body.light-mode .vt-404-status {
  background: #fff;
  color: #C2410C;
}

@media (max-width: 640px) {
  .vt-404-stage {
    min-height: auto;
    padding: 1rem 0 8.5rem;
  }
  .vt-404-visual {
    width: min(220px, 64vw);
    height: min(220px, 64vw);
  }
  .vt-404-code {
    font-size: 3.2rem;
  }
  .vt-404-actions .vt-btn {
    width: 100%;
  }
  .vt-404-search {
    flex-wrap: wrap;
    padding: 10px;
  }
  .vt-404-search > i {
    display: none;
  }
  .vt-404-search-input {
    width: 100%;
    padding: 6px 8px 10px;
  }
  .vt-404-search .vt-btn {
    width: 100%;
  }
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
