/* =========================================================
   GOparts.mn — Animation-ууд (animations.css)
   Зарчим: зөвхөн transform + opacity; html.js үед л нуугдана;
   prefers-reduced-motion үед бүгд унтарна.
   ========================================================= */

/* ---------- Хуудас ачаалах шар зураас ---------- */
.page-loader {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  height: 3px; background: var(--yellow);
  transform-origin: left;
  animation: loaderRun 1s var(--ease) forwards;
  pointer-events: none;
}
@keyframes loaderRun {
  0% { transform: scaleX(0); opacity: 1; }
  70% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

/* ---------- Header буух ---------- */
html.js .site-header { animation: headerDrop .55s var(--ease) backwards; } /* "both" байвал transform үлдэж, гар утасны цэс header дотор хавчигддаг байсан (№68) */
@keyframes headerDrop { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Scroll reveal (data-animate) ---------- */
html.js [data-animate] {
  opacity: 0;
  transition-property: opacity, transform, clip-path;
  transition-duration: .6s;
  transition-timing-function: var(--ease);
  transition-delay: var(--delay, 0ms);
  will-change: opacity, transform;
}
html.js [data-animate="fade-up"]    { transform: translateY(16px); }
html.js [data-animate="fade-down"]  { transform: translateY(-24px); }
html.js [data-animate="fade-left"]  { transform: translateX(-18px); }
html.js [data-animate="fade-right"] { transform: translateX(18px); }
html.js [data-animate="zoom"]       { transform: scale(.94); }
html.js [data-animate="fade"]       { transform: none; }
html.js [data-animate="curtain"]    { opacity: 1; }
html.js [data-animate="curtain"] > * { clip-path: inset(0 100% 0 0); transition: clip-path 1.1s var(--ease) var(--delay, 0ms); }
html.js [data-animate="spin-in"]    { transform: rotate(-90deg) scale(.85); transition-duration: .9s; }

html.js [data-animate].is-visible { opacity: 1; transform: none; }
html.js [data-animate="curtain"].is-visible > * { clip-path: inset(0 0 0 0); }

/* ---------- Hero текст: мөр мөрөөр ---------- */
html.js .hero-slide [data-seq] {
  opacity: 0; transform: translateY(26px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: calc(var(--i, 0) * 120ms + 150ms);
}
html.js .hero-slide.is-active.is-in [data-seq] { opacity: 1; transform: none; }
html.js .hero-slide.is-leaving [data-seq] { opacity: 0; transform: translateY(-14px); transition-delay: 0ms; transition-duration: .35s; }

/* "ХҮЧ" — шар өнгө зүүнээс будагдана */
.paint {
  background-image: linear-gradient(90deg, var(--yellow) 0 50%, var(--black) 50% 100%);
  background-size: 200% 100%;
  background-position: 0 0;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
html.js .paint { background-position: 100% 0; transition: background-position 1s var(--ease) .75s; }
html.js .hero-slide.is-active.is-in .paint { background-position: 0 0; }

/* ---------- Hero налуу хэсгүүд баруунаас орж ирэх ---------- */
html.js .hero-panel { transform: translateX(60px); opacity: 0; transition: transform 1s var(--ease), opacity 1s var(--ease), filter .6s var(--ease); }
html.js .hero-panel--1 { transition-delay: .15s, .15s, 0s; }
html.js .hero-panel--2 { transition-delay: .3s, .3s, 0s; }
html.js .hero-panel--3 { transition-delay: .45s, .45s, 0s; }
html.js .hero-visual.is-in .hero-panel { transform: none; opacity: 1; }
.hero-visual .parallax-layer { transition: transform .4s ease-out; }

/* ---------- Шар зураас: hero-гийн дараа зүүнээс баруун тийш нэг удаа сунана ---------- */
html.js .hazard { transform-origin: left; animation: hazardRun 1.2s var(--ease) .5s both; }
@keyframes hazardRun { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Давуу талын icon томрох ---------- */
html.js .feature[data-animate] .feature-icon { transform: scale(.8); transition: transform .6s var(--ease) calc(var(--delay, 0ms) + 200ms); }
html.js .feature[data-animate].is-visible .feature-icon { transform: none; }
html.js .feature[data-animate].is-visible:hover .feature-icon { transform: translateY(-6px); transition-delay: 0ms; }

/* ---------- ITR дэвсгэр fade ---------- */
html.js .itr-banner[data-animate="fade"] { transition-duration: 1s; }

/* ---------- Статистик icon гэрэлтэх ---------- */
.stat-icon { transition: transform .5s var(--ease), filter .5s var(--ease); }
.about-stats.is-visible .stat-icon { animation: glow 1.2s var(--ease) both; animation-delay: var(--delay, 0ms); }
@keyframes glow {
  0% { transform: scale(.7); filter: drop-shadow(0 0 0 rgba(255, 193, 7, 0)); }
  50% { transform: scale(1.12); filter: drop-shadow(0 0 10px rgba(255, 193, 7, .7)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255, 193, 7, 0)); }
}

/* ---------- Testimonial: од асах, quote томрох ---------- */
html.js .t-card .t-stars svg { opacity: .2; transform: scale(.6); transition: opacity .3s var(--ease), transform .3s var(--ease); transition-delay: calc(var(--s, 0) * 60ms + 300ms); }
html.js .t-card.is-visible .t-stars svg { opacity: 1; transform: none; }
html.js .t-card .t-quote { transform: scale(0); transition: transform .5s cubic-bezier(.16, 1, .3, 1) .2s; }
html.js .t-card.is-visible .t-quote { transform: scale(1); }

/* =========================================================
   ИНТЕРАКТИВ ЭФФЕКТҮҮД (interactions.js)
   ========================================================= */

/* ---------- Scroll-ын явцын шар зураас ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 250;
  height: 3px; background: var(--yellow);
  transform: scaleX(0); transform-origin: left;
  pointer-events: none;
}

/* ---------- Ангиллын карт: хазайх + курсорыг дагах гэрэл ---------- */
.cat-card::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 194, 14, .16), transparent 65%);
  opacity: 0; transition: opacity .3s var(--ease);
  pointer-events: none;
}
.cat-card.is-tilting::before { opacity: 1; }
html.js .cat-card.is-visible.is-tilting,
.cat-card.is-tilting {
  transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px);
  transition: transform .12s ease-out, border-color .3s var(--ease);
  border-color: var(--yellow);
}
html.js .cat-card.is-visible:not(.is-tilting) { transition: opacity .6s var(--ease), transform .5s var(--ease), border-color .3s var(--ease); }
.cat-card.is-tilting .cat-media img { transform: scale(1.08) translate(calc((var(--mx, 50%) - 50%) * -.06), calc((var(--my, 50%) - 50%) * -.06)); }
.cat-card.is-tilting .cat-arrow { background: var(--yellow); transform: translateX(3px); }

/* ---------- Брэндийн карт: хазайх + гэрлийн туяа гүйх ---------- */
.brand-card { position: relative; overflow: hidden; }
.brand-card::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .85) 50%, transparent);
  transform: skewX(-18deg) translateX(0);
  pointer-events: none;
}
.brand-card:hover::before { animation: shine .8s var(--ease); }
@keyframes shine { to { transform: skewX(-18deg) translateX(420%); } }
.brand-card.is-tilting {
  transform: perspective(600px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px);
  transition: transform .12s ease-out, border-color .3s var(--ease);
  border-color: var(--yellow);
}
.brand-card.is-tilting img { transform: scale(1.06); }
.brand-card img { transition: transform .35s var(--ease), filter .35s var(--ease), opacity .35s var(--ease); }
.oem-logos img { transition: transform .3s var(--ease); }
.oem-logos a:hover img { transform: translateY(-3px) scale(1.06); }

/* ---------- Товч: курсор руу татагдах + долгио ---------- */
.btn { position: relative; overflow: hidden; isolation: isolate; transition: background-color .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease), translate .25s var(--ease); }
.ripple {
  position: absolute; z-index: -1; border-radius: 50%;
  background: rgba(23, 21, 15, .14);
  transform: scale(0); animation: ripple .6s var(--ease) forwards;
  pointer-events: none;
}
.btn-outline .ripple { background: rgba(255, 194, 14, .35); }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* ---------- Давуу талын icon: шугам зурагдаж гарах ---------- */
html.js .feature[data-animate] .feature-icon svg * {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.1s var(--ease) calc(var(--delay, 0ms) + 250ms);
}
html.js .feature[data-animate].is-visible .feature-icon svg * { stroke-dashoffset: 0; }
.feature { transition: transform .3s var(--ease); }
.feature:hover .feature-icon svg * { animation: redraw .9s var(--ease); }
@keyframes redraw { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }

/* ---------- Hero: идэвхгүй хэсэг дээр hover хийхэд сонгох боломжтойг харуулна ---------- */
.hero-panel.is-dim:hover .hero-photo { scale: 1.03; }
.hero-photo { transition: translate .5s ease-out, scale .5s var(--ease); }
/* Лого, слоганы мөрүүд дараалан гарч ирнэ */
html.js .hero-copy > * { opacity: 0; transform: translateY(8px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
html.js .hero-visual.is-in .hero-copy > * { opacity: 1; transform: none; }
html.js .hero-panel--1 .hero-copy > * { transition-delay: calc(var(--i, 0) * 90ms + .7s); }
html.js .hero-panel--2 .hero-copy > * { transition-delay: calc(var(--i, 0) * 90ms + .85s); }
html.js .hero-panel--3 .hero-copy > * { transition-delay: calc(var(--i, 0) * 90ms + 1s); }

/* ---------- Сэтгэгдлийн карт: hover ---------- */
.t-card { transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease); }
.t-card:hover { transform: translateY(-4px); border-color: var(--yellow); }

/* ---------- Хамтрагчдын лого: hover үед өргөгдөх ---------- */
.partner-logo { transition: transform .3s var(--ease), border-color .3s var(--ease); }
.partner-logo:hover { transform: translateY(-3px); }

/* ---------- "Бидний тухай" зураг: scroll parallax-д зай гаргана ---------- */
.about-media img { scale: 1.08; will-change: translate; }

/* =========================================================
   Хөдөлгөөн багасгах тохиргоо
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  html.js [data-animate], html.js [data-animate] > *, html.js .hero-slide [data-seq] { opacity: 1 !important; transform: none !important; }
  html.js [data-animate="curtain"] > * { clip-path: none !important; }
  html.js .hero-panel { opacity: 1 !important; transform: none !important; }
  .paint { background-position: 0 0 !important; }
  .page-loader { display: none; }
  html.js .feature[data-animate] .feature-icon svg * { stroke-dashoffset: 0 !important; }
  .hero-panel.is-active .hero-photo { animation: none !important; transform: none !important; }
  html.js .hero-copy > * { opacity: 1 !important; transform: none !important; }
  .about-media img { translate: none !important; }
}
