/* ============================================================
   Zenginler Platform - Animation CSS
   Rule: transition always on DEFAULT state, not .revealed
   ============================================================ */

/* --- Keyframes -------------------------------------------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-32px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(32px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes clipRevealLeft {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0% 0 0); }
}

@keyframes clipRevealBottom {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0% 0); }
}

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4); }
  50%       { box-shadow: 0 0 0 12px rgba(255, 215, 0, 0); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

@keyframes mouseWheel {
  0%   { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(10px); opacity: 0; }
}

/* --- Magnetic button -------------------------------------- */
.btn-magnetic {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Scroll progress bar ---------------------------------- */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(to right, #e9c400, #ffd700);
  z-index: 9999;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.1s linear;
  will-change: transform;
}

/* --- Counter number --------------------------------------- */
.counter-num {
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

/* ──────────────────────────────────────────────────────────
   SCROLL REVEAL RULES
   ‼ transition is ALWAYS on the DEFAULT (non-revealed) state
   ‼ will-change tells GPU to pre-allocate a compositing layer
   ────────────────────────────────────────────────────────── */

/* --- Generic data-reveal --------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

[data-reveal="left"]  { transform: translateX(-32px); }
[data-reveal="right"] { transform: translateX(32px); }
[data-reveal="scale"] { transform: scale(0.93); }

[data-reveal].revealed {
  opacity: 1;
  transform: none;
}

/* --- Generic data-stagger children ----------------------- */
[data-stagger] > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

[data-stagger].revealed > *:nth-child(1) { opacity: 1; transform: none; transition-delay: 0ms; }
[data-stagger].revealed > *:nth-child(2) { opacity: 1; transform: none; transition-delay: 80ms; }
[data-stagger].revealed > *:nth-child(3) { opacity: 1; transform: none; transition-delay: 160ms; }
[data-stagger].revealed > *:nth-child(4) { opacity: 1; transform: none; transition-delay: 240ms; }
[data-stagger].revealed > *:nth-child(5) { opacity: 1; transform: none; transition-delay: 320ms; }
[data-stagger].revealed > *:nth-child(6) { opacity: 1; transform: none; transition-delay: 400ms; }
[data-stagger].revealed > *:nth-child(7) { opacity: 1; transform: none; transition-delay: 480ms; }

/* --- Services grid stagger ------------------------------- */
.services-grid .service-card {
  opacity: 0;
  transform: translateY(32px);
  /* transition on default state = no jump when .revealed is added */
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

.services-grid.revealed .service-card {
  opacity: 1;
  transform: none;
}

.services-grid.revealed .service-card:nth-child(1) { transition-delay: 0ms; }
.services-grid.revealed .service-card:nth-child(2) { transition-delay: 70ms; }
.services-grid.revealed .service-card:nth-child(3) { transition-delay: 140ms; }
.services-grid.revealed .service-card:nth-child(4) { transition-delay: 210ms; }
.services-grid.revealed .service-card:nth-child(5) { transition-delay: 280ms; }
.services-grid.revealed .service-card:nth-child(6) { transition-delay: 350ms; }
.services-grid.revealed .service-card:nth-child(7) { transition-delay: 420ms; }

/* --- Fleet/Machine grid — translateY (NOT clip-path)      */
/* clip-path forces rasterization every frame = frame drops */
.fleet-grid .machine-card {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

.fleet-grid.revealed .machine-card {
  opacity: 1;
  transform: none;
}

.fleet-grid.revealed .machine-card:nth-child(1) { transition-delay: 0ms; }
.fleet-grid.revealed .machine-card:nth-child(2) { transition-delay: 80ms; }
.fleet-grid.revealed .machine-card:nth-child(3) { transition-delay: 160ms; }
.fleet-grid.revealed .machine-card:nth-child(4) { transition-delay: 240ms; }
.fleet-grid.revealed .machine-card:nth-child(5) { transition-delay: 320ms; }
.fleet-grid.revealed .machine-card:nth-child(6) { transition-delay: 400ms; }

/* --- Gallery grid stagger -------------------------------- */
.gallery-grid .gallery-item {
  opacity: 0;
  transform: scale(0.93);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

.gallery-grid.revealed .gallery-item {
  opacity: 1;
  transform: none;
}

/* Sequential delay — ascending (not random) = smoother feel */
.gallery-grid.revealed .gallery-item:nth-child(1)  { transition-delay: 0ms; }
.gallery-grid.revealed .gallery-item:nth-child(2)  { transition-delay: 40ms; }
.gallery-grid.revealed .gallery-item:nth-child(3)  { transition-delay: 80ms; }
.gallery-grid.revealed .gallery-item:nth-child(4)  { transition-delay: 120ms; }
.gallery-grid.revealed .gallery-item:nth-child(5)  { transition-delay: 160ms; }
.gallery-grid.revealed .gallery-item:nth-child(6)  { transition-delay: 200ms; }
.gallery-grid.revealed .gallery-item:nth-child(7)  { transition-delay: 240ms; }
.gallery-grid.revealed .gallery-item:nth-child(8)  { transition-delay: 280ms; }
.gallery-grid.revealed .gallery-item:nth-child(9)  { transition-delay: 320ms; }
.gallery-grid.revealed .gallery-item:nth-child(10) { transition-delay: 360ms; }
.gallery-grid.revealed .gallery-item:nth-child(11) { transition-delay: 400ms; }
.gallery-grid.revealed .gallery-item:nth-child(12) { transition-delay: 440ms; }
.gallery-grid.revealed .gallery-item:nth-child(13) { transition-delay: 480ms; }
.gallery-grid.revealed .gallery-item:nth-child(14) { transition-delay: 520ms; }
.gallery-grid.revealed .gallery-item:nth-child(15) { transition-delay: 560ms; }
.gallery-grid.revealed .gallery-item:nth-child(16) { transition-delay: 600ms; }

/* --- Why Us grid ----------------------------------------- */
.why-grid > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

.why-grid.revealed > * {
  opacity: 1;
  transform: none;
}

.why-grid.revealed > *:nth-child(1) { transition-delay: 0ms; }
.why-grid.revealed > *:nth-child(2) { transition-delay: 80ms; }
.why-grid.revealed > *:nth-child(3) { transition-delay: 160ms; }
.why-grid.revealed > *:nth-child(4) { transition-delay: 240ms; }
.why-grid.revealed > *:nth-child(5) { transition-delay: 320ms; }
.why-grid.revealed > *:nth-child(6) { transition-delay: 400ms; }

/* --- Blog cards ------------------------------------------ */
.blog-grid .blog-card {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

.blog-grid.revealed .blog-card {
  opacity: 1;
  transform: none;
}

.blog-grid.revealed .blog-card:nth-child(1) { transition-delay: 0ms; }
.blog-grid.revealed .blog-card:nth-child(2) { transition-delay: 100ms; }
.blog-grid.revealed .blog-card:nth-child(3) { transition-delay: 200ms; }

/* --- Form focus line ------------------------------------- */
.form-field { position: relative; }

.form-field::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: #ffd700;
  transition: width 0.3s ease;
  border-radius: 0 0 4px 4px;
}

.form-field:focus-within::after { width: 100%; }

/* --- Loading shimmer ------------------------------------- */
.img-placeholder {
  background: linear-gradient(90deg, #1a1c1c 25%, #252727 50%, #1a1c1c 75%);
  background-size: 400% 100%;
  animation: shimmer 1.5s infinite;
}

/* --- Noise texture overlay ------------------------------- */
.noise-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* --- prefers-reduced-motion ------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal],
  [data-stagger] > *,
  .services-grid .service-card,
  .fleet-grid .machine-card,
  .gallery-grid .gallery-item,
  .why-grid > *,
  .blog-grid .blog-card {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    will-change: auto !important;
  }
}
